/* ── Visits Admin — complete stylesheet ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Tokens ───────────────────────────────────────────── */
:root {
  --bg:           #020917;
  --bg2:          #071428;
  --surface:      rgba(255,255,255,0.03);
  --surface2:     rgba(255,255,255,0.055);
  --border:       rgba(255,255,255,0.07);
  --border2:      rgba(255,255,255,0.12);
  --brand:        #14b8a6;
  --brand-dark:   #0d9488;
  --brand-glow:   rgba(20,184,166,0.22);
  --text:         #e2e8f0;
  --text-dim:     #94a3b8;
  --text-faint:   #4b5a6e;
  --error:        #f87171;
  --success:      #34d399;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;
}

/* ── Light theme ──────────────────────────────────────── */
:root.light {
  --bg:           #f1f5f9;
  --bg2:          #ffffff;
  --surface:      rgba(255,255,255,0.8);
  --surface2:     rgba(255,255,255,0.95);
  --border:       rgba(15,23,42,0.09);
  --border2:      rgba(15,23,42,0.16);
  --brand:        #0d9488;
  --brand-dark:   #0f766e;
  --brand-glow:   rgba(13,148,136,0.15);
  --text:         #0f172a;
  --text-dim:     #475569;
  --text-faint:   #94a3b8;
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

:root.light body {
  background: linear-gradient(160deg, #f0f9ff 0%, #f1f5f9 100%);
}

/* ── Utility ──────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── LOGIN ────────────────────────────────────────────── */
.screen-center {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 100;
}

:root.light .screen-center { background: var(--bg); }

.login-box {
  width: 100%;
  max-width: 360px;
  padding: 24px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2dd4bf, #0d9488);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 0 32px var(--brand-glow);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.login-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: left;
}

/* ── Fields ───────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.field-input {
  display: block;
  width: 100%;
  background: rgba(15,23,42,0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20,184,166,0.15);
}

.field-input::placeholder { color: var(--text-faint); }

:root.light .field-input {
  background: #fff;
  border-color: var(--border);
}

.field-group {
  display: flex;
  flex-direction: column;
}


/* Date range separator */
.toolbar .range-sep {
  font-size: 0.8rem;
  color: var(--text-faint);
  padding-bottom: 10px;
  flex-shrink: 0;
}




/* ── Buttons ──────────────────────────────────────────── */
button { font-family: inherit; cursor: pointer; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  box-shadow: 0 0 16px var(--brand-glow);
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary:hover  { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-outline:hover {
  border-color: var(--border2);
  color: var(--text);
  background: var(--surface2);
}

.btn-outline:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border);
}

.btn-icon-text { gap: 6px; }

.btn-danger:hover {
  color: #f87171;
  background: rgba(248,113,113,0.08);
  border-color: rgba(248,113,113,0.2);
}

/* ── App shell ────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(2,9,23,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

:root.light .app-header {
  background: rgba(241,245,249,0.88);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2dd4bf, #0d9488);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.nav-sep {
  color: var(--text-faint);
  font-size: 0.875rem;
}

.nav-crumb {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--brand);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Main content ─────────────────────────────────────── */
.page-content {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 32px 24px;
}

/* ── Toolbar ──────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* ── Status text ──────────────────────────────────────── */
.status-text {
  font-size: 0.8rem;
  color: var(--text-faint);
  min-height: 20px;
  margin: 8px 0;
}

.status-error   { color: var(--error) !important; }
.status-success { color: var(--success) !important; }

/* ── Summary grid ─────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

@media (max-width: 600px) {
  .summary-grid { grid-template-columns: 1fr; }
}

/* JS injects .card elements */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color 0.2s;
}

.card:hover { border-color: rgba(20,184,166,0.25); }

.card h3 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.card p {
  font-size: 2rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1;
}

:root.light .card {
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,0.06);
}

/* ── Table ────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 4px;
}

.table-scroll { overflow-x: auto; }

.records-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.records-table thead tr {
  border-bottom: 1px solid var(--border);
}

.records-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.records-table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

:root.light .records-table td {
  border-bottom-color: rgba(15,23,42,0.05);
}

.records-table tbody tr:hover { background: rgba(20,184,166,0.04); }
.records-table tbody tr:last-child td { border-bottom: none; }

td.empty {
  text-align: center;
  padding: 40px;
  color: var(--text-faint);
}

/* ── View header ──────────────────────────────────────── */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.view-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.view-sub {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ── User list ────────────────────────────────────────── */
#usersList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}

.user-row:hover { border-color: var(--border2); }

:root.light .user-row {
  background: #fff;
  box-shadow: 0 1px 4px rgba(15,23,42,0.06);
}

.user-info strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.user-info .muted {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 2px;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.user-actions button {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.user-actions button.edit:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: rgba(20,184,166,0.07);
}

.user-actions button.delete {
  border-color: rgba(248,113,113,0.25);
  color: #f87171;
}

.user-actions button.delete:hover {
  background: rgba(248,113,113,0.1);
  border-color: rgba(248,113,113,0.5);
}

li.empty {
  padding: 32px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.875rem;
}

/* ── User form ────────────────────────────────────────── */
.user-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 440px;
  display: flex;
  flex-direction: column;
}

:root.light .user-form {
  background: #fff;
  box-shadow: 0 2px 8px rgba(15,23,42,0.06);
}

.form-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ── Footer ───────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.78rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

/* ── Focus ────────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible { outline: 2px solid rgba(20,184,166,0.5); outline-offset: 2px; border-radius: 4px; }

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
:root.light ::-webkit-scrollbar-thumb { background: rgba(15,23,42,0.12); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner { padding: 0 16px; }
  .page-content { padding: 24px 16px; }
  .nav-sep, .nav-crumb { display: none; }
  .btn-ghost span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}