/*! Website design & development © 2026 Fernando Bulnes. All rights reserved. */
/* Pop's Padel · staff dashboard (/admin/). Same brand as the website: Harbor Navy, Sea Salt, Paper, Caslon titles,
   Jost for everything you read and every number. Charts follow the data-viz rules: thin marks, hairline grid,
   values in ink (never in the series colour), one categorical colour per contact type (validated for colour-blindness). */
:root {
  color-scheme: light;
  --navy: #12213B; --navy-2: #1A2D4D; --navy-3: #0B1628;
  --ivory: #F6F1E7; --paper: #FBF8F2; --sand: #EAE0CE;
  --court: #2D58D2; --clay: #C65D3B; --clay-2: #A94B2E;
  --text: #12213B; --text-soft: #46536A; --muted: #6B7486;
  --line: rgba(18, 33, 59, .12); --line-strong: rgba(18, 33, 59, .24);
  --good: #1D7A4C; --bad: #A94B2E;
  /* one colour per contact type, in this fixed order (validated: scripts/validate_palette.js, light, on #FBF8F2) */
  --t-list: #2D58D2; --t-membership: #C65D3B; --t-event: #0F9D7A; --t-lesson: #7B5EA7; --t-compete: #C49A2C; --t-contact: #D35A8C;
  --ff-display: "Libre Caslon Display", "Libre Caslon Text", Georgia, serif;
  --ff-sans: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ivory); color: var(--text); font-family: var(--ff-sans); font-size: 15.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
h1, h2, p, dl, dd { margin: 0; }
:focus-visible { outline: 2px solid var(--court); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-soft); }

/* ---------- Views ---------- */
.screen, .app { display: none; }
.adm[data-view="loading"] .loading, .adm[data-view="login"] .login, .adm[data-view="denied"] .denied,
.adm[data-view="offline"] .offline { display: grid; }
.adm[data-view="app"] .app { display: block; }

/* ---------- Loading, sign in, no access ---------- */
.screen { min-height: 100vh; min-height: 100dvh; place-items: center; align-content: center; gap: 36px; padding: 40px 16px;
  background: radial-gradient(120% 80% at 50% 0%, #1C3052 0%, var(--navy) 50%, var(--navy-3) 100%); color: var(--ivory); }
.loading .mark { width: 150px; opacity: .9; }
.loading p { font-size: 12px; letter-spacing: .26em; text-transform: uppercase; opacity: .7; }
.login-logo { width: min(220px, 56vw); }
.login-card { width: min(420px, 100%); background: var(--paper); color: var(--text); padding: 38px 34px 30px; position: relative; box-shadow: 0 40px 90px rgba(4, 10, 22, .45); }
.login-card::after { content: ""; position: absolute; inset: 10px; border: 1px solid var(--line); pointer-events: none; }
.login-card h1 { margin-top: 12px; font-family: var(--ff-display); font-weight: 400; font-size: 34px; line-height: 1.1; }
.login-card p { margin-top: 14px; }
.login-card form { margin-top: 26px; display: grid; gap: 18px; position: relative; z-index: 1; }
.login-card .btn { margin-top: 6px; }
.back { font-size: 12.5px; letter-spacing: .18em; text-transform: uppercase; color: rgba(246, 241, 231, .7); text-decoration: none; }
.back:hover { color: var(--ivory); }
.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .24em; text-transform: uppercase; color: var(--text-soft); }
.fld { display: grid; gap: 6px; }
.fld span { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-soft); }
.fld input { border: 0; border-bottom: 1px solid var(--line-strong); background: transparent; padding: 10px 0; font-size: 17px; border-radius: 0; }
.fld input:focus { outline: none; border-color: var(--navy); }
.msg { min-height: 1.4em; font-size: 14px; color: var(--text-soft); }
.msg.err { color: var(--clay-2); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 26px; border-radius: 999px;
  background: var(--navy); color: var(--ivory); border: 1px solid var(--navy); font-size: 12px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; text-decoration: none; white-space: nowrap; transition: background .3s, color .3s, border-color .3s; }
.btn:hover { background: var(--navy-2); }
.btn.sm { min-height: 38px; padding: 0 18px; font-size: 11px; }
.btn.outline { background: transparent; color: var(--navy); border-color: var(--line-strong); }
.btn.outline:hover { background: var(--navy); color: var(--ivory); border-color: var(--navy); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.linkish { font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--text-soft); border-bottom: 1px solid currentColor; padding-bottom: 3px; justify-self: start; }
.linkish:hover { color: var(--navy); }
.linkish.light { color: rgba(246, 241, 231, .78); }
.linkish.light:hover { color: var(--ivory); }
.linkish.danger { color: var(--clay-2); }

/* ---------- Top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px;
  padding: 12px clamp(16px, 3vw, 40px); background: var(--navy); color: var(--ivory); }
.top-logo img { display: block; height: 46px; width: auto; }
.tabs { display: flex; gap: 6px; justify-self: center; }
.tabs button { position: relative; padding: 10px 16px; font-size: 12px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: rgba(246, 241, 231, .7); border-radius: 999px; }
.tabs button:hover { color: var(--ivory); }
.tabs button[aria-selected="true"] { color: var(--navy); background: var(--ivory); }
.tabs .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--clay); color: #fff; font-size: 11px; letter-spacing: 0; }
.me { display: flex; align-items: center; gap: 18px; font-size: 13.5px; color: rgba(246, 241, 231, .86); }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: rgba(246, 241, 231, .62); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #5FD39A; box-shadow: 0 0 0 3px rgba(95, 211, 154, .18); }
.adm.is-stale .live i { background: #E0B04A; box-shadow: 0 0 0 3px rgba(224, 176, 74, .2); }

/* ---------- Page ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 36px clamp(16px, 3vw, 40px) 64px; }
.head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.head h1 { margin-top: 10px; font-family: var(--ff-display); font-weight: 400; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.08; }
.head > p { max-width: 46ch; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin: 28px 0 22px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); }
.seg button { padding: 7px 14px; border-radius: 999px; font-size: 13px; color: var(--text-soft); }
.seg button:hover { color: var(--navy); }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--ivory); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--paper); font-size: 13px; color: var(--text-soft); }
.chip:hover { color: var(--navy); border-color: var(--navy); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--ivory); }
.search input { width: min(320px, 78vw); padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); font-size: 14px; }
.search input:focus { outline: none; border-color: var(--navy); }
.sel select { padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); font-size: 13.5px; }
.filters .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.summary { margin-bottom: 12px; font-size: 13.5px; color: var(--text-soft); }

/* type identity: a dot in the type's colour + its name (never colour alone) */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex-shrink: 0; }
.type { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 13.5px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; letter-spacing: .04em; white-space: nowrap; }
.status.new { background: rgba(198, 93, 59, .12); color: var(--clay-2); }
.status.contacted { background: rgba(45, 88, 210, .1); color: #2147B0; }
.status.closed { background: rgba(18, 33, 59, .07); color: var(--text-soft); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--line); padding: 22px 22px 20px; }
.kpi .label { font-size: 13.5px; color: var(--text-soft); }
.kpi .value { margin-top: 6px; font-size: clamp(34px, 3.2vw, 46px); font-weight: 600; line-height: 1.05; letter-spacing: -.01em; }
.kpi .delta { margin-top: 8px; font-size: 13px; color: var(--text-soft); }
.kpi .delta b { font-weight: 600; }
.kpi .delta .up { color: var(--good); }
.kpi .delta .down { color: var(--bad); }
.kpi.hero .value { font-size: clamp(44px, 4.2vw, 60px); }

/* ---------- Cards and charts ---------- */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.card { background: var(--paper); border: 1px solid var(--line); padding: 22px 22px 20px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.card h2 { font-size: 13px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--text-soft); }
.trend { position: relative; transition: opacity .3s; }
.trend svg { display: block; width: 100%; height: auto; overflow: visible; }
.trend .grid { stroke: rgba(18, 33, 59, .09); stroke-width: 1; shape-rendering: crispEdges; }
.trend .axis { font-size: 11.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.trend .col { fill: var(--navy); transition: fill .2s; }
.trend .hit { fill: transparent; cursor: default; }
.trend .hit:hover + .col, .trend .hit:focus + .col, .trend .is-hover { fill: var(--court); }
.trend .val { font-size: 12.5px; font-weight: 600; fill: var(--text); }
.trend table { width: 100%; }
.bars { display: grid; gap: 12px; }
.bar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; align-items: center; gap: 14px; font-size: 14px; }
.bar .name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar .name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar .fill { height: 12px; min-width: 2px; background: var(--navy); border-radius: 0 4px 4px 0; }
.bar .n { font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar .n small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.empty { padding: 26px 0; color: var(--muted); font-size: 14px; }

/* ---------- Tables ---------- */
.table-wrap { background: var(--paper); border: 1px solid var(--line); overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .2s; }
.tbl tbody tr:hover, .tbl tbody tr:focus-visible { background: rgba(234, 224, 206, .45); outline: none; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .when { white-space: nowrap; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .strong { font-weight: 500; }
.tbl .types { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.latest .tbl { font-size: 14px; }
.more { margin-top: 18px; text-align: center; }

/* ---------- Drawer (one contact) ---------- */
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(520px, 100vw); height: 100%; max-height: none; max-width: none; padding: 26px 28px 40px;
  border: 0; background: var(--paper); color: var(--text); overflow-y: auto; box-shadow: -30px 0 80px rgba(11, 22, 40, .25); }
.drawer::backdrop { background: rgba(11, 22, 40, .38); }
.drawer[open] { animation: d-in .45s var(--ease); }
@keyframes d-in { from { transform: translateX(40px); opacity: 0; } }
.d-top { display: flex; justify-content: space-between; align-items: center; }
.x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-strong); position: relative; }
.x::before, .x::after { content: ""; position: absolute; left: 12px; right: 12px; top: 19px; height: 1.4px; background: currentColor; transform: rotate(45deg); }
.x::after { transform: rotate(-45deg); }
.drawer h2 { margin-top: 14px; font-family: var(--ff-display); font-weight: 400; font-size: 32px; line-height: 1.1; overflow-wrap: anywhere; }
.d-email { margin-top: 6px; font-size: 15px; color: var(--text-soft); overflow-wrap: anywhere; }
.d-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.d-block { margin-top: 26px; display: grid; gap: 10px; }
.lbl { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.d-list { margin-top: 26px; border-top: 1px solid var(--line); }
.d-list div { display: grid; grid-template-columns: 140px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.d-list dt { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.d-list dd { white-space: pre-wrap; overflow-wrap: anywhere; }
.drawer textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line-strong); background: #fff; border-radius: 4px; font-size: 14.5px; resize: vertical; }
.drawer textarea:focus { outline: none; border-color: var(--navy); }
.d-row { display: flex; align-items: center; gap: 14px; }
.d-meta { margin-top: 22px; font-size: 12.5px; color: var(--muted); }
.drawer .danger { margin-top: 26px; }

/* ---------- Tooltip ---------- */
.tip { position: fixed; z-index: 60; pointer-events: none; padding: 9px 12px; background: var(--navy); color: var(--ivory); border-radius: 6px; font-size: 13px; line-height: 1.35; box-shadow: 0 12px 30px rgba(11, 22, 40, .25); }
.tip b { display: block; font-size: 15px; font-weight: 600; }
.tip span { opacity: .78; }

.foot { padding: 24px clamp(16px, 3vw, 40px) 40px; text-align: center; font-size: 11.5px; letter-spacing: .06em; color: var(--muted); }
.foot strong { font-weight: 500; color: var(--text-soft); }

/* ---------- Phones and tablets ---------- */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .top { grid-template-columns: auto 1fr; gap: 10px 16px; padding: 10px 16px; }
  .top-logo img { height: 38px; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; overflow-x: auto; }
  .tabs button { padding: 8px 12px; font-size: 11px; letter-spacing: .14em; white-space: nowrap; }
  .me { justify-self: end; gap: 12px; }
  .me .js-me-name, .live { display: none; }
  .wrap { padding-top: 26px; }
  .kpi { padding: 16px; }
  .kpi .value { font-size: 32px; }
  .bar { grid-template-columns: 1fr; gap: 6px; }
  /* tables become cards */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .tbl td { padding: 2px 0; border: 0; }
  .tbl td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 96px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
  .tbl .num { text-align: left; }
  .drawer { width: 100vw; padding: 20px 18px 40px; }
  .d-list div { grid-template-columns: 1fr; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .drawer[open] { animation: none; } * { transition: none !important; } }
