/* Open Padel Content Studio: shell and component library (docs/design/SPEC.md sections 3 to 5).
   Colour values live in content-kit/brand/tokens.css; this file only maps roles and sizes.
   Screen files (css/screens/*.css) add layout for their own screen and never restyle components. */

:root {
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --gutter: clamp(16px, 4vw, 32px);

  --fs-small: var(--op-size-small);
  --fs-body: var(--op-size-body);
  --fs-h3: 20px;
  --fs-h2: clamp(24px, 22px + 0.5vw, 28px);
  --fs-h1: clamp(30px, 24px + 1.6vw, 40px);
  --fs-kpi: clamp(30px, 26px + 1vw, 36px);
  --lh-body: 1.5; --lh-head: 1.2;

  --r-card: var(--op-radius-card);
  --r-pill: var(--op-radius-pill);
  --r-control: 12px;
  --r-sheet: 20px;

  --el-0: none;
  --el-1: 0 1px 2px rgb(16 21 46 / .08), 0 1px 1px rgb(16 21 46 / .04);
  --el-2: 0 8px 24px rgb(16 21 46 / .16);

  --tap: var(--op-tap-min);
  --header-h: 56px; --nav-h: 64px; --rail-w: 248px;
  --content-max: 720px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  font-family: var(--op-font-body); font-size: var(--fs-body); line-height: var(--lh-body);
  color: var(--text); background: var(--surface);
}
h1, h2, h3 { font-family: var(--op-font-heading); color: var(--heading); line-height: var(--lh-head); margin: 0; overflow-wrap: anywhere; }
h1 { font-size: var(--fs-h1); font-weight: 800; }
h2 { font-size: var(--fs-h2); font-weight: 800; }
h3 { font-size: var(--fs-h3); font-weight: 700; }
p { margin: 0; overflow-wrap: anywhere; }
a { color: var(--link); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.app-header :focus-visible, .card-navy:focus-visible, .card-navy :focus-visible, .toast :focus-visible { outline-color: #FFFFFF; }
h1:focus, h2:focus, main:focus { outline: none; }
h1:focus-visible { outline: 3px solid var(--link); outline-offset: 4px; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-small { width: 18px; height: 18px; }
.sr-only, .copy-buffer {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.num, .kpi-value, .metric b, .meter-text { font-variant-numeric: tabular-nums; }
.noscript { padding: var(--sp-5) var(--gutter); }

.skip-link {
  position: absolute; left: var(--sp-2); top: -100px; z-index: 100;
  background: var(--card); color: var(--op-navy); font-weight: 700; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-control); box-shadow: var(--el-2);
}
.skip-link:focus { top: var(--sp-2); }

/* ---------- shell ---------- */

.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: var(--header-h); padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-4);
  padding-top: max(var(--sp-1), env(safe-area-inset-top, 0px));
  background: var(--op-navy); color: #FFFFFF;
}
.brand { display: flex; align-items: center; gap: var(--sp-3); color: #FFFFFF; text-decoration: none; min-height: var(--tap); min-width: var(--tap); flex: none; }
.brand-mark { width: 32px; height: 32px; display: block; }
.brand-name { display: none; font-family: var(--op-font-heading); font-weight: 800; font-size: var(--fs-body); }
.account { flex: 1; min-width: 0; font-size: var(--fs-small); font-weight: 700; line-height: 1.25; }
.app-header .header-range { display: none; }
.header-refresh .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.header-refresh { width: var(--tap); padding: 0; border-color: transparent; }
.lang { display: flex; flex: none; box-shadow: inset 0 0 0 2px var(--op-line-dark); border-radius: var(--r-pill); overflow: hidden; }
.lang-btn {
  min-width: var(--tap); min-height: var(--tap); padding: 0 var(--sp-2);
  background: transparent; border: 0; color: #FFFFFF; font-weight: 800; font-size: var(--fs-small);
}
.lang-btn[aria-pressed="true"] { background: #FFFFFF; color: var(--op-navy); }

.banners:empty { display: none; }
.banners { display: flex; flex-direction: column; }

main {
  display: block; min-width: 0;
  padding: var(--sp-5) var(--gutter) calc(var(--nav-h) + var(--safe-bottom) + var(--sp-5));
}
.page { max-width: var(--content-max); margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-5); container-type: inline-size; }
.page-head { display: flex; flex-direction: column; gap: var(--sp-1); }
.page-sub { color: var(--text-soft); }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.soft { color: var(--text-soft); }
.small { font-size: var(--fs-small); }
.grid { display: grid; gap: var(--sp-3); grid-template-columns: 1fr; container-type: inline-size; }
@container (min-width: 520px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* bottom navigation (below 1100 px) */
.app-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--card); border-top: 1px solid var(--op-line-soft);
  padding-bottom: var(--safe-bottom);
}
.app-nav ul { list-style: none; margin: 0; padding: 0; }
.nav-main { display: flex; height: var(--nav-h); padding: 0 2px; }
.nav-main li { flex: 1 1 0; min-width: 48px; display: flex; }
.nav-rail-extra { display: none; }
.nav-item {
  position: relative; flex: 1 1 0; min-width: 48px; padding: 0 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-soft); font-size: var(--fs-small); font-weight: 600; text-decoration: none; line-height: 1.2;
}
.nav-ind { width: clamp(40px, 12vw, 56px); height: 32px; border-radius: var(--r-pill); display: grid; place-items: center; transition: background-color var(--dur-2); }
.nav-item[aria-current="page"] { color: var(--op-navy); font-weight: 800; }
.nav-item[aria-current="page"] .nav-ind { background: var(--op-ball); }
.nav-label { white-space: nowrap; }
.nav-badge {
  position: absolute; top: 2px; right: max(0px, calc(50% - 36px));
  min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; border: 2px solid var(--card);
  background: var(--op-navy); color: #FFFFFF; font-size: 16px; font-weight: 800; display: grid; place-items: center;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: var(--sp-2) var(--sp-5); border-radius: var(--r-pill); border: 2px solid transparent;
  font-family: var(--op-font-heading); font-weight: 700; font-size: var(--fs-body); line-height: 1.2; text-align: center;
  text-decoration: none; transition: transform var(--dur-1), filter var(--dur-1), background-color var(--dur-1);
}
.btn .ico { width: 20px; height: 20px; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--btn-bg); color: var(--btn-text); }
.btn-secondary { background: var(--card); color: var(--op-navy); border-color: var(--border); }
.btn-quiet { background: transparent; color: var(--link); padding: 0 var(--sp-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.btn-danger { background: var(--op-bad); color: #FFFFFF; }
.btn-icon { width: var(--tap); padding: 0; border-radius: 50%; background: transparent; color: inherit; }
.btn-icon .ico { width: 24px; height: 24px; }
.btn-on-navy { background: transparent; color: #FFFFFF; border-color: var(--op-line-dark); }
.btn-block { width: 100%; }
.btn[aria-disabled="true"] { opacity: .45; }
.btn[aria-busy="true"] { cursor: progress; }
@media (hover: hover) {
  .btn-primary:hover, .btn-danger:hover { filter: brightness(.92); }
  .btn-secondary:hover { background: var(--surface); }
  .btn-quiet:hover { text-decoration-thickness: 2px; }
  .btn-on-navy:hover { background: rgb(255 255 255 / .1); }
}
.spinner {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 3px solid currentColor; border-right-color: transparent; animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.quiet-link {
  display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--tap);
  color: var(--link); font-weight: 700; font-size: var(--fs-small); text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- cards ---------- */

.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--el-1); padding: var(--sp-4); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.card-foot { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.card-navy { background: var(--op-navy); color: #FFFFFF; }
.card-navy h2, .card-navy h3, .card-navy .link-card-title { color: #FFFFFF; }
.card-navy .link-card-desc { color: var(--op-mist); }
.link-card { display: flex; align-items: center; gap: var(--sp-3); min-height: 88px; color: var(--text); text-decoration: none; transition: box-shadow var(--dur-2); }
.link-card .lead { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--surface); color: var(--op-navy); }
.card-navy .lead { background: rgb(255 255 255 / .12); color: #FFFFFF; }
.link-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.link-card-title { font-family: var(--op-font-heading); font-size: var(--fs-h3); font-weight: 700; color: var(--heading); line-height: var(--lh-head); }
.link-card-desc { font-size: var(--fs-small); color: var(--text-soft); }
.link-card-trailing { display: none; font-weight: 700; font-size: var(--fs-small); color: var(--link); }
.card-navy .link-card-trailing { color: #FFFFFF; }
.link-card .chev { opacity: .8; }
.badge {
  align-self: flex-start; display: inline-flex; align-items: center; min-height: 28px; margin-top: var(--sp-1);
  padding: 0 10px; border-radius: var(--r-pill); background: var(--op-navy); color: #FFFFFF; font-size: var(--fs-small); font-weight: 700;
}
.card-navy .badge { background: #FFFFFF; color: var(--op-navy); }
@media (hover: hover) and (min-width: 1100px) { a.card:hover { box-shadow: var(--el-2); } }

/* ---------- chips, segmented, meta chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 var(--sp-4);
  border-radius: var(--r-pill); border: 2px solid var(--border); background: var(--card); color: var(--text);
  font-size: var(--fs-small); font-weight: 600; transition: background-color var(--dur-2), color var(--dur-2);
}
.chip .ico { width: 18px; height: 18px; }
.chip-check { display: none; }
.chip[aria-checked="true"], .chip[aria-pressed="true"] { background: var(--op-navy); border-color: var(--op-navy); color: #FFFFFF; }
.chip[aria-checked="true"] .chip-check, .chip[aria-pressed="true"] .chip-check { display: inline-flex; }
.meta-chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: var(--r-pill);
  background: var(--surface); color: var(--text-soft); font-size: var(--fs-small); font-weight: 600;
}
/* Long hashtags (#pembrokepinesfl) may break anywhere, on hashtag chips only, so a 320 px phone never
   scrolls sideways. */
.ht-chip { max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
.seg { display: flex; border: 2px solid var(--border); border-radius: var(--r-pill); background: var(--surface); padding: 2px; }
.seg-tab {
  flex: 1 1 0; min-height: 48px; padding: 0 var(--sp-2); border: 0; border-radius: var(--r-pill); background: transparent;
  font-weight: 700; font-size: var(--fs-small); line-height: 1.2; color: var(--text);
}
.seg-tab[aria-selected="true"] { background: var(--op-navy); color: #FFFFFF; }

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: var(--sp-1); }
.field-label, .switch-label { font-weight: 700; }
.field-help { font-size: var(--fs-small); color: var(--text-soft); }
.field-error { display: flex; gap: 6px; font-size: var(--fs-small); color: var(--down); }
.field-error .ico { width: 18px; height: 18px; margin-top: 3px; }
.input, .select, textarea.input {
  width: 100%; min-height: var(--tap); padding: var(--sp-2) var(--sp-4);
  border: 2px solid var(--border); border-radius: var(--r-control); background: var(--card); color: var(--text);
}
textarea.input { min-height: 96px; resize: vertical; }
.input[aria-invalid="true"] { border-color: var(--down); }
.range-control { display: flex; flex-direction: column; gap: var(--sp-1); }
.range-label { font-size: var(--fs-small); color: var(--text-soft); }
.app-header .range-control { flex-direction: row; align-items: center; gap: var(--sp-2); }
.app-header .range-label { color: var(--op-mist); }
.app-header .select { width: auto; background: var(--op-navy); color: #FFFFFF; border-color: var(--op-line-dark); }
.switch-row { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-1) var(--sp-3); align-items: center; }
.switch-row .field-help { grid-column: 1 / -1; }
.switch { width: 64px; height: var(--tap); padding: 0; border: 0; background: transparent; display: grid; place-items: center; }
.switch-track { width: 52px; height: 32px; border-radius: 16px; border: 2px solid var(--border); background: var(--op-line-soft); position: relative; transition: background-color var(--dur-2); }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--card); box-shadow: var(--el-1); transition: transform var(--dur-2) var(--ease-out); }
.switch[aria-checked="true"] .switch-track { background: var(--op-navy); border-color: var(--op-navy); }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(20px); }
.radio-card {
  display: flex; gap: var(--sp-3); align-items: flex-start; width: 100%; min-height: 64px; padding: var(--sp-3);
  background: var(--card); border: 2px solid var(--border); border-radius: var(--r-card); text-align: left;
}
.radio-card .rb { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--op-line); flex: none; margin-top: 2px; }
.radio-card[aria-checked="true"] { border-color: var(--op-navy); box-shadow: inset 0 0 0 1px var(--op-navy); }
.radio-card[aria-checked="true"] .rb { border: 7px solid var(--op-navy); }

/* ---------- banners ---------- */

.banner {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--gutter); background: var(--card); border-left: 6px solid var(--warn); border-bottom: 1px solid var(--op-line-soft);
}
.banner > .ico { color: var(--warn); margin-top: 2px; }
.banner-offline { border-left-color: var(--op-ink-soft); }
.banner-offline > .ico { color: var(--op-ink-soft); }
.banner-error { border-left-color: var(--op-bad); }
.banner-error > .ico { color: var(--op-bad); }
.banner-info { border-left-color: var(--op-blue); }
.banner-info > .ico { color: var(--op-blue); }
.banner-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.banner-title { font-weight: 700; }
.banner-text { font-size: var(--fs-small); color: var(--text-soft); }
.banner-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.banner-compact { align-items: center; padding-top: var(--sp-1); padding-bottom: var(--sp-1); }
.banner-compact .banner-body { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0 var(--sp-3); }
.banner-compact .banner-title, .banner-compact .banner-text { font-size: var(--fs-small); }
.banner-compact .banner-actions { margin-top: 0; }
.page .banner { border-radius: var(--r-card); border-bottom: 0; padding: var(--sp-3) var(--sp-4); box-shadow: var(--el-1); }

/* ---------- dialogs and sheets ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end;
  background: rgb(20 26 71 / .4); animation: fade-in var(--dur-2) var(--ease-out);
}
.dialog {
  max-height: 85vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-3);
  background: var(--card); border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--el-2);
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-4) + var(--safe-bottom));
  animation: sheet-in var(--dur-3) var(--ease-out);
}
.dialog-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--op-line-soft); align-self: center; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.dialog-head h2 { padding-top: var(--sp-2); }
.dialog-close { margin: -4px -8px 0 0; color: var(--op-navy); }
.dialog-body { display: flex; flex-direction: column; gap: var(--sp-3); }
.dialog-body blockquote { margin: 0; padding: var(--sp-3); background: var(--surface); border-left: 4px solid var(--op-navy); border-radius: 8px; white-space: pre-wrap; }
.dialog-actions {
  position: sticky; bottom: calc(-1 * (var(--sp-4) + var(--safe-bottom))); display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end;
  background: var(--card); padding: var(--sp-3) 0 var(--sp-1);
}
.dialog-actions .btn { flex: 1 1 auto; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- toast ---------- */

.toast-region {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 12px + var(--safe-bottom)); width: min(92vw, 480px); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; gap: var(--sp-4); align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-card); box-shadow: var(--el-2);
  background: var(--op-navy); color: #FFFFFF; animation: rise-in var(--dur-2) var(--ease-out);
}
.toast-action { min-height: var(--tap); padding: 0 var(--sp-2); background: transparent; border: 0; color: #FFFFFF; font-weight: 700; text-decoration: underline; }

/* ---------- KPI ---------- */

.kpi { display: flex; flex-direction: column; gap: var(--sp-1); }
.kpi-label { display: flex; justify-content: space-between; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-small); font-weight: 600; color: var(--text-soft); line-height: 1.3; }
.kpi-value { font-family: var(--op-font-heading); font-weight: 800; font-size: var(--fs-kpi); color: var(--heading); line-height: 1.2; }
/* D13: the button itself is the 48 px target; the visible circle (32 px) sits inside it. The
   negative margins keep the label row as tall as before. */
.kpi-info {
  width: var(--tap); height: var(--tap); margin: -8px -8px -8px 0; padding: 0; flex: none; border: 0; border-radius: 50%;
  background: transparent; color: var(--op-navy); display: grid; place-items: center; cursor: pointer;
}
.kpi-info-dot {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border); background: var(--card);
  font-weight: 800; font-size: 15px; display: grid; place-items: center;
}
.kpi-help { font-size: var(--fs-small); }
.kpi-note { font-size: var(--fs-small); color: var(--text-soft); line-height: 1.35; }
.change { display: flex; gap: var(--sp-1); align-items: flex-start; font-size: var(--fs-small); line-height: 1.35; color: var(--text-soft); }
.change .ico { width: 18px; height: 18px; margin-top: 2px; }
.change-up { color: var(--up); }
.change-down { color: var(--down); }

/* ---------- insight ---------- */

.insight { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--op-line-soft); }
.insight:first-child { border-top: 0; padding-top: 0; }
.insight-dot { width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.insight-dot .ico { width: 20px; height: 20px; }
.insight-keep .insight-dot { color: var(--up); }
.insight-stop .insight-dot { color: var(--warn); }
.insight-info .insight-dot { color: var(--op-blue); }
.insight-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1); }
.insight-sample { font-size: var(--fs-small); color: var(--text-soft); }

/* ---------- post card ---------- */

.post { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--op-line-soft); }
.post:first-child { border-top: 0; padding-top: 0; }
.post-selected { border: 2px solid var(--op-navy); border-radius: var(--r-card); padding: var(--sp-3); }
.thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; display: block; }
.thumb-empty { display: grid; place-items: center; background: var(--op-navy); }
.thumb-empty img { width: 34px; height: 34px; }
.post-main { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.post-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.post-date { font-size: var(--fs-small); color: var(--text-soft); }
.post-caption { font-size: var(--fs-small); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.metrics { display: flex; flex-wrap: wrap; gap: var(--sp-1) 14px; font-size: var(--fs-small); color: var(--text-soft); }
.metric b { color: var(--text); }
.post-reason { grid-column: 1 / -1; font-size: var(--fs-small); }
.post-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

/* ---------- meter ---------- */

.meter { display: grid; grid-template-columns: minmax(80px, 1fr) auto; gap: var(--sp-2); align-items: center; font-size: var(--fs-small); }
.meter-track { height: 12px; border-radius: var(--r-pill); background: var(--op-line-soft); border: 1px solid var(--op-line); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--op-navy); }
.meter-full .meter-fill { background: var(--op-ok); }
.meter-text { display: inline-flex; align-items: center; gap: var(--sp-1); }
.meter-full .meter-text .ico { color: var(--op-ok); width: 18px; height: 18px; }

/* ---------- empty, loading, error ---------- */

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: var(--sp-5) var(--sp-3); }
.empty-icon { width: 48px; height: 48px; color: var(--text-soft); stroke-width: 1.5; }
.loading { display: flex; flex-direction: column; gap: var(--sp-3); }
.loading-text { font-size: var(--fs-small); color: var(--text-soft); }
.skeleton-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.skeleton {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--op-line-soft) 0%, var(--op-paper-soft) 50%, var(--op-line-soft) 100%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite;
}
.skeleton-line { height: 16px; }
.skeleton-line:nth-child(3n) { width: 60%; }
.skeleton-line:nth-child(3n+2) { width: 85%; }
.skeleton-kpi { width: 120px; height: 36px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.error-block {
  display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4);
  background: var(--card); border-left: 6px solid var(--op-bad); border-radius: var(--r-card); box-shadow: var(--el-1);
}
.error-block > .ico { color: var(--op-bad); margin-top: 2px; }
.error-block > div { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
.error-title { font-weight: 700; }

/* ---------- lists (Menú rows, rail) ---------- */

.row-list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: var(--r-card); box-shadow: var(--el-1); }
.row-list li + li { border-top: 1px solid var(--op-line-soft); }
.row-link { display: flex; align-items: center; gap: var(--sp-3); min-height: 64px; padding: 0 var(--sp-4); color: var(--text); text-decoration: none; font-weight: 600; }
.row-link > .ico:first-child { color: var(--op-navy); }
.row-link-label { flex: 1; min-width: 0; }
.row-link .badge { margin-top: 0; }
.row-link .row-link-badge { position: static; margin-left: auto; flex: none; }
.row-link .chev { color: var(--text-soft); }
.footer-note { font-size: var(--fs-small); color: var(--text-soft); display: flex; flex-direction: column; gap: var(--sp-1); }
.updated { font-size: var(--fs-small); color: var(--text-soft); display: flex; gap: var(--sp-1); align-items: center; }
.updated-stale { color: var(--warn); }
.updated .ico { width: 18px; height: 18px; }

/* steps (Start here) */
.step-dots { display: flex; gap: var(--sp-2); align-items: center; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--op-line-soft); border: 1px solid var(--op-line); }
.step-dot-on { background: var(--op-navy); border-color: var(--op-navy); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.check-row { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: center; min-height: var(--tap); border-bottom: 1px solid var(--op-line-soft); }
.check-status { display: inline-flex; align-items: center; gap: var(--sp-1); font-weight: 700; font-size: var(--fs-small); }
.check-ok { color: var(--up); }
.check-fail { color: var(--down); }
.check-waiting { color: var(--text-soft); }
.status-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-1); }

/* ---------- Home layout (SPEC 6.3) ---------- */

/* SPEC 6.2: the three actions sit in one row on tablet and desktop. */
@container (min-width: 680px) {
  .home-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-actions .link-card { flex-direction: column; align-items: flex-start; }
  .home-actions .link-card .chev { display: none; }
}
.home-columns { display: flex; flex-direction: column; gap: var(--sp-5); }
.home-left, .home-right { min-width: 0; gap: var(--sp-5); }
.glance-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: flex-end; justify-content: space-between; }
/* S9: the glance block measures itself: two KPIs a row, four once the block is 680 px wide. */
.home-glance { container-type: inline-size; }
.home-glance .glance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 680px) { .home-glance .glance-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.glance-grid .kpi { padding: var(--sp-3); }
.glance-grid .kpi-value { font-size: 26px; }
.pull-list .post { border-top: 0; padding: 0; }
/* B3: the pull list measures its own card, so two columns only when the card is 520 px or wider. */
.pull-card { container-type: inline-size; }
/* B1: on a phone the welcome card follows the three actions; from 600 px it sits above them. */
@media (min-width: 600px) {
  .page > .page-head:first-child { order: -2; }
  .page > .home-welcome { order: -1; }
}
/* S8: below 1100 px a toast sits above a sticky action bar instead of over it. */
@media (max-width: 1099px) {
  body:has(.script-bar) .toast-region, body:has(.sticky-bar) .toast-region { bottom: calc(var(--nav-h) + var(--safe-bottom) + 88px); }
}
.desktop-only { display: none; }
@media (min-width: 1100px) { .desktop-only { display: block; } .below-desktop { display: none; } }
/* B1: on a phone the Home demo banner shows its title, the memory note and its two buttons. */
@media (max-width: 599px) {
  .banner-demo-home .banner-text:not(:last-of-type) { display: none; }
  .banner-demo-home .banner-actions { margin-top: 0; }
}
.demo-offer { border-top: 1px solid var(--op-line-soft); padding-top: var(--sp-4); align-items: flex-start; }

/* ---------- tablet: 600 px and up ---------- */

@media (min-width: 600px) {
  :root { --header-h: 64px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-name { display: inline; }
  .app-header .header-range { display: flex; }
  .header-refresh { width: auto; padding: 0 var(--sp-4); }
  .header-refresh .btn-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; }
  .phone-only { display: none !important; }
  .card { padding: var(--sp-5); }
  .scrim { justify-content: center; align-items: center; padding: var(--sp-5); }
  .dialog { width: min(480px, 100%); border-radius: var(--r-card); padding: var(--sp-5); max-height: 85vh; animation-name: fade-in; }
  .dialog-handle { display: none; }
  .dialog-actions { bottom: calc(-1 * var(--sp-5)); }
  .dialog-actions .btn { flex: 0 1 auto; }
}
@media (min-width: 600px) and (max-width: 899px) { .brand-name { display: none; } }
@media (min-width: 600px) {
  .link-card-trailing { display: inline; }
  .home-left { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .home-left > .error-block, .home-left > .card:only-child { grid-column: 1 / -1; }
}

/* ---------- desktop: 1100 px and up, side rail ---------- */

@media (min-width: 1100px) {
  .app-nav {
    top: var(--header-h); bottom: 0; right: auto; width: var(--rail-w); overflow-y: auto;
    border-top: 0; border-right: 1px solid var(--op-line-soft); padding: var(--sp-3) 0;
  }
  .nav-main { display: block; height: auto; padding: 0; }
  .nav-main li:last-child { display: none; }
  .nav-rail-extra { display: block; border-top: 1px solid var(--op-line-soft); margin-top: var(--sp-2); padding-top: var(--sp-2); }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: var(--sp-3); min-height: var(--tap); padding: 0 var(--sp-4); border-left: 4px solid transparent; font-size: var(--fs-body); }
  .nav-ind { width: 24px; height: 24px; border-radius: 0; }
  .nav-item[aria-current="page"] { border-left-color: var(--op-ball); background: var(--surface); }
  .nav-item[aria-current="page"] .nav-ind { background: transparent; }
  .nav-badge { position: static; margin-left: auto; }
  main { margin-left: var(--rail-w); padding-bottom: var(--sp-7); }
  .banners { margin-left: var(--rail-w); }
  .page { max-width: 1040px; }
  .toast-region { bottom: var(--sp-5); left: calc(50% + var(--rail-w) / 2); }
  .home-columns { display: grid; grid-template-columns: 3fr 2fr; align-items: start; }
  .home-left { display: flex; flex-direction: column; }
}

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: var(--dur-1) !important; transition-property: opacity !important; animation: none !important; }
  .btn:active { transform: none; }
  .skeleton { background: var(--op-line-soft); }
}

/* ---------- print: the script view and anything marked printable ---------- */

@media print {
  body { background: #FFFFFF; color: #000000; font-size: 12pt; }
  .app-header, .app-nav, .banners, .toast-region, .skip-link, .no-print, .btn, .scrim { display: none !important; }
  main { margin: 0; padding: 0; }
  .page { max-width: none; gap: 12pt; }
  .card { box-shadow: none; border: 1px solid #999999; break-inside: avoid; padding: 10pt; }
  a { color: #000000; text-decoration: none; }
  h1, h2, h3 { color: #000000; break-after: avoid; }
}
