/* Sahaj Browser chrome - v0.4 design system "Sahaj Dawn".
   Warm porcelain, espresso ink, marigold accent. Self-hosted Sora for UI,
   Bricolage Grotesque for display moments. iOS-grade frosted layers,
   honest states, motion that answers input. Tokens mirrored in pages.css. */

:root {
  --surface: #f3f2ee;
  --chrome-glass: rgba(243, 242, 238, 0.78);
  --surface-raised: #fcfbf8;
  --surface-hover: rgba(252, 251, 248, 0.8);
  --ink: #231c12;
  --ink-soft: #5f5545;
  --ink-faint: #6e6250;
  --line: rgba(35, 28, 18, 0.1);
  --accent: #e8890c;
  --accent-strong: color-mix(in srgb, var(--accent) 64%, #1a1206);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-ink: #ffffff;
  --danger: #c93a3a;
  --ok: #3d9a50;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --radius-xl: 28px;
  --shadow-pop: 0 2px 8px rgba(46, 34, 18, 0.08), 0 16px 48px rgba(46, 34, 18, 0.16);
  --shadow-tab: 0 1px 2px rgba(46, 34, 18, 0.06), 0 4px 14px rgba(46, 34, 18, 0.08);
  --chrome-h: 96px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --font-ui: 'Sora Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Bricolage Grotesque Variable', 'Sora Variable', -apple-system, sans-serif;
  --glow: radial-gradient(120% 90% at 50% -20%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
          radial-gradient(80% 60% at 85% 0%, rgba(230, 73, 128, 0.05), transparent 55%);
}

[data-theme="dark"] {
  --surface: #16130e;
  --chrome-glass: rgba(22, 19, 14, 0.8);
  --surface-raised: #262019;
  --surface-hover: rgba(255, 244, 228, 0.07);
  --ink: #f3ead9;
  --ink-soft: #bcae97;
  --ink-faint: #a2957e;
  --line: rgba(243, 234, 217, 0.1);
  --accent-strong: color-mix(in srgb, var(--accent) 84%, #ffffff);
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --shadow-pop: 0 2px 8px rgba(0, 0, 0, 0.4), 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-tab: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.4);
  --glow: radial-gradient(120% 90% at 50% -20%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

[hidden] { display: none !important; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button:disabled { cursor: default; opacity: 0.38; }

::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

/* ---------- chrome shell ---------- */

.chrome {
  height: var(--chrome-h);
  display: grid;
  grid-template-rows: 44px 52px;
  background: var(--chrome-glass), var(--glow);
  background-blend-mode: normal;
  backdrop-filter: blur(30px) saturate(1.6);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  border-bottom: 1px solid var(--line);
  user-select: none;
  position: relative;
  z-index: 20;
}

/* ---------- tab strip ---------- */

.tabstrip-row {
  display: flex;
  align-items: center;
  padding: 8px 10px 0;
  gap: 6px;
}

.tabstrip {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  height: 36px;
}
.tabstrip::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  max-width: 208px;
  min-width: 128px;
  padding: 0 8px 0 11px;
  border-radius: var(--radius-m);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 450;
  cursor: pointer;
  background: transparent;
  transition: background-color 160ms var(--ease), box-shadow 160ms var(--ease), color 160ms var(--ease), transform 120ms var(--ease);
}
.tab:hover { background: var(--surface-hover); color: var(--ink); }
.tab:active { transform: scale(0.98); }
.tab.active {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-tab);
}
.tab.suspended .label { opacity: 0.6; }
.tab.pinned { min-width: 38px; max-width: 38px; padding: 0; justify-content: center; }
.tab .favicon {
  width: 15px; height: 15px; flex: none;
  border-radius: 4px;
  object-fit: contain;
}
.tab .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex: none;
}
.tab .label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tab .sleep-mark {
  font-size: 10px;
  font-weight: 550;
  color: var(--ink-faint);
  background: var(--surface-hover);
  border: 1px solid var(--line);
  padding: 1.5px 6px;
  border-radius: 999px;
  flex: none;
}
.tab .close {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 6px;
  display: grid; place-items: center;
  color: var(--ink-faint);
  font-size: 14px;
  line-height: 1;
  transition: background-color 130ms var(--ease), color 130ms var(--ease);
}
.tab .close:hover { background: var(--surface-hover); color: var(--ink); }

.new-tab {
  width: 30px; height: 30px; flex: none;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 400;
  color: var(--ink-soft);
  transition: background-color 140ms var(--ease), color 140ms var(--ease), transform 120ms var(--ease);
}
.new-tab:hover { background: var(--surface-hover); color: var(--ink); }
.new-tab:active { transform: scale(0.94); }

.workspace-picker {
  flex: none;
  max-width: 128px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  padding: 0 10px;
  outline: none;
}

/* ---------- nav bar ---------- */

.navbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.nav-cluster {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  box-shadow: var(--shadow-tab);
}
.nav-cluster button {
  width: 32px; height: 32px;
  border-radius: 999px;
  display: grid; place-items: center;
  color: var(--ink);
  transition: background-color 140ms var(--ease), transform 120ms var(--ease);
}
.nav-cluster button:hover:not(:disabled) { background: var(--surface-hover); }
.nav-cluster button:active:not(:disabled) { transform: scale(0.92); }
.nav-cluster svg { width: 16px; height: 16px; }

.omnibox-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  height: 38px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-tab);
  transition: box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}
.omnibox-wrap:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 15%, transparent), var(--shadow-tab);
}
.omnibox-icon {
  position: absolute; left: 14px;
  width: 15px; height: 15px;
  color: var(--ink-faint);
  display: grid; place-items: center;
  pointer-events: none;
}
.omnibox-icon svg { width: 15px; height: 15px; }
.omnibox-form { flex: 1; }
#omnibox {
  width: 100%;
  border: none; outline: none; background: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 450;
  color: var(--ink);
  padding: 0 12px 0 40px;
}
#omnibox::placeholder { color: var(--ink-faint); }
.omnibox-engine {
  flex: none;
  margin-right: 6px;
  font-size: 11px;
  font-weight: 550;
  color: var(--ink-faint);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
}

.suggest-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: -1px; right: -1px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
}
.suggest-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-m);
  cursor: pointer;
  transition: background-color 110ms var(--ease);
}
.suggest-row.selected, .suggest-row:hover { background: var(--accent-soft); }
.suggest-row .s-icon { width: 15px; height: 15px; color: var(--ink-faint); flex: none; display: grid; place-items: center; }
.suggest-row .s-icon svg { width: 15px; height: 15px; }
.suggest-row .s-title {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px;
}
.suggest-row .s-kind { font-size: 11px; color: var(--ink-faint); flex: none; }

.mem-readout {
  flex: none;
  font-size: 11px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  color: var(--ink-faint);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  padding: 4px 9px;
  border-radius: 999px;
}

.tool-btn {
  position: relative;
  width: 36px; height: 36px; flex: none;
  border-radius: 999px;
  display: grid; place-items: center;
  color: var(--ink-soft);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-tab);
  transition: color 140ms var(--ease), background-color 140ms var(--ease), transform 120ms var(--ease);
}
.tool-btn:hover { color: var(--ink); }
.tool-btn:active { transform: scale(0.92); }
.tool-btn svg { width: 17px; height: 17px; }
.tool-btn.on { color: var(--accent-strong); }
.tool-btn .count {
  position: absolute;
  top: -4px; right: -5px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: var(--accent-ink);
  font-size: 9.5px;
  font-weight: 650;
  display: grid; place-items: center;
  box-shadow: 0 1px 4px rgba(46, 34, 18, 0.25);
}
#ai-btn.on {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

/* ---------- stage: welcome + live viewport ---------- */

.stage {
  position: relative;
  height: calc(100% - var(--chrome-h));
  background: var(--glow), var(--surface);
}

.welcome {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  text-align: center;
  padding: 24px;
}
.welcome.hidden { display: none; }
.welcome .wordmark {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 640;
  font-stretch: 92%;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}
.welcome .wordmark b {
  color: var(--accent-strong);
  font-weight: 640;
}
.welcome .mark {
  width: 62px; height: 62px;
  border-radius: 20px;
  display: grid; place-items: center;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.welcome .mark svg { width: 32px; height: 32px; }
.welcome p {
  color: var(--ink-soft);
  font-size: 14px;
  max-width: 430px;
  line-height: 1.55;
}
.welcome .hint { font-size: 12.5px; color: var(--ink-faint); }
.welcome .pills {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-top: 4px;
}
.welcome .pills span {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500;
  color: var(--ink-soft);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  padding: 6px 13px;
  border-radius: 999px;
  box-shadow: var(--shadow-tab);
}
.welcome .pills svg { width: 13px; height: 13px; color: var(--accent-strong); }

/* live viewport (web preview) */
.viewport {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
#view-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--surface-raised);
}
.view-progress {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2.5px;
  z-index: 5;
  overflow: hidden;
  opacity: 0;
  transition: opacity 200ms var(--ease);
}
.view-progress.loading { opacity: 1; }
.view-progress i {
  display: block;
  height: 100%;
  width: 34%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #e64980));
  animation: view-slide 1.1s var(--ease) infinite;
}
@keyframes view-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}
.view-blocked {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
}
.view-blocked .vb-icon {
  width: 54px; height: 54px;
  border-radius: 18px;
  display: grid; place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.view-blocked .vb-icon svg { width: 26px; height: 26px; }
.view-blocked h2 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 620;
  letter-spacing: -0.01em;
}
.view-blocked p { color: var(--ink-soft); font-size: 13px; max-width: 420px; line-height: 1.55; }
.view-blocked .vb-actions { display: flex; gap: 10px; margin-top: 4px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent-strong);
  color: var(--accent-ink);
  font-size: 13px; font-weight: 550;
  padding: 10px 20px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent);
  transition: transform 130ms var(--ease), box-shadow 160ms var(--ease);
}
.btn-primary:hover { box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-primary:active { transform: scale(0.96); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-raised);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 140ms var(--ease), transform 130ms var(--ease);
}
.btn-ghost:hover { background: var(--surface-hover); }
.btn-ghost:active { transform: scale(0.96); }

/* ---------- Sahaj AI panel ---------- */

.ai-panel {
  position: fixed;
  top: calc(var(--chrome-h) + 10px);
  right: 12px;
  bottom: 12px;
  width: min(392px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  background: var(--chrome-glass);
  backdrop-filter: blur(34px) saturate(1.7);
  -webkit-backdrop-filter: blur(34px) saturate(1.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop);
  z-index: 40;
  overflow: hidden;
  animation: ai-in 260ms var(--ease-spring);
}
@keyframes ai-in {
  from { opacity: 0; transform: translateX(24px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.ai-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 12px 18px;
  border-bottom: 1px solid var(--line);
}
.ai-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 640;
  letter-spacing: -0.01em;
}
.ai-spark {
  width: 28px; height: 28px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 32%, transparent);
}
.ai-spark svg { width: 15px; height: 15px; }
.ai-head-actions { display: flex; gap: 4px; }
.ai-head-actions button {
  width: 30px; height: 30px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--ink-soft);
  transition: background-color 130ms var(--ease), color 130ms var(--ease);
}
.ai-head-actions button:hover { background: var(--surface-hover); color: var(--ink); }
.ai-head-actions svg { width: 15px; height: 15px; }
.ai-head-actions .ai-close-x { font-size: 17px; line-height: 1; }

.ai-model-tag {
  font-size: 10.5px;
  font-weight: 550;
  color: var(--ink-faint);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 999px;
  max-width: 140px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ai-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-empty {
  margin: auto;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 20px;
}
.ai-empty .glyph {
  width: 48px; height: 48px;
  border-radius: 16px;
  display: grid; place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.ai-empty .glyph svg { width: 23px; height: 23px; }
.ai-empty h3 { font-family: var(--font-display); font-size: 16px; font-weight: 620; }
.ai-empty p { font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; max-width: 270px; }

.ai-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: var(--radius-l);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  animation: msg-in 220ms var(--ease);
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.ai-msg.user {
  align-self: flex-end;
  background: var(--accent-strong);
  color: var(--accent-ink);
  border-bottom-right-radius: var(--radius-s);
}
.ai-msg.assistant {
  align-self: flex-start;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-bottom-left-radius: var(--radius-s);
  box-shadow: var(--shadow-tab);
}
.ai-msg.error {
  align-self: flex-start;
  background: color-mix(in srgb, var(--danger) 9%, var(--surface-raised));
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  color: var(--ink);
  font-size: 12.5px;
}
.ai-msg.demo-tag, .ai-meta {
  align-self: flex-start;
  font-size: 10.5px;
  color: var(--ink-faint);
  padding: 0 6px;
  margin-top: -7px;
}
.ai-thinking {
  align-self: flex-start;
  display: inline-flex;
  gap: 5px;
  padding: 13px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  border-bottom-left-radius: var(--radius-s);
}
.ai-thinking i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  animation: think 1.15s ease-in-out infinite;
}
.ai-thinking i:nth-child(2) { animation-delay: 0.18s; }
.ai-thinking i:nth-child(3) { animation-delay: 0.36s; }
@keyframes think {
  0%, 60%, 100% { transform: none; opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ai-setup {
  margin: 0 14px 12px;
  padding: 14px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  display: grid;
  gap: 9px;
}
.ai-setup h4 { font-size: 13px; font-weight: 600; }
.ai-setup p { font-size: 11.5px; color: var(--ink-soft); line-height: 1.5; }
.ai-setup label { display: grid; gap: 4px; font-size: 11px; font-weight: 550; color: var(--ink-soft); }
.ai-setup input {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  padding: 0 11px;
  outline: none;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.ai-setup input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.ai-setup .btn-primary { justify-content: center; padding: 9px; font-size: 12.5px; }

.ai-chips {
  display: flex;
  gap: 7px;
  padding: 10px 14px 4px;
  flex-wrap: wrap;
}
.ai-chips button {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  padding: 6px 12px;
  border-radius: 999px;
  transition: transform 120ms var(--ease), background-color 140ms var(--ease);
}
.ai-chips button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.ai-chips button:active { transform: scale(0.95); }

.ai-composer {
  padding: 10px 14px 14px;
  display: grid;
  gap: 8px;
}
.ai-page-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--ink-soft);
  cursor: pointer;
  width: max-content;
}
.ai-page-toggle input { accent-color: var(--accent-strong); }
.ai-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow-tab);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.ai-input-row:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 15%, transparent), var(--shadow-tab);
}
#ai-input {
  flex: 1;
  border: none; outline: none; background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  resize: none;
  max-height: 110px;
  padding: 6px 0;
  line-height: 1.45;
}
#ai-input::placeholder { color: var(--ink-faint); }
#ai-send {
  width: 34px; height: 34px; flex: none;
  border-radius: 999px;
  display: grid; place-items: center;
  background: var(--accent-strong);
  color: var(--accent-ink);
  transition: transform 130ms var(--ease), opacity 140ms var(--ease);
}
#ai-send:active { transform: scale(0.9); }
#ai-send:disabled { opacity: 0.4; }
#ai-send svg { width: 15px; height: 15px; }

/* ---------- find bar ---------- */

.find-bar {
  position: fixed;
  top: calc(var(--chrome-h) + 10px);
  right: 14px;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-pop);
  padding: 6px;
}
.find-bar input {
  border: none; outline: none; background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  width: 190px;
  padding: 5px 8px;
}
.find-bar .f-count { font-size: 11px; color: var(--ink-faint); min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.find-bar button {
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--ink-soft);
  transition: background-color 130ms var(--ease), color 130ms var(--ease);
}
.find-bar button:hover { background: var(--surface-hover); color: var(--ink); }
.find-bar svg { width: 14px; height: 14px; }

/* ---------- popovers ---------- */

.pop {
  position: fixed;
  top: calc(var(--chrome-h) + 10px);
  right: 14px;
  z-index: 60;
  width: 320px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-pop);
  padding: 14px;
  animation: pop-in 180ms var(--ease);
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.shield-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.shield-glyph {
  width: 40px; height: 40px; flex: none;
  border-radius: 13px;
  display: grid; place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
}
.shield-glyph.off { color: var(--ink-faint); background: var(--surface-hover); }
.shield-glyph svg { width: 20px; height: 20px; }
.sh-title { font-size: 14px; font-weight: 600; }
.sh-sub { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }

.shield-big {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.shield-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 12px;
  text-align: center;
}
.shield-stat .n {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.shield-stat .l { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }

.shield-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}
.t-label { font-size: 12.5px; font-weight: 500; }
.t-site { color: var(--ink-faint); font-weight: 400; }

.switch {
  width: 42px; height: 25px; flex: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 16%, transparent);
  position: relative;
  transition: background-color 180ms var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  top: 2.5px; left: 2.5px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 200ms var(--ease-spring);
}
.switch[aria-checked="true"] { background: var(--accent-strong); }
.switch[aria-checked="true"]::after { transform: translateX(17px); }

.shield-top { margin-top: 12px; }
.st-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); margin-bottom: 6px; }
.st-row { display: flex; justify-content: space-between; font-size: 12px; padding: 5px 2px; color: var(--ink-soft); }
.st-row b { font-variant-numeric: tabular-nums; color: var(--ink); }
.shield-foot { margin-top: 12px; text-align: right; }
.shield-foot button { font-size: 12px; color: var(--accent-strong); font-weight: 550; }

.dl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dl-head .t { font-size: 14px; font-weight: 600; }
.dl-head button { font-size: 12px; color: var(--accent-strong); font-weight: 550; }
.dl-list { display: grid; gap: 4px; max-height: 300px; overflow-y: auto; }
.dl-empty { font-size: 12.5px; color: var(--ink-faint); text-align: center; padding: 18px 0; }
.dl-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: var(--radius-m);
  transition: background-color 120ms var(--ease);
}
.dl-item:hover { background: var(--surface-hover); }
.dl-item .f-icon { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft); }
.dl-item .f-icon svg { width: 15px; height: 15px; }
.dl-item .f-meta { flex: 1; min-width: 0; }
.dl-item .f-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-item .f-state { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }
.dl-item.failed .f-state { color: var(--danger); }
.dl-item .bar { height: 3px; border-radius: 999px; background: var(--surface-hover); margin-top: 5px; overflow: hidden; }
.dl-item .bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 300ms var(--ease); }

.menu-pop { width: 250px; padding: 7px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-m);
  font-size: 13px;
  text-align: left;
  transition: background-color 110ms var(--ease);
}
.menu-item:hover { background: var(--accent-soft); }
.menu-item svg { width: 15px; height: 15px; color: var(--ink-soft); flex: none; }
.menu-item span:first-of-type { flex: 1; }
.menu-item .keys { font-size: 11px; color: var(--ink-faint); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 8px; }
.menu-zoom { display: flex; align-items: center; gap: 8px; padding: 8px 11px; }
.menu-zoom .z-label { flex: 1; font-size: 13px; }
.menu-zoom button {
  width: 28px; height: 28px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 15px;
  display: grid; place-items: center;
  transition: background-color 120ms var(--ease), transform 110ms var(--ease);
}
.menu-zoom button:hover { background: var(--surface-hover); }
.menu-zoom button:active { transform: scale(0.92); }
.menu-zoom .z-val { font-size: 12px; min-width: 42px; text-align: center; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- context menu ---------- */

.ctx-menu {
  position: fixed;
  z-index: 70;
  min-width: 180px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-pop);
  padding: 5px;
  animation: pop-in 160ms var(--ease);
}
.ctx-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-s);
  font-size: 12.5px;
  text-align: left;
  transition: background-color 110ms var(--ease);
}
.ctx-menu button:hover { background: var(--accent-soft); }
.ctx-menu svg { width: 14px; height: 14px; color: var(--ink-soft); }

/* ---------- toasts ---------- */

.toast-zone {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-pop);
  animation: toast-in 240ms var(--ease-spring);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .navbar { gap: 5px; padding: 0 8px; }
  .nav-cluster button { width: 28px; height: 28px; }
  .omnibox-engine, .mem-readout { display: none; }
  .ai-panel {
    top: auto;
    left: 8px; right: 8px; bottom: 8px;
    width: auto;
    max-height: 72%;
  }
  .welcome .wordmark { font-size: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
