@layer tokens, base, layout, components, responsive;

@layer tokens {
  :root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #243631;
    background: #f7f8f6;
    font-synthesis: none;
    --brand: #214f40;
    --brand-soft: #e8f0e9;
    --text-muted: #68756e;
    --line: #e2e7e1;
    --surface: #fff;
    --radius: 14px;
  }
}

@layer base {
  * { box-sizing: border-box; }
  body { margin: 0; }
  button, input, select, textarea { font: inherit; }
  button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
  button, select { cursor: pointer; }
  a { color: inherit; text-decoration: none; }
  h1, h2, h3, p { margin-top: 0; }
  h1 { font-size: clamp(28px, 3vw, 39px); font-weight: 620; letter-spacing: -1.3px; line-height: 1.2; margin-bottom: 12px; }
  h2 { font-size: 18px; letter-spacing: -.35px; font-weight: 620; }
  h3 { font-size: 13px; font-weight: 650; }
  p { line-height: 1.6; }
  small { font-size: 12px; line-height: 1.6; }
  button { border: 0; background: none; color: inherit; }
  :focus-visible { outline: 3px solid #61967c; outline-offset: 4px; }
  :disabled { cursor: not-allowed; opacity: .45; }
  [hidden] { display: none !important; }
  input, select, textarea { background: white; color: #243631; border: 1px solid #cbd4cc; border-radius: 8px; padding: 11px 13px; }
  textarea { width: 100%; resize: vertical; min-height: 90px; line-height: 1.5; }
  hr { border: 0; border-top: 1px solid #c9d5c9; margin: 25px 0; }
  .muted { color: var(--text-muted); }
  .eyebrow { font-size: 10px; letter-spacing: 1.6px; font-weight: 700; color: var(--text-muted); }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .skip-link { position: fixed; left: 12px; top: -80px; z-index: 10; background: white; padding: 16px; border: 2px solid var(--brand); }
  .skip-link:focus { top: 12px; }
}

@layer layout {
  .app-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }
  .sidebar { background: #f0f2ed; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 32px 19px 22px; position: sticky; top: 0; height: 100dvh; }
  .brand { display: flex; align-items: center; gap: 8px; font-size: 29px; font-weight: 700; letter-spacing: -1.6px; padding: 0 10px; }
  .brand-mark { width: 30px; height: 32px; color: white; border-radius: 9px 9px 14px 9px; background: var(--brand); font-size: 24px; text-align: center; line-height: 29px; letter-spacing: -2px; }
  .brand-caption { font-size: 9px; letter-spacing: 1.5px; font-weight: 550; align-self: end; margin-bottom: 5px; margin-left: 4px; }
  .navigation { margin-top: 58px; }
  .nav-label { padding: 0 12px; margin-bottom: 16px; }
  .nav-link { display: flex; align-items: center; gap: 11px; padding: 13px 12px; margin-bottom: 7px; font-size: 13px; border-radius: 8px; color: #5d6c62; font-weight: 520; }
  .nav-link:hover { background: #e6eae2; }
  .nav-link[aria-current] { background: #dfe9df; color: #234d3b; font-weight: 650; }
  .nav-symbol { width: 21px; text-align: center; font-size: 21px; line-height: 17px; }
  .sidebar-note { margin-top: auto; padding: 20px 12px 0; }
  .sidebar-note strong { display: block; font-size: 12px; margin: 10px 0; }
  .sidebar-note p { color: var(--text-muted); font-size: 12px; }
  .status-dot { display: block; width: 7px; height: 7px; border-radius: 50%; background: #699477; }
  .sidebar-version { margin-top: 20px; padding: 0 12px; color: var(--text-muted); font-size: 10px; }
  .workspace { min-width: 0; }
  .topbar { min-height: 83px; border-bottom: 1px solid var(--line); background: #fff; padding: 15px 38px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
  .breadcrumb { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); }
  .breadcrumb strong { color: #2f4338; font-weight: 550; }
  .breadcrumb-separator { color: #c3cbc2; }
  .staff-label { display: flex; align-items: center; gap: 9px; color: var(--text-muted); font-size: 11px; }
  .staff-select { max-width: 220px; padding: 9px; font-size: 12px; }
  .demo-banner { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 20px; font-size: 11px; background: #f6f0dc; color: #706024; border-bottom: 1px solid #e9e1c7; }
  .demo-banner strong { white-space: nowrap; font-weight: 650; }
  .main-content { max-width: 1360px; margin: auto; padding: 44px 38px; }
  .page-heading { position: relative; margin-bottom: 32px; }
  .page-heading .lead { color: var(--text-muted); font-size: 14px; margin-bottom: 0; }
  .page-heading > .button { margin-top: 23px; }
  .page-heading.compact { margin-bottom: 25px; }
  .notice:empty { display: none; }
  .notice { margin: 20px 38px 0; padding: 13px 17px; border: 1px solid #c3d7c4; border-radius: 9px; background: var(--brand-soft); font-size: 13px; }
}

@layer components {
  .pilot-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 20px; padding: 12px 20px; font-size: 11px; background: #e8f0e9; border-bottom: 1px solid #c3d7c4; }
  .pilot-banner span { overflow-wrap: anywhere; min-width: 0; }
  .pilot-status { max-width: 720px; margin: 0 auto; padding: 90px 24px; }
  .access-demo-link { margin-top: 10px; }
  .access-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 26px 5%; border-bottom: 1px solid var(--line); background: white; }
  .access-header .brand { padding: 0; }
  .access-session-actions { display: flex; gap: 18px; align-items: center; }
  .access-main { max-width: 1120px; margin: 0 auto; padding: 70px 32px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 430px); gap: 70px; align-items: start; }
  .access-intro { padding-top: 25px; }
  .access-intro h1 { max-width: 430px; font-size: clamp(32px, 4vw, 48px); }
  .access-intro .lead { color: var(--text-muted); font-size: 15px; max-width: 390px; }
  .access-steps { list-style: none; padding: 0; display: grid; gap: 20px; margin-top: 35px; }
  .access-steps li { display: flex; gap: 14px; align-items: center; font-size: 13px; }
  .access-steps span { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 12px; }
  .access-steps strong { font-weight: 500; }
  .access-panel { padding: 32px; }
  .access-panel h2 { font-size: 25px; }
  .access-panel p { font-size: 13px; }
  .access-panel .empty-state { padding: 10px 0; text-align: left; }
  .access-form { display: grid; gap: 20px; margin-top: 26px; }
  .access-field { display: grid; gap: 9px; font-size: 12px; font-weight: 600; min-width: 0; }
  .access-field input, .access-field select { min-width: 0; width: 100%; font-size: 14px; }
  .access-field input[readonly] { color: var(--text-muted); background: #f5f7f3; }
  .access-footnote { color: var(--text-muted); font-size: 11px !important; margin: 22px 0 0; }
  .access-message { padding: 12px; background: var(--brand-soft); border-radius: 8px; margin: 0; }
  .access-form .mfa-code { letter-spacing: 8px; font-size: 24px; text-align: center; }
  .access-catalogue { display: block; max-width: 1100px; padding-top: 44px; }
  .catalogue-search { display: flex; align-items: end; gap: 10px; margin-bottom: 24px; }
  .catalogue-list { list-style: none; margin: 0; padding: 0; }
  .catalogue-row { display: flex; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
  .catalogue-row h2 { margin-bottom: 5px; font-size: 16px; overflow-wrap: anywhere; }
  .catalogue-row p { margin-bottom: 10px; font-size: 12px; }
  .catalogue-row time { flex-shrink: 0; font-size: 11px; padding-top: 3px; }
  .catalogue-note { margin-top: 20px; color: var(--text-muted); font-size: 12px; }
  .access-lab { max-width: 1036px; margin: 0 auto 30px; padding: 0 24px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  .access-lab:empty { display: none; }
  .access-lab .eyebrow { width: 100%; }
  .button { display: inline-flex; justify-content: center; align-items: center; min-height: 42px; padding: 11px 17px; border-radius: 8px; font-size: 12px; font-weight: 600; line-height: 1.4; }
  .primary { background: var(--brand); color: #fff; }
  .primary:hover:not(:disabled) { background: #183c30; }
  .secondary { background: #fff; border: 1px solid #d5ddd4; }
  .secondary:hover:not(:disabled) { background: #f3f5f0; }
  .metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 28px; }
  .metric-card { padding: 25px; background: white; border: 1px solid var(--line); border-radius: var(--radius); }
  .metric-accent { background: var(--brand); color: #fff; border-color: var(--brand); }
  .metric-label { font-size: 12px; margin-bottom: 18px; font-weight: 500; }
  .metric-value { font-size: 43px; line-height: 1; font-weight: 550; letter-spacing: -2px; }
  .metric-description { color: var(--text-muted); font-size: 11px; margin: 16px 0 0; }
  .metric-accent .metric-description { color: #cbded1; }
  .overview-lower { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(240px, 1fr); gap: 25px; align-items: start; }
  .panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .panel-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--line); }
  .panel-heading h2 { font-size: 15px; margin: 0; }
  .panel-heading > span { font-size: 10px; }
  .overview-row { padding: 21px 24px; border-bottom: 1px solid #eef0eb; display: flex; align-items: center; gap: 15px; }
  .overview-row:last-child { border-bottom: 0; }
  .overview-row:hover { background: #f7faf5; }
  .overview-row > div { margin-right: auto; }
  .overview-row strong { font-weight: 600; font-size: 13px; }
  .overview-row small { display: block; margin-top: 4px; font-size: 11px; }
  .row-arrow { color: #768c7b; font-size: 18px; }
  .badge { display: inline-flex; padding: 4px 8px; border-radius: 5px; font-size: 10px; font-weight: 550; white-space: nowrap; line-height: 1.5; }
  .neutral { background: #f0f2ed; color: #59685c; }
  .pending { background: #f8efd7; color: #7a5e18; }
  .accepted { background: #e6f0e7; color: #346340; }
  .rejected { background: #f5e7e3; color: #914b36; }
  .guide-card { padding: 27px; border-radius: var(--radius); background: #e9eee4; border: 1px solid #dfe6d8; }
  .guide-card h2 { font-size: 24px; line-height: 1.3; margin: 18px 0 14px; }
  .guide-card p:not(.eyebrow) { font-size: 13px; color: #596952; }
  .guide-card .guide-footnote { margin-top: 22px; font-size: 11px !important; margin-bottom: 0; }
  .review-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 23px; }
  .search-field { flex: 1; min-width: 0; }
  .search-field input { width: 100%; font-size: 12px; height: 43px; }
  .filter-field select { font-size: 12px; height: 43px; }
  .review-grid { display: grid; grid-template-columns: minmax(255px, .9fr) minmax(320px, 1.3fr); gap: 25px; align-items: start; }
  .queue-count { padding: 18px 20px; margin: 0; border-bottom: 1px solid var(--line); color: var(--text-muted); font-size: 11px; }
  .queue-row { display: block; width: 100%; padding: 20px; text-align: left; border-left: 3px solid transparent; border-bottom: 1px solid #edf0e9; }
  .queue-row:hover { background: #f7f9f4; }
  .queue-row[aria-pressed="true"] { background: #eef4ec; border-left-color: var(--brand); }
  .queue-row > strong { display: block; font-size: 14px; font-weight: 600; }
  .queue-row > small { display: block; margin: 4px 0 10px; }
  .queue-tags { display: flex; gap: 7px; }
  .pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 13px; font-size: 11px; }
  .text-button { padding: 10px 4px; font-size: 11px; }
  .review-detail { padding: 25px; }
  .detail-header h2 { font-size: 25px; margin-bottom: 8px; }
  .detail-header > .muted { font-size: 12px; margin-bottom: 11px; }
  .comparison { margin: 25px 0; display: grid; gap: 8px; }
  .comparison dt { font-size: 11px; color: var(--text-muted); }
  .comparison dd { margin: 0 0 8px; padding: 14px; border-radius: 8px; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
  .current-value { background: #f3f4f1; color: #707a70; }
  .proposed-value { background: #eaf2e8; color: #345639; border: 1px solid #d4e3d0; }
  .evidence { margin-bottom: 25px; }
  .evidence p { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
  .evidence small { font-size: 10px; }
  .decision-form { border-top: 1px solid var(--line); padding-top: 22px; display: grid; gap: 10px; }
  .decision-form > label { font-size: 12px; font-weight: 600; }
  .decision-form textarea { font-size: 12px; }
  .decision-form small { font-size: 10px; }
  .decision-actions { display: flex; justify-content: flex-end; gap: 10px; }
  .form-error { color: #9c392a; font-size: 12px; margin: 0; }
  .form-error:empty { display: none; }
  .read-only { font-size: 12px; color: #5f705e; padding: 16px; background: #f0f4eb; border-radius: 9px; }
  .empty-state { padding: 40px 24px; text-align: center; }
  .empty-state h2 { font-size: 17px; }
  .empty-state p { font-size: 13px; margin: 0 auto; max-width: 420px; }
  .empty-state .button { margin-top: 18px; }
  .panel-empty { padding: 25px; font-size: 13px; }
  .audit-list { list-style: none; padding: 0; display: grid; gap: 15px; }
  .audit-entry { padding: 24px; }
  .audit-heading { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
  .audit-heading h2 { margin: 0; font-size: 16px; }
  .audit-entry p { font-size: 13px; }
  .audit-entry small { font-size: 11px; }
  .loading { padding: 35px; color: var(--text-muted); }

  /* Costos y uso (0.4.0) */
  .costs-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; }
  .segmented { display: inline-flex; background: #fff; border: 1px solid #d5ddd4; border-radius: 8px; overflow: hidden; }
  .segmented button { padding: 10px 14px; font-size: 12px; font-weight: 550; color: #5d6c62; }
  .segmented button[aria-pressed="true"] { background: var(--brand); color: #fff; }
  .costs-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #5d6c62; }
  .costs-toggle input { width: 15px; height: 15px; padding: 0; margin: 0; accent-color: var(--brand); }
  .costs-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 28px; }
  .costs-chips .eyebrow { margin: 0 6px 0 0; }
  .chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; border: 1px solid #d5ddd4; background: #fff; font-size: 12px; font-weight: 550; color: #5d6c62; }
  .chip:hover { background: #f3f5f0; }
  .chip[aria-pressed="true"] { background: #dfe9df; border-color: #c3d7c4; color: #234d3b; }
  .chip .amount { font-weight: 500; color: var(--text-muted); font-size: 11px; }
  .chip[aria-pressed="true"] .amount { color: #3f6b52; }
  .costs-answer { margin-bottom: 25px; }
  .costs-answer .panel-heading { align-items: baseline; }
  .costs-answer .panel-heading h2 { font-size: 17px; }
  .costs-answer .panel-heading h2 small { display: block; margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
  .costs-headline { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
  .costs-headline > div:first-child { padding: 26px 24px; border-right: 1px solid var(--line); }
  .costs-big { display: block; font-size: 46px; line-height: 1; font-weight: 550; letter-spacing: -2px; color: #243631; }
  .costs-big-sub { color: var(--text-muted); font-size: 12px; margin: 12px 0 0; }
  .costs-facts { margin: 20px 0 0; padding: 0; list-style: none; display: grid; gap: 9px; font-size: 12px; }
  .costs-facts li { display: flex; justify-content: space-between; gap: 10px; }
  .costs-facts li span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
  .costs-chart { padding: 18px 20px 4px; }
  svg.chart { display: block; width: 100%; height: auto; }
  .chart .grid line { stroke: #eef0eb; }
  .chart .tick { fill: #8a968d; font-size: 11px; }
  .chart .lbl { fill: #5d6c62; font-size: 11px; font-weight: 550; }
  .chart rect.day { fill: var(--brand); }
  .chart .bar:hover rect.day { fill: #2f6b57; }
  .chart .avg { stroke: #c08a1e; stroke-dasharray: 4 4; }
  .chart .avg-lbl { fill: #8a6414; font-size: 10px; font-weight: 600; }
  .costs-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 25px; align-items: start; }
  .costs-bars { padding: 12px 24px 16px; }
  .bar-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 64px 46px; align-items: center; gap: 12px; padding: 8px 0; font-size: 12px; }
  .bar-row .what { overflow-wrap: anywhere; }
  .bar-row .track { height: 12px; background: #eef0eb; border-radius: 0 4px 4px 0; overflow: hidden; }
  .bar-row .fill { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; transition: width .25s ease; }
  .bar-row .fill.fam-details { background: #2a78d6; }
  .bar-row .fill.fam-photo { background: #eb6834; }
  .bar-row .fill.fam-search { background: #1baf7a; }
  .bar-row .fill.fam-autocomplete { background: #eda100; }
  .bar-row .fill.fam-map { background: #e87ba4; }
  .bar-row .fill.fam-server { background: #6250d6; }
  .bar-row .fill.fam-llm { background: #8a968d; }
  .bar-row .n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
  .bar-row .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: 11px; }
  .bar-row.clickable { cursor: pointer; border-radius: 8px; margin: 0 -8px; padding-inline: 8px; }
  .bar-row.clickable:hover { background: #f7f9f4; }
  .bar-row.clickable[aria-pressed="true"] { background: #eef4ec; }
  .costs-insights { padding: 20px 24px 24px; display: grid; gap: 12px; }
  .costs-insight { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; align-items: start; font-size: 13px; line-height: 1.55; }
  .costs-insight > span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700; }
  .costs-insight strong { font-weight: 600; }
  .costs-insight small { display: block; color: var(--text-muted); font-size: 11px; margin-top: 2px; }
  .costs-note { padding: 14px 24px 20px; font-size: 12px; color: var(--text-muted); margin: 0; }
  .costs-tech { border-top: 1px solid var(--line); }
  .costs-tech summary { padding: 14px 24px; font-size: 12px; font-weight: 600; color: #5d6c62; cursor: pointer; }
  .data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
  .data-table th { text-align: left; padding: 10px 24px; color: var(--text-muted); font-weight: 550; font-size: 10px; letter-spacing: .8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .data-table td { padding: 11px 24px; border-bottom: 1px solid #eef0eb; }
  .data-table tr:last-child td { border-bottom: 0; }
  .data-table .n { text-align: right; font-variant-numeric: tabular-nums; }
  .data-table .free td { color: var(--text-muted); font-size: 11px; }
  .costs-supa { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
  .costs-supa > div { padding: 22px 24px; border-right: 1px solid var(--line); }
  .costs-supa > div:last-child { border-right: 0; }
  .costs-supa .metric-value { font-size: 30px; letter-spacing: -1.2px; }
  .costs-supa .metric-label { margin-bottom: 8px; }
  .costs-supa .metric-description { margin-top: 8px; }
  .costs-empty { padding: 22px 24px; font-size: 13px; color: #596952; }
  .costs-empty strong { display: block; margin-bottom: 6px; color: #243631; }
  .costs-footnote { color: var(--text-muted); font-size: 11px; margin: 0 0 30px; }
  .reco { display: inline-flex; padding: 4px 9px; border-radius: 5px; font-size: 10px; font-weight: 600; white-space: nowrap; }
  .reco.import { background: #f8efd7; color: #7a5e18; }
  .reco.has { background: #e6f0e7; color: #346340; }
  .reco.watch, .reco.none { background: #f0f2ed; color: #59685c; }
  .city-table td.city strong { display: block; font-size: 13px; }
  .city-table td.city small { color: var(--text-muted); font-size: 11px; }
  .screens-cell { font-size: 11px; color: var(--text-muted); }
  .rule { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
  .rule > div { padding: 18px 24px; border-right: 1px solid var(--line); font-size: 12px; }
  .rule > div:last-child { border-right: 0; }
  .rule strong { display: block; margin-bottom: 4px; }
  .users-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
  .users-kpis > div { padding: 22px 24px; border-right: 1px solid var(--line); }
  .users-kpis > div:last-child { border-right: 0; }
  .users-kpis .metric-value { font-size: 34px; letter-spacing: -1.4px; }
  .users-kpis .metric-label { margin-bottom: 8px; }
  .users-kpis .metric-description { margin-top: 8px; }
  .users-weeks { padding: 18px 24px 6px; }
  .users-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 24px 18px; font-size: 11px; color: var(--text-muted); }
  .users-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
  .users-acts .bar-row { grid-template-columns: 170px minmax(0, 1fr) 64px 130px; }
  .users-acts .bar-row .pct { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .users-ret { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
  .users-ret > div:first-child { padding: 26px 24px; border-right: 1px solid var(--line); }
  .users-ret .big { display: block; font-size: 40px; font-weight: 550; letter-spacing: -1.8px; color: #243631; line-height: 1; }
  .users-ret > div p { font-size: 12px; color: var(--text-muted); margin: 12px 0 0; }
  .users-ret ul { margin: 0; padding: 18px 24px; list-style: none; display: grid; gap: 9px; font-size: 12px; }
  .users-ret li { display: flex; justify-content: space-between; gap: 12px; }
  .users-ret li span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-muted); }
  .state { display: inline-flex; padding: 4px 9px; border-radius: 5px; font-size: 10px; font-weight: 600; white-space: nowrap; }
  .state.fresh { background: #e6f0e7; color: #346340; } .state.stale { background: #f8efd7; color: #7a5e18; }
  .state.none { background: #f0f2ed; color: #59685c; } .state.duplicate { background: #f5e7e3; color: #914b36; }
  .mini-btn { padding: 7px 11px; border-radius: 7px; border: 1px solid #d5ddd4; background: #fff; font-size: 11px; font-weight: 600; color: #2f4338; }
  .mini-btn:hover { background: #f3f5f0; }
  .coll-block { border-bottom: 1px solid #eef0eb; }
  .coll-block:last-child { border-bottom: 0; }
  .coll { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 24px; cursor: pointer; list-style: none; }
  .coll .ctrls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .toggle-btn { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; color: #5d6c62; padding: 4px 6px; border-radius: 7px; }
  .toggle-btn:hover:not(:disabled) { background: #f3f5f0; }
  .toggle { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #c9d5c9; display: inline-block; }
  .toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s ease; }
  .toggle.on { background: var(--brand); } .toggle.on::after { left: 16px; }
  .title .badge, .name .badge { margin-left: 8px; vertical-align: middle; }
  .title-form { display: grid; gap: 10px; max-width: 560px; padding: 4px 0 6px; }
  .title-form .button { justify-self: start; }
  .item .act { display: flex; gap: 6px; }
  .item.hidden .name, .item.hidden .why { opacity: .5; }
  .item.hidden .name { text-decoration: line-through; }
  .inspiration-notice { margin: 0 0 18px; }
  .refresh-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .refresh-card { padding: 20px 24px; border-right: 1px solid var(--line); display: grid; gap: 8px; align-content: start; }
  .refresh-card:last-child { border-right: 0; }
  .refresh-card strong { font-size: 14px; }
  .refresh-card p { font-size: 12px; color: var(--text-muted); margin: 0; }
  .refresh-card .refresh-meta { color: #2f4338; font-weight: 550; }
  .refresh-card .mini-btn { justify-self: start; }
  .refresh-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .refresh-confirm { padding: 0; }
  .coll::-webkit-details-marker { display: none; }
  .coll .order { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700; }
  .coll .title { font-size: 14px; font-weight: 600; }
  .coll .sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
  .coll .sub .badge { margin-left: 6px; vertical-align: middle; }
  .items { padding: 0 24px 12px 72px; }
  .item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eef0eb; font-size: 12px; }
  .item:last-child { border-bottom: 0; }
  .item .rank { color: var(--text-muted); font-variant-numeric: tabular-nums; }
  .item .name { font-weight: 600; font-size: 13px; }
  .item .why { color: var(--text-muted); font-size: 11px; margin-top: 2px; overflow-wrap: anywhere; }
  .log { padding: 0 24px 16px; font-size: 12px; }
  .log > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid #eef0eb; }
  .log > div:last-child { border-bottom: 0; }
  .log small { color: var(--text-muted); }
  .control-tabs { display: flex; gap: 6px; margin: 0 auto 30px; max-width: 1100px; padding: 0 32px; }
  .control-tabs button { padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 550; color: #5d6c62; }
  .control-tabs button[aria-current] { background: #dfe9df; color: #234d3b; font-weight: 650; }
  .access-main.access-control { display: block; max-width: 1180px; padding-top: 30px; }
}

@layer responsive {
  @media (min-width: 1450px) { .main-content { padding-top: 55px; } }
  @media (max-width: 1100px) {
    .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
    .sidebar { padding-inline: 12px; }
    .topbar { padding-inline: 24px; }
    .main-content { padding: 32px 24px; }
    .overview-lower { grid-template-columns: 1fr; }
    .costs-headline, .costs-two, .costs-supa, .rule, .users-ret { grid-template-columns: 1fr; }
    .users-kpis { grid-template-columns: 1fr 1fr; }
    .items { padding-left: 24px; }
    .coll { grid-template-columns: 34px minmax(0, 1fr); }
    .coll .ctrls { grid-column: 1 / -1; }
    .refresh-cards { grid-template-columns: 1fr; }
    .refresh-card { border-right: 0; border-bottom: 1px solid var(--line); }
    .log > div { grid-template-columns: 1fr; gap: 2px; }
    .users-ret > div:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
    .rule > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .city-table { display: block; overflow-x: auto; }
    .costs-headline > div:first-child, .costs-supa > div { border-right: 0; border-bottom: 1px solid var(--line); }
    .review-grid { gap: 15px; grid-template-columns: minmax(220px, .8fr) minmax(280px, 1fr); }
    .review-toolbar { flex-wrap: wrap; }
    .search-field { flex-basis: 100%; }
    .staff-label { font-size: 0; gap: 0; }
  }
  @media (max-width: 800px) {
    .access-demo-link { width: fit-content; margin: 3px 0; }
    .access-header { padding: 20px; flex-wrap: wrap; }
    .access-session-actions { gap: 12px; }
    .access-main { grid-template-columns: minmax(0, 1fr); padding: 25px 20px; gap: 20px; }
    .access-intro { padding-top: 0; }
    .access-intro h1 { font-size: 32px; }
    .access-steps { display: none; }
    .access-panel { padding: 24px; }
    .catalogue-search { flex-wrap: wrap; }
    .catalogue-search .search-field { flex-basis: 100%; }
    .catalogue-search > button { flex: 1; }
    .catalogue-row { flex-direction: column; gap: 12px; padding: 20px; }
    .access-demo-banner .text-button { padding-left: 0; }
    .app-shell { display: block; }
    .sidebar { position: static; height: auto; padding: 20px 18px 10px; border-right: 0; }
    .brand { font-size: 25px; }
    .navigation { display: flex; gap: 5px; margin-top: 22px; overflow-x: auto; padding-bottom: 4px; }
    .nav-label, .sidebar-note, .sidebar-version { display: none; }
    .nav-link { flex: 0 0 auto; margin: 0; padding: 10px; font-size: 11px; }
    .nav-symbol { display: none; }
    .topbar { min-height: 64px; padding: 12px 22px; }
    .breadcrumb { font-size: 10px; gap: 7px; }
    .breadcrumb > span:first-child, .breadcrumb-separator { display: none; }
    .staff-select { max-width: 190px; font-size: 11px; }
    .demo-banner { align-items: flex-start; gap: 5px; flex-direction: column; font-size: 10px; padding: 10px 22px; }
    .main-content { padding: 30px 20px; }
    .metric-grid { gap: 9px; }
    .metric-card { padding: 17px 14px; }
    .metric-value { font-size: 34px; }
    .metric-description { font-size: 10px; }
    .review-grid { grid-template-columns: minmax(0, 1fr); }
    .review-toolbar { gap: 8px; }
    .filter-field { flex: 1; }
    .filter-field select { width: 100%; padding: 10px 7px; font-size: 11px; }
    .review-toolbar > button { width: 100%; }
    .notice { margin-inline: 20px; }
    .overview-row { padding: 18px; gap: 9px; }
    .bar-row { grid-template-columns: 110px minmax(0, 1fr) 56px 40px; }
    .costs-big { font-size: 38px; }
    .control-tabs { padding: 0 20px; }
    .panel-heading { padding: 20px 18px; }
  }
}
