/* Palm Eye Cloud portal — the application shell (2026-10-02): a persistent left sidebar (collapsible to icons, a drawer on
 * phones), a slim top bar with breadcrumbs, the ⌘K command palette and the theme switch; denser, calmer tokens for a
 * professional console (Linear / Vercel / Datadog reading), and a manual light / dark override on top of the system
 * scheme. Loaded after styles.css and pages.css, so the tokens here win. Copyright © 2026 Palm Digitalz. All rights reserved. */

:root {
  --side-w: 232px;
  --side-w-collapsed: 60px;
  --top-h: 52px;
  --r-card: 12px;
  --r-tile: 10px;
  --r-btn: 8px;
  --row: 40px;
  --inset: 20px;
  --tile-inset: 14px;
}

/* manual theme override — the same two token sets as styles.css, chosen by <html data-theme> (Settings / top bar) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0A0A0C; --surface: #111114; --surface2: #1B1B1F; --surface3: #26262B; --label: #F5F5F7;
  --secondary: rgba(245, 245, 247, .62); --tertiary: rgba(245, 245, 247, .34); --quaternary: rgba(245, 245, 247, .18);
  --hairline: rgba(255, 255, 255, .12); --hairline-soft: rgba(255, 255, 255, .07); --glass-top: rgba(255, 255, 255, .05);
  --accent: #E8A33D; --accent-soft: rgba(232, 163, 61, .2); --on-accent: #1A1200; --green: #30D158; --yellow: #FFD60A;
  --orange: #FF9F0A; --red: #FF453A; --blue: #0A84FF; --teal: #64D2FF; --purple: #BF5AF2; --ivory: #F5F1E8;
  --track: rgba(255, 255, 255, .1); --shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
:root[data-theme="light"] {
  color-scheme: light;
  --ground: #F4F4F6; --surface: #FFFFFF; --surface2: #F5F5F7; --surface3: #EBEBF0; --label: #111113;
  --secondary: rgba(17, 17, 19, .6); --tertiary: rgba(17, 17, 19, .38); --quaternary: rgba(17, 17, 19, .18);
  --hairline: rgba(0, 0, 0, .1); --hairline-soft: rgba(0, 0, 0, .065); --glass-top: rgba(255, 255, 255, .6);
  --accent: #A8650A; --accent-soft: rgba(168, 101, 10, .14); --on-accent: #FFFFFF; --green: #248A3D; --yellow: #B88A00;
  --orange: #C46A00; --red: #D70015; --blue: #0060DF; --teal: #1E86B8; --purple: #8E3FC4; --ivory: #3A342A;
  --track: rgba(0, 0, 0, .08); --shadow: 0 12px 40px rgba(0, 0, 0, .14);
}

/* ---------- frame ---------- */
body.has-side .top, body.has-side .app, body.has-side .offline { margin-left: var(--side-w); }
body.has-side.side-collapsed .top, body.has-side.side-collapsed .app, body.has-side.side-collapsed .offline { margin-left: var(--side-w-collapsed); }
.app { max-width: 1480px; padding: 20px var(--page) 48px; }
body.has-side .app { margin-right: auto; }
.page-head { margin: 4px 0 18px; }
.page-title { font-size: var(--t-title); font-weight: 700; letter-spacing: -.02em; }
.page-sub { font-size: var(--t-subhead); }
/* a card says what it is in the label colour, one step above its body (2026-10-23: "no clear visual hierarchy") */
.card-title { font-size: var(--t-body); letter-spacing: -.005em; }
.kpi-n { font-size: clamp(20px, 2vw, 26px); font-weight: 400; }
.table { font-size: 13px; }
.table th { height: 34px; font-size: var(--t-foot); text-transform: none; }

/* ---------- sidebar ---------- */
.side { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: var(--side-w); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--hairline-soft); transition: width var(--dur) var(--ease), transform var(--dur-sheet) var(--ease); }
body.side-collapsed .side { width: var(--side-w-collapsed); }
.side-head { height: var(--top-h); display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--hairline-soft); flex: none; }
.side .brand { display: flex; align-items: center; gap: 9px; color: var(--label); min-width: 0; flex: 1; }
.side .brand:hover { text-decoration: none; }
.side .mark { flex: none; }
.side .wordmark { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; }
.side-collapse { width: 30px; height: 30px; border: 0; background: none; border-radius: 7px; color: var(--secondary); display: flex; align-items: center; justify-content: center; flex: none; }
.side-collapse:hover { background: var(--surface2); color: var(--label); }
.side-nav { flex: 1; overflow-y: auto; padding: 8px 8px 12px; display: flex; flex-direction: column; gap: 10px; }
.side-group { display: flex; flex-direction: column; gap: 1px; }
.side-group-title { font-size: var(--t-foot); font-weight: 600; color: var(--tertiary); padding: 6px 10px 4px; white-space: nowrap; overflow: hidden; }
.side-nav a, .side-settings { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 7px; color: var(--secondary); font-size: var(--t-callout); font-weight: 500; white-space: nowrap; position: relative; }
.side-nav a:hover, .side-settings:hover { background: var(--surface2); color: var(--label); text-decoration: none; }
.side-nav a[aria-current="page"], .side-settings[aria-current="page"] { background: var(--surface2); color: var(--label); }
.side-nav a[aria-current="page"]::before, .side-settings[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 2px 2px 0; background: var(--accent); }
.side-ico { flex: none; color: inherit; }
.side-nav a[aria-current="page"] .side-ico { color: var(--accent); }
.side-label { overflow: hidden; text-overflow: ellipsis; }
.side-badge { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--green); display: inline-flex; align-items: center; gap: 5px; }
.side-badge .dot { width: 6px; height: 6px; }
.side-foot { border-top: 1px solid var(--hairline-soft); padding: 8px; display: flex; flex-direction: column; gap: 4px; flex: none; }
.side-foot .user { position: relative; }
.side-foot .user-btn { width: 100%; border: 0; background: none; border-radius: 7px; height: 36px; padding: 0 8px; justify-content: flex-start; }
.side-foot .user-btn:hover { background: var(--surface2); }
.side-foot .menu { left: 0; right: auto; top: auto; bottom: calc(100% + 6px); min-width: 230px; }
body.side-collapsed .side-label, body.side-collapsed .side-group-title, body.side-collapsed .wordmark, body.side-collapsed .side-badge-n { display: none; }
body.side-collapsed .side-head { padding: 0 8px; justify-content: center; flex-direction: column; height: auto; min-height: var(--top-h); gap: 4px; padding-top: 8px; padding-bottom: 8px; }
body.side-collapsed .side-nav a, body.side-collapsed .side-settings { justify-content: center; padding: 0; }
body.side-collapsed .side-group + .side-group { border-top: 1px solid var(--hairline-soft); padding-top: 8px; }
body.side-collapsed .side-foot .user-btn { justify-content: center; padding: 0; }
.side-scrim { position: fixed; inset: 0; z-index: 29; background: rgba(0, 0, 0, .45); animation: fade var(--dur) var(--ease); }

/* ---------- top bar ---------- */
.top { height: var(--top-h); background: color-mix(in srgb, var(--ground) 88%, transparent); }
.top-inner { max-width: none; height: var(--top-h); padding: 0 var(--page); gap: 12px; }
.top .nav-toggle { display: none; }
.top-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; font-size: 13px; color: var(--secondary); overflow: hidden; white-space: nowrap; }
.top-crumbs a { color: var(--secondary); }
.top-crumbs a:hover { color: var(--label); text-decoration: none; }
.top-crumbs .crumbs { margin: 0; flex-wrap: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.top-crumbs .crumbs > span:last-child, .top-crumbs .crumb-here { color: var(--label); font-weight: 500; }
.app .crumbs { display: none; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.cmdk-btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 10px; border: 1px solid var(--hairline); background: var(--surface); border-radius: 8px; color: var(--tertiary); font-size: 13px; min-width: 240px; }
.cmdk-btn:hover { border-color: var(--quaternary); color: var(--secondary); }
.cmdk-text { flex: 1; text-align: left; }
.cmdk-btn .gsearch-kbd { position: static; }
.theme { display: inline-flex; background: var(--surface2); border-radius: 8px; padding: 2px; gap: 2px; }
.theme button { border: 0; background: none; height: 26px; padding: 0 8px; border-radius: 6px; color: var(--secondary); font-size: 12px; font-weight: 500; }
.theme button[aria-pressed="true"] { background: var(--surface); color: var(--label); box-shadow: 0 0 0 1px var(--hairline-soft); }
.offline { top: var(--top-h); }

/* ---------- command palette ---------- */
.cmdk-back { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .42); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; animation: fade .12s var(--ease); }
.cmdk { width: min(640px, 100%); max-height: min(70vh, 620px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; animation: modalIn var(--dur-fast) var(--ease); }
.cmdk-field { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 14px; height: 52px; border-bottom: 1px solid var(--hairline-soft); flex: none; }
.cmdk-field .gsearch-ico { position: static; color: var(--tertiary); }
.cmdk-input { flex: 1; height: 100%; border: 0; background: none; outline: none; font-size: 15px; color: var(--label); -webkit-appearance: none; appearance: none; min-width: 0; }
.cmdk-input::placeholder { color: var(--tertiary); }
.cmdk-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.cmdk-esc { border: 1px solid var(--hairline); background: none; border-radius: 6px; font-size: 11px; color: var(--tertiary); height: 22px; padding: 0 6px; }
.cmdk .gs-list { overflow-y: auto; padding: 6px; flex: 1; }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--hairline-soft); font-size: var(--t-foot); color: var(--tertiary); flex: none; }
.cmdk-foot kbd, .gs-kbd { font: 500 10.5px/1 var(--font); border: 1px solid var(--hairline); border-radius: 4px; padding: 2px 4px; margin-right: 3px; color: var(--secondary); }
.gs-ico { width: 26px; height: 26px; border-radius: 6px; background: var(--surface2); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--secondary); font: 600 10px/1 var(--font); }
.gs-line .gs-ico .ico { color: var(--secondary); }
.gs-opt { padding: 6px 8px; }
.gs-mark { color: var(--accent); font-weight: 600; }

/* ---------- responsive: icons below 1100 px, a drawer below 820 px ---------- */
@media (max-width: 1100px) {
  body.has-side:not(.side-open) .side { width: var(--side-w-collapsed); }
  body.has-side .top, body.has-side .app, body.has-side .offline { margin-left: var(--side-w-collapsed); }
  body.has-side:not(.side-open) .side-label, body.has-side:not(.side-open) .side-group-title, body.has-side:not(.side-open) .wordmark { display: none; }
  body.has-side:not(.side-open) .side-nav a, body.has-side:not(.side-open) .side-settings { justify-content: center; padding: 0; }
  body.has-side:not(.side-open) .side-head { justify-content: center; padding: 0 8px; }
  body.has-side:not(.side-open) .side-collapse { display: none; }
  body.has-side:not(.side-open) .side-foot .user-btn { justify-content: center; padding: 0; }
  body.side-open .side { width: var(--side-w); box-shadow: var(--shadow); }
  .cmdk-btn { min-width: 0; }
  .cmdk-text { display: none; }
}
@media (max-width: 820px) {
  body.has-side .top, body.has-side .app, body.has-side .offline, body.has-side.side-collapsed .top, body.has-side.side-collapsed .app, body.has-side.side-collapsed .offline { margin-left: 0; }
  body.has-side .side { transform: translateX(-100%); width: var(--side-w); }
  body.has-side.side-open .side { transform: none; }
  body.has-side.side-open .side-label, body.has-side.side-open .side-group-title, body.has-side.side-open .wordmark { display: initial; }
  body.has-side.side-open .side-nav a, body.has-side.side-open .side-settings { justify-content: flex-start; padding: 0 10px; }
  .top .nav-toggle { display: flex; margin: 0; flex: none; width: 36px; height: 36px; }
  .theme { display: none; }
  .cmdk-back { padding: 8px; }
}
@media (max-width: 720px) { :root { --inset: 16px; } .app { padding-top: 14px; } }
@media print { .side, .top, .side-scrim { display: none !important; } body.has-side .app { margin-left: 0 !important; } }
