/*
 * Fixo type system.
 *
 * Two self-hosted typefaces (SIL Open Font License, see fonts/LICENSE-*):
 *   Figtree             - everything people read and type: body, tables, forms, menus.
 *   Bricolage Grotesque - page titles, card titles and big figures, set slightly
 *                         condensed so headings feel engineered rather than generic.
 *
 * One scale, used everywhere (roughly a 1.2 ratio from a 14px base):
 *   12 caption/help . 13 table + secondary . 14 body + inputs . 16 card title
 *   20 section figure . 26 page title . 32 hero figure
 *
 * Loaded last, so it settles sizes that earlier sheets set ad hoc.
 */

@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 300 900;
    src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2-variations"), url("fonts/figtree-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-display: swap; font-weight: 300 900;
    src: url("fonts/figtree-latin-ext-wght-normal.woff2") format("woff2-variations"), url("fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-display: swap; font-weight: 200 800; font-stretch: 75% 100%;
    src: url("fonts/bricolage-grotesque-latin-wdth-normal.woff2") format("woff2-variations"), url("fonts/bricolage-grotesque-latin-wdth-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-display: swap; font-weight: 200 800; font-stretch: 75% 100%;
    src: url("fonts/bricolage-grotesque-latin-ext-wdth-normal.woff2") format("woff2-variations"), url("fonts/bricolage-grotesque-latin-ext-wdth-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
    --font-ui: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-display: "Bricolage Grotesque", "Figtree", "Segoe UI", system-ui, sans-serif;
    --t-12: 12px; --t-13: 13px; --t-14: 14px; --t-16: 16px; --t-20: 20px; --t-26: 26px; --t-32: 32px;
    --ink-2: #4c5b61;   /* secondary text, 7:1 on white */
    --ink-3: #66757b;   /* captions and help, 4.6:1 on white */
}
html[data-theme="dark"] { --ink-2: #c3ced6; --ink-3: #9fb0bb; }

/* ---------- base ---------- */
body, button, input, select, textarea, .workspace-ui, .workspace-ui button, .workspace-ui input, .workspace-ui select, .workspace-ui textarea {
    font-family: var(--font-ui);
    font-feature-settings: "kern", "liga", "calt";
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body, .workspace-ui { font-size: var(--t-14); line-height: 1.55; letter-spacing: 0; }

/* Figures line up wherever numbers appear in columns or totals. */
td, th, .invoice-totals, .metric-card strong, .chart-total, .bar-value, .summary-value, input[type="number"], .num {
    font-variant-numeric: tabular-nums lining-nums;
}

/* ---------- headings ---------- */
.workspace-ui h1, .workspace-ui h2, .workspace-ui h3, .login-story h1, .login-card h1, h1, h2 {
    font-family: var(--font-display); font-stretch: 92%; letter-spacing: -0.01em;
}
.workspace-ui .page-heading h1 { font-size: var(--t-26); font-weight: 650; line-height: 1.15; margin: 0 0 4px; }
.workspace-ui .page-heading p { font-size: var(--t-13); color: var(--ink-3); margin: 0; }
.workspace-ui .page-heading { align-items: flex-end; gap: 16px 24px; }
.workspace-ui .card-heading h2, .workspace-ui .card > h2, .workspace-ui section h2, .workspace-ui .card .card-heading h2 { font-size: var(--t-16); font-weight: 600; line-height: 1.3; }
.workspace-ui .card-heading p { font-size: var(--t-13); color: var(--ink-3); line-height: 1.5; margin-top: 2px; }
.workspace-ui h3 { font-size: var(--t-14); font-weight: 600; line-height: 1.35; }
.workspace-ui .greeting-panel h1 { font-size: var(--t-32); font-weight: 650; line-height: 1.1; letter-spacing: -0.015em; }
.workspace-ui .greeting-panel p { font-size: var(--t-14); }

/* Small section labels: sentence case, no tracking. They are labels, not shouting. */
.workspace-ui .eyebrow, .workspace-ui .metric-card span, .workspace-ui .metric-label span {
    text-transform: none; letter-spacing: 0; font-size: var(--t-12); font-weight: 500; color: var(--ink-3);
}
.workspace-ui .eyebrow, .track-page .eyebrow, .eyebrow {
    font-variant-caps: all-small-caps; font-size: var(--t-14); font-weight: 600; letter-spacing: 0.04em; color: var(--ink-3);
}

/* ---------- metric cards ---------- */
.workspace-ui .metric-card strong {
    font-family: var(--font-display); font-stretch: 88%; font-size: var(--t-26); font-weight: 600;
    line-height: 1.1; letter-spacing: -0.01em; color: var(--ink);
}
.workspace-ui .metric-card .metric-label { align-items: flex-start; gap: 8px; }
/* Figures sit on the card's floor, so a wrapped label never pushes one number below its row-mates. */
.workspace-ui .metric-card { display: flex; flex-direction: column; }
.workspace-ui .metric-card strong { margin-top: auto; padding-top: 10px; }
.workspace-ui .metric-card .metric-label span { font-size: var(--t-13); font-weight: 500; color: var(--ink-2); line-height: 1.35; }

/* Colour carries meaning, not position: owed money is amber, earned revenue teal, counts plain ink. */
.workspace-ui .metric-card:nth-child(n) strong, html[data-theme="dark"] .workspace-ui .metric-card:nth-child(n) strong { color: var(--ink); }
.workspace-ui .metric-card[data-tone="due"] strong { color: #b45309; }
.workspace-ui .metric-card[data-tone="earned"] strong { color: var(--teal-dark, #dd560e); }
html[data-theme="dark"] .workspace-ui .metric-card[data-tone="due"] strong { color: #ffc98a; }
html[data-theme="dark"] .workspace-ui .metric-card[data-tone="earned"] strong { color: #e9b285; }

/* ---------- tables ---------- */
.workspace-ui table th {
    font-size: var(--t-12); font-weight: 600; color: var(--ink-2); text-transform: none; letter-spacing: 0;
    text-align: left; white-space: nowrap; vertical-align: bottom;
}
.workspace-ui table td { font-size: var(--t-13); line-height: 1.45; vertical-align: middle; }
.workspace-ui table td strong { font-weight: 600; }
/* app.js marks money / quantity columns with .num; they align on the right like a ledger. */
.workspace-ui table th.num, .workspace-ui table td.num, table th.num, table td.num { text-align: right; white-space: nowrap; }

/* ---------- invoice and document sheets ---------- */
.workspace-ui .invoice-totals { width: min(100%, 380px); }
.workspace-ui .invoice-totals > div { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 16px; font-size: var(--t-14); color: var(--ink-2); }
.workspace-ui .invoice-totals > div > span { min-width: 0; }
.workspace-ui .invoice-totals strong { text-align: right; white-space: nowrap; font-weight: 600; color: var(--ink); }
.workspace-ui .invoice-totals .grand-total { font-family: var(--font-display); font-stretch: 92%; font-size: var(--t-20); font-weight: 600; color: var(--teal); }
.workspace-ui .invoice-totals .grand-total strong { color: var(--teal); }

/* ---------- forms ---------- */
.workspace-ui .field > span { font-size: var(--t-13); font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.workspace-ui .field input, .workspace-ui .field select, .workspace-ui .field textarea { font-size: var(--t-14); }
.workspace-ui .field small, .workspace-ui .help, .workspace-ui .muted { font-size: var(--t-12); color: var(--ink-3); }

/* ---------- buttons, badges, navigation ---------- */
.workspace-ui .button, .workspace-ui button.button { font-size: var(--t-13); font-weight: 600; letter-spacing: 0; }
.workspace-ui .badge { font-size: var(--t-12); font-weight: 600; letter-spacing: 0; text-transform: none; }
.workspace-ui .sidebar .nav-item, .workspace-ui .sidebar .nav-group summary { font-size: var(--t-14); font-weight: 450; letter-spacing: 0; }
.workspace-ui .sidebar .nav-item.active { font-weight: 600; }
.workspace-ui .sidebar .nav-children .nav-item { font-size: var(--t-13); }
.workspace-ui .sidebar-heading a, .workspace-ui .sidebar-heading strong { font-family: var(--font-display); font-stretch: 90%; font-size: var(--t-16); font-weight: 650; letter-spacing: -0.005em; }
.workspace-ui .breadcrumb { font-size: var(--t-13); }

/* ---------- detail lists (job card, party) ---------- */
.workspace-ui dl dt { font-size: var(--t-13); color: var(--ink-3); }
.workspace-ui dl dd { font-size: var(--t-14); color: var(--ink); }

/* ---------- phones: same family, one step smaller at the top of the scale ---------- */
@media (max-width: 720px) {
    .workspace-ui .page-heading h1 { font-size: 22px; }
    .workspace-ui .greeting-panel h1 { font-size: 24px; }
    .workspace-ui .metric-card strong { font-size: var(--t-20); }
    .workspace-ui .invoice-totals .grand-total { font-size: 18px; }
}

/* ---------- print keeps the same faces, sized for paper ---------- */
@media print {
    body { font-family: var(--font-ui); }
    h1, h2, h3 { font-family: var(--font-display); }
}

/* Login story: the first headline line was dark green on the dark panel; set it in white. */
.login-story h1 { color: #f6f2ec; font-stretch: 90%; line-height: 1.05; }
.login-story .eyebrow { color: #ffcf9e; }
