@font-face { font-family: Onest; src: url('fonts/Onest-Regular.ttf') format('truetype'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: Onest; src: url('fonts/Onest-Bold.ttf') format('truetype'); font-weight: 650 900; font-display: swap; }
/* Source palettes with accessible secondary text and scoped pilot aliases. */
:root, :root[data-theme='picpac-paper'] {
  color-scheme: light;
  --bg: #ece3d4; --surface: #fbf6ec; --surface2: #f3ece0; --surface3: #ece2d2;
  --border: #d8ccb8; --border2: #b8a990; --control-border: #958267; --text: #2c2823; --text2: #6b6357;
  --accent: #b23b40; --accent-hover: #982c31; --good: #356b47; --good-soft: #e1eadd;
  --danger: #b33137; --danger-soft: #f7e2df; --warning: #80500e; --warning-soft: #f4e7ca;
  --selection: #e9c5c0; --icon-filter: none; --sidebar-width: 188px;
}
:root[data-theme='picpac-graphite'] {
  color-scheme: dark;
  --bg: #1e1b17; --surface: #2a2620; --surface2: #332e27; --surface3: #3c362d;
  --border: #51493e; --border2: #827462; --control-border: #93836e; --text: #f3ede3; --text2: #bdb2a3;
  --accent: #f18d91; --accent-hover: #ffacaf; --good: #a3cbbb; --good-soft: #293e33;
  --danger: #ff9b9f; --danger-soft: #4b292a; --warning: #edc17e; --warning-soft: #453820;
  --selection: #654247; --icon-filter: invert(92%);
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f0f2f7; --surface: #fff; --surface2: #f5f7fb; --surface3: #eaecf4;
  --border: #d8dce8; --border2: #959bb3; --control-border: #81889e; --text: #1a1d2e; --text2: #4a5068;
  --accent: #3060d8; --accent-hover: #224bb4; --good: #217245; --good-soft: #e0eee5;
  --danger: #bd252b; --danger-soft: #fbe5e5; --warning: #835300; --warning-soft: #f7edce;
  --selection: #c9d6fb; --icon-filter: none;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d0f14; --surface: #151820; --surface2: #1c2030; --surface3: #232840;
  --border: #343c58; --border2: #697694; --control-border: #697694; --text: #e8eaf0; --text2: #adb6d1;
  --accent: #a6bcff; --accent-hover: #c2d0ff; --good: #70dfa5; --good-soft: #19372c;
  --danger: #ff9ca0; --danger-soft: #48242c; --warning: #f3cc79; --warning-soft: #40351f;
  --selection: #354b80; --icon-filter: invert(92%);
}
:root[data-theme='mary'] {
  color-scheme: light;
  --bg: #f2f2ef; --surface: #fff; --surface2: #f7f7f4; --surface3: #ecece7;
  --border: #deded7; --border2: #bdbdb4; --control-border: #85857c;
  --text: #11110f; --text2: #4f4f49; --accent: #11110f; --accent-hover: #33332d;
  --good: #26724a; --good-soft: #d8f5b8; --danger: #b4232d; --danger-soft: #ffe7eb;
  --warning: #765900; --warning-soft: #fff0a3; --selection: #ffed86; --icon-filter: none;
  --mary-yellow: #ffdc2e; --mary-yellow-hover: #f2cb00; --mary-button-border: #8d790c;
}
:root {
  --paper: var(--bg); --ink: var(--text); --muted: var(--text2); --line: var(--border);
  --green: var(--good); --green-soft: var(--good-soft); --blue: var(--accent);
  --nav: var(--surface); --nav-soft: var(--surface2); --orange: var(--danger);
  font-family: Onest, sans-serif;
}
html, body { background: var(--bg); color: var(--text); }
::selection { background: var(--selection); color: var(--text); }
:focus-visible { outline-color: var(--accent); }
input, textarea, select { caret-color: var(--accent); accent-color: var(--accent); }
* { scrollbar-color: var(--border2) var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-color: var(--bg); }
.skip-link { background: var(--surface); }
.signed-in .button.primary, .button.primary { color: var(--surface); background: var(--accent); border-color: var(--accent); }
.signed-in .button.primary:hover, .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.secondary, .icon-button { background: var(--surface); color: var(--text); border-color: var(--border2); }
.button.secondary:hover, .icon-button:hover { background: var(--surface3); }
.field input, .field select, .field textarea, .object-filter select { color: var(--text); background: var(--surface); border-color: var(--border2); }
input::placeholder, textarea::placeholder { color: var(--text2); opacity: 1; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--accent); }
.status, .avatar { color: var(--good); background: var(--good-soft); }
.urgent, .form-error { color: var(--danger); background: var(--danger-soft); border-color: var(--border2); }
.overdue, .risk-label, .exception-item > small, .chat-status[data-error] { color: var(--danger); }
.ok-label, .notice.success, .paid-note { color: var(--good); }
.staff-header { background: var(--surface2); }
.test-label, .demo-banner { color: var(--warning); border-color: var(--border2); background: var(--warning-soft); }
.topbar { background: var(--surface); }
.nav-icon, .shell-icon img, .calendar-arrow img, .overview-calendar summary img, .context-submit img, .icon-button img { filter: var(--icon-filter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.sidebar { width: var(--sidebar-width); color: var(--text); background: var(--surface); border-right: 1px solid var(--border); }
.shell-brand { min-height: 62px; padding: 12px 14px; gap: 9px; color: var(--text); border-color: var(--border); }
.shell-brand strong { font-size: 16px; }
.shell-brand small { color: var(--text2); font-size: 9px; }
.shell-brand img { width: 30px; height: 30px; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 14px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border); }
.user-avatar { flex: 0 0 32px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--surface); background: var(--accent); font-size: 12px; font-weight: 700; }
.user-info { min-width: 0; }
.user-info strong { display: block; font-size: 12px; overflow-wrap: anywhere; }
.user-info small { display: block; font-size: 10px; color: var(--text2); margin-top: 3px; }
.context-block { order: 2; padding: 10px 14px; border-top: 1px solid var(--border); border-bottom: 0; }
.context-block label { color: var(--text2); text-transform: none; font-size: 11px; }
.context-block select { height: 36px; color: var(--text); background: var(--surface2); border-color: var(--border); font-size: 11px; }
.context-submit { bottom: 11px; height: 34px; }
.primary-nav { padding: 10px 0; }
.nav-section { padding: 12px 14px 4px; color: var(--text2); font-size: 10px; text-transform: uppercase; font-weight: 700; }
.nav-item { display: flex; gap: 10px; min-height: 38px; padding: 8px 14px; color: var(--text); border: 0; border-radius: 0; font-size: 12px; }
.nav-item .nav-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-item:hover, .nav-item[aria-current] { background: var(--surface3); color: var(--accent); border-color: var(--border); }
.nav-item[aria-current] { box-shadow: inset 1px 0 var(--accent); font-weight: 700; }
.sidebar-footer { display: flex; order: 3; align-items: center; justify-content: space-between; padding: 10px 14px; gap: 8px; border-color: var(--border); }
.sidebar-footer > small { color: var(--text2); margin: 0; font-size: 10px; }
.sidebar-footer .logout { margin: 0; }
.sidebar-footer button { display: flex; align-items: center; gap: 7px; color: var(--text2); font-size: 11px; text-decoration: none; }
.sidebar :focus-visible { outline-color: var(--accent); }
.shell-icon.drawer-close { display: none; }
.shell-workspace { padding-inline: 24px; }
.shell-topbar { min-height: 56px; padding: 8px 24px; margin-inline: -24px; gap: 16px; background: var(--surface); }
.shell-page-title { margin-right: auto; font-size: 17px; }
.shell-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; padding: 6px; background: var(--surface2); border: 1px solid var(--border2); border-radius: 6px; cursor: pointer; }
.shell-icon:hover { background: var(--surface3); }
.shell-search { display: flex; align-items: center; width: 230px; min-width: 100px; gap: 8px; margin: 0; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface2); }
.shell-search input { width: 100%; min-width: 0; background: transparent; border: 0; color: var(--text); font-size: 12px; }
.shell-search input:focus { outline: 0; }
.shell-search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.new-task { gap: 7px; white-space: nowrap; }
.shell-topbar .button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
.theme-control { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--text2); font-size: 11px; }
.theme-control select { width: 116px; min-height: 34px; padding: 5px 7px; color: var(--text); background: var(--surface2); border: 1px solid var(--border2); border-radius: 6px; font: inherit; font-size: 12px; }
.demo-banner { margin-top: 16px; padding-block: 7px; }
.signed-in .content, .signed-in .content.workspace, .signed-in .messenger-workspace { width: 100%; max-width: none; margin: 24px 0 0; }
.overview-calendar, .schedule-field, .exception-ledger, .trace-section, .overview-payments { background: var(--surface); }
.overview-calendar { border-color: var(--border2); }
.calendar-agenda { border-color: var(--border); }
.calendar-day { border-color: var(--border); display: grid; grid-template-rows: 1fr auto; min-height: 50px; padding: 5px 8px; gap: 0; font-size: 13px; }
.calendar-day small { justify-self: end; font-size: 9px; line-height: 1; }
.calendar-day.outside, .portfolio-head { background: var(--surface2); }
.calendar-day.selected { background: var(--surface3); border-color: var(--accent); }
.calendar-day:hover, .status-cell:hover, .portfolio-row:hover, .exception-item:hover, .exception-item.selected { background: var(--surface2); }
.status-ribbon { border-color: var(--border2); background: var(--surface); }
.status-cell.warning > strong { color: var(--warning); }
.director-grid { grid-template-columns: minmax(0,1fr) 300px; }
.director-grid > * { min-width: 0; }
.portfolio-table { max-width: 100%; }
.trace-node { background: var(--surface2); border-color: var(--border2); }
.trace-section, .overview-payments { margin-top: 24px; }
.planning-table { background: var(--surface); }
.planning-table thead { background: var(--surface2); }
.chat-room:hover { background: var(--surface2); }
.chat-room[aria-current] { background: var(--surface3); }
.chat-thread { background: var(--surface); padding-right: 16px; }
.message { padding: 14px 44px 14px 0; }
.message blockquote { border-color: var(--border2); }
.chat-composer { background: var(--surface); }
.theme-settings { margin-top: 32px; }
.theme-settings h2 { font-size: 17px; margin: 0 0 16px; }
.theme-options { display: flex; flex-wrap: wrap; gap: 12px 20px; padding: 16px; max-width: 680px; border: 1px solid var(--border); }
.theme-options legend { padding-inline: 6px; color: var(--text2); font-size: 12px; }
.theme-options label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.theme-swatch { width: 18px; height: 18px; border-radius: 3px; border: 1px solid var(--border2); }
.field input, .field select, .field textarea, .object-filter select,
.button.secondary, .icon-button, .shell-icon, .shell-search, .theme-control select,
.context-block select, .calendar-arrow { border-color: var(--control-border); }
[data-swatch='picpac-paper'] { background: #ece3d4; }
[data-swatch='picpac-graphite'] { background: #2a2620; }
[data-swatch='light'] { background: #fff; }
[data-swatch='dark'] { background: #151820; }
[data-swatch='mary'] { background: #ffdc2e; }
:root[data-theme='mary'] .sidebar { background: #fbfbfa; }
:root[data-theme='mary'] .shell-brand { background: var(--surface); }
:root[data-theme='mary'] .nav-item { margin: 2px 8px; padding: 9px 10px; border-radius: 8px; }
:root[data-theme='mary'] .nav-item:hover { color: var(--text); background: var(--surface3); }
:root[data-theme='mary'] .nav-item[aria-current] { color: var(--text); background: var(--mary-yellow); box-shadow: none; }
:root[data-theme='mary'] .user-avatar { color: var(--text); background: var(--mary-yellow); }
:root[data-theme='mary'] .button.primary { color: var(--text); background: var(--mary-yellow); border-color: var(--mary-button-border); }
:root[data-theme='mary'] .button.primary:hover { color: var(--text); background: var(--mary-yellow-hover); border-color: var(--mary-button-border); }
:root[data-theme='mary'] .composer-tools .button img { filter: none; }
:root[data-theme='mary'] .calendar-day.selected { background: #fff9d9; }
:root[data-theme='mary'] .mobile-nav a[aria-current] { color: var(--text); background: var(--mary-yellow); border-top-color: var(--text); }
@media (min-width: 781px) {
  .sidebar-collapsed { --sidebar-width: 64px; }
  .sidebar-collapsed .shell-brand span, .sidebar-collapsed .user-info, .sidebar-collapsed .nav-label, .sidebar-collapsed .nav-section, .sidebar-collapsed .context-block, .sidebar-collapsed .sidebar-footer > small, .sidebar-collapsed .sidebar-footer button span { display: none; }
  .sidebar-collapsed .shell-brand, .sidebar-collapsed .sidebar-user, .sidebar-collapsed .nav-item, .sidebar-collapsed .sidebar-footer { justify-content: center; padding-inline: 8px; }
  .sidebar-collapsed .nav-item { min-height: 44px; }
}
@media (max-width: 1320px) { .director-grid { grid-template-columns: minmax(0,1fr); } .shell-search { width: 180px; } }
@media (max-width: 1100px) { :root { --sidebar-width: 188px; } .shell-search { display: none; } .shell-page-title { font-size: 15px; } }
@media (max-width: 780px) {
  .signed-in { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .shell-workspace { padding: 0 12px 24px; }
  .mobile-header { color: var(--text); background: var(--surface); border-bottom: 1px solid var(--border); gap: 9px; }
  .mobile-header .brand { color: var(--text); font-size: 16px; gap: 6px; }
  .mobile-header .theme-control select { min-height: 40px; width: 104px; font-size: 13px !important; }
  .mobile-header .shell-icon { width: 40px; height: 40px; flex-basis: 40px; }
  .sidebar { width: min(300px,calc(100% - 30px)); }
  .sidebar .shell-brand { padding-right: 52px; }
  .shell-icon.drawer-close { position: absolute; display: grid; right: 10px; top: 13px; }
  .mobile-header .shell-icon img { filter: var(--icon-filter); }
  .menu-open .sidebar { height: 100dvh; }
  .menu-shade { background: #0008; }
  .nav-item { min-height: 44px; font-size: 13px; }
  .director-grid { grid-template-columns: minmax(0,1fr); }
  .calendar-day { min-height: 48px; padding: 5px; }
  .calendar-toolbar { gap: 6px; }
  .calendar-toolbar .calendar-arrow { width: 32px; height: 36px; }
  .calendar-toolbar > strong { font-size: 12px; }
  .calendar-toolbar > a:last-child { font-size: 11px; }
  .chat-thread { padding-inline: 12px; }
  .mobile-nav { color: var(--text2); background: var(--surface); border-top: 1px solid var(--border); }
  .mobile-nav a:hover, .mobile-nav a[aria-current] { color: var(--accent); background: var(--surface3); border-top-color: var(--accent); }
  .demo-banner { margin-top: 12px; }
  .signed-in .staff-row { grid-template-columns: minmax(0,1fr); }
  .status-cell { min-width: 0; gap: 8px; }
  .status-cell > strong { font-size: 25px; }
  .status-cell > span { min-width: 0; overflow-wrap: anywhere; }
  a, button, input, select, textarea, summary { scroll-margin-bottom: 80px; scroll-margin-top: 65px; }
}
@media (prefers-reduced-motion: no-preference) { .nav-item, .button, .shell-icon { transition: background-color 140ms ease-out, color 140ms ease-out; } }
