/* Movie OS. The approved look (12 Oct): IBM Plex Sans for the interface, IBM Plex Mono with tabular
   figures for every number; the organization's brand in the menu rail and the actions (Indiana: navy
   #00212C, action #00465C, its red only for brand marks, never for states). */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 400; src: url(/movie-os/assets/fonts/ibm-plex-sans-latin-400-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: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 500; src: url(/movie-os/assets/fonts/ibm-plex-sans-latin-500-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: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 600; src: url(/movie-os/assets/fonts/ibm-plex-sans-latin-600-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: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 700; src: url(/movie-os/assets/fonts/ibm-plex-sans-latin-700-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: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 400; src: url(/movie-os/assets/fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,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: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 600; src: url(/movie-os/assets/fonts/ibm-plex-sans-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,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: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 400; src: url(/movie-os/assets/fonts/ibm-plex-mono-latin-400-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: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 500; src: url(/movie-os/assets/fonts/ibm-plex-mono-latin-500-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: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 600; src: url(/movie-os/assets/fonts/ibm-plex-mono-latin-600-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; }

:root {
  /* Ground and ink */
  --ground: #F3F4F1;
  --panel: #FFFFFF;
  --line: #E3E5E1;
  --ink: #16181C;
  --muted: #59606A;
  --radius: 14px;
  /* The organization's brand (Indiana's by default; the rail follows the org's accent) */
  --rail: #00212C;
  --rail-hover: #0B3A4A;
  --rail-line: #12404F;
  --brand-mark: #E3032E;
  --action: #00465C;
  --action-hover: #00212C;
  --tint: #E3EEF1;
  --tint-strong: #D5E6EC;
  --row-sel: #F0F6F8;
  /* States (never the brand's red) */
  --attention: #F2B33D;
  --attention-bg: #FDF3DC;
  --attention-ink: #6B4A00;
  --good: #1E5B32;
  --good-bg: #E3F1E7;
  --bad: #B42318;
  --bad-bg: #FDE8E6;
  /* Older names, still used by the modules */
  --accent: var(--action);
  --accent-ink: #FFFFFF;
  --bg: var(--ground);
  --warn: var(--attention-ink);
  --sans: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); }
a { color: var(--action); }
a:hover { color: var(--action-hover); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); padding: 9px 16px; min-height: 44px; color: var(--ink); }
button:hover { border-color: #C9CDC6; }
button.primary { background: var(--action); color: #fff; border-color: var(--action); font-weight: 600; }
button.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
button.link { border: 0; background: none; color: var(--action); padding: 4px 6px; min-height: 32px; text-decoration: underline; text-underline-offset: 2px; }
button.link:hover { color: var(--action-hover); }
button.link.strong { font-weight: 600; color: var(--ink); text-align: left; padding-left: 0; }
button.link.strong:hover { color: var(--action); }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-height: 44px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.boot { padding: 40px; color: var(--muted); }
/* Every number: Plex Mono, tabular figures. */
.num, td.num, th.num, .money, .totals b, .fig, input.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* The brand: the organization's logo on a white rounded tile (a dark logo on white), "Movie OS" under it. */
/* The menu fits the window: sizes shrink with the viewport height (clamp on vh) down to a compact minimum
   (36 px items, 13 px text, a ~48 px logo tile); only below that the item list scrolls, head and foot stay. */
.side { --nav-item: clamp(36px, 5.2vh, 44px); --nav-font: clamp(13px, 1.8vh, 15px); --nav-gap: clamp(0px, .35vh, 4px); --nav-group: clamp(6px, 2.2vh, 22px); --nav-tile: clamp(48px, 10vh, 92px); }
.brandtile { display: flex; flex-direction: column; align-items: center; gap: clamp(4px, .9vh, 8px); margin: 2px 4px clamp(8px, 2vh, 18px); flex: 0 0 auto; }
.brandtile .tile { background: #fff; border-radius: 12px; padding: clamp(5px, 1vh, 10px) 14px; display: grid; place-items: center; width: 100%; height: var(--nav-tile); }
.brandtile .tile { overflow: hidden; }
.brandtile .tile img { display: block; max-width: 150px; max-height: calc(var(--nav-tile) - 2 * clamp(5px, 1vh, 10px)); width: auto; height: auto; object-fit: contain; }
.brandtile .product { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.82); font-weight: 600; }
.brandtile .wordmark { color: var(--rail); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 16px; text-align: center; }
.brandtile .markonly { display: none; }

/* Sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--rail); }
.login .card { width: 100%; max-width: 420px; background: var(--panel); border-radius: var(--radius); padding: 32px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 22px; }
.brand img { max-height: 80px; max-width: 220px; }
.brand .product { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.wordmark { font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--rail); font-size: 18px; line-height: 1.1; }
.wordmark small { display: block; font-weight: 500; letter-spacing: .08em; font-size: 11px; color: var(--muted); }
.login input { width: 100%; }
.login button.primary { width: 100%; margin-top: 18px; }
.login .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.err { color: var(--bad); margin-top: 10px; font-size: 14px; }
.ok { color: var(--good); }

/* Shell: the side menu on overview pages; none inside a budget (focus mode). */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.shell.collapsed { grid-template-columns: 64px 1fr; }
.shell.focus { grid-template-columns: 1fr; }
.shell.focus .side { display: none; }
.side { background: var(--rail); color: #fff; padding: clamp(8px, 1.6vh, 16px) 10px; display: flex; flex-direction: column; gap: 0; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.side .navlist { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: var(--nav-gap); scrollbar-width: thin; }
.side .navbtn { background: none; border: 0; color: rgba(255,255,255,.88); text-align: left; padding: 0 12px; min-height: var(--nav-item); height: var(--nav-item); font-size: var(--nav-font); border-radius: 10px; display: flex; gap: 12px; align-items: center; width: 100%; position: relative; font-weight: 500; flex: 0 0 auto; }
.side .navbtn svg { flex: 0 0 20px; width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side .navbtn:hover { background: var(--rail-hover); color: #fff; }
.side .navbtn.on { background: var(--rail-hover); color: #fff; }
.side .navbtn.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--brand-mark); }
.side .navbtn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.side .soon { font-size: 11px; background: rgba(255,255,255,.18); padding: 1px 7px; border-radius: 9px; margin-left: auto; }
.side h6 { margin: var(--nav-group) 12px calc(var(--nav-group) / 3); padding-top: var(--nav-group); border-top: 1px solid var(--rail-line); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.62); font-weight: 600; flex: 0 0 auto; }
.side .spacer { flex: 1; }
.side .collapse { margin-top: clamp(4px, 1vh, 8px); border-top: 1px solid var(--rail-line); padding-top: clamp(4px, 1vh, 8px); flex: 0 0 auto; }
.shell.collapsed .side { padding: clamp(8px, 1.6vh, 14px) 8px; align-items: center; }
.shell.collapsed .side .navlist { align-items: center; width: 100%; }
.shell.collapsed .side .navbtn { justify-content: center; padding: 0; width: 48px; }
.shell.collapsed .side .navbtn .label, .shell.collapsed .side h6, .shell.collapsed .side .soon { display: none; }
.shell.collapsed .side h6 { display: block; height: 0; margin: 10px 4px; padding: 0; border-top: 1px solid var(--rail-line); font-size: 0; width: 40px; }
.shell.collapsed .brandtile .full { display: none; }
.shell.collapsed .brandtile .markonly { display: grid; place-items: center; width: 44px; height: clamp(36px, 5.2vh, 44px); background: #fff; border-radius: 10px; }
.shell.collapsed .brandtile .markonly img { width: 34px; height: auto; max-height: 80%; }
.shell.collapsed .brandtile .product { display: none; }
.main { padding: 22px 28px 60px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { font-size: 24px; margin: 0; font-weight: 600; letter-spacing: -.01em; }
.top .who { color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.top .menu-toggle { display: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.panel h2 { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.row > div { min-width: 160px; }
.row > label { display: inline-flex; align-items: center; gap: 4px; margin: 4px 12px 4px 0; color: var(--ink); font-size: 14px; }
.muted { color: var(--muted); }
.pill { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--tint); color: var(--action-hover); font-weight: 500; }
.pill.warn { background: var(--attention-bg); color: var(--attention-ink); }
.pill.good, .pill.current { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; border-radius: 10px 10px 0 0; padding: 10px 14px; color: var(--muted); font-weight: 500; }
.tabs button.on { color: var(--ink); box-shadow: inset 0 -3px 0 var(--action); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.cat td { background: #F7F8F5; font-weight: 700; }
tr.acct td { font-weight: 600; }
tr.excluded td { color: var(--muted); text-decoration: line-through; }
tr.hiddenrow td { color: var(--muted); font-style: italic; }
.list button.item { display: block; width: 100%; text-align: left; margin-bottom: 8px; padding: 12px 14px; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.totals div { background: var(--ground); border-radius: 10px; padding: 10px 12px; }
.totals b { display: block; font-size: 18px; }
.soonpage { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 18px; }
.edit input { width: 90px; }
.edit input.desc { width: 220px; }
.scroll { overflow-x: auto; }
.linklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.linklist button { text-align: left; }
/* ── Kit: the shared pieces of the approved design ── */
.tabs .count, .chip .count { margin-left: 6px; font-size: 12px; font-family: var(--mono); color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.chip { min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; color: var(--ink); }
.chip.on { background: var(--tint); border-color: var(--action); color: var(--action-hover); font-weight: 600; }
.chip.good::before, .chip.warn::before, .chip.bad::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.chip.good::before { background: var(--good); } .chip.warn::before { background: var(--attention); } .chip.bad::before { background: var(--bad); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; align-content: start; align-items: start; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; container-type: inline-size; }
.kpi .lbl { font-size: 13px; color: var(--muted); }
/* A figure is never cut: its size follows the card's width (about 15 characters fit), and only below 13px does it wrap. */
.kpi b { font-size: clamp(13px, 10.5cqi, 22px); font-weight: 600; white-space: nowrap; overflow-wrap: anywhere; }
@supports not (font-size: 1cqi) { .kpi b { font-size: 18px; white-space: normal; } }
.kpi .lbl { overflow-wrap: anywhere; }
.kpi .sub { font-size: 12px; color: var(--muted); }
button.kpi.k-link { text-align: left; font: inherit; color: inherit; cursor: pointer; min-height: 0; }
button.kpi.k-link:hover { border-color: var(--action); }
button.kpi.k-link:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.kpi.k-main { border-color: var(--action); box-shadow: inset 0 0 0 1px var(--action); }
.kpi.k-attention { background: var(--attention-bg); border-color: #EAD49A; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.banner.info { background: var(--tint); border-color: var(--tint-strong); color: var(--action-hover); }
.banner.attention { background: var(--attention-bg); border-color: #EAD49A; color: var(--attention-ink); }
.banner.good { background: var(--good-bg); color: var(--good); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.empty { text-align: center; padding: 32px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.empty p { margin: 0 auto 14px; max-width: 520px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status.good { background: var(--good-bg); color: var(--good); }
.status.warn { background: var(--attention-bg); color: var(--attention-ink); }
.status.bad { background: var(--bad-bg); color: var(--bad); }
.status.info { background: var(--tint); color: var(--action-hover); }
.status.muted { background: #EEF0EC; color: var(--muted); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.split-detail { position: sticky; top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.sheet-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(0, 18, 24, .45); display: grid; place-items: center; padding: 16px; }
.sheet { background: var(--panel); border-radius: var(--radius); width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; padding: 18px 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 17px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.tablewrap table th:first-child, .tablewrap table td:first-child { padding-left: 16px; }


/* ── Progetti and the project page (step b) ── */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pagetitle { font-size: 24px; margin: 4px 0 6px; font-weight: 600; }
.backlink { padding-left: 0; }
.chipline { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.headactions { display: flex; gap: 10px; flex-wrap: wrap; }
.pillbtn { border: 0; cursor: pointer; min-height: 0; }
.filterbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.filterbar .chips { margin: 0; }
.filterbar input[type=search] { width: 280px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.pcard { display: flex; flex-direction: column; padding: 0; text-align: left; border-radius: var(--radius); overflow: hidden; background: var(--panel); border: 1px solid var(--line); min-height: 0; }
.pcard:hover { border-color: var(--action); box-shadow: 0 4px 18px rgba(0, 33, 44, .08); }
.cover { background: var(--tint); display: grid; place-items: center; overflow: hidden; aspect-ratio: 8.5 / 11; width: 100%; }
.cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; background: #fff; }
.cover .initials { font-size: 34px; font-weight: 600; color: var(--action); letter-spacing: .04em; }
.pcard .cover { aspect-ratio: 16 / 10; border-bottom: 1px solid var(--line); }
.pcard-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.pcard-title { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.pcard-title b { font-size: 16px; }
.pcard-meta { font-size: 13px; }
.pcard-budget { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.toolrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.projcols { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
/* A grid item may not grow past its track: a wide table scrolls inside its own box. */
.projcols > *, .pgrid > *, .kpis > * { min-width: 0; }
.projcols.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.scriptbox { display: grid; grid-template-columns: 120px 1fr; gap: 14px; margin-bottom: 12px; }
.cover.large { aspect-ratio: 8.5 / 11; border: 1px solid var(--line); border-radius: 8px; }
.scriptinfo { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.touched { margin: 0 0 12px; font-size: 14px; }
.touched ul { margin: 6px 0 0; padding-left: 18px; }
table.compact th, table.compact td { padding: 7px 8px; font-size: 14px; }
table.compact td:not(:first-child), table.compact th { white-space: nowrap; }
tr.subrow td { color: var(--muted); font-size: 13px; padding-top: 4px; padding-bottom: 4px; }
tr.brow td { border-top: 1px solid var(--line); }
.rowlist { display: none; }
/* A list of rows inside a sheet (the budget's ⋯ menu, "Del progetto") shows at every width. */
.sheet .rowlist { display: grid; gap: 8px; }
.sheet .listrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; }
.sheet .listrow small { display: block; margin-top: 2px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; text-align: right; }
.bars { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 10px; align-items: center; font-size: 14px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; background: var(--ground); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--action); border-radius: 4px; }
.doclist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.doclist li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.doclist a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-family: var(--mono); font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: var(--tint); color: var(--action-hover); }
.stack { display: flex; flex-direction: column; gap: 4px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.optlist { display: grid; gap: 10px; }
.optcard { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 14px; }
.optcard:hover { border-color: var(--action); background: var(--row-sel); }
.stickybar { display: none; }
.phoneonly { display: none; }
@media (max-width: 1180px) {
  .projcols, .projcols.three { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .pagetitle { font-size: 20px; }
  .headactions .primary { display: none; }
  .filterbar input[type=search] { width: 100%; }
  .filterbar .chips { width: 100%; }
  .pgrid { grid-template-columns: 1fr; gap: 10px; }
  .pcard { flex-direction: row; align-items: stretch; }
  .pcard .cover { aspect-ratio: auto; width: 76px; flex: 0 0 76px; border-bottom: 0; border-right: 1px solid var(--line); }
  .pcard .cover .initials { font-size: 20px; }
  .pcard-body { padding: 10px 12px; min-width: 0; flex: 1; }
  .scriptbox { grid-template-columns: 96px 1fr; }
  .budgets-table, .panel .tablewrap.budgets { display: none; }
  .rowlist { display: grid; gap: 8px; }
  .listrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; }
  .listrow small { display: block; margin-top: 2px; }
  .stickybar { display: block; position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); padding: 8px 16px; z-index: 25; }
  .stickybar button { width: 100%; min-height: 48px; box-shadow: 0 6px 20px rgba(0, 33, 44, .25); }
  .main:has(.stickybar) { padding-bottom: 160px; }
  .desktoponly { display: none !important; }
  .phoneonly { display: block; }
}

/* Phone pieces, hidden on wider screens. */
.phonebar, .tabbar, .scrim, .sheethead, .sheetfoot { display: none; }
/* Narrow desktop and tablet: a wide table scrolls inside its own panel, never the page. */
@media (max-width: 1180px) {
  .panel, .scroll { overflow-x: auto; }
  .main { padding: 20px; }
}
/* Phone (< 860 px): navy top bar, the menu as a sheet, a bottom tab bar; paddings 16 px. */
@media (max-width: 860px) {
  .shell, .shell.collapsed { display: block; }
  .phonebar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--rail); color: #fff; padding: 8px 12px; min-height: 56px; }
  .phonebar .phonetile { background: #fff; border: 0; border-radius: 10px; padding: 4px 8px; min-height: 40px; display: grid; place-items: center; }
  .phonebar .phonetile img { display: block; height: 30px; width: auto; }
  .phonebar .phonetitle { flex: 1; font-weight: 600; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .phonebar .phonemenu { background: none; border: 0; color: #fff; min-width: 48px; min-height: 48px; display: grid; place-items: center; }
  .phonebar svg, .tabbar svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .shell.focus .phonebar { display: none; }
  /* The whole menu as a sheet over the page. */
  .side { position: fixed; z-index: 40; left: 0; right: 0; top: 0; bottom: 0; width: auto; height: 100%; transform: translateY(100%); transition: transform .22s ease; padding: 12px 16px 24px; --nav-item: 48px; --nav-font: 16px; }
  .shell.open .side { transform: none; }
  .shell.collapsed .side { align-items: stretch; padding: 12px 16px 24px; }
  .shell.collapsed .side .navbtn { justify-content: flex-start; width: 100%; padding: 10px 12px; }
  .shell.collapsed .side .navbtn .label, .shell.collapsed .brandtile .full, .shell.collapsed .brandtile .product { display: initial; }
  .shell.collapsed .brandtile .markonly { display: none; }
  .shell.collapsed .side h6 { display: block; height: auto; width: auto; margin: 16px 12px 6px; padding-top: 14px; font-size: 11px; }
  .side .brandtile { display: none; }
  .side .collapse { display: none; }
  .side .sheethead { display: flex; align-items: center; justify-content: space-between; color: rgba(255,255,255,.8); padding: 0 4px 8px; margin-bottom: 6px; border-bottom: 1px solid var(--rail-line); }
  .side .sheethead .sheetclose { width: 48px; justify-content: center; }
  .side .sheetfoot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 4px 0; border-top: 1px solid var(--rail-line); }
  .side .sheetfoot button.link { color: #fff; min-height: 44px; }
  .shell.focus .side { display: block; }
  .shell.focus:not(.open) .side { transform: translateY(100%); }
  /* The bottom tab bar: Progetti, Approvazioni, Bert, Altro. */
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .tabbar .tab { border: 0; background: none; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--muted); border-radius: 10px; padding: 4px; }
  .tabbar .tab.on { color: var(--action); font-weight: 600; background: var(--tint); }
  .main { padding: 16px 16px 96px; }
  .shell.focus .main { padding-bottom: 24px; }
  .top { margin-bottom: 12px; }
  .top h1 { display: none; }
  .shell.focus .top h1 { display: block; font-size: 18px; }
  .top .who { display: none; }
  .panel { padding: 16px; border-radius: 12px; }
  .row > div { min-width: 0; flex: 1 1 140px; }
  .row > div input, .row > div select, .row > div textarea { width: 100%; }
  .tabs, .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs button, .chips .chip { flex: 0 0 auto; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi.wide { grid-column: 1 / -1; }
  .kpi b { font-size: clamp(13px, 10.5cqi, 18px); }
  .kpi.wide b { font-size: clamp(13px, 7cqi, 22px); }
  .split { grid-template-columns: 1fr; }
  .split-detail { position: static; }
  .sheet-wrap { place-items: end stretch; padding: 0; }
  .sheet { max-width: none; border-radius: 16px 16px 0 0; max-height: 88vh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
input, select, textarea { max-width: 100%; }
