:root {
  --bg: #0f0b09;
  --bg-soft: #18130f;
  --panel: rgba(255, 248, 241, 0.06);
  --panel-strong: rgba(255, 248, 241, 0.1);
  --line: rgba(255, 244, 235, 0.12);
  --gold: #d9b47a;
  --gold-strong: #f0ca8d;
  --text: #f5efe7;
  --muted: #c7beb4;
  --wine: #6e2331;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(217, 180, 122, 0.12), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(110, 35, 49, 0.18), transparent 26%),
    linear-gradient(180deg, #120d09 0%, #0a0706 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0));
}

.site-shell {
  width: min(1280px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.95rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 7, 6, 0.68);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.brand img {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.brand strong,
.section-title,
h1,
h2,
h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
}

.brand strong {
  font-size: 1.3rem;
}

.brand em {
  display: block;
  font-style: normal;
  color: var(--muted);
  font-size: 0.88rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(240, 202, 141, 0.28);
  background: linear-gradient(135deg, rgba(240, 202, 141, 0.24), rgba(110, 35, 49, 0.24));
  color: #fff8ef;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 202, 141, 0.55);
}

.btn-ghost {
  background: rgba(255, 248, 241, 0.04);
  border-color: rgba(255, 248, 241, 0.2);
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 0.9rem;
}

.login-wrap {
  width: min(540px, 100%);
  max-width: 540px;
  margin: 0;
  padding: 0;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.8rem;
  width: 100%;
  text-align: center;
}

.login-brand span {
  text-align: center;
}

.login-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(10, 7, 6, 0.74);
  box-shadow: var(--shadow);
  padding: 1.4rem 1.25rem 1.25rem;
  width: 100%;
}

.login-card h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  font-family: "Cormorant Garamond", Georgia, serif;
}

.form-grid {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.7rem;
  width: 100%;
  text-align: left;
}

.form-grid .btn {
  width: 100%;
}

.field-group {
  display: grid;
  gap: 0.4rem;
}

.field-label,
.form-grid label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.93rem;
  width: 100%;
}

.input-field {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255, 248, 241, 0.18);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  padding: 0.68rem 0.8rem;
  font: inherit;
}

.input-field:focus {
  outline: none;
  border-color: rgba(240, 202, 141, 0.7);
  box-shadow: 0 0 0 2px rgba(240, 202, 141, 0.18);
}

.error-msg {
  margin: 0.8rem 0 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 167, 167, 0.35);
  background: rgba(167, 42, 58, 0.22);
  color: #ffd8d8;
  padding: 0.65rem 0.75rem;
  font-weight: 600;
}

.intro {
  margin-top: 1rem;
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.intro h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
}

.intro p {
  margin: 0.7rem 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.auto-refresh-status {
  margin-top: 0.45rem !important;
  color: rgba(245, 239, 231, 0.9) !important;
  font-size: 0.92rem;
}

.auto-refresh-status strong {
  color: var(--gold-strong);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  padding: 1rem;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.5rem;
  color: var(--gold-strong);
}

.panel-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.9rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.15);
}

.card-head h2 {
  margin: 0;
  font-size: 1.45rem;
}

.card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-body {
  padding: 0.9rem 1.1rem 1.1rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 14px;
  overflow: hidden;
  min-width: 520px;
}

th,
td {
  padding: 0.74rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

th {
  color: var(--muted);
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-pages td:first-child {
  min-width: 260px;
  white-space: normal;
  word-break: break-word;
}

.country-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(240, 202, 141, 0.25);
  color: var(--gold-strong);
  background: rgba(217, 180, 122, 0.08);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.expand-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 248, 241, 0.03);
  padding: 0.75rem 0.9rem;
}

.expand-card summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--gold-strong);
}

.zone-list {
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
  max-height: 320px;
  overflow: auto;
}

.zone-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.46rem 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.zone-list li:last-child {
  border-bottom: 0;
}

.muted {
  color: var(--muted);
}

.empty {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

@media (max-width: 1060px) {
  .site-shell {
    width: calc(100vw - 1.2rem);
  }

  .topbar {
    border-radius: 24px;
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar-actions .btn {
    width: 100%;
  }

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

  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-page {
    align-items: flex-start;
    padding: 0.65rem;
  }

  .login-wrap.site-shell {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  .topbar {
    padding: 0.9rem 0.95rem;
  }

  .brand strong {
    font-size: 1.15rem;
  }

  .brand em {
    font-size: 0.82rem;
  }

  .intro {
    padding: 1.1rem 1rem;
  }

  .card-head {
    padding: 0.9rem 0.95rem;
  }

  .card-head h2 {
    font-size: 1.25rem;
  }

  .card-body {
    padding: 0.8rem 0.9rem 0.95rem;
  }

  .topbar-actions {
    grid-template-columns: 1fr;
  }

  .topbar-actions .btn {
    min-height: 42px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .zone-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .zone-list li strong {
    font-size: 0.9rem;
  }

  table {
    min-width: 470px;
  }

  .login-card {
    padding: 1.1rem 0.9rem 0.95rem;
    border-radius: 18px;
  }
}

@media (max-width: 430px) {
  table {
    min-width: 430px;
  }
}
