:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #64748b;
  --line: #dbe3ea;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

a {
  color: inherit;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.brand small,
.muted,
.module-card small,
.login-card p,
.hero p,
.user-check small {
  color: var(--muted);
}

.brand small,
.user-check small {
  display: block;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.lang-switch a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.lang-switch a.active {
  background: var(--brand);
  color: #fff;
}

.user-pill {
  max-width: 220px;
  overflow: hidden;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.hero,
.panel,
.module-card,
.empty-card,
.login-card,
.admin-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  margin-bottom: 18px;
}

.hero h1,
.login-card h1,
.panel h1,
.panel h2,
.module-card h2 {
  margin: 0;
}

.hero p {
  margin: 6px 0 0;
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn-big {
  min-height: 48px;
  padding: 12px 18px;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-light {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.full {
  width: 100%;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.module-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.module-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e6f4f1;
  color: var(--brand);
  font-size: 22px;
  font-weight: 800;
}

.module-content {
  min-width: 0;
  flex: 1;
}

.module-content p {
  min-height: 46px;
  margin: 8px 0;
}

.module-content small {
  overflow-wrap: anywhere;
}

.empty-card,
.panel,
.login-card,
.admin-item {
  padding: 18px;
}

.login-shell {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
}

.stack-form,
.admin-form {
  display: grid;
  gap: 14px;
}

.admin-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-form.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

input[type="url"] {
  overflow-wrap: anywhere;
}

textarea {
  resize: vertical;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.check-line input,
.user-check input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  flex: 0 0 auto;
}

.wide,
.item-actions,
.item-head {
  grid-column: 1 / -1;
}

.alert {
  padding: 12px;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.admin-list {
  display: grid;
  gap: 14px;
}

.item-head,
.item-actions,
.form-actions,
.item-delete {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.item-head {
  justify-content: space-between;
}

.status-on,
.status-off {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
}

.status-on {
  background: #dcfce7;
  color: #166534;
}

.status-off {
  background: #f1f5f9;
  color: #475569;
}

.user-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.user-check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.wide-panel {
  grid-column: 1 / -1;
}

.info-list {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 12px 16px;
  margin: 16px 0 0;
}

.info-list dt {
  color: var(--muted);
  font-weight: 700;
}

.info-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

code {
  font-family: Consolas, "SFMono-Regular", monospace;
}

@media (max-width: 900px) {
  .module-grid,
  .server-grid,
  .user-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-form,
  .admin-form.compact {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar,
  .hero {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
  }

  .lang-switch,
  .user-pill {
    grid-column: 1 / -1;
    max-width: none;
  }

  .lang-switch a {
    flex: 1;
  }

  .page {
    padding: 14px;
  }

  .module-grid,
  .server-grid,
  .user-check-grid {
    grid-template-columns: 1fr;
  }

  .wide-panel {
    grid-column: auto;
  }

  .info-list {
    grid-template-columns: 1fr;
  }

  .btn,
  .item-actions form,
  .item-actions .btn,
  .item-delete .btn,
  .form-actions .btn {
    width: 100%;
  }
}
