/* ══════════════════════════════════════════════════════════════════════════
   Admin panel — same brand tokens as the public site, denser layout.
   A dashboard is scanned and operated, not read, so state is encoded in
   shape and colour as well as text.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  --color-primary:    #1A56DB;
  --color-secondary:  #00C896;
  --color-dark:       #0F1B3C;
  --color-surface:    #F0F4FF;
  --color-white:      #FFFFFF;
  --color-text:       #1A202C;
  --color-text-muted: #6B7280;
  --color-error:      #EF4444;
  --color-warning:    #F59E0B;
  --color-border:     #E2E8F0;

  --font-heading: "Plus Jakarta Sans", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body:    "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--color-surface); color: var(--color-text);
  font-family: var(--font-body); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-heading); margin: 0; }
a { color: var(--color-primary); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ── shell ───────────────────────────────────────────────────────────────── */
.admin-header {
  background: var(--color-dark); color: #fff;
  padding: 0 1.5rem; height: 60px;
  display: flex; align-items: center; gap: 1.5rem;
  position: sticky; top: 0; z-index: 50;
}
.admin-brand {
  font-family: var(--font-heading); font-weight: 800; font-size: 1rem;
  color: #fff; text-decoration: none; white-space: nowrap;
}
.admin-brand span { color: var(--color-secondary); }
.admin-nav { display: flex; gap: .25rem; margin-left: 1rem; flex-wrap: wrap; }
.admin-nav a {
  font-family: var(--font-heading); font-weight: 600; font-size: .8125rem;
  color: rgba(255,255,255,.72); text-decoration: none;
  padding: .4rem .75rem; border-radius: 6px;
}
.admin-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav a.active { background: var(--color-primary); color: #fff; }
.admin-user { margin-left: auto; display: flex; align-items: center; gap: .875rem; font-size: .8125rem; color: rgba(255,255,255,.6); }
.admin-user a { color: rgba(255,255,255,.85); text-decoration: none; font-weight: 600; }
.admin-user a:hover { text-decoration: underline; }

.admin-main { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.375rem; font-weight: 800; color: var(--color-dark); }
.page-head p { margin: .25rem 0 0; color: var(--color-text-muted); font-size: .875rem; }

/* ── cards / stats ───────────────────────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: 12px; padding: 1.25rem;
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.75rem; }
.stat {
  background: #fff; border: 1px solid var(--color-border); border-radius: 12px;
  padding: 1.125rem 1.25rem; border-left: 3px solid var(--color-primary);
}
.stat.is-good    { border-left-color: var(--color-secondary); }
.stat.is-warning { border-left-color: var(--color-warning); }
.stat-label {
  font-family: var(--font-heading); font-size: .6875rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-muted);
}
.stat-value {
  font-family: var(--font-heading); font-size: 1.75rem; font-weight: 800;
  color: var(--color-dark); line-height: 1.1; margin-top: .35rem;
  font-variant-numeric: tabular-nums;
}
.stat-sub { font-size: .75rem; color: var(--color-text-muted); margin-top: .2rem; }

/* ── filters ─────────────────────────────────────────────────────────────── */
.filters {
  display: flex; flex-wrap: wrap; gap: .625rem; align-items: flex-end;
  background: #fff; border: 1px solid var(--color-border);
  border-radius: 12px; padding: 1rem; margin-bottom: 1.25rem;
}
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label {
  font-family: var(--font-heading); font-size: .6875rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted);
}
.field input, .field select, .field textarea {
  font-family: var(--font-body); font-size: .875rem; color: var(--color-text);
  padding: .5rem .625rem; border: 1.5px solid var(--color-border);
  border-radius: 8px; background: #fff; outline: none; min-width: 150px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--color-primary); }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-heading); font-weight: 700; font-size: .8125rem;
  padding: .55rem 1.1rem; border-radius: 8px; border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: .4rem; white-space: nowrap;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: #1648C0; }
.btn-ghost { background: #fff; border-color: var(--color-border); color: var(--color-dark); }
.btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-success { background: var(--color-secondary); color: #05372A; }
.btn-danger  { background: #fff; border-color: #FCA5A5; color: #B91C1C; }
.btn-danger:hover { background: #FEF2F2; }

/* ── table ───────────────────────────────────────────────────────────────── */
.table-wrap { background: #fff; border: 1px solid var(--color-border); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
  text-align: left; font-family: var(--font-heading); font-size: .6875rem;
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-text-muted); padding: .75rem 1rem;
  border-bottom: 1px solid var(--color-border); white-space: nowrap;
}
tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--color-border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFBFF; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-name { font-family: var(--font-heading); font-weight: 700; color: var(--color-dark); }
.row-sub  { font-size: .8125rem; color: var(--color-text-muted); }
.empty { padding: 3rem 1rem; text-align: center; color: var(--color-text-muted); }

/* ── pills ───────────────────────────────────────────────────────────────── */
.pill {
  display: inline-block; font-family: var(--font-heading); font-size: .6875rem;
  font-weight: 700; letter-spacing: .03em; padding: .22rem .6rem;
  border-radius: 100px; white-space: nowrap;
}
.pill-new       { background: #EFF6FF; color: #1D4ED8; }
.pill-contacted { background: #FEF3C7; color: #92400E; }
.pill-confirmed { background: #DCFCE7; color: #166534; }
.pill-cancelled { background: #F3F4F6; color: #4B5563; }
.pill-pending   { background: #FEF3C7; color: #92400E; }
.pill-partial   { background: #FFEDD5; color: #9A3412; }
.pill-rejected  { background: #FEE2E2; color: #991B1B; }

/* ── alerts ──────────────────────────────────────────────────────────────── */
.alert { border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1.25rem; font-size: .875rem; }
.alert-error   { background: #FEF2F2; border: 1px solid #FCA5A5; color: #991B1B; }
.alert-success { background: #ECFDF5; border: 1px solid #6EE7B7; color: #065F46; }
.alert-warning { background: #FFFBEB; border: 1px solid #FCD34D; color: #92400E; }

/* ── detail view ─────────────────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-rows { width: 100%; }
.detail-rows th {
  text-align: left; width: 170px; padding: .55rem 0; vertical-align: top;
  font-family: var(--font-body); font-weight: 400; color: var(--color-text-muted);
  font-size: .875rem; border: none;
}
.detail-rows td { padding: .55rem 0; font-weight: 600; border: none; }
.card h2 {
  font-size: .8125rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--color-text-muted); margin-bottom: .875rem;
}
.stack { display: flex; flex-direction: column; gap: .875rem; }
.muted { color: var(--color-text-muted); font-weight: 400; }

/* ── pagination ──────────────────────────────────────────────────────────── */
.pager { display: flex; gap: .4rem; align-items: center; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }
.pager a, .pager span {
  font-family: var(--font-heading); font-size: .8125rem; font-weight: 700;
  padding: .45rem .75rem; border-radius: 7px; text-decoration: none;
  border: 1px solid var(--color-border); background: #fff; color: var(--color-dark);
}
.pager .current { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.pager .disabled { opacity: .45; }

/* ── login ───────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--color-border); border-radius: 14px; padding: 2rem; }
.login-card h1 { font-size: 1.25rem; font-weight: 800; color: var(--color-dark); margin-bottom: .35rem; }
.login-card p.sub { color: var(--color-text-muted); font-size: .875rem; margin: 0 0 1.5rem; }
.login-card .field { margin-bottom: 1rem; }
.login-card .field input { width: 100%; padding: .65rem .75rem; }
.login-card .btn { width: 100%; justify-content: center; padding: .7rem; font-size: .9375rem; }

/* ── mobile ──────────────────────────────────────────────────────────────── */
/* Tables already scroll inside .table-wrap and .detail-grid collapses at
   860px. What was left was the header, which is a fixed-height single row,
   and inputs narrow enough to trigger iOS zoom. */
@media (max-width: 760px) {
  .admin-header {
    height: auto; padding: .75rem 1rem;
    flex-wrap: wrap; gap: .5rem .875rem;
  }
  .admin-nav  { margin-left: 0; width: 100%; }
  .admin-user { margin-left: auto; }
  .admin-main { padding: 1.25rem 1rem 2.5rem; }
  .detail-rows th { width: auto; min-width: 110px; }
  /* 16px keeps iOS from zooming the page on focus. */
  input, select, textarea { font-size: 1rem; }
  .filters input, .filters select { min-width: 0; width: 100%; }
}
@media (pointer: coarse) {
  .admin-nav a { padding: .55rem .875rem; }
}
