/* Vestyn macOS app chrome — native-leaning (traffic lights, unified toolbar,
 * translucent vibrancy, popover notch, sheet, Settings window) on Vestyn tokens.
 * Built to sit alongside design/tokens.css + app/hidyn.css. Palette + secret
 * type stay ours; only the window furniture is macOS. */

/* ── Desktop wallpaper (so vibrancy has something to sample) ── */
.vm-desktop {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120% 90% at 18% 12%, color-mix(in oklab, var(--accent) 38%, #d8c3b0) 0%, transparent 55%),
    radial-gradient(120% 100% at 88% 90%, color-mix(in oklab, #6a5a96 34%, #c9bdb0) 0%, transparent 60%),
    linear-gradient(150deg, #cdbfae 0%, #b7a591 48%, #9c8a78 100%);
}
[data-theme="dark"] .vm-desktop {
  background:
    radial-gradient(120% 90% at 18% 12%, color-mix(in oklab, var(--accent) 34%, #2a2118) 0%, transparent 55%),
    radial-gradient(120% 100% at 88% 90%, color-mix(in oklab, #6a5a96 30%, #1a1712) 0%, transparent 60%),
    linear-gradient(150deg, #2c2620 0%, #221d18 50%, #15110d 100%);
}
.vm-menubar {
  position: absolute; top: 0; left: 0; right: 0; height: 26px; z-index: 5;
  display: flex; align-items: center; gap: 16px; padding: 0 14px;
  background: color-mix(in srgb, var(--surface) 42%, transparent);
  backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  color: var(--ink); font: 500 12px/1 var(--font-ui);
}
.vm-menubar .right { margin-left: auto; display: flex; align-items: center; gap: 14px; color: var(--ink); }

/* ── Window shell ─────────────────────────────────────────── */
.vm-win {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 11px; border: 0.5px solid color-mix(in oklab, var(--ink) 22%, transparent);
  box-shadow: 0 30px 70px rgb(20 16 12 / 0.42), 0 10px 24px rgb(20 16 12 / 0.30);
  background: var(--surface);
}

/* Vibrant material shared by sidebar column + its toolbar segment */
.vm-vibrant {
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  backdrop-filter: blur(44px) saturate(180%); -webkit-backdrop-filter: blur(44px) saturate(180%);
}

/* Unified toolbar (title bar fused with toolbar) */
.vm-toolbar { height: 52px; display: flex; flex: none; }
.vm-tbar-left {
  width: var(--vm-sidebar, 232px); flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; border-bottom: 0.5px solid var(--line); border-right: 0.5px solid var(--line);
}
.vm-tbar-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding: 0 12px 0 14px; border-bottom: 0.5px solid var(--line); background: var(--surface);
}

/* Traffic lights */
.vm-lights { display: flex; align-items: center; gap: 8px; }
.vm-light { width: 12px; height: 12px; border-radius: 50%; }
.vm-light.r { background: #ff5f57; box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.12); }
.vm-light.y { background: #febc2e; box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.12); }
.vm-light.g { background: #28c840; box-shadow: inset 0 0 0 0.5px rgb(0 0 0 / 0.12); }

.vm-tbtn { width: 28px; height: 26px; border-radius: 6px; border: none; background: transparent; color: var(--ink-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background var(--duration-state) var(--ease); }
.vm-tbtn:hover { background: color-mix(in oklab, var(--ink) 8%, transparent); color: var(--ink); }
.vm-tbar-title { font: 500 14px/20px var(--font-ui); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Toolbar search (capsule) */
.vm-search { display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 7px; background: var(--surface-sunken); border: 0.5px solid var(--line); color: var(--ink-faint); min-width: 150px; }
.vm-search input { border: none; background: none; outline: none; font: 13px/18px var(--font-ui); color: var(--ink); width: 100%; }
.vm-search input::placeholder { color: var(--ink-faint); }

/* ── Window body (3-pane) ─────────────────────────────────── */
.vm-body { flex: 1; min-height: 0; display: flex; }
.vm-sidebar { width: var(--vm-sidebar, 232px); flex: none; display: flex; flex-direction: column; padding: 8px; overflow-y: auto; }
.vm-content { flex: 1; min-width: 0; display: flex; background: var(--bg); }

/* Sidebar items */
.vm-sb-section { font: 600 11px/16px var(--font-ui); color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; padding: 12px 8px 4px; }
.vm-sb-row { display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 9px; border-radius: 7px; border: none; background: transparent; cursor: pointer; width: 100%; text-align: left; color: var(--ink); font: 500 13px/18px var(--font-ui); transition: background var(--duration-state) var(--ease); }
.vm-sb-row:hover { background: color-mix(in oklab, var(--ink) 7%, transparent); }
.vm-sb-row.active { background: var(--accent); color: var(--on-accent); }
.vm-sb-row.active .vm-sb-count { color: color-mix(in oklab, var(--on-accent) 80%, transparent); }
.vm-sb-row .vm-sb-icon { flex: none; display: inline-flex; }
.vm-sb-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vm-sb-count { font: 12px/16px var(--font-ui); color: var(--ink-faint); }
.vm-sb-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.vm-sb-spacer { flex: 1; }
.vm-sb-user { display: flex; align-items: center; gap: 9px; padding: 8px; margin-top: 6px; border-top: 0.5px solid var(--line); }

/* List pane */
.vm-list { width: 300px; flex: none; border-right: 0.5px solid var(--line); display: flex; flex-direction: column; background: var(--surface); }
.vm-list-head { padding: 12px 16px 8px; display: flex; align-items: baseline; justify-content: space-between; }
.vm-list-title { font: 600 16px/22px var(--font-ui); color: var(--ink); }
.vm-list-count { font: 12px/16px var(--font-ui); color: var(--ink-faint); }
.vm-rows { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 8px; }
.vm-row { display: flex; align-items: center; gap: 11px; padding: 8px 8px; border-radius: 8px; cursor: pointer; border: none; background: transparent; width: 100%; text-align: left; transition: background var(--duration-state) var(--ease); }
.vm-row:hover { background: var(--surface-sunken); }
.vm-row.selected { background: var(--accent); }
.vm-row.selected .vm-row-name { color: var(--on-accent); }
.vm-row.selected .vm-row-sub { color: color-mix(in oklab, var(--on-accent) 78%, transparent); }
.vm-row.selected .hd-tile { background: color-mix(in oklab, var(--on-accent) 20%, transparent) !important; color: var(--on-accent) !important; }
.vm-row-text { flex: 1; min-width: 0; }
.vm-row-name { font: 500 13px/18px var(--font-ui); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vm-row-sub { font: 11px/15px var(--font-mono); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Detail pane */
.vm-detail { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); overflow-y: auto; }
.vm-detail-head { display: flex; align-items: center; gap: 14px; padding: 22px 28px 18px; }
.vm-detail-title { font: 500 22px/28px var(--font-display); color: var(--ink); font-optical-sizing: auto; }
.vm-detail-body { padding: 4px 28px 28px; display: flex; flex-direction: column; max-width: 620px; }
.vm-meta { display: flex; gap: 16px; margin-top: 18px; padding-top: 14px; border-top: 0.5px solid var(--line); font: 12px/16px var(--font-ui); color: var(--ink-faint); }

/* Touch ID reveal affordance (inline, branded) */
.vm-reveal {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px;
  border-radius: 7px; border: 0.5px solid var(--line); background: var(--surface);
  color: var(--ink-muted); font: 500 12px/16px var(--font-ui); cursor: pointer;
  transition: border-color var(--duration-state) var(--ease), color var(--duration-state) var(--ease);
}
.vm-reveal:hover { border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); color: var(--ink); }
.vm-reveal svg { color: var(--accent); }
.vm-authing { color: var(--accent); }

/* ── Menu bar popover ─────────────────────────────────────── */
.vm-popover {
  position: relative; width: 360px; border-radius: 12px; overflow: hidden;
  border: 0.5px solid color-mix(in oklab, var(--ink) 18%, transparent);
  box-shadow: 0 20px 50px rgb(20 16 12 / 0.40), 0 6px 16px rgb(20 16 12 / 0.26);
  display: flex; flex-direction: column;
}
.vm-pop-notch { position: absolute; top: -7px; left: 50%; transform: translateX(-50%) rotate(45deg); width: 14px; height: 14px; background: var(--surface); border-left: 0.5px solid color-mix(in oklab, var(--ink) 18%, transparent); border-top: 0.5px solid color-mix(in oklab, var(--ink) 18%, transparent); z-index: 1; }
.vm-pop-head { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 0.5px solid var(--line); }
.vm-pop-word { flex: 1; font: 600 15px/20px var(--font-display); color: var(--ink); }
.vm-pop-search { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-bottom: 0.5px solid var(--line); color: var(--ink-faint); }
.vm-pop-search input { border: none; background: none; outline: none; font: 13px/18px var(--font-ui); color: var(--ink); width: 100%; }
.vm-pop-search input::placeholder { color: var(--ink-faint); }
.vm-pop-search.disabled { opacity: 0.5; }
.vm-pop-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.vm-pop-foot { display: flex; gap: 8px; padding: 10px 13px; border-top: 0.5px solid var(--line); }
.vm-pop-locked { padding: 30px 24px 26px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }

/* ── Auth windows (unlock / sign-in) ──────────────────────── */
.vm-authwin { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 40px; background: var(--surface); }
.vm-bioring { width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: color-mix(in oklab, var(--accent) 12%, var(--surface-sunken)); color: var(--accent); transition: transform var(--duration-state) var(--ease); cursor: pointer; }
.vm-bioring:hover { transform: scale(1.04); }
.vm-bioring.pulsing { box-shadow: 0 0 0 6px color-mix(in oklab, var(--accent) 14%, transparent); }
.vm-auth-word { font: 600 31px/38px var(--font-display); color: var(--ink); }
.vm-auth-host { font: 12px/16px var(--font-mono); color: var(--ink-muted); }
.vm-auth-form { width: 300px; display: flex; flex-direction: column; gap: 10px; }

/* ── AutoFill sheet ───────────────────────────────────────── */
.vm-sheet {
  width: 480px; border-radius: 12px; overflow: hidden; background: var(--surface);
  border: 0.5px solid color-mix(in oklab, var(--ink) 16%, transparent);
  box-shadow: 0 24px 60px rgb(20 16 12 / 0.42), 0 8px 20px rgb(20 16 12 / 0.28);
  display: flex; flex-direction: column;
}
.vm-sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 0.5px solid var(--line); }
.vm-sheet-glyph { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font: 700 14px/1 var(--font-display); flex: none; }
.vm-sheet-title { flex: 1; font: 500 14px/20px var(--font-ui); color: var(--ink); }
.vm-sheet-sub { font: 12px/16px var(--font-ui); color: var(--ink-muted); }
.vm-sheet-list { max-height: 280px; overflow-y: auto; padding: 8px; }
.vm-sheet-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 0.5px solid var(--line); }

/* ── Settings window ──────────────────────────────────────── */
.vm-settings { width: 580px; }
.vm-set-tabs { display: flex; align-items: center; justify-content: center; gap: 2px; height: 52px; padding: 0 12px; border-bottom: 0.5px solid var(--line); position: relative; }
.vm-set-lights { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.vm-set-tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 14px; border-radius: 7px; border: none; background: transparent; cursor: pointer; color: var(--ink-muted); font: 500 11px/14px var(--font-ui); transition: background var(--duration-state) var(--ease), color var(--duration-state) var(--ease); }
.vm-set-tab:hover { background: color-mix(in oklab, var(--ink) 7%, transparent); }
.vm-set-tab.active { background: color-mix(in oklab, var(--accent) 14%, transparent); color: var(--accent); }
.vm-set-body { padding: 22px 26px; display: flex; flex-direction: column; gap: 18px; background: var(--bg); }
.vm-set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.vm-set-row-text { font: 13px/18px var(--font-ui); color: var(--ink); }
.vm-set-row-sub { font: 12px/16px var(--font-ui); color: var(--ink-muted); margin-top: 1px; }
.vm-set-group { background: var(--surface); border: 0.5px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.vm-set-group .vm-set-row { padding: 12px 14px; }
.vm-set-group .vm-set-row + .vm-set-row { border-top: 0.5px solid var(--line); }
.vm-set-label { font: 600 11px/16px var(--font-ui); color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: -8px; }

/* macOS toggle switch */
.vm-switch { width: 38px; height: 22px; border-radius: 11px; background: var(--surface-sunken); border: 0.5px solid var(--line); position: relative; cursor: pointer; transition: background var(--duration-state) var(--ease); flex: none; }
.vm-switch.on { background: var(--accent); border-color: var(--accent); }
.vm-switch .knob { position: absolute; top: 1.5px; left: 1.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); transition: transform var(--duration-state) var(--ease); }
.vm-switch.on .knob { transform: translateX(16px); }

/* native-ish select */
.vm-select { height: 28px; padding: 0 9px; border-radius: 6px; border: 0.5px solid var(--line); background: var(--surface); color: var(--ink); font: 13px/18px var(--font-ui); cursor: pointer; outline: none; }

/* About pane */
.vm-about { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 20px; text-align: center; }
.vm-about-mark { width: 64px; height: 64px; border-radius: 15px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font: 600 38px/1 var(--font-display); box-shadow: var(--shadow-pop); }
.vm-about-name { font: 600 22px/28px var(--font-display); color: var(--ink); margin-top: 6px; }
.vm-about-ver { font: 12px/16px var(--font-mono); color: var(--ink-muted); }
