/* Runway style (redesign fase 4, 30/11/2026; DESIGN.md section 12). The look of the "runway" mock-up Rodrigo chose
 * (fase3/visao-geral-runway.html), replacing the Ledger (Livro-caixa) skin: Inter variable everywhere (vendored in
 * /static/fonts), tabular figures, a cool light-grey page with white rounded cards and a soft shadow, light blue as
 * the brand, a deep navy dark theme. Pill-shaped controls; the chosen month and the Movements section sit on a pill.
 * Motion (transitions.dev tokens, opacity/transform only): screen reveal, staggered rows, the month marker gliding to
 * the chosen cycle (js/components/cycletabs.js), menus opening from their corner and the big number settling when the
 * cycle changes. prefers-reduced-motion switches it all off.
 *
 * Scope: every selector starts with :root[data-style="runway"]; colours live only in the token blocks. The Overview
 * runway blocks themselves (.rw-*) are drawn by css/runway.css in every style. */

/* ---------- tokens ---------- */

:root[data-style="runway"] {
  --font: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  --r-compact: 10px;
  --r-capsule: 12px;
  --r-card: 20px;
  --r-pill: 9999px;
  --runway-quick: 150ms;
  --runway-fast: 250ms;
  --runway-medium: 350ms;
  --runway-slow: 400ms;
  --runway-stagger: 40ms;
  --runway-ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-variant-numeric: lining-nums tabular-nums;
}

:root[data-style="runway"]:not([data-theme="dark"]) {
  --bg: #f2f4f8;
  --canvas: #ffffff;
  --parchment: #f2f4f8;
  --pearl: #f6f8fb;
  --chip: rgba(14, 23, 38, 0.06);
  --ink: #0e1726;
  --ink-80: #2a3446;
  --ink-48: #5b6678;          /* 5.8:1 on white */
  --hairline: #e1e6ee;
  --divider: #e9edf3;
  --line-soft: rgba(14, 23, 38, 0.08);
  --hairline-strong: #a3adbd;
  --green: #0f7a48;
  --green-hover: #0c643b;
  --green-text: #0f7a48;      /* 5.4:1 */
  --green-soft: #e2f2ea;
  --yellow: #c98a00;
  --yellow-text: #7a5200;
  --yellow-soft: #fbf1d6;
  --red: #c8312f;
  --red-text: #c8312f;        /* 5.3:1 */
  --red-soft: #fae6e6;
  --guardado: #1f5fd1;        /* 5.9:1 */
  --guardado-soft: #e3eefc;
  --on-accent: #ffffff;
  --on-ink: #ffffff;
  --hover: rgba(14, 23, 38, 0.04);
  --selection: rgba(31, 95, 209, 0.18);
  --toggle-off: #c9d0db;
  --knob: #ffffff;
  --grabber: #d2d8e2;
  --toolbar-bg: rgba(242, 244, 248, 0.94);
  --tabbar-bg: #ffffff;
  --scrim: rgba(14, 23, 38, 0.4);
  --runway-skeleton: rgba(14, 23, 38, 0.07);
  --runway-shadow: 0 1px 2px rgba(14, 23, 38, 0.06), 0 4px 16px rgba(14, 23, 38, 0.05);
  --runway-menu-shadow: 0 12px 40px rgba(14, 23, 38, 0.18);
  --blue: #1f5fd1;            /* brand: buttons, links, the chosen month (white text 5.9:1) */
  --blue-focus: #1f5fd1;
  --blue-hover: #1b52b4;
  --blue-soft: #e3eefc;
  --runway-panel: linear-gradient(180deg, #e3eefc, #cadef8);
  --runway-panel-line: rgba(31, 95, 209, 0.16);
}

:root[data-style="runway"][data-theme="dark"] {
  --bg: #0a101c;
  --canvas: #121a29;
  --parchment: #0a101c;
  --pearl: #18223a;
  --chip: rgba(234, 240, 249, 0.08);
  --ink: #eaf0f9;
  --ink-80: #c6d0df;
  --ink-48: #a3afc2;          /* 7.4:1 on --canvas */
  --hairline: #232e42;
  --divider: #1b2536;
  --line-soft: rgba(234, 240, 249, 0.1);
  --hairline-strong: #5d6a80;
  --green: #2fb377;
  --green-hover: #3fc487;
  --green-text: #3fc487;      /* 8.0:1 */
  --green-soft: #12291f;
  --yellow: #f2c04b;
  --yellow-text: #f2c04b;
  --yellow-soft: #2b240f;
  --red: #ff6b6b;
  --red-text: #ff6b6b;        /* 6.0:1 */
  --red-soft: #2c1718;
  --guardado: #7faaff;        /* 7.0:1 */
  --guardado-soft: #142443;
  --on-accent: #0a101c;       /* dark text on the light blue fills */
  --on-ink: #0a101c;
  --hover: rgba(234, 240, 249, 0.05);
  --selection: rgba(127, 170, 255, 0.28);
  --toggle-off: #3a4760;
  --knob: #eaf0f9;
  --grabber: #33405a;
  --toolbar-bg: rgba(10, 16, 28, 0.94);
  --tabbar-bg: #121a29;
  --scrim: rgba(0, 0, 0, 0.7);
  --render-edge: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  --logo-tile: #eaf0f9;
  --runway-skeleton: rgba(234, 240, 249, 0.07);
  --runway-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --runway-menu-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  --blue: #7faaff;
  --blue-focus: #7faaff;
  --blue-hover: #6d92db;
  --blue-soft: #1a2b4d;
  --runway-panel: linear-gradient(180deg, #12274a, #0e1f3d);
  --runway-panel-line: rgba(127, 170, 255, 0.18);
}

/* ---------- type: Inter everywhere, tabular figures, tight tracking on titles ---------- */

:root[data-style="runway"] body,
:root[data-style="runway"] input,
:root[data-style="runway"] select,
:root[data-style="runway"] textarea,
:root[data-style="runway"] button { font-family: var(--font); font-variant-numeric: lining-nums tabular-nums; }
:root[data-style="runway"] body { -webkit-font-smoothing: antialiased; }
:root[data-style="runway"] .hero-display { font-weight: 650; letter-spacing: -0.035em; }
:root[data-style="runway"] .large-title,
:root[data-style="runway"] .display-lg { font-weight: 680; letter-spacing: -0.025em; }
:root[data-style="runway"] .side-mark,
:root[data-style="runway"] .toolbar-title,
:root[data-style="runway"] .card-title,
:root[data-style="runway"] .sheet-title,
:root[data-style="runway"] .ask-title { font-weight: 660; letter-spacing: -0.015em; }
:root[data-style="runway"] .kpi-value,
:root[data-style="runway"] .subs-total-value,
:root[data-style="runway"] .debt-balance-value,
:root[data-style="runway"] .loans-total-value,
:root[data-style="runway"] .investments-total-value,
:root[data-style="runway"] .review-amount { font-weight: 640; letter-spacing: -0.025em; }

/* kickers and labels: sentence case, quiet grey, medium weight (wording unchanged) */
:root[data-style="runway"] .hero-eyebrow,
:root[data-style="runway"] .derived-tag,
:root[data-style="runway"] .theme-legend,
:root[data-style="runway"] .section-label,
:root[data-style="runway"] .cat-group-label,
:root[data-style="runway"] .entry-group-label,
:root[data-style="runway"] .data-table th[scope="col"],
:root[data-style="runway"] .card-choice-tag,
:root[data-style="runway"] .month-current { font-size: 13px; font-weight: 560; letter-spacing: 0; text-transform: none; }
:root[data-style="runway"] .hero-eyebrow,
:root[data-style="runway"] .section-label,
:root[data-style="runway"] .entry-group-label { color: var(--ink-48); }
:root[data-style="runway"] .derived-tag { padding: 3px 10px; border: 0; border-radius: var(--r-pill); background: var(--chip); color: var(--ink-48); }

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

:root[data-style="runway"] .sidebar { border-right: 1px solid var(--hairline); background: var(--canvas); }
:root[data-style="runway"] .side-link,
:root[data-style="runway"] .side-sublink { border-radius: 12px; font-weight: 560; }
:root[data-style="runway"] .side-link[aria-current="page"],
:root[data-style="runway"] .side-sublink[aria-current="page"] { background: var(--blue-soft); color: var(--ink); box-shadow: none; }
:root[data-style="runway"] .side-link[aria-current="page"] .icon { color: var(--blue); }
:root[data-style="runway"] .toolbar { border-bottom: 1px solid var(--hairline); }
:root[data-style="runway"] .tab-bar { border-top: 1px solid var(--hairline); background: var(--tabbar-bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
:root[data-style="runway"] .tab[aria-current="page"] { color: var(--blue); }
:root[data-style="runway"] .pill-search { border: 1px solid var(--hairline); border-radius: var(--r-pill); background: var(--canvas); }
:root[data-style="runway"] .icon-circle { border: 1px solid var(--hairline); background: var(--canvas); }
:root[data-style="runway"] .theme-option span { border-color: var(--hairline); border-radius: var(--r-pill); }
:root[data-style="runway"] .theme-option input:checked + span { border-color: var(--blue); background: var(--blue); color: var(--on-accent); font-weight: 600; }

/* ---------- cards: white, rounded, a soft shadow ---------- */

:root[data-style="runway"] .ov-card,
:root[data-style="runway"] .statement-panel,
:root[data-style="runway"] .store-card,
:root[data-style="runway"] .store-detail,
:root[data-style="runway"] .state-card,
:root[data-style="runway"] .where-drill,
:root[data-style="runway"] .ask-window,
:root[data-style="runway"] .subs-total,
:root[data-style="runway"] .investments-total,
:root[data-style="runway"] .login-card { border: 1px solid var(--hairline); border-radius: var(--r-card); background: var(--canvas); box-shadow: var(--runway-shadow); }
/* fase 5: the sign-in form sits in the blue panel of the runway hero */
:root[data-style="runway"] .login-card { border-color: var(--runway-panel-line); border-radius: 28px; background: var(--runway-panel); box-shadow: none; }
:root[data-style="runway"] .group { border-color: var(--hairline); border-radius: var(--r-card); background: var(--canvas); box-shadow: var(--runway-shadow); }
:root[data-style="runway"] .card-head { align-items: baseline; }

/* KPI tiles: rounded cards */
:root[data-style="runway"] .kpi { border: 1px solid var(--hairline); border-radius: 16px; background: var(--canvas); }
:root[data-style="runway"] .kpi-guardado,
:root[data-style="runway"] .kpi-saved { background: var(--canvas); }
:root[data-style="runway"] .kpi-saved.is-attention { border-color: var(--yellow); background: var(--yellow-soft); }

:root[data-style="runway"] .acc-dot { width: 8px; height: 8px; border-radius: 50%; }
:root[data-style="runway"] .acc-total { font-weight: 620; }
:root[data-style="runway"] .acc-balance { border-top: 1px solid var(--hairline); padding-top: 12px; font-size: 17px; font-weight: 640; }

/* ---------- months: the chosen one on a blue pill that glides (Tabs sliding) ---------- */

:root[data-style="runway"] .cycle-tab { z-index: 0; isolation: isolate; border-bottom-color: transparent; border-radius: var(--r-pill); font-size: 14px; font-weight: 560; }
:root[data-style="runway"] .cycle-tab:hover { background: var(--hover); }
:root[data-style="runway"] .cycle-tab[aria-selected="true"] { border-bottom-color: transparent; color: var(--ink); font-weight: 650; }
:root[data-style="runway"] .cycle-tab[aria-selected="true"]::after { content: ""; position: absolute; inset: 4px 0; z-index: -1; border-radius: var(--r-pill); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--runway-panel-line); transform-origin: 0 0; }
:root[data-style="runway"] .cycle-tabs-scroll { border-bottom-color: transparent; }
:root[data-style="runway"] .strip-col[aria-selected="true"] { background: var(--blue-soft); border-radius: 10px; }

/* ---------- controls ---------- */

:root[data-style="runway"] .pill,
:root[data-style="runway"] .btn-fill,
:root[data-style="runway"] .pill-hero,
:root[data-style="runway"] .btn-save { border-radius: var(--r-pill); font-weight: 600; }
/* fase 5: a blue pill stays blue on hover (the shared hover token is green; iOS keeps :hover after a tap) */
:root[data-style="runway"] .pill:not(.pill-ghost):hover,
:root[data-style="runway"] .btn-fill:hover { border-color: var(--blue-hover); background: var(--blue-hover); }
:root[data-style="runway"] .pill-ghost { border: 1px solid var(--hairline); background: var(--canvas); color: var(--ink); }
:root[data-style="runway"] .pill-ghost:hover { border-color: var(--blue); background: var(--canvas); color: var(--blue); }
:root[data-style="runway"] .capsule { border: 1px solid var(--hairline); border-radius: var(--r-pill); background: var(--canvas); color: var(--ink); }
:root[data-style="runway"] .chip,
:root[data-style="runway"] .chip-filter { border: 1px solid var(--hairline); border-radius: var(--r-pill); background: var(--canvas); }
:root[data-style="runway"] .chip[aria-checked="true"] { border-color: var(--blue); background: var(--blue-soft); color: var(--ink); font-weight: 600; }
:root[data-style="runway"] .chip-filter .chip-value { color: var(--ink); }
/* filter chips keep the Original metrics: Cycle, Card and Sort must stay on one row at 390px */
:root[data-style="runway"] .chip-filter { font-variant-numeric: normal; }
:root[data-style="runway"] .chip-filter[aria-expanded="true"] { border-color: var(--ink); }
/* Movements sections: a segmented row, the current one on a white pill */
:root[data-style="runway"] .movement-link { border: 1px solid transparent; border-radius: var(--r-pill); background: transparent; color: var(--ink-48); font-weight: 560; }
:root[data-style="runway"] .movement-link:hover { border-color: transparent; color: var(--ink); }
:root[data-style="runway"] .movement-link[aria-current="page"] { border: 1px solid var(--hairline); background: var(--canvas); color: var(--ink); box-shadow: var(--runway-shadow); }
:root[data-style="runway"] .text-link,
:root[data-style="runway"] .disclosure,
:root[data-style="runway"] .row-edit,
:root[data-style="runway"] .all-cards-choice,
:root[data-style="runway"] .data-table tr.is-selected th[scope="row"],
:root[data-style="runway"] .month-table tr.is-selected .month-pick { color: var(--blue); }
:root[data-style="runway"] .toggle[aria-checked="true"] { background: var(--blue); }

/* menus (cycle, card, sort): a rounded sheet that opens from its corner (Menu dropdown) */
:root[data-style="runway"] .menu { border-radius: 18px; box-shadow: var(--runway-menu-shadow); transform-origin: top right; animation: runway-menu var(--runway-fast) var(--runway-ease) backwards; }
:root[data-style="runway"] .menu-left { transform-origin: top left; }
:root[data-style="runway"] .menu button { border-radius: 12px; }
:root[data-style="runway"] .menu button[aria-selected="true"] { background: var(--blue-soft); color: var(--ink); font-weight: 600; }

/* ---------- lists ---------- */

:root[data-style="runway"] .row-value { font-weight: 620; }
:root[data-style="runway"] .row-button:hover { background: var(--pearl); }
:root[data-style="runway"] .subscription-row .sub-logo { border-radius: 50%; }

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

:root[data-style="runway"] .all-cards-choice,
:root[data-style="runway"] .card-choice { border-color: var(--hairline); border-radius: 16px; }
:root[data-style="runway"] .all-cards-choice.is-selected,
:root[data-style="runway"] .card-choice.is-selected { outline: 2px solid var(--blue); }
:root[data-style="runway"] .card-choice-tag { padding: 1px 8px; border-radius: var(--r-pill); }

/* ---------- overlays ---------- */

:root[data-style="runway"] .sheet,
:root[data-style="runway"] .action-sheet { border-color: var(--hairline); border-radius: 24px; }
:root[data-style="runway"] .field { border-radius: 14px; }
:root[data-style="runway"] .field:focus-within,
:root[data-style="runway"] .field-select:focus-visible { border-color: var(--blue); outline: 1px solid var(--blue); }
:root[data-style="runway"] .review-effects { border-radius: 14px; }
:root[data-style="runway"] .toast { border-radius: 14px; background: var(--ink); color: var(--on-ink); font-weight: 600; }
:root[data-style="runway"] .recon-banner { border-radius: 12px; }

/* ---------- Ask ---------- */

:root[data-style="runway"] .ask-turn { border-radius: 16px; }
:root[data-style="runway"] .ask-turn.is-user,
:root[data-style="runway"] .ask-turn.is-user .ask-who { background: var(--blue); color: var(--on-accent); }
:root[data-style="runway"] .ask-turn.is-model { border: 1px solid var(--hairline); background: var(--canvas); }
:root[data-style="runway"] .ask-textarea { border-color: var(--hairline); border-radius: 16px; }

/* ---------- Overview runway: the blue panel of the mock-up ---------- */

:root[data-style="runway"] .rw-panel { border-color: var(--runway-panel-line); background: var(--runway-panel); box-shadow: none; }

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

/* Skeleton loader and reveal: the loading line is a pulsing card (text kept for screen readers) */
:root[data-style="runway"] .loading {
  height: 220px;
  padding: 0;
  overflow: hidden;
  border-radius: var(--r-card);
  background: var(--runway-skeleton);
  color: transparent;
  animation: runway-pulse 1000ms ease-in-out infinite;
}
/* fill "backwards" only: a transform left applied after the end would keep each row a stacking context and the
   next row would paint over a menu opened inside the previous one.
   a new screen (js/router.js marks the page data-enter="screen"): cards rise one after another and rows follow;
   another cycle on the same screen (data-enter="cycle"): only the rows and the big number move.
   --enter-at keeps the motion going when the cycle detail re-renders a moment later instead of restarting it */
:root[data-style="runway"] .page[data-enter="screen"] > *,
:root[data-style="runway"] .page[data-enter="screen"] .ov-card,
:root[data-style="runway"] .page[data-enter="screen"] .rw-card,
:root[data-style="runway"] .page[data-enter] .row { animation: runway-rise var(--runway-medium) var(--runway-ease) backwards; animation-delay: var(--enter-at, 0ms); }
:root[data-style="runway"] .page[data-enter="screen"] .ov-card:nth-child(2),
:root[data-style="runway"] .page[data-enter="screen"] .rw-card:nth-child(2),
:root[data-style="runway"] .page[data-enter] .row:nth-child(2) { animation-delay: calc(var(--enter-at, 0ms) + 40ms); }
:root[data-style="runway"] .page[data-enter="screen"] .ov-card:nth-child(3),
:root[data-style="runway"] .page[data-enter="screen"] .rw-card:nth-child(3),
:root[data-style="runway"] .page[data-enter] .row:nth-child(3) { animation-delay: calc(var(--enter-at, 0ms) + 80ms); }
:root[data-style="runway"] .page[data-enter="screen"] .ov-card:nth-child(4),
:root[data-style="runway"] .page[data-enter="screen"] .rw-card:nth-child(4),
:root[data-style="runway"] .page[data-enter] .row:nth-child(4) { animation-delay: calc(var(--enter-at, 0ms) + 120ms); }
:root[data-style="runway"] .page[data-enter="screen"] .ov-card:nth-child(5),
:root[data-style="runway"] .page[data-enter] .row:nth-child(5) { animation-delay: calc(var(--enter-at, 0ms) + 160ms); }
:root[data-style="runway"] .page[data-enter="screen"] .ov-card:nth-child(n + 6),
:root[data-style="runway"] .page[data-enter] .row:nth-child(n + 6) { animation-delay: calc(var(--enter-at, 0ms) + 200ms); }
/* Number subtle change: the big amount settles in when the cycle changes */
:root[data-style="runway"] .page[data-enter] .hero-display { animation: runway-number var(--runway-fast) var(--runway-ease) backwards; animation-delay: calc(var(--enter-at, 0ms) + 60ms); }

@keyframes runway-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes runway-number { from { opacity: 0; transform: translateY(0.25em); } }
@keyframes runway-menu { from { opacity: 0; transform: scale(0.96); } }
@keyframes runway-pulse { 50% { opacity: 0.5; } }

@media (prefers-reduced-motion: reduce) {
  :root[data-style="runway"] *,
  :root[data-style="runway"] *::before,
  :root[data-style="runway"] *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 899px) {
  :root[data-style="runway"] .ov-card { padding: 16px 16px 18px; }
}
