/* ====================================================================
   AquaGo! — Admin stylesheet
   Self-contained: defines its own tokens and depends on NO other
   stylesheet, so the admin area looks identical regardless of which
   public theme (original / cinematic) is currently live.
   ==================================================================== */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --ink:          #0f2e2f;
  --muted:        #4c6b6a;
  --line:         #d2e1e0;
  --surface:      #eef4f3;
  --card:         #ffffff;
  --accent:       #0D5F63;  /* deep teal */
  --accent-dark:  #094a4e;
  --danger:       #d64545;
  --danger-dark:  #b33030;
  --radius:       12px;
  --shadow:       0 1px 2px rgba(15,46,47,.04), 0 6px 18px rgba(15,46,47,.05);
}

/* ── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 9999;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ── Top bar / chrome ───────────────────────────────────── */
.adminbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--ink);
  color: #fff;
  padding: 12px clamp(16px, 4vw, 40px);
  position: sticky; top: 0; z-index: 20;
}
.adminbar-brand {
  font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em;
  color: #fff; text-decoration: none; display: inline-flex; align-items: baseline; gap: 8px;
}
.adminbar-brand .go { color: #E91E63; }
.adminbar-brand .tag {
  font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .16em;
  color: rgba(255,255,255,.6); border: 1px solid rgba(255,255,255,.25);
  padding: 2px 7px; border-radius: 999px; align-self: center;
}
.adminnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.adminnav a {
  color: rgba(255,255,255,.75); text-decoration: none;
  font-size: .9rem; font-weight: 600;
  padding: 7px 13px; border-radius: 8px; transition: background .15s, color .15s;
}
.adminnav a:hover { color: #fff; background: rgba(255,255,255,.1); }
.adminnav a.is-active { color: #fff; background: rgba(255,255,255,.16); }
.adminnav form { margin: 0; }
.adminnav .logout {
  min-height: 0; padding: 7px 14px; font-size: .85rem; font-weight: 600;
  background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px; cursor: pointer;
}
.adminnav .logout:hover { background: rgba(255,255,255,.2); }

/* "More" dropdown for rarely used pages (Design, Resources, job searches) */
.adminnav-more { position: relative; }
.adminnav-more summary {
  list-style: none; cursor: pointer;
  color: rgba(255,255,255,.75); font-size: .9rem; font-weight: 600;
  padding: 7px 13px; border-radius: 8px; transition: background .15s, color .15s;
}
.adminnav-more summary::-webkit-details-marker { display: none; }
.adminnav-more summary:hover { color: #fff; background: rgba(255,255,255,.1); }
.adminnav-more summary.is-active { color: #fff; background: rgba(255,255,255,.16); }
.adminnav-more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  display: flex; flex-direction: column; min-width: 160px;
  background: var(--ink); border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px; padding: 6px; box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
.adminnav-more-menu a { padding: 9px 13px; }

/* ── Layout ─────────────────────────────────────────────── */
.admin-main {
  max-width: 1120px; margin: 0 auto;
  padding: clamp(20px, 4vw, 36px) clamp(16px, 4vw, 40px) 64px;
}
.admin-h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.admin-intro { color: var(--muted); font-size: .95rem; margin-bottom: 24px; max-width: 60ch; }

/* ── Flash messages ─────────────────────────────────────── */
.flash-stack { display: grid; gap: 10px; margin: 0 0 22px; }
.flash {
  padding: 13px 16px; border-radius: 8px; background: var(--card);
  border: 1.5px solid var(--line); font-weight: 500; font-size: .93rem;
}
.flash-error   { border-color: var(--danger); color: #8a1f1f; background: #fff5f5; }
.flash-success { border-color: #1a9952; color: #0f5c30; background: #f0faf4; }

/* ── Buttons ────────────────────────────────────────────── */
.button, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 20px; border: 0; border-radius: 8px;
  background: var(--accent); color: #fff;
  font-family: inherit; font-size: .92rem; font-weight: 700;
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.button:hover, button:hover { background: var(--accent-dark); }
.button.secondary {
  background: var(--card); color: var(--accent-dark); border: 1.5px solid var(--line);
}
.button.secondary:hover { border-color: var(--accent); color: var(--accent); }
button.danger, .button.danger { background: var(--danger); }
button.danger:hover, .button.danger:hover { background: var(--danger-dark); }
button:disabled, .button:disabled { opacity: .5; cursor: default; }
.button.small, button.small { min-height: 34px; padding: 0 13px; font-size: .82rem; }

/* ── Forms ──────────────────────────────────────────────── */
label { display: grid; gap: 6px; font-weight: 600; font-size: .86rem; color: var(--ink); }
input:not([type=checkbox]):not([type=submit]),
textarea, select {
  width: 100%; min-height: 42px;
  border: 1.5px solid var(--line); border-radius: 8px;
  padding: 8px 12px; font: inherit; color: var(--ink); background: var(--card);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(13,95,99,.12);
}
textarea { min-height: 84px; resize: vertical; }
.checkline { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.checkline input { width: auto; min-height: auto; }

.admin-form {
  display: grid; gap: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(20px, 4vw, 28px); max-width: 560px;
}

/* ── Cards & tables ─────────────────────────────────────── */
.dash-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 22px;
}
.dash-card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.dash-card-head h2 { font-size: 1.1rem; font-weight: 700; }
.dash-empty { color: var(--muted); font-size: .92rem; padding: 4px 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-size: .92rem; }
th { color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(13,95,99,.025); }

.status-tag { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; }
.status-confirmed { background: #f0faf4; color: #0f5c30; }
.status-cancelled { background: #fff5f5; color: #8a1f1f; }

.status-walkup { background: #eef4ff; color: #1b3a78; }
.status-returned { background: #f3f0fa; color: #4a3a78; }
.status-noshow { background: #fff4e8; color: #8a4b12; }
.status-hold { background: #fdf3d7; color: #7a5d0e; }

/* Side-by-side row actions (No show / Cancel) */
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Customer's order comment, shown under the booking's items */
.booking-comment {
  margin-top: 6px;
  padding: 5px 9px;
  font-size: .85rem;
  color: var(--ink);
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  white-space: pre-wrap;
  max-width: 320px;
}

.date-form { display: flex; align-items: flex-end; gap: 12px; margin: 0 0 18px; flex-wrap: wrap; }
.date-form label { flex-direction: row; align-items: center; gap: 8px; }
.date-form input { width: auto; }

/* ── Walk-up hand-out ───────────────────────────────────── */
.handout-box {
  background: var(--bg, #f7f9fb); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 0 0 18px;
}
.handout-box h3 { margin: 0 0 10px; font-size: .95rem; }
.handout-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.handout-form label { flex-direction: column; align-items: flex-start; gap: 4px; font-size: .8rem; }
.handout-form select, .handout-form input { width: auto; min-width: 150px; }

/* Whole-order hand-out: one qty field per item, craft then accessories */
.handout-qty-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px 14px; width: 100%; margin: 0 0 6px;
}
.handout-qty { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; }
.handout-qty-name small { color: var(--muted); font-weight: normal; }
.handout-form .handout-qty input { min-width: 0; width: 80px; }
.handout-form .handout-check { flex-direction: row; align-items: center; gap: 6px; }
.handout-form .handout-check input { min-width: 0; width: auto; min-height: 0; }

/* ── Per-board return controls in the items cell ────────── */
.item-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0; }
.inline-form { display: inline; }
.button-link {
  background: none; border: none; padding: 0; min-height: 0; color: var(--muted);
  font-size: .78rem; text-decoration: underline; cursor: pointer;
}
.button-link:hover { background: none; color: var(--accent); }

/* ── KPI row ────────────────────────────────────────────── */
.kpi-row {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 26px;
}
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 2px;
}
.kpi-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi-value { font-size: 2.3rem; font-weight: 800; line-height: 1.05; }
.kpi-sub { font-size: .8rem; color: var(--muted); }
.kpi-value-neg { color: var(--danger); }
.kpi-hero { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%); border-color: transparent; }
.kpi-hero .kpi-label, .kpi-hero .kpi-sub { color: rgba(255,255,255,.85); }
.kpi-hero .kpi-value { color: #fff; }
.kpi-hero.kpi-off { background: var(--card); border: 1px solid var(--line); }
.kpi-hero.kpi-off .kpi-label, .kpi-hero.kpi-off .kpi-sub { color: var(--muted); }
.kpi-hero.kpi-off .kpi-value { color: var(--line); }

/* ── Activity ───────────────────────────────────────────── */
.range-toggle { display: flex; gap: 6px; }
.range-pill {
  font-size: .78rem; font-weight: 600; padding: 5px 12px;
  border: 1.5px solid var(--line); border-radius: 999px; color: var(--muted); text-decoration: none;
}
.range-pill:hover { border-color: var(--accent); color: var(--accent); }
.range-active, .range-active:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.activity-headline { display: flex; gap: 40px; margin-bottom: 20px; }
.metric { display: flex; flex-direction: column; }
.metric-value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.metric-label { font-size: .8rem; color: var(--muted); }

.bar-chart {
  display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 0 0;
  border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 34px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; transition: background .15s; }
.bar-col:hover .bar { background: var(--accent-dark); }
.bar-label { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.activity-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 32px; }
.activity-panel h3 { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 10px; }
.rank-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.rank-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--surface); font-size: .9rem; }
.rank-list li:last-child { border-bottom: none; }
.rank-count { font-weight: 700; color: var(--accent-dark); }

/* ── Inventory table ────────────────────────────────────── */
.inv-table { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.inv-table td { vertical-align: middle; }
.inv-table input, .inv-table select { min-height: 38px; }
.inv-table .col-cat   input { max-width: 110px; }
.inv-table .col-price input { max-width: 90px; }
.inv-table .col-active { text-align: center; }
.inv-table .col-active input { width: auto; min-height: auto; transform: scale(1.2); }
.inv-table .row-add td { border-top: 2px solid var(--line); background: var(--surface); }

/* ── Design / theme picker ──────────────────────────────── */
.design-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.design-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.design-card.is-active { outline: 3px solid var(--accent); outline-offset: -1px; }
.design-card-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.design-card-head strong { font-size: 1.1rem; }
.design-badge { background: var(--accent); color: #fff; font-size: .66rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; letter-spacing: .04em; }
.design-desc { color: var(--muted); font-size: .9rem; min-height: 2.4em; }
.design-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.design-actions form { margin: 0; }

/* ── Login ──────────────────────────────────────────────── */
.admin-login-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 24px; }
.admin-login-wrap .admin-form { width: 100%; max-width: 380px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 860px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .activity-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 1.9rem; }
  .activity-headline { gap: 24px; }
}

/* Small "walk-in" qualifier next to a walk-up's trigger time */
.pickup-note-sm { color: var(--muted); font-size: .78rem; }

/* Logged-in admin's name in the bar */
.adminnav-user {
  color: rgba(255, 255, 255, .85);
  font-size: .9rem;
  font-weight: 600;
  padding: 0 4px;
  align-self: center;
  white-space: nowrap;
}

/* ── Touch devices (iPad etc.) ──────────────────────────────
   Grow tap targets toward the ~44px Apple guideline. Scoped to coarse
   pointers, so the mouse/desktop layout is unaffected. 16px control text
   stops iOS Safari from zooming in when a field gains focus. */
@media (pointer: coarse) {
  .button, button, .small, button.small { min-height: 44px; }
  .adminnav a, .adminnav .logout { padding: 11px 15px; }
  input, select, textarea { min-height: 44px; font-size: 16px; }
  .inv-table input, .inv-table select { min-height: 44px; }
  .inv-table .col-active input { transform: scale(1.5); }
  .handout-form select, .handout-form input { min-height: 44px; }
}

/* ── Analytics helpers ──────────────────────────────────── */
.dash-more { font-size: 0.7em; font-weight: 500; margin-left: 0.5rem; }
.dash-sub { color: var(--muted, #667); margin: 0.25rem 0 0; font-size: 0.9rem; }
