:root {
  /* Black and white, with the same teal accent Perplexity uses. Orion himself is copper. */
  --bg: #000000;
  --bg-2: #0a0a0a;
  --panel: #121212;
  --panel-2: #1a1a1a;
  --line: #222222;
  --line-2: #2e2e2e;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --faint: #737373;
  --cyan: #20b8cd;
  --cyan-2: #5ccfdf;
  --cyan-dim: rgba(32, 184, 205, 0.12);
  --copper: #d6844a;
  --amber: #ffb547;
  --red: #ff6b6b;
  --green: #4ade9a;
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --side: 268px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--cyan-2); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd { font: 11px var(--mono); color: var(--faint); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; margin-left: auto; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.app { display: grid; grid-template-columns: var(--side) 1fr; height: 100dvh; }

/* ------------------------------------------------ sidebar */
.sidebar { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 12px; gap: 10px; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 50%; filter: hue-rotate(185deg) saturate(1.3) drop-shadow(0 0 8px rgba(214,132,74,.45)); }
.brand-name { font: 600 19px var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--text); }
.new-chat { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); transition: border-color .15s, background .15s; }
.new-chat:hover { border-color: var(--cyan); background: var(--panel-2); }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--muted); text-align: left; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--cyan-dim); color: var(--cyan-2); }
.side-section { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 6px; }
.side-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 6px 10px; }
.recent-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding-right: 2px; }
.recent-item { display: block; flex: none; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.recent-item:hover { background: var(--panel); color: var(--text); }
.recent-item.active { background: var(--panel-2); color: var(--text); }
.recent-row { position: relative; display: flex; align-items: center; flex: none; border-radius: 8px; }
.recent-row .recent-item { flex: 1 1 auto; min-width: 0; padding-right: 34px; }
.recent-row.active .recent-item { background: var(--panel-2); color: var(--text); }
.recent-del { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 6px; color: var(--faint); opacity: 0; transition: opacity .12s, color .12s, background .12s; }
.recent-del svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.recent-row:hover .recent-del, .recent-row.active .recent-del, .recent-del:focus-visible { opacity: 1; }
.recent-del:hover { color: var(--red); background: rgba(255,107,107,.1); }
@media (hover: none) { .recent-del { opacity: .75; } }
.recent-row.confirm { gap: 6px; padding: 4px 4px 4px 10px; background: rgba(255,107,107,.08); border: 1px solid rgba(255,107,107,.35); }
.recent-row.confirm .rc-q { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-yes, .rc-no { flex: none; font-size: 12.5px; padding: 5px 9px; border-radius: 6px; }
.rc-yes { background: var(--red); color: #1a0000; font-weight: 600; }
.rc-no { color: var(--muted); }
.rc-no:hover { color: var(--text); background: var(--panel-2); }
.side-foot { border-top: 1px solid var(--line); padding-top: 10px; }
.engine { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 2px 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.warn { background: var(--amber); }
.dot.bad { background: var(--red); }

/* ------------------------------------------------ main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative;
  background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; min-height: 56px; border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.crumb { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.crumb .sub { color: var(--faint); font-weight: 400; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--muted); }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.on { color: var(--cyan); background: var(--cyan-dim); }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; color: var(--muted); }
.chip-btn:hover { color: var(--text); border-color: var(--cyan); }
.chip-btn svg { width: 15px; height: 15px; }
.only-mobile { display: none; }
.side-scrim { display: none; }

.view { flex: 1; overflow-y: auto; padding: 8px 20px 24px; min-height: 0; }
.wrap { max-width: 780px; margin: 0 auto; }

/* ------------------------------------------------ home */
.home { min-height: 100%; display: grid; place-items: center; text-align: center; padding: 6vh 0 2vh; }
.orb { width: 260px; height: 260px; margin: -10px auto 6px; position: relative; overflow: hidden; }
@media (max-height: 640px) { .orb { width: 110px !important; height: 110px !important; } }
.orb .holo-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.orb .holo-canvas:active { cursor: grabbing; }
.status-line .holo-spin { width: 22px; height: 22px; position: relative; flex: none; margin: -4px 0; }
.status-line .holo-spin .holo-canvas { position: absolute; inset: -3px; width: 28px; height: 28px; }
.greeting { font: 600 30px/1.2 var(--font-display); margin: 0 0 6px; letter-spacing: -.01em; }
.greeting-sub { color: var(--muted); margin: 0 0 26px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 640px; margin: 0 auto; }
.suggestion { padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); font-size: 14px; background: var(--panel); }
.suggestion:hover { color: var(--text); border-color: var(--cyan); }

/* ------------------------------------------------ thread */
.thread { display: flex; flex-direction: column; gap: 30px; padding: 12px 0 40px; }
.turn-q { font: 600 24px/1.3 var(--font-display); letter-spacing: -.01em; margin: 0; white-space: pre-wrap; word-wrap: break-word; }
.turn { display: flex; flex-direction: column; gap: 14px; }
.turn + .turn { border-top: 1px solid var(--line); padding-top: 28px; }
.status-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; font-family: var(--mono); }
.status-line .spin, .img-status .spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--cyan); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { display: flex; flex-direction: column; gap: 3px; font: 12.5px var(--mono); color: var(--faint); }
.steps div::before { content: "› "; color: var(--cyan); }
.label { display: flex; align-items: center; gap: 7px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.label svg { width: 15px; height: 15px; color: var(--cyan); }
.answer { font-size: 15.5px; line-height: 1.7; word-wrap: break-word; }
.answer p { margin: 0 0 12px; }
.answer h1, .answer h2, .answer h3 { font-family: var(--font-display); line-height: 1.3; margin: 20px 0 8px; }
.answer h1 { font-size: 21px; } .answer h2 { font-size: 18.5px; } .answer h3 { font-size: 16.5px; }
.answer ul, .answer ol { margin: 0 0 12px; padding-left: 22px; }
.answer li { margin: 3px 0; }
.answer code { font: 13.5px var(--mono); background: var(--panel-2); padding: 1px 6px; border-radius: 5px; }
.answer pre { background: #060a10; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
.answer pre code { background: none; padding: 0; }
.answer table { border-collapse: collapse; margin: 6px 0 14px; font-size: 14px; display: block; overflow-x: auto; }
.answer th, .answer td { border: 1px solid var(--line-2); padding: 6px 10px; text-align: left; vertical-align: top; }
.answer th { background: var(--panel); }
.answer blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 3px solid var(--line-2); color: var(--muted); }
.cite { display: inline-grid; place-items: center; min-width: 18px; height: 17px; padding: 0 4px; margin: 0 1px; font: 600 10.5px var(--mono); color: var(--cyan); background: var(--cyan-dim); border-radius: 5px; vertical-align: 2px; text-decoration: none !important; }
.cite:hover { background: var(--cyan); color: var(--bg); }
.caret { display: inline-block; width: 8px; height: 17px; background: var(--cyan); vertical-align: -3px; animation: blink 1s steps(2) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.turn-foot { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.turn-foot .who { font-size: 12px; color: var(--faint); margin-right: auto; font-family: var(--mono); }
.turn-foot .icon-btn { width: 30px; height: 30px; }
.turn-foot .icon-btn svg { width: 16px; height: 16px; }
.escalate { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border: 1px solid rgba(255,181,71,.35); background: rgba(255,181,71,.07); border-radius: 10px; font-size: 14px; color: #ffd9a0; }
.err { padding: 10px 12px; border: 1px solid rgba(255,107,107,.4); background: rgba(255,107,107,.08); border-radius: 10px; color: #ffc1c1; font-size: 14px; }

/* ------------------------------------------------ composer */
.composer-wrap { padding: 0 20px 16px; }
.composer { max-width: 780px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 12px 12px 8px 16px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: rgba(32,184,205,.55); box-shadow: 0 0 0 4px rgba(32,184,205,.07); }
.composer textarea { width: 100%; resize: none; border: 0; outline: 0; background: none; color: var(--text); font: 15.5px/1.5 var(--font); max-height: 220px; padding: 2px 0 6px; }
.composer textarea::placeholder { color: var(--faint); }
.composer-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; }
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.seg button { padding: 4px 11px; border-radius: 999px; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: var(--panel-2); color: var(--cyan-2); box-shadow: inset 0 0 0 1px rgba(32,184,205,.35); }
.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; padding: 4px 4px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .track { width: 28px; height: 16px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; }
.toggle .track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.toggle input:checked + .track { background: rgba(32,184,205,.35); }
.toggle input:checked + .track::after { transform: translateX(12px); background: var(--cyan-2); }
.toggle input:focus-visible + .track { outline: 2px solid var(--cyan); outline-offset: 2px; }
.toggle.deep input:checked ~ * { color: var(--cyan-2); }
.mic.rec { color: var(--bg); background: var(--red); }
.send { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--cyan); color: #001417; }
.send:disabled { background: var(--line-2); color: var(--faint); cursor: default; }
.send.stop { background: var(--text); }
.composer-hint { max-width: 780px; margin: 6px auto 0; font-size: 12px; color: var(--faint); text-align: center; min-height: 16px; }

/* ------------------------------------------------ pages */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 10px 0 18px; flex-wrap: wrap; }
.page-title { font: 600 26px/1.2 var(--font-display); margin: 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); font-size: 14px; }
.btn:hover { border-color: var(--cyan); }
.btn.primary { background: var(--cyan); color: #001417; border-color: var(--cyan); font-weight: 600; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn svg { width: 16px; height: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: left; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
button.card:hover { border-color: var(--cyan); }
.card h3 { margin: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { font-size: 12px; color: var(--faint); margin-top: auto; }
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--panel); min-width: 0; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--panel-2); }
.row .grow { min-width: 0; }
.row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.row .m { font-size: 12px; color: var(--faint); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.search-box { width: 100%; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; color: var(--text); font: inherit; margin-bottom: 14px; outline: 0; }
.search-box:focus { border-color: var(--cyan); }
.section { margin: 26px 0; }
.section h2 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 9px; padding: 9px 11px; font: inherit; outline: 0; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--cyan); }
.field textarea { min-height: 120px; resize: vertical; font-family: var(--font); }
.field .help { font-size: 12px; color: var(--faint); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.meter { height: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.meter > div { height: 100%; background: linear-gradient(90deg, var(--cyan), var(--cyan-2)); }
.pill { font: 11px var(--mono); padding: 2px 7px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--green); border-color: rgba(74,222,154,.35); }
.notice { padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); color: var(--muted); font-size: 14px; }

/* ------------------------------------------------ modal, menu, toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(4px); }
.modal-card { width: min(520px, 100%); max-height: 86dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; }
.modal-card h3 { margin: 0 0 6px; font: 600 19px var(--font-display); }
.modal-card .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.pick { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.pick button { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.pick button:hover { border-color: var(--cyan); }
.menu { position: fixed; z-index: 60; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 5px; min-width: 190px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.menu button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px; font-size: 14px; text-align: left; }
.menu button:hover { background: var(--panel); }
.menu button.danger { color: var(--red); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel-2); border: 1px solid var(--line-2); padding: 9px 16px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 70; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------ mobile */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 60px rgba(0,0,0,.6); }
  .app.side-open .sidebar { transform: none; }
  .only-mobile { display: inline-grid; }
  .brand .only-mobile { margin-left: auto; }
  /* Keep the top bar and menu clear of the iPhone status bar and notch, with big tap targets. */
  .topbar { padding: calc(8px + env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left)); min-height: calc(60px + env(safe-area-inset-top)); }
  .topbar .only-mobile { width: 44px; height: 44px; flex: none; }
  .topbar .only-mobile svg { width: 24px; height: 24px; }
  .top-settings { order: 10; margin-left: auto; }
  .top-actions + .top-settings, .top-actions:not([hidden]) ~ .top-settings { margin-left: 0; }
  .sidebar { padding-top: calc(14px + env(safe-area-inset-top)); padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  #closeSidebar { width: 44px; height: 44px; }
  .side-scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.side-open .side-scrim { opacity: 1; pointer-events: auto; }
  .view { padding: 6px 14px 20px; }
  .composer-wrap { padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
  .chip-btn .lbl { display: none; }
  .greeting { font-size: 25px; }
  .orb { width: clamp(110px, 36vw, 160px); height: clamp(110px, 36vw, 160px); margin: -12px auto 0; }
  .turn-q { font-size: 20px; }
  .two { grid-template-columns: 1fr; }
  .toggle { font-size: 12px; }
  .seg button { padding: 4px 9px; }
  .top-actions .chip-btn { padding: 6px 8px; font-size: 0; gap: 0; }
  .top-actions .chip-btn svg { width: 16px; height: 16px; }
}

/* ---------------------------------------------------------------- + menu and attachments */
.plus-btn { border: 1px solid var(--line-2); border-radius: 999px; width: 32px; height: 32px; color: var(--text); }
.plus-btn[aria-expanded="true"], .plus-btn:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-dim); }
.plus-btn svg { width: 18px; height: 18px; }
.proj-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 150px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px;
  color: var(--cyan-2); background: var(--cyan-dim); border: 1px solid rgba(32,184,205,.3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-chip svg { width: 14px; height: 14px; flex: none; }
.plus-menu { position: fixed; z-index: 70; width: 290px; max-width: calc(100vw - 16px); max-height: min(440px, 70vh); overflow: auto;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 6px; box-shadow: 0 16px 48px rgba(0,0,0,.55); }
.plus-menu .pm-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.plus-menu .pm-head button { color: var(--muted); padding: 2px 6px; border-radius: 6px; font-size: 13px; text-transform: none; letter-spacing: 0; }
.plus-menu .pm-head button:hover { background: var(--panel); color: var(--text); }
.plus-menu .pm-item { display: flex; width: 100%; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; font-size: 14px; text-align: left; color: var(--text); }
.plus-menu .pm-item:hover, .plus-menu .pm-item:focus-visible { background: var(--panel); outline: none; }
.plus-menu .pm-item svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.plus-menu .pm-item .sub { display: block; font-size: 12px; color: var(--faint); margin-top: 1px; }
.plus-menu .pm-item .txt { flex: 1; min-width: 0; }
.plus-menu .pm-item .txt > span:first-child { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plus-menu .pm-item .chev { color: var(--faint); }
.plus-menu .pm-item.on svg.check { color: var(--cyan); }
.plus-menu .pm-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.plus-menu .pm-note { font-size: 12px; color: var(--faint); padding: 6px 10px 4px; line-height: 1.45; }
.plus-menu .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; margin: 0 5px; }
.plus-menu .dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(74,222,154,.15); }
.plus-menu .toggle { padding: 0; }
.attach-tray { display: flex; gap: 8px; flex-wrap: wrap; padding: 2px 0 10px; }
.att { position: relative; display: flex; align-items: center; gap: 9px; max-width: 240px; padding: 6px 30px 6px 6px; border-radius: 11px;
  background: var(--panel-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--text); }
.att .thumb { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; background: var(--bg-2); flex: none; }
.att .ficon { width: 40px; height: 40px; border-radius: 7px; display: grid; place-items: center; background: var(--cyan-dim); color: var(--cyan); font: 600 10.5px var(--mono); flex: none; text-transform: uppercase; }
.att .meta { min-width: 0; }
.att .nm { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att .sz { display: block; font-size: 11.5px; color: var(--faint); }
.att.err { border-color: rgba(255,107,107,.5); }
.att.err .sz { color: var(--red); }
.att .x { position: absolute; top: 5px; right: 5px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.att .x:hover { background: var(--panel); color: var(--text); }
.att .x svg { width: 14px; height: 14px; }
.att.uploading .sz::after { content: ""; display: inline-block; width: 9px; height: 9px; margin-left: 6px; border: 2px solid var(--cyan); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
.turn-att { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.turn-att img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line-2); cursor: zoom-in; }
.turn-att a.att { padding-right: 10px; text-decoration: none; }
.composer.dropping { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(32,184,205,.12); }
@media (max-width: 860px) { .turn-att img { width: 96px; height: 96px; } }
.proj-chip span { overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- model picker */
.model-btn { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px 5px 11px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; color: var(--text); background: var(--bg-2); max-width: 190px; }
.model-btn:hover, .model-btn[aria-expanded="true"] { border-color: var(--cyan); }
.model-btn .mb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-btn .mb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.model-btn[data-kind="auto"] .mb-dot { background: linear-gradient(90deg, var(--green) 50%, var(--cyan) 50%); }
.model-btn[data-kind="cloud"] .mb-dot { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.model-btn .mb-chev { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.plus-menu.model-menu { width: 330px; max-height: min(560px, 78vh); display: flex; flex-direction: column; overflow: hidden; padding: 6px; }
.model-menu .mm-scroll { overflow: auto; flex: 1; min-height: 0; }
.model-menu .mm-head { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); padding: 6px 10px 3px; }
.model-menu .mm-item { padding: 7px 10px; gap: 9px; }
.model-menu .mm-item.on { background: var(--cyan-dim); }
.model-menu .mm-item.locked .txt > span:first-child { color: var(--muted); }
.model-menu .mm-check { width: 18px; height: 18px; flex: none; display: grid; place-items: center; }
.model-menu .mm-check svg { width: 16px; height: 16px; color: var(--cyan); }
.model-menu .mm-rate { font: 600 11px var(--mono); color: var(--amber); flex: none; }
.model-menu .mm-rate.free { color: var(--green); }
.model-menu .mm-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 10px 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.model-menu .mm-effort[data-off] { opacity: .45; }
.model-menu .mm-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 10px 6px; font-size: 12px; color: var(--faint); }
.linkish { color: var(--cyan-2); font-size: 12.5px; }
.linkish:hover { text-decoration: underline; }
.dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }

/* ---------------------------------------------------------------- API key cards */
.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.key-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--bg-2); display: flex; flex-direction: column; gap: 9px; scroll-margin-top: 20px; }
.key-card.ready { border-color: rgba(74,222,154,.3); }
.key-card.focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-dim); }
.kc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kc-title { font-weight: 600; }
.kc-get { margin-left: auto; }
.kc-models { display: flex; flex-wrap: wrap; gap: 6px; }
.kc-models .chip { font-size: 12px; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.kc-models .chip b { font: 500 11px var(--mono); color: var(--amber); }
.kc-models .chip .x { color: var(--faint); padding: 0 2px; }
.kc-row { display: flex; gap: 6px; flex-wrap: wrap; }
.kc-row input { flex: 1; min-width: 150px; }
.kc-add input { font-size: 13px; }
.kc-msg { font-size: 12.5px; color: var(--muted); min-height: 0; }
.kc-msg:empty { display: none; }
.kc-msg.ok { color: var(--green); }
.kc-msg.bad { color: var(--red); }
.sub-h { font-size: 15px; margin: 22px 0 4px; }
@media (max-width: 640px) {
  .model-btn { max-width: 130px; padding: 5px 8px; }
  .key-grid { grid-template-columns: 1fr; }
}
.key-card input { background: var(--bg); border: 1px solid var(--line-2); color: var(--text); border-radius: 9px; padding: 8px 10px; font: inherit; outline: 0; }
.key-card input:focus { border-color: var(--cyan); }
.kc-hint { font-size: 12px; color: var(--faint); margin-top: -4px; }

/* ---------------------------------------------------------------- sources: one slim line */
.src-block { margin: 2px 0 6px; }
.src-line { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 2px 0; font-size: 12.5px; color: var(--faint); }
.src-line svg { width: 13px; height: 13px; flex: none; color: var(--cyan); }
.src-line .sl-count { color: var(--muted); flex: none; }
.src-line .sl-hosts { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.src-line .sl-chev { fill: none; stroke: var(--faint); stroke-width: 2; transition: transform .15s; }
.src-line[aria-expanded="true"] .sl-chev { transform: rotate(180deg); }
.src-line:hover .sl-count, .src-line:hover .sl-hosts { color: var(--text); }
.src-list { min-width: 0; overflow: hidden; display: flex; flex-direction: column; margin: 4px 0 2px 2px; border-left: 1px solid var(--line-2); padding-left: 10px; }
.src-row { display: flex; align-items: baseline; gap: 8px; padding: 3px 0; font-size: 12.5px; color: var(--muted); min-width: 0; }
.src-row:hover { color: var(--text); text-decoration: none; }
.src-row .n { font: 600 10px var(--mono); color: var(--cyan); background: var(--cyan-dim); border-radius: 4px; padding: 0 4px; flex: none; }
.src-row .t { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.src-row .d { color: var(--faint); flex: 0 1 auto; max-width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; margin-left: auto; }

/* ---------------------------------------------------------------- images */
.img-chip { cursor: pointer; max-width: 220px; }
.img-menu .img-controls .seg button { padding: 4px 8px; font-size: 12px; }
.img-turn .img-stage { position: relative; width: min(100%, 520px); aspect-ratio: 1 / 1; border-radius: 14px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); margin: 6px 0 4px; }
.img-turn .img-stage:has(.err) { aspect-ratio: auto; border: 0; background: none; }
.img-turn .img-stage img { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.img-wait { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 14px; }
.img-shimmer { position: absolute; inset: 0; background: radial-gradient(60% 50% at 50% 45%, rgba(32,184,205,.10), transparent 70%), linear-gradient(110deg, transparent 30%, rgba(255,255,255,.05) 50%, transparent 70%); background-size: 100% 100%, 220% 100%; animation: imgshim 2.2s linear infinite; }
@keyframes imgshim { from { background-position: 0 0, 120% 0; } to { background-position: 0 0, -120% 0; } }
@media (prefers-reduced-motion: reduce) { .img-shimmer { animation: none; } }
.img-status { position: relative; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.img-bar { position: relative; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.img-bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--cyan); box-shadow: 0 0 8px var(--cyan); transition: width .4s ease; }
.turn-foot a.icon-btn { display: inline-grid; place-items: center; }
.img-turn .img-stage { width: var(--img-w, min(100%, 520px)); }
/* ------------------------------------------------ feedback + reviews */
.turn-foot .fb.on[data-a=up] { color: var(--cyan-2); background: var(--cyan-dim); }
.turn-foot .fb.on[data-a=down] { color: #ffb4a8; background: rgba(255,120,100,.12); }
.fb-note { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.fb-note input { flex: 1; min-width: 0; background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 9px; padding: 8px 11px; font: inherit; font-size: 14px; outline: 0; }
.fb-note input:focus { border-color: var(--cyan); }
.rv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.rv-card { gap: 8px; }
.rv-card .rv-p { display: block; -webkit-line-clamp: unset; overflow: visible; margin: 0; color: var(--muted); font-size: 13.5px; }
.rv-meta { font-size: 12.5px; color: var(--faint); font-family: var(--mono); display: flex; align-items: center; gap: 6px; min-height: 18px; }
.rv-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rv-sel { background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; }
.rv-ctl .btn { margin-left: auto; padding: 6px 12px; font-size: 13px; }
.rv-ctl .btn[disabled] { opacity: .6; pointer-events: none; }
.rv-folder { font-size: 11.5px; color: var(--faint); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t.wrap-t { white-space: normal; }
.rv-report { margin: 8px 0 30px; }
.rv-rh { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.rv-report .answer { font-size: 14.5px; }
.rv-meta .spin { width: 12px; height: 12px; }

/* ---------------------------------------------------------------- friends */
.friend [data-view="archive"], .friend .owner-only { display: none !important; }
.sub-h { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill.warn { color: var(--amber); border-color: rgba(255,181,71,.4); }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 16px; }
.auth { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; overflow-y: auto;
  background: radial-gradient(circle at 50% 18%, rgba(214,132,74,.10), transparent 55%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; }
.auth-mark { width: 56px; height: 56px; display: block; margin: 0 auto 10px; filter: hue-rotate(185deg) saturate(1.3); }
.auth-card h1 { font: 600 22px/1.2 var(--font-display); text-align: center; margin: 0 0 6px; }
.auth-sub { color: var(--muted); text-align: center; margin: 0 0 18px; font-size: 14px; }
.auth-card .field input { width: 100%; }
.auth-card input.pin { letter-spacing: .5em; font-size: 20px; text-align: center; }
.auth-go { width: 100%; justify-content: center; margin-top: 8px; min-height: 44px; }
.auth-terms { font-size: 12.5px; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0 10px; max-height: 150px; overflow-y: auto; }
.auth-err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }
.auth-foot { color: var(--faint); font-size: 12px; text-align: center; margin: 14px 0 0; }
#fNote, #fLink, [data-key] { background: var(--bg-2); border: 1px solid var(--line-2); color: var(--text); border-radius: 9px; padding: 9px 11px; font: inherit; font-size: 14px; outline: 0; min-height: 40px; }
#fNote:focus, #fLink:focus, [data-key]:focus { border-color: var(--cyan); }
#fLink { font-family: var(--mono); font-size: 12.5px; }
@media (max-width: 640px) {
  .row:has([data-key]) { flex-wrap: wrap; }
  .row:has([data-key]) .grow { flex: 1 1 100%; }
  [data-key] { flex: 1; max-width: none !important; }
  .row:has(.row-actions) { flex-wrap: wrap; }
  .row:has(.row-actions) .grow { flex: 1 1 100%; }
  .row-actions { justify-content: flex-start; }
}

/* ---------------------------------------------------------------- side panel: only on wide / full-screen desktop windows */
.info-panel { display: none; }
@media (min-width: 1500px) {
  .app { grid-template-columns: var(--side) 1fr 300px; }
  .info-panel { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; padding: 14px 12px;
    background: var(--bg-2); border-left: 1px solid var(--line); }
}
.ip-sec { border-bottom: 1px solid var(--line); padding: 4px 0 8px; }
.ip-sec:last-child { border-bottom: 0; }
.ip-head { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--muted);
  font: 500 13px var(--font); padding: 8px 6px; border-radius: 8px; cursor: pointer; text-align: left; }
.ip-head:hover { background: var(--panel); color: var(--text); }
.ip-head > span:first-child { flex: 1; }
.ip-right { font: 12px var(--mono); color: var(--faint); }
.ip-head .chev { width: 14px; height: 14px; transition: transform .15s; transform: rotate(90deg); stroke: currentColor; fill: none; stroke-width: 2; }
.ip-head[aria-expanded="false"] .chev { transform: rotate(0deg); }
.ip-body { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 2px; }
.ip-row { display: flex; flex-direction: column; gap: 1px; padding: 7px 8px; border-radius: 8px; color: var(--text); text-decoration: none; min-width: 0; }
.ip-row:hover { background: var(--panel); }
.ip-t { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-m { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-empty { font-size: 12.5px; color: var(--faint); padding: 6px 8px; }
.ip-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 6px 8px; color: var(--muted); }
.ip-kv b { color: var(--text); font-weight: 500; text-align: right; }
.ip-btn { width: 100%; justify-content: center; margin-top: 8px; text-decoration: none; }
#standbyBox .row .m, #friendsBox .row .m { white-space: normal; }
.auth-by { text-align: center; color: var(--cyan); font-size: 14px; margin: -2px 0 10px; letter-spacing: .02em; }
.loc-opts { display: grid; gap: 8px; margin-top: 14px; }
.loc-opts .btn { display: grid; gap: 3px; text-align: left; justify-items: start; padding: 12px 14px; height: auto; white-space: normal; }
.loc-opts .btn span { font-weight: 400; font-size: 13px; opacity: .8; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- picture editing */
.img-chip .edit-thumb { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; flex: none; }
.img-chip .edit-x { margin-left: 2px; padding: 0 4px; font-size: 16px; line-height: 1; color: var(--muted); border-radius: 4px; }
.img-chip .edit-x:hover { color: var(--text); background: var(--panel-2); }
.edit-from { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.edit-from img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line-2); }
.edit-install { padding: 14px 16px 16px; text-align: left; display: grid; gap: 10px; }
.edit-install p { margin: 0; color: var(--muted); font-size: 14px; }
.edit-install .m { color: var(--muted); font-size: 13px; }
.edit-install .btn { justify-self: start; }
