/* ---------- Tokens ---------- */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, "Segoe UI", system-ui, sans-serif;
  --accent: #2F7CF6;
  --accent-soft: rgba(47, 124, 246, .14);
  --ink: #18203D;
  --apricot: #F6C27E;

  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #8E8E93;
  --win-bg: rgba(250, 250, 252, .9);
  --win-solid: #FFFFFF;
  --sidebar: rgba(236, 237, 242, .72);
  --toolbar: rgba(246, 246, 249, .9);
  --hair: rgba(0, 0, 0, .09);
  --hair-strong: rgba(0, 0, 0, .14);
  --field: rgba(0, 0, 0, .05);
  --paper-desk: #E4E5EA;
  --menu-bg: rgba(246, 246, 249, .93);
  --shadow-win: 0 0 0 .5px rgba(0, 0, 0, .18), 0 22px 60px rgba(10, 14, 36, .38), 0 6px 18px rgba(10, 14, 36, .22);
  --shadow-win-blur: 0 0 0 .5px rgba(0, 0, 0, .14), 0 12px 32px rgba(10, 14, 36, .22);

  --menubar-h: 28px;
  --radius-win: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #F2F2F5; --text-2: #A1A1AA; --text-3: #7C7C85;
    --win-bg: rgba(34, 35, 42, .84); --win-solid: #1E1F25; --sidebar: rgba(44, 45, 54, .66);
    --toolbar: rgba(40, 41, 49, .9); --hair: rgba(255, 255, 255, .08); --hair-strong: rgba(255, 255, 255, .14);
    --field: rgba(255, 255, 255, .07); --paper-desk: #2A2B31; --menu-bg: rgba(40, 41, 49, .93);
    --accent-soft: rgba(80, 150, 255, .2);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --text: #F2F2F5; --text-2: #A1A1AA; --text-3: #7C7C85;
  --win-bg: rgba(34, 35, 42, .84); --win-solid: #1E1F25; --sidebar: rgba(44, 45, 54, .66);
  --toolbar: rgba(40, 41, 49, .9); --hair: rgba(255, 255, 255, .08); --hair-strong: rgba(255, 255, 255, .14);
  --field: rgba(255, 255, 255, .07); --paper-desk: #2A2B31; --menu-bg: rgba(40, 41, 49, .93);
  --accent-soft: rgba(80, 150, 255, .2);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--ink) url("../assets/wallpaper.svg") center / cover no-repeat fixed;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.g { width: 16px; height: 16px; flex: none; }
.ic { display: block; width: 100%; height: 100%; overflow: visible; }
.noscript { color: #fff; padding: 40px; font-size: 16px; }
.noscript a { color: #fff; text-decoration: underline; }

/* ---------- Boot ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100; background: #05060A;
  display: grid; place-content: center; justify-items: center; gap: 44px;
  transition: opacity .5s ease;
}
.boot.is-done { opacity: 0; pointer-events: none; }
.boot-mark { font-family: var(--font-display); font-weight: 600; font-size: 64px; letter-spacing: -2px; color: #F5F5F7; }
.boot-bar { width: 180px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.18); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 0; background: #F5F5F7; border-radius: 3px; animation: boot 1.1s cubic-bezier(.4,.1,.3,1) forwards; }
@keyframes boot { 60% { width: 72%; } 100% { width: 100%; } }

/* ---------- Avatar ---------- */
.avatar {
  --size: 40px;
  width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(160deg, #4A578C, #1B2142);
  color: #fff; font-family: var(--font-display); font-weight: 600; font-size: calc(var(--size) * .36); letter-spacing: -.02em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.avatar { position: relative; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { --size: 104px; box-shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.2); }

/* ---------- Lock screen ---------- */
.lock {
  position: fixed; inset: 0; z-index: 50; color: #fff;
  display: grid; grid-template-rows: 1fr auto; justify-items: center;
  padding: 9vh 24px max(11vh, env(safe-area-inset-bottom));
  background: rgba(12, 16, 36, .18);
  backdrop-filter: blur(26px) saturate(140%); -webkit-backdrop-filter: blur(26px) saturate(140%);
  transition: opacity .45s ease, transform .45s ease, backdrop-filter .45s ease;
}
.lock.is-leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }
.lock-clock { text-align: center; text-shadow: 0 2px 20px rgba(0,0,0,.2); }
.lock-date { font-size: 21px; font-weight: 600; opacity: .92; }
.lock-time { font-family: var(--font-display); font-size: clamp(84px, 13vw, 132px); font-weight: 700; line-height: 1; letter-spacing: -.04em; margin-top: 4px; color: rgba(255,255,255,.94); }
.lock-user { display: grid; justify-items: center; gap: 12px; }
.lock-name { margin: 2px 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.lock-field {
  position: relative; display: flex; align-items: center; width: 200px; height: 30px;
  border-radius: 15px; background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 .5px rgba(255,255,255,.3);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.lock-field input { all: unset; flex: 1; padding: 0 34px 0 14px; font-size: 12px; color: rgba(255,255,255,.72); }
.lock-go { position: absolute; right: 4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.88); color: #2A3150; cursor: pointer; }
.lock-go .g { width: 13px; height: 13px; stroke-width: 2.4; }
.lock-hint { margin: 2px 0 0; font-size: 11px; color: rgba(255,255,255,.66); }
.hint-mobile { display: none; }

/* ---------- Menu bar ---------- */
.desktop { position: fixed; inset: 0; }
.menubar {
  position: absolute; inset: 0 0 auto; height: var(--menubar-h); z-index: 30;
  display: flex; align-items: center; gap: 2px; padding: 0 10px;
  color: #fff; font-size: 13px;
  background: rgba(14, 18, 40, .26);
  backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%);
  text-shadow: 0 1px 1px rgba(0,0,0,.15);
}
.mb-item { height: 22px; padding: 0 9px; border-radius: 5px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.mb-item:hover, .mb-item.is-open { background: rgba(255,255,255,.2); }
.mb-logo { font-family: var(--font-display); font-weight: 700; letter-spacing: -.5px; font-size: 13px; padding: 0 10px; }
.mb-app { font-weight: 700; }
.mb-spacer { flex: 1; }
.mb-status { display: flex; align-items: center; gap: 2px; }
.mb-status .g { width: 15px; height: 15px; }
.mb-clock { font-variant-numeric: tabular-nums; }

.menu {
  position: absolute; top: calc(var(--menubar-h) - 2px); min-width: 220px; z-index: 40;
  padding: 5px; border-radius: 9px; color: var(--text); text-shadow: none;
  background: var(--menu-bg);
  backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 0 0 .5px var(--hair-strong), 0 12px 34px rgba(0,0,0,.25);
}
.menu button { width: 100%; height: 24px; padding: 0 10px 0 22px; border-radius: 5px; display: flex; align-items: center; gap: 10px; text-align: left; position: relative; }
.menu button:hover, .menu button:focus-visible { background: var(--accent); color: #fff; outline: none; }
.menu button .kbd { margin-left: auto; color: var(--text-3); }
.menu button:hover .kbd, .menu button:focus-visible .kbd { color: rgba(255,255,255,.8); }
.menu button[aria-checked="true"]::before { content: "✓"; position: absolute; left: 7px; font-size: 11px; }
.menu hr { border: 0; height: 1px; margin: 5px 10px; background: var(--hair-strong); }

/* ---------- Widgets ---------- */
.widgets { position: absolute; top: calc(var(--menubar-h) + 22px); left: 22px; display: grid; gap: 16px; width: 168px; z-index: 1; }
.widget {
  border-radius: 22px; padding: 14px 15px; color: var(--text); text-align: left;
  background: var(--win-bg);
  backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%);
  box-shadow: 0 0 0 .5px var(--hair-strong), 0 8px 24px rgba(10,14,36,.2);
}
button.widget { cursor: pointer; width: 100%; }
.w-now { display: grid; gap: 10px; }
.w-now .w-name { font-weight: 650; font-size: 14px; letter-spacing: -.01em; }
.w-now .w-sub { color: var(--text-2); font-size: 12px; line-height: 1.35; }
.w-now .w-place { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 11px; }
.w-now .w-place .g { width: 12px; height: 12px; }
.w-cert-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.w-cert-label { font-size: 12px; font-weight: 600; color: #B7790B; white-space: nowrap; }
.w-cert-num { font-family: var(--font-display); font-size: 40px; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; margin: 4px 0 2px; }
.w-cert-sub { font-size: 11px; color: var(--text-2); }
.w-bars { display: grid; gap: 5px; margin-top: 10px; }
.w-bar { display: grid; grid-template-columns: 1fr 26px; align-items: center; gap: 6px; font-size: 10px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.w-bar i { position: relative; display: block; height: 5px; border-radius: 3px; background: var(--field); overflow: hidden; }
.w-bar i::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--pass); width: 1.5px; background: var(--text); opacity: .55; }
.w-cert-pass { flex: none; font-size: 10px; font-weight: 600; color: var(--text-2); padding: 1px 6px; border-radius: 8px; background: var(--field); white-space: nowrap; }
.w-bar i b { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #F5B841, #E3920F); }

/* ---------- Desktop icons ---------- */
.desk-icons {
  position: absolute; top: calc(var(--menubar-h) + 14px); right: 14px; bottom: 96px;
  display: flex; flex-direction: column; flex-wrap: wrap-reverse; align-content: flex-start; gap: 6px; z-index: 1;
}
.desk-icon { width: 92px; padding: 6px 4px 4px; border-radius: 8px; display: grid; justify-items: center; gap: 4px; cursor: default; }
.desk-icon .art { width: 62px; height: 62px; padding: 3px; border-radius: 10px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.28)); }
.desk-icon .label {
  max-width: 88px; padding: 1px 5px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 500; line-height: 1.25; text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,.55);
}
.desk-icon.is-selected .art { background: rgba(0,0,0,.24); box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.desk-icon.is-selected .label { background: var(--accent); text-shadow: none; }
.desk-icon:focus-visible { outline-offset: 0; }

/* ---------- Windows ---------- */
.windows { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.win {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column;
  min-width: 300px; min-height: 200px; border-radius: var(--radius-win); overflow: hidden;
  background: var(--win-bg); color: var(--text);
  backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow: var(--shadow-win-blur);
  transform-origin: 50% 40%;
  animation: win-in .22s cubic-bezier(.2,.9,.3,1.2);
}
.win.is-focused { box-shadow: var(--shadow-win); }
.win.is-resizable { resize: both; }
.win.is-closing { animation: win-out .16s ease-in forwards; }
.win.is-min { display: none; }
.win.is-zoomed { border-radius: 0; resize: none; }
.win.is-animating { transition: transform .32s cubic-bezier(.5,0,.3,1), opacity .32s ease; }
@keyframes win-in { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes win-out { to { opacity: 0; transform: scale(.95); } }

.titlebar {
  flex: none; height: 38px; display: flex; align-items: center; gap: 12px; padding: 0 12px;
  border-bottom: 1px solid var(--hair); touch-action: none;
}
.win.is-bare .titlebar { border-bottom-color: transparent; }
.lights { display: flex; gap: 8px; }
.light { width: 12px; height: 12px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.16); }
.light .g { width: 8px; height: 8px; stroke-width: 3; opacity: 0; color: rgba(0,0,0,.55); }
.lights:hover .light .g, .light:focus-visible .g { opacity: 1; }
.light-close { background: #FF5F57; }
.light-min { background: #FEBC2E; }
.light-zoom { background: #28C840; }
.win:not(.is-focused) .light { background: var(--hair-strong); }
.win:not(.is-focused) .lights:hover .light-close { background: #FF5F57; }
.win:not(.is-focused) .lights:hover .light-min { background: #FEBC2E; }
.win:not(.is-focused) .lights:hover .light-zoom { background: #28C840; }
.light.is-disabled { background: var(--hair-strong) !important; pointer-events: none; }
.win-title { flex: 1; text-align: center; font-weight: 600; font-size: 13px; color: var(--text); margin-right: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win:not(.is-focused) .win-title { color: var(--text-3); }
.win-tools { display: flex; gap: 6px; margin-left: auto; }
.win-body { flex: 1; min-height: 0; overflow: auto; container-type: inline-size; user-select: text; }

/* ---------- Dock ---------- */
.dock-wrap { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; pointer-events: none; z-index: 20; }
.dock {
  pointer-events: auto; display: flex; align-items: flex-end; gap: 4px; padding: 6px 8px 7px; height: 72px;
  border-radius: 22px;
  background: rgba(255,255,255,.2);
  box-shadow: inset 0 0 0 .5px rgba(255,255,255,.36), 0 10px 30px rgba(10,14,36,.28);
  backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
}
.dock-item { position: relative; width: 56px; height: 56px; display: grid; place-items: end center; transition: width .16s ease, height .16s ease; }
.dock-item .art { width: 100%; height: 100%; filter: drop-shadow(0 3px 4px rgba(0,0,0,.25)); transform-origin: 50% 100%; }
.dock-item.is-bouncing .art { animation: bounce .7s ease 1; }
@keyframes bounce { 0%, 100% { transform: none; } 30% { transform: translateY(-18px); } 55% { transform: none; } 72% { transform: translateY(-6px); } }
.dock-item::after {
  content: ""; position: absolute; bottom: -5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%;
  background: rgba(255,255,255,.9); opacity: 0; transition: opacity .2s;
}
.dock-item.is-running::after { opacity: 1; }
.dock-tip {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%);
  padding: 4px 10px; border-radius: 6px; white-space: nowrap; font-size: 12.5px; color: var(--text);
  background: var(--menu-bg); box-shadow: 0 0 0 .5px var(--hair-strong), 0 4px 14px rgba(0,0,0,.2);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.dock-item:hover .dock-tip, .dock-item:focus-visible .dock-tip { opacity: 1; }
.dock-sep { width: 1px; height: 46px; margin: 0 6px 5px; background: rgba(255,255,255,.35); }

/* ---------- Spotlight ---------- */
.spotlight { position: fixed; inset: 0; z-index: 60; display: grid; justify-items: center; align-items: start; padding-top: 20vh; }
.spot-panel {
  width: min(640px, calc(100vw - 32px)); border-radius: 18px; overflow: hidden; color: var(--text);
  background: var(--menu-bg);
  backdrop-filter: blur(40px) saturate(180%); -webkit-backdrop-filter: blur(40px) saturate(180%);
  box-shadow: 0 0 0 .5px var(--hair-strong), 0 24px 70px rgba(0,0,0,.35);
  animation: win-in .18s ease;
}
.spot-field { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 18px; }
.spot-glyph .g { width: 22px; height: 22px; color: var(--text-2); }
.spot-field input { all: unset; flex: 1; font-size: 21px; font-weight: 400; color: var(--text); }
.spot-field input::placeholder { color: var(--text-3); }
.spot-results { list-style: none; margin: 0; padding: 0 8px 8px; max-height: 50vh; overflow: auto; border-top: 1px solid var(--hair); }
.spot-results:empty { display: none; }
.spot-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.spot-row { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 8px; cursor: default; }
.spot-row .art { width: 26px; height: 26px; flex: none; }
.spot-row .meta { margin-left: auto; color: var(--text-3); font-size: 12px; }
.spot-row[aria-selected="true"] { background: var(--accent); color: #fff; }
.spot-row[aria-selected="true"] .meta { color: rgba(255,255,255,.8); }

/* ---------- Phone ---------- */
.phone { position: fixed; inset: 0; color: #fff; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.statusbar { display: flex; justify-content: space-between; align-items: center; height: 44px; padding: 0 28px; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.status-icons { display: flex; gap: 6px; }
.status-icons .g { width: 17px; height: 17px; stroke-width: 2; }
.home { flex: 1; display: flex; flex-direction: column; gap: 26px; padding: 14px 22px 0; overflow: auto; }
.home-widget {
  display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 24px; text-align: left; width: 100%;
  background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 .5px rgba(255,255,255,.3);
  backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
}
.home-widget .avatar { --size: 62px; }
.home-widget .hw-name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.home-widget .hw-sub { font-size: 13px; opacity: .85; line-height: 1.35; }
.home-widget .hw-stat { margin-left: auto; text-align: right; }
.home-widget .hw-num { font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: 1; }
.home-widget .hw-lbl { font-size: 10.5px; opacity: .8; white-space: nowrap; }
.home-widget .hw-pass { font-size: 10px; opacity: .65; margin-top: 1px; white-space: nowrap; }
.home-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px 10px; }
.app-tap { display: grid; justify-items: center; gap: 6px; }
.app-tap .art { width: min(64px, 17vw); aspect-ratio: 1; filter: drop-shadow(0 3px 5px rgba(0,0,0,.25)); transition: transform .12s; }
.app-tap:active .art { transform: scale(.92); }
.app-tap .label { font-size: 11.5px; font-weight: 500; text-shadow: 0 1px 3px rgba(0,0,0,.45); white-space: nowrap; }
.home-search {
  align-self: center; margin-top: auto; margin-bottom: 14px; display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 14px; font-size: 13px; font-weight: 500;
  background: rgba(255,255,255,.2); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.home-search .g { width: 13px; height: 13px; stroke-width: 2.4; }
.phone-dock {
  margin: 0 12px 10px; padding: 14px 16px; border-radius: 32px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; justify-items: center;
  background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 .5px rgba(255,255,255,.3);
  backdrop-filter: blur(26px) saturate(170%); -webkit-backdrop-filter: blur(26px) saturate(170%);
}
.phone-dock .label { display: none; }

.sheet {
  position: fixed; inset: 0; top: max(10px, env(safe-area-inset-top)); z-index: 45; display: flex; flex-direction: column;
  border-radius: 14px 14px 0 0; overflow: hidden; color: var(--text); background: var(--win-solid);
  box-shadow: 0 -10px 40px rgba(0,0,0,.35);
  transform: translateY(0); transition: transform .34s cubic-bezier(.2,.9,.25,1);
}
.sheet.is-off { transform: translateY(105%); }
.sheet-head { position: relative; flex: none; height: 54px; display: grid; place-items: center; border-bottom: 1px solid var(--hair); touch-action: none; }
.grabber { position: absolute; top: 6px; width: 36px; height: 5px; border-radius: 3px; background: var(--hair-strong); }
.sheet-title { margin: 6px 0 0; font-size: 16px; font-weight: 600; }
.sheet-done { position: absolute; right: 16px; top: 18px; color: var(--accent); font-size: 16px; font-weight: 600; cursor: pointer; }
.sheet-body { flex: 1; overflow: auto; container-type: inline-size; user-select: text; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }

/* ---------- Mode switch ---------- */
body.is-mobile { background-attachment: scroll; }
body.is-mobile .hint-desktop { display: none; }
body.is-mobile .hint-mobile { display: inline; }
body.is-mobile .lock-field { display: none; }
body.is-mobile .spotlight { padding-top: 12vh; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================= App content ================= */
.pane { padding: 20px 22px; }
.muted { color: var(--text-2); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px; border-radius: 7px;
  font-size: 13px; font-weight: 500; background: var(--win-solid); color: var(--text); cursor: pointer;
  box-shadow: 0 0 0 .5px var(--hair-strong), 0 1px 1.5px rgba(0,0,0,.08);
}
.btn:hover { text-decoration: none; filter: brightness(.98); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 1.5px rgba(0,0,0,.15); }
.btn .g { width: 14px; height: 14px; }

/* About Phil */
.about { display: grid; grid-template-columns: 168px 1fr; gap: 28px; align-items: center; padding: 24px 30px 26px; }
.about-photo { width: 168px; aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 .5px var(--hair-strong), 0 10px 26px rgba(0,0,0,.2); }
.about-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.about .avatar { --size: 150px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.about h2 { margin: 0; font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.about .tag { margin: 2px 0 14px; font-size: 14px; color: var(--text-2); }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 0 0 18px; font-size: 12.5px; }
.specs dt { font-weight: 600; text-align: right; }
.specs dd { margin: 0; color: var(--text-2); }
.about-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@container (max-width: 520px) {
  .about { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 26px 22px; gap: 16px; }
  .about .avatar { --size: 120px; }
  .about-photo { width: 150px; }
  .specs { text-align: left; grid-template-columns: 1fr; gap: 2px; }
  .specs dt { text-align: left; margin-top: 8px; }
  .about-actions { justify-content: center; }
}

/* Finder (Projects) */
.finder { display: grid; grid-template-columns: 180px 1fr 320px; height: 100%; }
.f-side { padding: 12px 10px; background: var(--sidebar); border-right: 1px solid var(--hair); }
.f-side h3 { margin: 6px 8px 6px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.f-side button { width: 100%; height: 28px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-radius: 6px; font-size: 13px; text-align: left; cursor: pointer; }
.f-side button .g { color: var(--accent); }
.f-side button[aria-pressed="true"] { background: var(--hair-strong); font-weight: 500; }
.f-chips { display: none; }
.f-grid { padding: 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); align-content: start; gap: 14px 6px; overflow: auto; }
.f-item { display: grid; justify-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 10px; cursor: pointer; }
.f-item .art { width: 64px; height: 64px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }
.f-item .label { font-size: 12px; font-weight: 500; text-align: center; padding: 1px 6px; border-radius: 4px; }
.f-item .kind { font-size: 11px; color: var(--text-3); text-align: center; }
.f-item[aria-selected="true"] { background: var(--accent-soft); }
.f-item[aria-selected="true"] .label { background: var(--accent); color: #fff; }
.f-detail { border-left: 1px solid var(--hair); overflow: auto; background: var(--win-solid); }
.f-back { display: none; }
.f-empty { height: 100%; display: grid; place-content: center; text-align: center; color: var(--text-3); padding: 24px; }
.proj { padding: 22px 20px 26px; }
.proj-head { display: grid; justify-items: center; text-align: center; gap: 4px; margin-bottom: 16px; }
.proj-head .art { width: 84px; height: 84px; margin-bottom: 6px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.proj-head h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.proj-head .kind { font-size: 12.5px; color: var(--text-2); }
.proj p { margin: 0 0 14px; font-size: 13px; line-height: 1.5; }
.proj-video { margin: 0 0 14px; }
.proj-video video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: #000; box-shadow: 0 0 0 .5px var(--hair-strong), 0 6px 18px rgba(0,0,0,.14); }
.proj-video figcaption { margin-top: 6px; font-size: 11px; color: var(--text-3); text-align: center; }
.proj-disclaimer { display: flex; gap: 8px; align-items: flex-start; padding: 9px 11px; border-radius: 9px; font-size: 12px !important; line-height: 1.4 !important; background: rgba(254, 188, 46, .16); color: var(--text); box-shadow: inset 0 0 0 .5px rgba(214, 150, 0, .45); }
.proj-disclaimer .g { width: 15px; height: 15px; margin-top: 1px; color: #B7790B; }
.proj-links { display: flex; flex-wrap: wrap; gap: 8px; margin: -2px 0 14px; }
.proj-links .btn-primary .g { color: #fff; }
.proj-note { font-size: 12px !important; color: var(--text-2); margin-top: -6px !important; }
.proj-quote { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: linear-gradient(160deg, #1B2A5C, #0D1633); color: #EAF8FC; }
.proj-quote p { margin: 0 0 4px !important; font-size: 14px !important; font-weight: 600; line-height: 1.4 !important; }
.proj-quote span { font-size: 11px; color: #7DE3F4; }
.proj-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; margin: 0 0 16px; }
.proj-stat { padding: 10px; border-radius: 10px; background: var(--field); }
.proj-stat b { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.proj-stat span { font-size: 11px; color: var(--text-2); line-height: 1.3; display: block; }
.proj ul { margin: 0 0 16px; padding-left: 18px; }
.proj li { margin-bottom: 7px; line-height: 1.45; }
.proj-info { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; padding-top: 12px; border-top: 1px solid var(--hair); }
.proj-info dt { color: var(--text-3); }
.proj-info dd { margin: 0; }
@container (max-width: 760px) {
  .finder { grid-template-columns: 160px 1fr; }
  .f-detail { position: absolute; inset: 0; border: 0; z-index: 2; }
  .finder:not(.has-detail) .f-detail { display: none; }
  .f-back { display: flex; align-items: center; gap: 2px; height: 40px; padding: 0 12px; color: var(--accent); font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--hair); width: 100%; position: sticky; top: 0; background: var(--win-solid); z-index: 1; }
  .f-back .g { width: 18px; height: 18px; }
}
@container (max-width: 520px) {
  .finder { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .f-side { display: none; }
  .f-chips { display: flex; gap: 6px; padding: 12px 14px 4px; overflow-x: auto; }
  .f-chips button { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 13px; background: var(--field); cursor: pointer; }
  .f-chips button[aria-pressed="true"] { background: var(--text); color: var(--win-solid); }
  .f-grid { grid-template-columns: 1fr; gap: 0; padding: 6px 14px 20px; }
  .f-item { grid-template-columns: 52px 1fr; grid-template-rows: auto auto; justify-items: start; column-gap: 12px; row-gap: 0; padding: 10px 4px; border-radius: 0; border-bottom: 1px solid var(--hair); }
  .f-item .art { grid-row: 1 / 3; width: 52px; height: 52px; }
  .f-item .label { padding: 0; font-size: 15px; font-weight: 600; align-self: end; }
  .f-item .kind { font-size: 13px; text-align: left; }
  .f-item[aria-selected="true"] { background: none; }
  .f-item[aria-selected="true"] .label { background: none; color: inherit; }
}
.finder { position: relative; }

/* Certificates */
.certs { padding: 8px 22px 24px; }
.cert-top { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin: 10px 0 2px; padding: 12px 14px; border-radius: 12px; background: var(--field); }
.cert-top p { flex: 1 1 220px; margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-2); }
.cert-top p b { color: var(--text); }
.cert-note { margin: -4px 0 10px; font-size: 12px; color: var(--text-2); }
.cert-group h3 { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; font-size: 14px; font-weight: 650; }
.cert-group h3 .art { width: 26px; height: 26px; }
.cert-group h3 .count { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--text-3); }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.cert {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: start; padding: 12px 14px; border-radius: 12px;
  background: var(--win-solid); box-shadow: 0 0 0 .5px var(--hair-strong), 0 1px 2px rgba(0,0,0,.05);
}
.cert-name { font-weight: 600; font-size: 13px; line-height: 1.3; }
.cert-level { grid-column: 1; font-size: 12px; color: var(--text-2); }
.cert-date { grid-column: 1; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.cert-verify { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-weight: 500; }
.cert-verify .g { width: 11px; height: 11px; }
a.cert { color: inherit; text-decoration: none; transition: box-shadow .15s ease, transform .15s ease; }
a.cert:hover { box-shadow: 0 0 0 1px var(--accent), 0 4px 12px rgba(0,0,0,.08); }
a.cert:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cert-score { grid-row: 1 / 4; grid-column: 2; text-align: right; }
.cert-score b { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.cert-score span { font-size: 10px; color: var(--text-3); }
.cert.is-flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 2px var(--accent); } 100% { box-shadow: 0 0 0 .5px var(--hair-strong); } }

/* Résumé (Preview): embedded PDF */
.preview { background: var(--paper-desk); min-height: 100%; }
.pdf-view { display: flex; flex-direction: column; height: 100%; }
.pdf-view.is-pages { height: auto; min-height: 100%; }
.pdf-bar {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  background: var(--win-solid); border-bottom: 1px solid var(--hair);
}
.pdf-name { display: flex; align-items: center; gap: 6px; margin-right: auto; min-width: 0; font-size: 12px; color: var(--text-2); }
.pdf-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-name .g { flex: none; width: 14px; height: 14px; color: #E5484D; }
.pdf-bar .btn-primary .g { color: #fff; }
.pdf-frame { flex: 1; min-height: 0; width: 100%; border: 0; background: #fff; }
.pdf-pages { display: grid; gap: 14px; padding: 16px; }
.pdf-pages img { display: block; width: 100%; height: auto; max-width: 820px; margin: 0 auto; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 10px 30px rgba(0,0,0,.10); }
@container (max-width: 520px) {
  .pdf-pages { gap: 10px; padding: 10px; }
  .pdf-name span { display: none; }
}

/* Notes */
.notes { display: grid; grid-template-columns: 190px 1fr; height: 100%; }
.n-side { background: var(--sidebar); border-right: 1px solid var(--hair); padding: 10px 8px; }
.n-note { padding: 9px 10px; border-radius: 7px; background: #F7C531; color: #1D1D1F; }
.n-note b { display: block; font-size: 13px; }
.n-note span { font-size: 11.5px; opacity: .7; }
.n-body { padding: 18px 26px 28px; background: var(--win-solid); overflow: auto; font-size: 14px; line-height: 1.55; }
.n-body .n-date { text-align: center; font-size: 11.5px; color: var(--text-3); margin-bottom: 12px; }
.n-body h2 { margin: 0 0 10px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.n-body p { margin: 0 0 12px; }
.n-body ul { margin: 0 0 12px; padding-left: 20px; }
.n-body li { margin-bottom: 4px; }
.n-body kbd { font: inherit; padding: 0 5px; border-radius: 4px; background: var(--field); box-shadow: inset 0 0 0 .5px var(--hair-strong); }
@container (max-width: 520px) {
  .notes { grid-template-columns: 1fr; }
  .n-side { display: none; }
  .n-body { padding: 16px 20px 28px; }
}

/* Mail */
.mail { display: flex; flex-direction: column; height: 100%; background: var(--win-solid); }
.m-row { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 18px; border-bottom: 1px solid var(--hair); font-size: 13px; }
.m-row label { color: var(--text-3); width: 56px; flex: none; }
.m-row input { all: unset; flex: 1; font-size: 13px; color: var(--text); }
.m-to { display: inline-flex; padding: 1px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.mail textarea { all: unset; flex: 1; padding: 14px 18px; font-size: 14px; line-height: 1.5; color: var(--text); white-space: pre-wrap; min-height: 140px; }
.mail textarea::placeholder { color: var(--text-3); }
.m-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--hair); }

/* Messages: Sim Phil + text the real Phil */
.msgs { display: grid; grid-template-columns: 230px 1fr; height: 100%; min-height: 0; background: var(--win-solid); }
.msgs-side { background: var(--sidebar); border-right: 1px solid var(--hair); padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.m-thread { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.m-thread:hover { background: var(--field); }
.m-thread.is-on { background: var(--accent); color: #fff; }
.m-thread.is-on .m-thread-text span { color: rgba(255,255,255,.8); }
.m-thread-text { min-width: 0; display: flex; flex-direction: column; }
.m-thread-text b { font-size: 13px; font-weight: 600; }
.m-thread-text span { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-ava, .m-thread .avatar, .m-who-art .avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; }
.m-ava.is-sim { display: grid; place-items: center; background: linear-gradient(160deg, #8B7CFF, #4B3BD6); color: #fff; }
.m-ava.is-sim .g { width: 18px; height: 18px; }
.m-thread .avatar, .m-who-art .avatar { --size: 36px; font-size: 13px; }

.msgs-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.msgs-head { border-bottom: 1px solid var(--hair); padding: 10px 16px; display: flex; flex-direction: column; gap: 10px; }
.m-seg { display: none; padding: 2px; border-radius: 9px; background: var(--field); }
.m-seg button { all: unset; flex: 1; text-align: center; padding: 6px 0; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.m-seg button.is-on { background: var(--win-solid); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.m-who { display: flex; align-items: center; gap: 10px; }
.m-who b { display: block; font-size: 14px; }
.m-who span { font-size: 12px; color: var(--text-2); }
.m-test { margin-left: auto; padding: 2px 8px; border-radius: 8px; background: #FFE8B0; color: #7A5200 !important; font-weight: 600; font-size: 11px !important; }

.msgs-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.bub { max-width: 78%; padding: 8px 13px; border-radius: 18px; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.bub.is-them { align-self: flex-start; background: var(--field); color: var(--text); border-bottom-left-radius: 6px; }
.bub.is-me { align-self: flex-end; background: #0A84FF; color: #fff; border-bottom-right-radius: 6px; }
.bub.is-me.is-sms { background: #30C551; }
.bub.is-me + .bub.is-them, .bub.is-them + .bub.is-me { margin-top: 6px; }
.bub.is-typing { display: flex; gap: 4px; padding: 12px 14px; }
.bub.is-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: m-dot 1.2s infinite ease-in-out; }
.bub.is-typing i:nth-child(2) { animation-delay: .15s; }
.bub.is-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes m-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .bub.is-typing i { animation: none; } }

.m-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.m-chip, .m-handoff { all: unset; box-sizing: border-box; cursor: pointer; padding: 6px 12px; border-radius: 16px; font-size: 13px; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); background: var(--accent-soft); }
.m-chip:hover, .m-handoff:hover { filter: brightness(.97); }
.m-handoff { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 4px; }
.m-handoff .g { width: 14px; height: 14px; }
.m-note { margin: 10px auto 2px; max-width: 420px; text-align: center; font-size: 11.5px; color: var(--text-3); line-height: 1.4; }

.msgs-compose { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--hair); }
.msgs-compose[hidden] { display: none; }
.msgs-compose input { all: unset; flex: 1; min-width: 0; padding: 8px 14px; border-radius: 18px; font-size: 14px; color: var(--text); box-shadow: inset 0 0 0 1px var(--hair-strong); }
.msgs-compose input::placeholder { color: var(--text-3); }
.m-send { all: unset; flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #0A84FF; color: #fff; cursor: pointer; }
.m-send .g { width: 17px; height: 17px; stroke-width: 2.4; }

.m-card { align-self: stretch; display: grid; gap: 10px; margin-top: 8px; padding: 14px; border-radius: 14px; background: var(--field); }
.m-card label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.m-card input, .m-card textarea { font: inherit; font-size: 14px; font-weight: 400; color: var(--text); padding: 8px 10px; border-radius: 9px; border: 0; background: var(--win-solid); box-shadow: inset 0 0 0 1px var(--hair-strong); resize: vertical; }
.m-card .btn { justify-self: start; }
.m-card .btn .g { color: #fff; }
.m-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.m-err { margin: 0; font-size: 12.5px; color: #D93025; }

@container (max-width: 560px) {
  .msgs { grid-template-columns: 1fr; }
  .msgs-side { display: none; }
  .m-seg { display: flex; }
  .msgs-log { padding: 12px; }
  .bub { max-width: 86%; }
  .msgs-compose input, .m-card input, .m-card textarea { font-size: 16px; }
}
