/* ============================================================
   macOS 27 — Liquid Glass design system
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --font: -apple-system, "SF Pro Text", "SF Pro Display", "Inter", system-ui, sans-serif;

  /* Liquid Glass tokens (light) */
  --glass-tint: rgba(255,255,255,0.42);
  --glass-tint-strong: rgba(255,255,255,0.60);
  --glass-border: rgba(255,255,255,0.65);
  --glass-shadow: 0 12px 40px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.14);
  --glass-inner: inset 0 1px 1px rgba(255,255,255,0.9), inset 0 -1px 1px rgba(255,255,255,0.25);
  --glass-blur: 26px;
  --glass-sat: 180%;

  --text: #1c1c1e;
  --text-dim: rgba(60,60,67,0.62);
  --text-faint: rgba(60,60,67,0.35);
  --accent: #0a84ff;
  --accent-2: #34c759;
  --sep: rgba(0,0,0,0.10);
  --menubar-text: #ffffff;
  --radius-win: 14px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --hi: 0.18s cubic-bezier(.32,.72,0,1);
}

html[data-theme="dark"] {
  --glass-tint: rgba(30,30,34,0.52);
  --glass-tint-strong: rgba(40,40,45,0.72);
  --glass-border: rgba(255,255,255,0.14);
  --glass-shadow: 0 18px 50px rgba(0,0,0,0.55), 0 2px 10px rgba(0,0,0,0.4);
  --glass-inner: inset 0 1px 1px rgba(255,255,255,0.18), inset 0 -1px 1px rgba(0,0,0,0.3);
  --text: #f5f5f7;
  --text-dim: rgba(235,235,245,0.6);
  --text-faint: rgba(235,235,245,0.3);
  --sep: rgba(255,255,255,0.12);
  --accent: #0a84ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  height: 100%; width: 100%; overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  background: #000;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}
.hidden { display: none !important; }
button, input, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(140,140,150,0.45); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(140,140,150,0.7); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- The core Liquid Glass surface ---------- */
.glass {
  position: relative;
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  isolation: isolate;
}
/* specular sheen sweeping the top edge */
.glass::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 20% -10%, rgba(255,255,255,0.55), rgba(255,255,255,0) 45%),
    radial-gradient(100% 60% at 100% 0%, rgba(255,255,255,0.22), rgba(255,255,255,0) 50%);
  mix-blend-mode: screen;
  opacity: 0.9;
}
html[data-theme="dark"] .glass::before { opacity: 0.5; }
/* refractive lensing rim — Liquid Glass edge */
.glass::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.22), inset 0 0 14px rgba(255,255,255,0.05);
}
html[data-theme="dark"] .glass::after { box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.10), inset 0 0 16px rgba(255,255,255,0.03); }

/* App icon glass shimmer (Liquid Glass layered icons) */
.app-icon { position: relative; }
.app-icon::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(150deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.12) 22%, rgba(255,255,255,0) 46%);
  mix-blend-mode: screen; opacity: 0.75;
}

/* Siri orb (menu bar) */
.siri-orb {
  width: 17px; height: 17px; border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #fff 0%, rgba(255,255,255,0) 40%),
    conic-gradient(from 210deg, #0a84ff, #bf5af2, #ff375f, #ff9f0a, #34c759, #0a84ff);
  box-shadow: 0 0 6px rgba(120,120,255,0.6), inset 0 0 3px rgba(255,255,255,0.6);
  display: inline-block;
}

/* ============================================================
   BOOT
   ============================================================ */
.boot-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: #000; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 60px;
  transition: opacity 0.6s ease;
}
.apple-logo { width: 90px; height: 90px; animation: logoIn 1s ease; }
@keyframes logoIn { from { opacity: 0; transform: scale(0.9);} to { opacity: 1; transform: scale(1);} }
.boot-progress { width: 200px; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.18); overflow: hidden; }
.boot-progress-bar { height: 100%; width: 0; background: #fff; border-radius: 3px; transition: width 2.2s ease; }

/* ============================================================
   LOCK / LOGIN
   ============================================================ */
.lock-screen {
  position: fixed; inset: 0; z-index: 9000;
  background-size: cover; background-position: center;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 8vh 0 12vh;
  color: #fff;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.lock-screen::after { content:""; position:absolute; inset:0; background: rgba(0,0,0,0.15); backdrop-filter: blur(0px); }
.lock-clock { text-align: center; z-index: 2; text-shadow: 0 2px 20px rgba(0,0,0,0.35); }
.lock-day { font-size: 22px; font-weight: 600; opacity: 0.95; }
.lock-time { font-size: 96px; font-weight: 700; letter-spacing: -3px; line-height: 1; margin-top: 4px; }
.lock-user { z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lock-avatar { width: 90px; height: 90px; border-radius: 50%; overflow: hidden; background: rgba(255,255,255,0.25); display: grid; place-items: center; color: rgba(255,255,255,0.9); border: 1px solid rgba(255,255,255,0.3); }
.lock-avatar svg { width: 70px; height: 70px; }
.lock-name { font-size: 19px; font-weight: 600; text-shadow: 0 1px 8px rgba(0,0,0,0.4); }
.lock-input-row { display: flex; align-items: center; gap: 8px; }
.lock-input {
  width: 220px; padding: 9px 16px; border-radius: 20px; border: none;
  background: rgba(255,255,255,0.22); color: #fff; font-size: 14px; text-align: center;
  backdrop-filter: blur(20px); outline: none; border: 0.5px solid rgba(255,255,255,0.3);
}
.lock-input::placeholder { color: rgba(255,255,255,0.7); }
.lock-go { width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(255,255,255,0.25); color: #fff; font-size: 16px; cursor: pointer; backdrop-filter: blur(20px); }
.lock-go:hover { background: rgba(255,255,255,0.4); }
.lock-hint { font-size: 12px; opacity: 0.7; margin-top: 4px; }

/* ============================================================
   DESKTOP + WALLPAPER
   ============================================================ */
.desktop { position: fixed; inset: 0; overflow: hidden; }
.wallpaper {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  transition: opacity 0.8s ease;
}
.desktop-icons { position: absolute; top: 40px; right: 16px; z-index: 1; display: flex; flex-direction: column; flex-wrap: wrap; gap: 6px; align-content: flex-start; height: calc(100% - 160px); }
.desk-icon { width: 88px; padding: 8px 4px 6px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: default; text-align: center; }
.desk-icon:hover { background: rgba(255,255,255,0.12); }
.desk-icon.sel { background: rgba(10,132,255,0.35); }
.desk-icon .di-img { width: 52px; height: 52px; display: grid; place-items: center; }
.desk-icon .di-img svg, .desk-icon .di-img img { width: 52px; height: 52px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35)); }
.desk-icon .di-label { font-size: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.8); padding: 1px 5px; border-radius: 4px; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   MENU BAR
   ============================================================ */
.menubar {
  position: absolute; top: 0; left: 0; right: 0; height: 28px; z-index: 500;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; color: var(--menubar-text);
  font-size: 13.5px; font-weight: 500;
  background: linear-gradient(rgba(0,0,0,0.22), rgba(0,0,0,0.05));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  text-shadow: 0 0 2px rgba(0,0,0,0.25);
}
.menubar-left, .menubar-right { display: flex; align-items: center; height: 100%; gap: 1px; }
.menu-item { padding: 2px 9px; height: 22px; display: flex; align-items: center; border-radius: 6px; cursor: default; }
.menu-item:hover, .menu-item.active { background: rgba(255,255,255,0.22); }
.menu-appname b { font-weight: 700; }
.status-item { padding: 2px 7px; height: 22px; display: flex; align-items: center; gap: 4px; border-radius: 6px; cursor: default; }
.status-item:hover, .status-item.active { background: rgba(255,255,255,0.22); }
.battery-pct { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.battery-fill { transition: width 0.4s ease; }
.status-clock { font-variant-numeric: tabular-nums; }

/* dropdown menus */
.menu-dropdown {
  position: absolute; z-index: 1200; min-width: 200px;
  border-radius: 10px; padding: 5px; color: var(--text);
  font-size: 13.5px; font-weight: 400;
  animation: menuPop 0.13s ease;
}
@keyframes menuPop { from { opacity: 0; transform: translateY(-6px) scale(0.98);} to { opacity: 1; transform: none;} }
.menu-row { padding: 5px 10px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; gap: 24px; cursor: default; white-space: nowrap; }
.menu-row:hover:not(.disabled):not(.sep) { background: var(--accent); color: #fff; }
.menu-row.disabled { color: var(--text-faint); }
.menu-row .shortcut { font-size: 12px; opacity: 0.6; }
.menu-row:hover:not(.disabled) .shortcut { opacity: 0.9; }
.menu-sep { height: 1px; background: var(--sep); margin: 5px 8px; }

/* ============================================================
   WINDOWS
   ============================================================ */
.window-layer { position: absolute; inset: 0; z-index: 100; }
.window {
  position: absolute; min-width: 320px; min-height: 200px;
  border-radius: var(--radius-win);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,0.45), 0 8px 20px rgba(0,0,0,0.3), 0 0 0 0.5px rgba(0,0,0,0.25);
  background: var(--win-bg, rgba(246,246,248,0.86));
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  animation: winOpen 0.26s cubic-bezier(.2,.8,.2,1);
  transition: opacity .18s, transform .22s cubic-bezier(.2,.8,.2,1);
}
html[data-theme="dark"] .window { background: var(--win-bg, rgba(38,38,42,0.86)); box-shadow: 0 30px 70px rgba(0,0,0,0.65), 0 8px 20px rgba(0,0,0,0.5), 0 0 0 0.5px rgba(255,255,255,0.12); }
@keyframes winOpen { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
.window.closing { opacity: 0; transform: scale(0.9); }
.window.minimizing { transition: transform .38s cubic-bezier(.5,0,.7,1), opacity .38s; }
.window.inactive { box-shadow: 0 18px 40px rgba(0,0,0,0.3), 0 0 0 0.5px rgba(0,0,0,0.18); }

.titlebar {
  height: 40px; flex: 0 0 40px; display: flex; align-items: center;
  padding: 0 14px; gap: 8px; cursor: default; position: relative;
  border-bottom: 0.5px solid var(--sep);
  background: linear-gradient(var(--tb-top, rgba(255,255,255,0.10)), rgba(255,255,255,0));
}
.traffic { display: flex; gap: 8px; align-items: center; }
.light { width: 12px; height: 12px; border-radius: 50%; position: relative; cursor: pointer; border: 0.5px solid rgba(0,0,0,0.12); }
.light.close { background: #ff5f57; }
.light.min { background: #febc2e; }
.light.zoom { background: #28c840; }
.light span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9px; color: rgba(0,0,0,0.55); opacity: 0; font-weight: 700; }
.traffic:hover .light span { opacity: 1; }
.title-text { position: absolute; left: 0; right: 0; text-align: center; font-size: 13.5px; font-weight: 600; color: var(--text); pointer-events: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 90px; }
.titlebar-tools { margin-left: auto; display: flex; gap: 6px; z-index: 2; }
.tb-btn { width: 28px; height: 24px; border-radius: 6px; border: none; background: transparent; color: var(--text-dim); cursor: default; display: grid; place-items: center; }
.tb-btn:hover { background: rgba(128,128,128,0.2); color: var(--text); }
.window-body { flex: 1; overflow: hidden; position: relative; display: flex; min-height: 0; }
.resize-handle { position: absolute; z-index: 5; }
.rh-r { top:0; right:0; width:6px; height:100%; cursor: ew-resize; }
.rh-b { left:0; bottom:0; width:100%; height:6px; cursor: ns-resize; }
.rh-l { top:0; left:0; width:6px; height:100%; cursor: ew-resize; }
.rh-t { top:0; left:0; width:100%; height:6px; cursor: ns-resize; }
.rh-br { right:0; bottom:0; width:14px; height:14px; cursor: nwse-resize; }
.rh-bl { left:0; bottom:0; width:14px; height:14px; cursor: nesw-resize; }
.rh-tr { right:0; top:0; width:14px; height:14px; cursor: nesw-resize; }
.rh-tl { left:0; top:0; width:14px; height:14px; cursor: nwse-resize; }

/* ============================================================
   DOCK
   ============================================================ */
.dock-wrap { position: absolute; left: 0; right: 0; bottom: 6px; z-index: 400; display: flex; justify-content: center; pointer-events: none; }
.dock {
  pointer-events: auto;
  display: flex; align-items: flex-end; gap: 6px;
  padding: 7px 8px; border-radius: 22px;
  height: 68px;
  --glass-blur: 22px;
}
.dock-item { position: relative; width: 52px; height: 52px; display: flex; align-items: flex-end; justify-content: center; transition: width .16s ease, height .16s ease, margin .16s ease; cursor: pointer; }
.dock-item img, .dock-item .app-glyph { width: 52px; height: 52px; border-radius: 12px; transition: transform .16s ease; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); }
.dock-item .tooltip {
  position: absolute; top: -40px; left: 50%; transform: translateX(-50%) scale(0.9);
  padding: 4px 10px; border-radius: 8px; font-size: 12.5px; white-space: nowrap;
  color: var(--text); opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s;
  background: var(--glass-tint-strong); backdrop-filter: blur(20px); border: 0.5px solid var(--glass-border);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.dock-item:hover .tooltip { opacity: 1; transform: translateX(-50%) scale(1); }
.dock-item .run-dot { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--text-dim); opacity: 0; }
.dock-item.running .run-dot { opacity: 1; }
.dock-sep { width: 1px; height: 44px; align-self: center; background: var(--sep); margin: 0 4px; }
@keyframes dockBounce { 0%,100%{ transform: translateY(0);} 30%{ transform: translateY(-26px);} 55%{transform: translateY(0);} 75%{transform: translateY(-10px);} }
.dock-item.bounce img, .dock-item.bounce .app-glyph { animation: dockBounce .55s ease 2; }

/* generic app glyph */
.app-glyph { display: grid; place-items: center; color: #fff; font-weight: 700; }

/* ============================================================
   CONTROL CENTER / SPOTLIGHT / PANELS
   ============================================================ */
.overlay-layer, .menu-dropdown-layer, .context-menu-layer { position: absolute; inset: 0; z-index: 1100; pointer-events: none; }
.overlay-layer > *, .menu-dropdown-layer > *, .context-menu-layer > * { pointer-events: auto; }

.control-center {
  position: absolute; top: 34px; right: 8px; width: 320px;
  border-radius: 22px; padding: 12px; display: grid; gap: 10px;
  grid-template-columns: 1fr 1fr;
  animation: menuPop 0.16s ease;
}
.cc-tile { border-radius: 16px; padding: 12px; background: rgba(128,128,128,0.18); display: flex; flex-direction: column; gap: 8px; }
.cc-tile.wide { grid-column: span 2; }
.cc-tile.tall { grid-row: span 2; }
.cc-row { display: flex; align-items: center; gap: 10px; }
.cc-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(140,140,150,0.4); color: #fff; flex: 0 0 30px; }
.cc-ico.on { background: var(--accent); }
.cc-ico.green.on { background: var(--accent-2); }
.cc-label { display: flex; flex-direction: column; line-height: 1.15; font-size: 13px; }
.cc-label small { font-size: 11px; color: var(--text-dim); }
.cc-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; border-radius: 14px; background: rgba(160,160,170,0.4); outline: none; overflow: hidden; }
.cc-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: -200px 0 0 190px rgba(255,255,255,0.55), 0 1px 3px rgba(0,0,0,0.3); cursor: pointer; }
.cc-title { font-size: 12px; color: var(--text-dim); font-weight: 600; }

.spotlight-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.001); z-index: 1300; display: flex; align-items: flex-start; justify-content: center; padding-top: 9vh; animation: fadeIn .12s; }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }
.spotlight { width: 640px; max-width: 92vw; border-radius: 26px; overflow: hidden; animation: menuPop .16s ease; }
.spot-input-row { display: flex; align-items: center; gap: 14px; padding: 15px 22px; }
.spot-input-row .spot-lead { flex: 0 0 22px; color: var(--text-dim); display:grid; place-items:center; }
.spot-input { flex: 1; background: transparent; border: none; outline: none; font-size: 22px; color: var(--text); font-weight: 400; }
.spot-mic { flex: 0 0 30px; width:30px; height:30px; border-radius:50%; display:grid; place-items:center; cursor:pointer; background: rgba(128,128,128,0.14); }
.spot-mic:hover { background: rgba(128,128,128,0.26); }
.spot-mic .siri-orb { width:16px; height:16px; }
.spot-results { max-height: 320px; overflow-y: auto; border-top: 0.5px solid var(--sep); }
.spot-result { display: flex; align-items: center; gap: 12px; padding: 8px 16px; cursor: default; }
.spot-result.sel { background: var(--accent); color: #fff; }
.spot-result .sr-ico { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 30px; }
.spot-result .sr-ico img, .spot-result .sr-ico svg { width: 30px; height: 30px; border-radius: 7px; }
.spot-result .sr-title { font-size: 14px; font-weight: 500; }
.spot-result .sr-sub { font-size: 12px; opacity: 0.65; }

/* context menu */
.context-menu { position: absolute; min-width: 190px; border-radius: 10px; padding: 5px; font-size: 13.5px; animation: menuPop .1s ease; }

/* pull-to-refresh (Safari/Mail/Calendar) */
@keyframes spin { to { transform: rotate(360deg); } }
.ptr { position: absolute; top: 6px; left: 50%; transform: translate(-50%,-46px); opacity: 0; z-index: 8; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; pointer-events: none; background: var(--glass-tint-strong); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); border: 0.5px solid var(--glass-border); box-shadow: 0 6px 16px rgba(0,0,0,0.22); transition: opacity .15s, transform .18s cubic-bezier(.2,.8,.2,1); }
.ptr-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text-faint); border-top-color: var(--accent); }
.ptr.spinning .ptr-spin { animation: spin .7s linear infinite; }

/* notifications */
.notif-layer { position: absolute; top: 34px; right: 10px; z-index: 1250; display: flex; flex-direction: column; gap: 10px; width: 340px; pointer-events: none; }
.notif { pointer-events: auto; border-radius: 16px; padding: 12px 14px; display: flex; gap: 10px; animation: notifIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes notifIn { from { opacity: 0; transform: translateX(30px);} to { opacity: 1; transform: none; } }
.notif.out { animation: notifOut .3s forwards; }
@keyframes notifOut { to { opacity: 0; transform: translateX(40px); } }
.notif .n-ico { width: 38px; height: 38px; border-radius: 9px; flex: 0 0 38px; display: grid; place-items: center; }
.notif .n-ico img, .notif .n-ico svg { width: 38px; height: 38px; border-radius: 9px; }
.notif .n-body { flex: 1; min-width: 0; }
.notif .n-title { font-size: 13px; font-weight: 700; }
.notif .n-sub { font-size: 12.5px; color: var(--text-dim); }
.notif .n-app { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .3px; }

/* ============================================================
   Buttons / form controls (shared, glassy)
   ============================================================ */
.btn { border: none; border-radius: 9px; padding: 7px 14px; font-size: 13px; font-weight: 500; cursor: pointer; background: rgba(128,128,128,0.16); color: var(--text); transition: background .12s; }
.btn:hover { background: rgba(128,128,128,0.28); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #2a95ff; }
.switch { position: relative; width: 42px; height: 25px; border-radius: 13px; background: rgba(140,140,150,0.4); cursor: pointer; transition: background .18s; flex: 0 0 42px; }
.switch::after { content:""; position:absolute; top:2px; left:2px; width:21px; height:21px; border-radius:50%; background:#fff; box-shadow:0 1px 3px rgba(0,0,0,0.3); transition: left .18s; }
.switch.on { background: var(--accent-2); }
.switch.on::after { left: 19px; }
.field { background: rgba(128,128,128,0.14); border: 0.5px solid var(--sep); border-radius: 8px; padding: 7px 11px; font-size: 13px; color: var(--text); outline: none; width: 100%; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,132,255,0.25); }

/* ============================================================
   APP-SPECIFIC LAYOUTS  (see js/apps.js)
   ============================================================ */
.app { width: 100%; height: 100%; display: flex; overflow: hidden; color: var(--text); font-size: 14px; }
.sidebar { width: 200px; flex: 0 0 200px; background: rgba(128,128,128,0.06); border-right: 0.5px solid var(--sep); overflow-y: auto; padding: 10px 8px; }
html[data-theme="dark"] .sidebar { background: rgba(0,0,0,0.14); }
.sb-title { font-size: 11px; font-weight: 700; color: var(--text-dim); padding: 8px 8px 3px; text-transform: uppercase; letter-spacing: .3px; }
.sb-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: default; font-size: 13.5px; }
.sb-item:hover { background: rgba(128,128,128,0.14); }
.sb-item.active { background: var(--accent); color: #fff; }
.sb-item .sb-ico { width: 18px; height: 18px; display: grid; place-items: center; flex: 0 0 18px; }
.main { flex: 1; overflow: auto; min-width: 0; display: flex; flex-direction: column; }
.content-pad { padding: 18px 22px; }

/* Finder */
.finder-toolbar { height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 0.5px solid var(--sep); }
.finder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px,1fr)); gap: 10px; padding: 18px; }
.finder-file { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border-radius: 10px; cursor: default; text-align: center; }
.finder-file:hover { background: rgba(128,128,128,0.12); }
.finder-file.sel { background: rgba(10,132,255,0.28); }
.finder-file .ff-ico { width: 52px; height: 52px; display: grid; place-items: center; font-size: 42px; }
.finder-file .ff-name { font-size: 12.5px; word-break: break-word; }

/* Calculator */
.calc { display: flex; flex-direction: column; width: 100%; height: 100%; background: #1c1c1e; }
html[data-theme="light"] .calc { background: #2a2a2c; }
.calc-display { flex: 1; display: flex; align-items: flex-end; justify-content: flex-end; padding: 16px 22px; color: #fff; font-size: 60px; font-weight: 300; overflow: hidden; }
.calc-pad { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; padding: 8px; gap: 8px; }
.calc-key { border: none; border-radius: 50%; aspect-ratio: 1; font-size: 24px; font-weight: 500; color: #fff; background: #505050; cursor: pointer; transition: filter .1s; }
.calc-key:active { filter: brightness(1.4); }
.calc-key.op { background: #ff9f0a; }
.calc-key.fn { background: #d4d4d2; color: #1c1c1e; }
.calc-key.zero { aspect-ratio: auto; border-radius: 40px; grid-column: span 2; text-align: left; padding-left: 28px; }

/* Terminal */
.term { width: 100%; height: 100%; background: rgba(20,20,22,0.9); color: #e6e6e6; font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 13px; padding: 12px 14px; overflow-y: auto; line-height: 1.5; }
.term .prompt-user { color: #34c759; }
.term .prompt-path { color: #0a84ff; }
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-input-line { display: flex; }
.term-input { flex: 1; background: transparent; border: none; outline: none; color: #e6e6e6; font-family: inherit; font-size: 13px; }

/* Notes */
.notes-list { width: 240px; flex: 0 0 240px; border-right: 0.5px solid var(--sep); overflow-y: auto; }
.note-item { padding: 12px 16px; border-bottom: 0.5px solid var(--sep); cursor: default; }
.note-item:hover { background: rgba(128,128,128,0.08); }
.note-item.active { background: rgba(255,214,10,0.22); }
.note-item .ni-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item .ni-prev { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes-editor { flex: 1; display: flex; flex-direction: column; }
.notes-textarea { flex: 1; border: none; outline: none; resize: none; padding: 22px 28px; font-size: 15px; line-height: 1.6; background: transparent; color: var(--text); }

/* Messages / Mail generic list-detail */
.msg-list { width: 260px; flex: 0 0 260px; border-right: 0.5px solid var(--sep); overflow-y: auto; }
.msg-row { display: flex; gap: 10px; padding: 10px 14px; cursor: default; border-bottom: 0.5px solid var(--sep); }
.msg-row:hover { background: rgba(128,128,128,0.08); }
.msg-row.active { background: rgba(10,132,255,0.16); }
.msg-avatar { width: 42px; height: 42px; border-radius: 50%; flex: 0 0 42px; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 16px; }
.msg-thread { flex: 1; display: flex; flex-direction: column; }
.msg-scroll { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 70%; padding: 8px 13px; border-radius: 18px; font-size: 14px; line-height: 1.35; }
.bubble.them { align-self: flex-start; background: rgba(128,128,128,0.22); }
.bubble.me { align-self: flex-end; background: var(--accent); color: #fff; }
.msg-compose { display: flex; gap: 8px; padding: 12px; border-top: 0.5px solid var(--sep); }
.msg-compose input { flex: 1; border-radius: 18px; padding: 9px 15px; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 4px; padding: 6px; }
.photo-cell { aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #333; cursor: pointer; }
.photo-cell div { width: 100%; height: 100%; }

/* Calendar */
.cal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; }
.cal-title { font-size: 22px; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); flex: 1; }
.cal-dow { text-align: right; padding: 6px 10px; font-size: 11px; font-weight: 700; color: var(--text-dim); border-bottom: 0.5px solid var(--sep); text-transform: uppercase; }
.cal-cell { border-right: 0.5px solid var(--sep); border-bottom: 0.5px solid var(--sep); padding: 6px 8px; min-height: 74px; font-size: 13px; }
.cal-cell .cal-num { font-weight: 500; }
.cal-cell.today .cal-num { background: #ff3b30; color: #fff; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal-cell.other { color: var(--text-faint); }
.cal-event { font-size: 11px; background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Settings */
.settings-list { padding: 4px; }
.set-group { background: rgba(128,128,128,0.08); border-radius: 12px; margin: 10px 0; overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 0.5px solid var(--sep); }
.set-row:last-child { border-bottom: none; }
.set-row .set-label { flex: 1; font-size: 14px; }
.set-row .set-sub { font-size: 12px; color: var(--text-dim); }
.wall-picker { display: grid; grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap: 12px; }
.wall-thumb { aspect-ratio: 16/10; border-radius: 12px; cursor: pointer; overflow: hidden; border: 2px solid transparent; background-size: cover; background-position: center; }
.wall-thumb.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* Safari */
.safari { display: flex; flex-direction: column; width: 100%; height: 100%; }
.safari-bar { height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 0.5px solid var(--sep); }
.safari-nav { width: 30px; height: 28px; border-radius: 7px; border: none; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 15px; }
.safari-nav:hover { background: rgba(128,128,128,0.16); color: var(--text); }
.safari-url { flex: 1; text-align: center; background: rgba(128,128,128,0.14); border: none; border-radius: 9px; padding: 7px 14px; font-size: 13px; color: var(--text); outline: none; }
.safari-url:focus { background: rgba(128,128,128,0.2); box-shadow: 0 0 0 3px rgba(10,132,255,0.25); }
.safari-view { flex: 1; overflow: auto; }
.safari-view iframe { width: 100%; height: 100%; border: none; background: #fff; }
.start-page { padding: 40px; display: flex; flex-direction: column; align-items: center; gap: 24px; height: 100%; overflow:auto; }
.start-title { font-size: 26px; font-weight: 700; }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(90px,1fr)); gap: 18px; width: 100%; max-width: 600px; }
.fav { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.fav-ico { width: 60px; height: 60px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 26px; font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.fav-name { font-size: 12px; }

/* Music */
.music { display:flex; width:100%; height:100%; }
.music-main { flex:1; display:flex; flex-direction:column; }
.now-playing { padding: 24px; display: flex; gap: 20px; align-items: center; border-bottom: 0.5px solid var(--sep); }
.np-art { width: 120px; height: 120px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); flex: 0 0 120px; }
.np-info h2 { font-size: 22px; } .np-info p { color: var(--text-dim); font-size: 15px; margin-top:4px; }
.music-controls { display:flex; align-items:center; gap:20px; margin-top:16px; }
.music-controls button { background:none; border:none; color:var(--text); font-size:22px; cursor:pointer; }
.track-row { display:flex; align-items:center; gap:12px; padding:10px 16px; border-bottom:0.5px solid var(--sep); cursor:default; }
.track-row:hover { background: rgba(128,128,128,0.1); }
.track-row.playing { color: var(--accent); }
.track-num { width:24px; text-align:center; color:var(--text-dim); }
.track-title { flex:1; }
.track-time { color: var(--text-dim); font-size:13px; }

/* generic centered placeholder */
.app-center { width:100%; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px; color: var(--text-dim); text-align:center; padding:30px; }
.app-center .big-ico { width:96px; height:96px; }

/* Weather */
.weather { width:100%;height:100%; background: linear-gradient(160deg,#3a7bd5,#4a90d9 50%,#8ec5e6); color:#fff; display:flex; flex-direction:column; }
.wx-cur { text-align:center; padding: 30px 20px 10px; }
.wx-city { font-size:26px; font-weight:600; }
.wx-temp { font-size:78px; font-weight:200; line-height:1; }
.wx-cond { font-size:16px; opacity:.95; }
.wx-hourly { display:flex; gap:8px; overflow-x:auto; padding:16px; }
.wx-hour { display:flex; flex-direction:column; align-items:center; gap:8px; min-width:52px; font-size:13px; }
.wx-days { padding: 0 16px 16px; }
.wx-day { display:flex; align-items:center; gap:14px; padding:8px 6px; border-top:1px solid rgba(255,255,255,0.2); font-size:14px; }
.wx-day .d-name { width:90px; }

/* app store */
.store-hero { border-radius:16px; padding:26px; color:#fff; background:linear-gradient(135deg,#5e5ce6,#bf5af2); margin-bottom:18px; }
.store-card { display:flex; gap:14px; align-items:center; padding:12px 0; border-bottom:0.5px solid var(--sep); }
.store-card .sc-ico { width:60px;height:60px;border-radius:14px; flex:0 0 60px; }
.store-card .sc-info { flex:1; }
.store-card .sc-name { font-weight:600; }
.store-card .sc-sub { font-size:12px; color:var(--text-dim); }
.get-btn { background: rgba(128,128,128,0.2); color: var(--accent); font-weight:700; border:none; border-radius:20px; padding:5px 18px; cursor:pointer; font-size:13px; }

/* maps */
.maps { width:100%;height:100%; position:relative; overflow:hidden; background:#e8eef2; }
html[data-theme="dark"] .maps { background:#1a2530; }
.map-search { position:absolute; top:14px; left:14px; width:280px; z-index:5; border-radius:10px; }
.map-search input { width:100%; padding:9px 14px; }

/* stickies / textedit */
.textedit { width:100%; height:100%; }
.textedit textarea { width:100%; height:100%; border:none; outline:none; resize:none; padding:20px 26px; font-size:15px; line-height:1.6; background:transparent; color:var(--text); font-family: "SF Mono", ui-monospace, monospace; }

/* reminders */
.rem-item { display:flex; align-items:center; gap:12px; padding:10px 4px; border-bottom:0.5px solid var(--sep); }
.rem-check { width:22px;height:22px;border-radius:50%; border:1.6px solid var(--text-faint); cursor:pointer; flex:0 0 22px; display:grid; place-items:center; }
.rem-check.done { background: var(--accent); border-color: var(--accent); color:#fff; }
.rem-item.done .rem-text { color: var(--text-faint); text-decoration: line-through; }

/* clock */
.clock-face { width:100%;height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; }
.clock-big { font-size:72px; font-weight:200; font-variant-numeric:tabular-nums; }
.clock-date { font-size:18px; color:var(--text-dim); }

@media (max-width: 640px) {
  .window { min-width: 260px; }
  .lock-time { font-size: 64px; }
  .sidebar, .notes-list, .msg-list { width: 150px; flex-basis: 150px; }
}
