/* ROSE — navy / silver agent console */
:root {
  --bg: #120506;
  --bg-2: #200709;
  --panel: #270a0d;
  --panel-2: #320e11;
  --raised: #3e1317;
  --line: rgba(220, 194, 196, 0.10);
  --line-2: rgba(220, 194, 196, 0.18);
  --silver: #c9d1dc;
  --silver-hi: #eef2f7;
  --silver-lo: #8a96a8;
  --muted: #835c5f;
  --steel: #da959b;
  --steel-dim: rgba(218, 149, 155, 0.14);
  --ok: #7fd8b4;
  --warn: #e6c27a;
  --err: #f08c8c;
  --metal: linear-gradient(135deg, #f4f7fb 0%, #b9c3d0 38%, #e8edf3 55%, #8d99aa 100%);
  --radius: 14px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --side-w: 290px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 70% -10%, #3b0e12 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #310a0d 0%, transparent 55%), var(--bg);
  color: var(--silver);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--steel); }
::selection { background: rgba(218, 149, 155, 0.35); color: #fff; }

.grid-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(rgba(206, 164, 167, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(206, 164, 167, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 25%, transparent 80%);
}
.scan {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px);
}

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #502327 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #451d20; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* LEDs */
.led { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px rgba(131, 92, 95,0.15); flex: none; }
.led.on { background: var(--ok); box-shadow: 0 0 8px rgba(127, 216, 180, 0.7); }
.led.run { background: var(--steel); box-shadow: 0 0 10px rgba(218, 149, 155, 0.9); animation: pulse 1.2s ease-in-out infinite; }
.led.err { background: var(--err); box-shadow: 0 0 8px rgba(240, 140, 140, 0.6); }
.led.queue { background: var(--warn); box-shadow: 0 0 8px rgba(230, 194, 122, 0.6); }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

/* corner-bracket frames */
.panel-frame { position: relative; }
.corner { position: absolute; width: 12px; height: 12px; border-color: var(--silver-lo); border-style: solid; opacity: 0.55; pointer-events: none; }
.corner.tl { top: -1px; left: -1px; border-width: 1.5px 0 0 1.5px; border-top-left-radius: 4px; }
.corner.tr { top: -1px; right: -1px; border-width: 1.5px 1.5px 0 0; border-top-right-radius: 4px; }
.corner.bl { bottom: -1px; left: -1px; border-width: 0 0 1.5px 1.5px; border-bottom-left-radius: 4px; }
.corner.br { bottom: -1px; right: -1px; border-width: 0 1.5px 1.5px 0; border-bottom-right-radius: 4px; }

/* brand */
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-logo { width: 36px; height: 36px; filter: drop-shadow(0 0 10px rgba(226, 184, 187, 0.25)); }
.brand-word {
  font-weight: 700; letter-spacing: 0.32em; font-size: 18px;
  background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: 9.5px; letter-spacing: 0.18em; color: var(--muted); margin-top: 1px; }

/* ===== Login ===== */
.login-body { display: grid; place-items: center; min-height: 100%; overflow: auto; }
.login-wrap { position: relative; z-index: 2; width: 100%; padding: 24px 16px; display: grid; place-items: center; }
.login-card {
  width: 100%; max-width: 420px; padding: 34px 30px 22px;
  background: linear-gradient(180deg, rgba(50, 14, 17, 0.85), rgba(32, 7, 9, 0.92));
  border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(14px);
}
.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.login-logo { width: 54px; height: 54px; filter: drop-shadow(0 0 16px rgba(226, 184, 187, 0.3)); }
.login-brand .brand-word { font-size: 26px; }
.login-form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field span { font-size: 10.5px; letter-spacing: 0.2em; color: var(--silver-lo); }
.field input {
  width: 100%; padding: 13px 14px; border-radius: 10px;
  background: rgba(18, 5, 6, 0.7); border: 1px solid var(--line-2); color: var(--silver-hi);
  font: 15px var(--mono); outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--steel); box-shadow: 0 0 0 3px var(--steel-dim); }
.login-error { color: var(--err); font-size: 12.5px; padding: 9px 12px; border: 1px solid rgba(240,140,140,0.3); border-radius: 8px; background: rgba(240,140,140,0.06); }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px 18px; border-radius: 10px; font-weight: 600; letter-spacing: 0.16em; font-size: 13px;
  background: var(--metal); color: #25090c;
  box-shadow: 0 8px 24px -8px rgba(232, 203, 205, 0.45), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: transform .15s, filter .2s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(1px); }
.login-btn { margin-top: 6px; }
.login-foot { margin-top: 22px; font-size: 10.5px; color: var(--muted); letter-spacing: 0.14em; display: flex; align-items: center; gap: 8px; justify-content: center; }

/* ===== Shell ===== */
.shell { position: relative; z-index: 2; display: flex; height: 100vh; height: 100dvh; }

.sidebar {
  width: var(--side-w); flex: none; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(36, 9, 12, 0.92), rgba(22, 6, 7, 0.95));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 14px; }
.btn-new {
  margin: 4px 14px 12px; display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 11px;
  background: linear-gradient(180deg, rgba(201, 209, 220, 0.12), rgba(201, 209, 220, 0.05));
  border: 1px solid var(--line-2); color: var(--silver-hi); font-weight: 500;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.btn-new:hover { border-color: rgba(201, 209, 220, 0.4); box-shadow: 0 0 0 3px rgba(201,209,220,0.05), 0 6px 20px -10px rgba(218, 149, 155,.5); }
.btn-new kbd { margin-left: auto; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; }
.search { margin: 0 14px 10px; display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-radius: 10px; background: rgba(18, 5, 6,.6); border: 1px solid var(--line); color: var(--muted); }
.search:focus-within { border-color: var(--line-2); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--silver); font: 13.5px var(--sans); }
.history { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.h-group { font: 500 10px var(--mono); letter-spacing: 0.2em; color: var(--muted); padding: 14px 10px 6px; text-transform: uppercase; }
.h-item {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 9px; text-align: left; color: var(--silver-lo);
  font-size: 13.5px; text-decoration: none; transition: background .15s, color .15s;
}
.h-item:hover { background: rgba(201, 209, 220, 0.05); color: var(--silver); }
.h-item.active { background: linear-gradient(90deg, rgba(218, 149, 155,0.14), rgba(218, 149, 155,0.03)); color: var(--silver-hi); }
.h-item.active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--metal); }
.h-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-pin { color: var(--silver-lo); flex: none; }
.h-empty { padding: 30px 14px; text-align: center; color: var(--muted); font-size: 12.5px; }

.side-foot { border-top: 1px solid var(--line); padding: 10px 12px 14px; display: grid; gap: 8px; }
.foot-btn { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--silver-lo); font-size: 13px; }
.foot-btn:hover { background: rgba(201, 209, 220, 0.05); color: var(--silver); }
.foot-btn .led { margin-left: auto; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px 0 6px; }
.avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 600; color: #25090c; background: var(--metal); flex: none; }
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 13.5px; color: var(--silver-hi); }
.user-mail { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--silver-lo); transition: background .15s, color .15s; flex: none; cursor: pointer; }
.icon-btn:hover { background: rgba(201, 209, 220, 0.07); color: var(--silver-hi); }

/* ===== Main ===== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px; min-height: 64px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(28, 7, 9, 0.85), rgba(28, 7, 9, 0.55));
  backdrop-filter: blur(10px);
}
.title-wrap { flex: 1; min-width: 0; }
.conv-title { font-weight: 600; color: var(--silver-hi); font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; border-radius: 6px; padding: 0 4px; margin-left: -4px; }
.conv-title[contenteditable="true"] { background: rgba(18, 5, 6,.7); box-shadow: 0 0 0 1px var(--steel); text-overflow: clip; }
.conv-sub { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 7px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; }
.conv-sub .path { overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; position: relative; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line-2); font-size: 12px; color: var(--silver); letter-spacing: 0.05em; }
.chip-btn:hover { border-color: rgba(201,209,220,.35); background: rgba(201,209,220,.05); }
.menu { position: absolute; right: 0; top: 42px; min-width: 210px; padding: 6px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 20px 50px -10px rgba(0,0,0,.7); z-index: 30; display: grid; }
.menu button { text-align: left; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--silver); }
.menu button:hover { background: rgba(201,209,220,.07); }
.menu button.danger { color: var(--err); }

.thread { flex: 1; overflow-y: auto; overflow-x: hidden; scroll-behavior: auto; }
.thread-inner { max-width: 860px; margin: 0 auto; padding: 28px 24px 40px; }

/* empty state */
.hero { min-height: 58vh; display: grid; place-items: center; text-align: center; }
.hero-logo { width: 84px; height: 84px; margin: 0 auto 18px; filter: drop-shadow(0 0 24px rgba(226, 184, 187, 0.28)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.hero h1 { margin: 0; font-size: clamp(24px, 4vw, 34px); font-weight: 600; letter-spacing: -0.01em; background: var(--metal); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 10px 0 0; color: var(--silver-lo); }
.hero .boot { margin-top: 18px; font-size: 11px; color: var(--muted); letter-spacing: 0.14em; }
.suggest { margin-top: 28px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 640px; }
.suggest button { text-align: left; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--line); background: rgba(39, 10, 13, 0.6); color: var(--silver-lo); font-size: 13.5px; transition: border-color .2s, color .2s, transform .2s; }
.suggest button:hover { border-color: var(--line-2); color: var(--silver-hi); transform: translateY(-1px); }
.suggest b { display: block; color: var(--silver); font-weight: 500; margin-bottom: 2px; font-size: 13px; }

/* messages */
.msg { margin: 0 0 26px; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.bubble {
  max-width: min(640px, 88%); padding: 12px 16px; border-radius: 16px 16px 4px 16px;
  background: linear-gradient(180deg, #47191d, #3a1316); border: 1px solid var(--line-2);
  color: var(--silver-hi); white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere;
  box-shadow: 0 10px 30px -18px rgba(0,0,0,.8);
}
.atts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 8px; max-width: 88%; }
.att-img { width: 120px; height: 120px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line-2); cursor: zoom-in; background: var(--panel); }
.att-file { display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); font-size: 12.5px; color: var(--silver); text-decoration: none; max-width: 260px; }
.att-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-file small { color: var(--muted); }

.msg.assistant .who { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.who-badge { width: 26px; height: 26px; }
.who-name { font: 600 11.5px var(--mono); letter-spacing: 0.24em; color: var(--silver); }
.who-time { font: 11px var(--mono); color: var(--muted); }

.md { color: var(--silver); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { color: var(--silver-hi); margin: 20px 0 10px; line-height: 1.3; font-weight: 600; }
.md h1 { font-size: 1.4em; } .md h2 { font-size: 1.22em; } .md h3 { font-size: 1.08em; }
.md strong { color: var(--silver-hi); }
.md ul, .md ol { padding-left: 22px; margin: 0 0 12px; }
.md li { margin: 3px 0; }
.md li::marker { color: var(--silver-lo); }
.md blockquote { margin: 0 0 12px; padding: 4px 14px; border-left: 2px solid var(--silver-lo); color: var(--silver-lo); }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 18px 0; }
.md table { border-collapse: collapse; margin: 0 0 14px; font-size: 13.5px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--line-2); padding: 7px 11px; text-align: left; }
.md th { background: rgba(201,209,220,.06); color: var(--silver-hi); font-weight: 600; }
.md code { font: 0.88em var(--mono); background: rgba(218, 149, 155,.1); border: 1px solid rgba(218, 149, 155,.14); padding: 1px 6px; border-radius: 6px; color: #f3dddf; }
.md pre { position: relative; margin: 0 0 14px; border-radius: 12px; background: #160607 !important; border: 1px solid var(--line-2); overflow: hidden; }
.md pre code { display: block; padding: 14px 16px; overflow-x: auto; background: none; border: 0; font-size: 12.8px; line-height: 1.6; color: #e7d6d8; }
.md pre .code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--line); font: 10.5px var(--mono); color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; background: rgba(201,209,220,.03); }
.copy-btn { font: 10.5px var(--mono); color: var(--silver-lo); padding: 3px 8px; border-radius: 6px; letter-spacing: 0.1em; }
.copy-btn:hover { background: rgba(201,209,220,.08); color: var(--silver-hi); }
.md img { max-width: 100%; border-radius: 10px; }

/* tool steps */
.steps { margin: 6px 0 14px; border-left: 1px dashed var(--line-2); padding-left: 14px; display: grid; gap: 6px; }
.step { border: 1px solid var(--line); border-radius: 10px; background: rgba(22, 6, 7, 0.65); overflow: hidden; }
.step-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; text-align: left; font: 12.5px var(--mono); color: var(--silver-lo); }
.step-head:hover { background: rgba(201,209,220,.03); }
.step-name { color: var(--steel); font-weight: 600; flex: none; }
.step-arg { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--silver-lo); }
.step-state { flex: none; width: 16px; height: 16px; display: grid; place-items: center; }
.step-state.done { color: var(--ok); }
.step-state.error { color: var(--err); }
.spin { width: 12px; height: 12px; border: 1.6px solid rgba(218, 149, 155,.25); border-top-color: var(--steel); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chev { flex: none; color: var(--muted); transition: transform .2s; }
.step.open .chev { transform: rotate(90deg); }
.step-body { display: none; border-top: 1px solid var(--line); }
.step.open .step-body { display: block; }
.step-body pre { margin: 0; padding: 10px 12px; font: 11.8px/1.55 var(--mono); color: #b8c3d3; white-space: pre-wrap; word-break: break-word; max-height: 340px; overflow: auto; }
.step-body .lbl { font: 9.5px var(--mono); letter-spacing: 0.2em; color: var(--muted); padding: 8px 12px 0; }
.step-body .res.err { color: var(--err); }

.working { display: inline-flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(39, 10, 13, 0.6); font: 12px var(--mono); color: var(--silver-lo); letter-spacing: 0.06em; margin-top: 4px; }
.bars { display: inline-flex; gap: 3px; align-items: flex-end; height: 14px; }
.bars i { width: 3px; background: var(--metal); border-radius: 2px; animation: bar 1s ease-in-out infinite; }
.bars i:nth-child(2) { animation-delay: .15s; } .bars i:nth-child(3) { animation-delay: .3s; } .bars i:nth-child(4) { animation-delay: .45s; }
@keyframes bar { 0%, 100% { height: 4px; opacity: .5; } 50% { height: 14px; opacity: 1; } }
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--silver); vertical-align: -2px; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.err-box { margin-top: 8px; padding: 11px 14px; border-radius: 11px; border: 1px solid rgba(240,140,140,.3); background: rgba(240,140,140,.06); color: #f3b3b3; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
.note { margin-top: 8px; font: 12px var(--mono); color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font: 10.5px var(--mono); color: var(--muted); letter-spacing: 0.08em; align-items: center; }
.meta button { font: inherit; color: var(--muted); padding: 2px 6px; margin-left: -6px; border-radius: 5px; }
.meta button:hover { color: var(--silver); background: rgba(201,209,220,.06); }

/* composer */
.composer-wrap { padding: 8px 24px calc(14px + env(safe-area-inset-bottom)); }
.composer {
  max-width: 812px; margin: 0 auto; border-radius: 18px; padding: 10px 10px 8px 14px;
  background: linear-gradient(180deg, rgba(53, 16, 19, 0.92), rgba(36, 9, 12, 0.95));
  border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px -24px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color .2s, box-shadow .2s;
  backdrop-filter: blur(14px);
}
.composer:focus-within { border-color: rgba(201,209,220,0.32); box-shadow: 0 24px 60px -24px rgba(0,0,0,.9), 0 0 0 4px rgba(218, 149, 155,0.06); }
.composer textarea {
  width: 100%; resize: none; border: 0; outline: none; background: none; color: var(--silver-hi);
  font: 15.5px/1.5 var(--sans); padding: 6px 2px; max-height: 40vh; min-height: 28px;
}
.composer textarea::placeholder { color: var(--muted); }
.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.composer-bar .left, .composer-bar .right { display: flex; align-items: center; gap: 6px; }
.model-select { position: relative; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); color: var(--silver-lo); font-size: 11.5px; }
.model-select select { appearance: none; -webkit-appearance: none; background: none; border: 0; outline: none; color: var(--silver); font: 11.5px var(--mono); letter-spacing: 0.06em; cursor: pointer; padding-right: 2px; }
.model-select select option { background: var(--panel-2); }
.hint { font-size: 10.5px; color: var(--muted); letter-spacing: 0.06em; margin-right: 6px; }
.send-btn { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--metal); color: #25090c; box-shadow: 0 6px 18px -6px rgba(232, 203, 205,.5), inset 0 1px 0 rgba(255,255,255,.8); transition: transform .15s, filter .2s, opacity .2s; }
.send-btn:hover { filter: brightness(1.07); }
.send-btn:active { transform: scale(.95); }
.send-btn:disabled { opacity: .35; cursor: not-allowed; }
.send-btn .i-stop { display: none; }
.send-btn.stop { background: linear-gradient(135deg, #5f292d, #49191d); color: var(--silver-hi); box-shadow: 0 0 0 1px var(--line-2), 0 0 18px -4px rgba(218, 149, 155,.6); }
.send-btn.stop .i-stop { display: block; }
.send-btn.stop .i-send { display: none; }
.composer-note { max-width: 812px; margin: 8px auto 0; text-align: center; font-size: 10px; color: var(--muted); letter-spacing: 0.1em; opacity: .8; }

.attach-tray { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 8px; }
.tray-item { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 30px 6px 6px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(18, 5, 6,.6); font: 11.5px var(--mono); color: var(--silver); max-width: 230px; }
.tray-item img, .tray-item .ficon { width: 36px; height: 36px; border-radius: 7px; object-fit: cover; flex: none; }
.tray-item .ficon { display: grid; place-items: center; background: var(--raised); color: var(--silver-lo); font-size: 9.5px; letter-spacing: .05em; }
.tray-item .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-item small { display: block; color: var(--muted); font-size: 10px; }
.tray-item .rm { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: var(--silver-lo); }
.tray-item .rm:hover { background: rgba(240,140,140,.15); color: var(--err); }

.drop-overlay { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(18, 5, 6, 0.75); backdrop-filter: blur(4px); }
.drop-box { padding: 40px 60px; border: 1.5px dashed var(--silver-lo); border-radius: 18px; letter-spacing: 0.25em; color: var(--silver-hi); font-size: 13px; }

/* drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 50;
  background: linear-gradient(180deg, rgba(41, 11, 14, 0.98), rgba(22, 6, 7, 0.98));
  border-left: 1px solid var(--line-2); transform: translateX(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column; box-shadow: -30px 0 60px -20px rgba(0,0,0,.8);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 18px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.drawer-title { font-weight: 600; color: var(--silver-hi); }
.drawer-path { font-size: 10.5px; color: var(--muted); word-break: break-all; margin-top: 3px; }
.drawer-actions { display: flex; gap: 2px; }
.file-list { flex: 1; overflow: auto; padding: 8px 10px 20px; font-size: 12.5px; }
.f-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; color: var(--silver-lo); text-decoration: none; }
.f-row:hover { background: rgba(201,209,220,.05); color: var(--silver-hi); }
.f-row.dir { color: var(--silver); }
.f-row .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-row .fsize { color: var(--muted); font-size: 10.5px; flex: none; }

/* lightbox & toast */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(12, 3, 4,.92); display: grid; place-items: center; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 90; padding: 10px 16px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--silver-hi); font: 12.5px var(--mono); box-shadow: 0 20px 40px -10px rgba(0,0,0,.7); max-width: calc(100vw - 32px); }

.backdrop { display: none; }
.only-mobile { display: none; }

/* ===== Mobile ===== */
@media (max-width: 860px) {
  .only-mobile { display: inline-grid; }
  .hide-sm { display: none; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; transform: translateX(-102%); transition: transform .28s cubic-bezier(.2,.8,.2,1); width: min(86vw, 320px); }
  .shell.side-open .sidebar { transform: none; box-shadow: 30px 0 60px -20px rgba(0,0,0,.8); }
  .shell.side-open .backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(12, 3, 4,.6); backdrop-filter: blur(2px); }
  .topbar { padding: 10px 12px; min-height: 56px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .thread-inner { padding: 20px 16px 30px; }
  .composer-wrap { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .composer-note { display: none; }
  .suggest { grid-template-columns: 1fr; }
  .bubble { max-width: 92%; }
  .att-img { width: 96px; height: 96px; }
  .btn-new kbd { display: none; }
  body { font-size: 15px; }
  .composer textarea { font-size: 16px; } /* prevents iOS zoom */
}

/* ===== Voice: dictation + read aloud ===== */
.mic-btn { position: relative; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--silver-lo); border: 1px solid var(--line-2); transition: background .15s, color .15s, box-shadow .2s; flex: none; }
.mic-btn:hover { background: rgba(201, 209, 220, 0.07); color: var(--silver-hi); }
.mic-btn .mic-wave { display: none; gap: 2px; align-items: center; height: 16px; }
.mic-btn .mic-wave i { width: 3px; border-radius: 2px; background: var(--silver-hi); animation: bar 0.9s ease-in-out infinite; }
.mic-btn .mic-wave i:nth-child(2) { animation-delay: .12s; } .mic-btn .mic-wave i:nth-child(3) { animation-delay: .24s; } .mic-btn .mic-wave i:nth-child(4) { animation-delay: .36s; }
.mic-btn.live { background: linear-gradient(135deg, #a3242f, #6d1520); color: var(--silver-hi); border-color: transparent; box-shadow: 0 0 0 4px rgba(218, 149, 155, .14), 0 0 22px -4px rgba(240, 120, 130, .7); animation: micpulse 1.6s ease-in-out infinite; }
.mic-btn.live .i-mic { display: none; }
.mic-btn.live .mic-wave { display: inline-flex; }
.mic-btn.unsupported { opacity: .45; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 8px rgba(218, 149, 155, .06), 0 0 26px -2px rgba(240, 120, 130, .8); } }
.composer.listening { box-shadow: 0 0 0 1px rgba(218, 149, 155, .45), 0 0 30px -10px rgba(240, 120, 130, .6); }
.hint.live { color: var(--steel); }

.voice-panel { display: grid; gap: 10px; padding: 12px; border-radius: 11px; background: rgba(18, 5, 6, .55); border: 1px solid var(--line-2); font-size: 12.5px; color: var(--silver); }
.v-row { display: grid; gap: 5px; }
.v-row > span.mono { font-size: 9.5px; letter-spacing: .14em; color: var(--muted); }
.v-row select { width: 100%; background: var(--panel-2); color: var(--silver); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 8px; font: 12px var(--sans); outline: none; }
.v-check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; line-height: 1.35; }
.v-check input { accent-color: #c4505b; margin: 2px 0 0; width: 15px; height: 15px; flex: none; }
.v-test { justify-self: start; font-size: 10.5px; letter-spacing: .1em; color: var(--silver-lo); padding: 5px 9px; border-radius: 7px; border: 1px solid var(--line-2); }
.v-test:hover { color: var(--silver-hi); background: rgba(201, 209, 220, .06); }

.meta button.speaking { color: var(--steel); }
.meta button[data-speak] svg { vertical-align: -2px; margin-right: 4px; }
@media (max-width: 860px) {
  .mic-btn { width: 40px; height: 40px; }
}
