/* Apple look: macOS chrome on desktop, iOS on phones. Loads last on every page.
   Stays flat by design (no translucency, shadows, or decorative borders) and keeps the brand fonts;
   the Apple feel comes from system colours, shapes, spacing, and control styles. */

/* System colours. Each page reads a different subset of these tokens. */
:root{
  --accent:#007aff;--on-accent:#fff;--accent-ink:#0062cc;
  --sys-green:#34c759;--sys-red:#ff3b30;--sys-orange:#ff9500;--sys-yellow:#ffcc00;
  --text:#1d1d1f;--secondary:#6e6e73;--muted:#8a8a8e;
  --canvas:#f2f2f7;--bg:#f2f2f7;--surface:#fff;--surface-2:#f2f2f7;--inset:#ececf0;--quiet:#f5f5f7;--sidebar:#ececf0;
  --line:#e5e5ea;--border:#e5e5ea;--hover:#e8e8ed;--chrome:#ececec;--radius:10px;
}
:root[data-theme=dark]{
  --accent:#0a84ff;--accent-ink:#409cff;
  --text:#f5f5f7;--secondary:#a1a1a6;--muted:#8d8d93;
  --canvas:#000;--bg:#000;--surface:#1c1c1e;--surface-2:#2c2c2e;--inset:#2c2c2e;--quiet:#1c1c1e;--sidebar:#161618;
  --line:#38383a;--border:#38383a;--hover:#3a3a3c;--chrome:#2a2a2c;
}
/* macOS dark windows are graphite; the pure-black iOS background stays on phones. */
@media(min-width:651px){
  :root[data-theme=dark]{--canvas:#1e1e1e;--bg:#1e1e1e;--surface:#2c2c2e;--surface-2:#333336;--inset:#333336;--quiet:#262628;--sidebar:#232325;--hover:#3f3f42;--chrome:#2c2c2e}
}
/* Optional accents. Light accents keep dark text on top for contrast. */
:root[data-accent=sunlight]{--accent:#ffc300;--accent-ink:#8a6a00}
:root[data-accent=ocean]{--accent-ink:#2f6fd6}
:root[data-accent=forest]{--accent-ink:#1f8a4f}
:root[data-accent=sunset]{--accent-ink:#c75a12}
:root[data-accent=grape]{--accent-ink:#6f4fd6}
:root[data-accent=mono]{--accent-ink:#5c5c58}
:root:is([data-accent=sunlight],[data-accent=mono],[data-accent=sunset],[data-accent=forest]){--on-accent:#0d0d0d}
[data-swatch=blue]{background:#007aff!important}

/* Anything filled with the accent uses the matching text colour. */
.btn.primary,.primary,.os-button.primary,.start,.returning #resume,.returning-avatar,.you-pill,:root .data-mode-label,
.avatar.me,.avatar.yellow,.timeline-bar,.spotlight-result.selected,.os-context-menu button:hover:not(:disabled),.os-context-menu button:focus-visible,
.control-grid button[role=switch][aria-checked=true],html.restored-module .btn-primary{color:var(--on-accent)!important}
.avatar.me{background:var(--accent)}
.btn.primary,.btn.primary:hover{background:var(--accent);border-color:var(--accent)}
.btn.primary:hover,.primary:hover,.os-button.primary:hover,.start:hover,.returning #resume:hover{background:color-mix(in srgb,var(--accent) 88%,#000)}
.task-checkbox.checked{color:var(--on-accent)}
.task-checkbox:hover{background:color-mix(in srgb,var(--accent) 18%,transparent)}
.event-chip{background:color-mix(in srgb,var(--accent) 16%,var(--surface));color:var(--accent-ink)}
.theme-option.active{background:color-mix(in srgb,var(--accent) 10%,transparent)}
#resume,.previous-backup{color:var(--accent-ink)}
.toast .toast-action,.toast>.icon,.os-toast>.icon{color:var(--accent)}
.metric.lead strong,.metrics>div.metric:first-child strong{color:var(--accent-ink)}
::selection{background:color-mix(in srgb,var(--accent) 30%,transparent)}

/* Controls: macOS push buttons, rounded fields, iOS-style switches. */
.btn,.os-button,.primary,button.secondary{border-radius:7px}
.btn,.os-button{font-weight:500}
.field input,.field select,.field textarea,.toolbar input,.toolbar select,.status-select,.native-search,.search-button,.sidebar-search{border-radius:8px}
input[type=checkbox],input[type=radio]{accent-color:var(--accent)}
.os-switch{width:38px;height:22px;border-radius:11px;padding:2px;background:#d1d1d6}
[data-theme=dark] .os-switch{background:#39393d}
.os-switch span{width:18px;height:18px}
.os-switch[aria-checked=true]{background:var(--accent)}
.os-switch[aria-checked=true] span{transform:translateX(16px)}
.tab.active{border-radius:7px}
/* Section tabs in business and finance screens become a segmented control. */
:is(#business,#finance) nav.tabs{display:inline-flex;gap:0;padding:2px;border-radius:9px;background:var(--inset)}
:is(#business,#finance) nav.tabs button{border-radius:7px;background:transparent;color:var(--text);padding-inline:14px}
:is(#business,#finance) nav.tabs button.selected,:is(#business,#finance) nav.tabs button[aria-selected=true]{background:var(--surface);color:var(--text)}
[data-theme=dark] :is(#business,#finance) nav.tabs button.selected{background:#636366}
.metric.lead{background:var(--surface);color:var(--text)}

/* macOS menubar */
.os-menubar{height:28px;padding:0 12px;font-size:13px;background:#1d1d1f;color:#f5f5f7}
.light-wall .os-menubar{background:#e8e8ed;color:#1d1d1f}
.os-menubar button{height:22px;padding:0 9px;border-radius:5px;font-size:13px}
.os-menubar button:hover{background:#ffffff1f}
.light-wall .os-menubar button:hover{background:#0000000f}
.os-menubar button[aria-expanded=true]{background:var(--accent);color:var(--on-accent)}
.os-menubar .os-wordmark{font-size:16px;padding-right:12px}

/* macOS windows: rounded corners, centred title, traffic lights. */
.os-window{border-radius:10px}
.os-window-bar{height:38px;padding:0 12px;background:var(--chrome)}
.os-window:not(.is-focused) .os-window-bar{background:var(--surface)}
.os-window.is-focused{outline-color:#0000001f}
.window-lights{gap:8px}
.light{width:12px;height:12px;background:#d1d1d6;color:#0000008c}
[data-theme=dark] .light{background:#4a4a4d}
.is-focused .light.close{background:#ff5f57;color:#4d0000}
.is-focused .light.minimize{background:#febc2e;color:#5a3c00}
.is-focused .light.maximize{background:#28c840;color:#003a00}
.light span{font-size:9px}
.window-caption{font-size:13px;font-weight:600}
.window-caption .icon{display:none}

/* Menus, Spotlight, panels */
.os-context-menu{border-radius:9px;padding:5px}
.os-context-menu button,.os-context-menu [role=menuitem]{border-radius:5px;font-size:13px}
.os-context-menu button:hover:not(:disabled),.os-context-menu button:focus-visible,.spotlight-result.selected{background:var(--accent)}
.os-panel{border-radius:14px}

/* macOS dock */
.os-dock{border-radius:22px;padding:6px 8px;gap:4px;background:#2c2c2e}
.light-wall .os-dock{background:#e5e5ea}
.os-dock .app-glyph{width:48px;height:48px;border-radius:11px}
.os-dock[data-size=small] .app-glyph{width:38px;height:38px;border-radius:9px}
.os-dock[data-size=large] .app-glyph{width:56px;height:56px;border-radius:13px}
.focused .running-indicator,.running-indicator{background:#8e8e93}
.light-wall .running-indicator{background:#3a3a3c}

/* App icons: iOS-style rounded-square tiles with a white glyph. */
.app-glyph{border-radius:22.5%;color:#fff;background:linear-gradient(180deg,#a1a1a6,#6e6e73)}
.app-glyph .icon{width:58%;height:58%}
.app-glyph.app-home,.app-glyph.app-sprints,.app-glyph.app-onboarding,.app-glyph.app-proposals,.app-glyph.app-costing{background:linear-gradient(180deg,#ffb340,#ff8a00)}
.app-glyph.app-tasks,.app-glyph.app-inbox,.app-glyph.app-requests,.app-glyph.app-reports{background:linear-gradient(180deg,#5ac8fa,#0a7aff)}
.app-glyph.app-projects,.app-glyph.app-tickets,.app-glyph.app-intern,.app-glyph.app-cms{background:linear-gradient(180deg,#8e8cff,#5856d6)}
.app-glyph.app-messages,.app-glyph.app-conversations,.app-glyph.app-attendance{background:linear-gradient(180deg,#6be07f,#28c840)}
.app-glyph.app-email,.app-glyph.app-files{background:linear-gradient(180deg,#4fb6ff,#1a73f0)}
.app-glyph.app-calendar{background:#fff;color:#ff3b30}
.app-glyph.app-meeting,.app-glyph.app-payslip{background:linear-gradient(180deg,#4ade96,#11a861)}
.app-glyph.app-feed,.app-glyph.app-mybenefits,.app-glyph.app-hr{background:linear-gradient(180deg,#ff6f91,#ff2d55)}
.app-glyph.app-issues,.app-glyph.app-incidents,.app-glyph.app-notifications{background:linear-gradient(180deg,#ff7b6e,#ff3b30)}
.app-glyph.app-docs{background:linear-gradient(180deg,#ffe066,#ffcc00);color:#5c4700}
.app-glyph.app-tracking,.app-glyph.app-client-portal,.app-glyph.app-invoices{background:linear-gradient(180deg,#5ad8e6,#00a3c4)}
.app-glyph.app-qa,.app-glyph.app-forms{background:linear-gradient(180deg,#d08cff,#af52de)}
.app-glyph.app-people{background:linear-gradient(180deg,#c7a98a,#a2845e)}
.app-glyph.app-clients,.app-glyph.app-crm{background:linear-gradient(180deg,#6e8bff,#3550e6)}
.app-glyph.app-finance,.app-glyph.app-analytics,.app-glyph.app-terminal{background:linear-gradient(180deg,#3a3a3c,#0d0d0d)}
.app-glyph.app-po,.app-glyph.app-audit{background:linear-gradient(180deg,#b8a48c,#8a7560)}
.app-glyph.app-assets,.app-glyph.app-archive,.app-glyph.app-links{background:linear-gradient(180deg,#7da3c9,#4f7396)}
.app-glyph.app-automation,.app-glyph.app-automations{background:linear-gradient(160deg,#ff5e9c,#5b5bf5);color:#fff}
.app-glyph.app-operations,.app-glyph.app-admin,.app-glyph.app-settings{background:linear-gradient(180deg,#aeaeb2,#636366)}
.app-glyph.app-library{background:linear-gradient(160deg,#5ac8fa,#5856d6)}
.app-glyph.app-desktop{background:linear-gradient(180deg,#636366,#3a3a3c)}

/* iOS on phones */
@media(max-width:650px){
  .mobile-status{background:transparent;color:#fff;padding-left:28px;padding-right:18px}
  .light-wall .mobile-status{color:#000}
  body.mobile-app-open .mobile-status{background:var(--canvas);color:var(--text)}
  .mobile-time{font:600 16px Poppins,sans-serif;letter-spacing:-.2px}
  .mobile-navigation{background:transparent;color:#fff}
  .light-wall .mobile-navigation{color:#000}
  body.mobile-app-open .mobile-navigation{background:var(--canvas);color:var(--text)}
  .mobile-home span{width:134px;height:5px;border-radius:3px}
  .os-window{border-radius:0}
  .os-window .os-window-bar,.os-window.is-focused .os-window-bar,.os-window:not(.is-focused) .os-window-bar{height:44px;min-height:44px;background:var(--canvas);padding:0 8px}
  .os-window,.os-window-body{background:var(--canvas)}
  .os-window,.os-window.is-focused{outline:none}
  .window-caption{position:absolute;left:50%;transform:translateX(-50%);justify-content:center;font-size:17px;font-weight:600}
  .window-options{color:var(--accent)}
  #desktop[data-layout] .desktop-shortcuts{gap:24px 10px}
  #desktop[data-layout] .desktop-shortcut{font-size:11px;color:#fff}
  .light-wall #desktop[data-layout] .desktop-shortcut,#desktop[data-layout].light-wall .desktop-shortcut{color:#000}
  #desktop[data-layout] .desktop-shortcut .app-glyph{width:60px;height:60px;border-radius:13.5px}
  #desktop[data-layout] .desktop-agenda,#desktop[data-layout] :is(.desktop-tasks,.desktop-quicknote){border-radius:22px;background:#1c1c1e}
  #desktop[data-layout].light-wall :is(.desktop-agenda,.desktop-tasks,.desktop-quicknote){background:#fff}
  #desktop[data-layout] .desktop-search{border-radius:18px;background:#2c2c2e;color:#ebebf5}
  #desktop.light-wall[data-layout] .desktop-search{background:#e5e5ea;color:#3c3c43}
  .mobile-dock{height:88px;left:12px;right:12px;bottom:calc(30px + env(safe-area-inset-bottom));border-radius:32px;background:#2c2c2e}
  .light-wall .mobile-dock{background:#e5e5ea}
  .mobile-dock .app-glyph{width:60px;height:60px;border-radius:13.5px}
  .library-app .app-glyph{width:60px;height:60px;border-radius:13.5px}
  .os-switch{width:51px;height:31px;border-radius:16px}
  .os-switch span{width:27px;height:27px}
  .os-switch[aria-checked=true]{background:var(--sys-green)}
  .os-switch[aria-checked=true] span{transform:translateX(20px)}
  .os-panel{border-radius:12px 12px 0 0}
  .os-context-menu{border-radius:13px}
  .btn,.os-button,.primary{border-radius:10px;min-height:44px}
}
