:root {
  --bg: #000000;
  --bar: rgba(22, 22, 24, 0.92);
  --surface: #1c1c1e;
  --text: #f2f2f7;
  --muted: #8e8e93;
  --sent: #0a84ff;
  --accent: #0a84ff;
  --recv: #26262a;
  --line: #2c2c2e;
  --danger: #ff453a;
  --warn: #ffd60a;
  --ok: #30d158;
  --code: #1c1c1e;
  --shadow: none;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #ffffff; --bar: rgba(248, 248, 250, 0.94); --surface: #ffffff; --text: #000000; --muted: #6e6e73;
          --recv: #e9e9eb; --line: #d1d1d6; --code: #f2f2f7; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }  /* even on elements styled display: flex */
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif; }
body { display: flex; flex-direction: column; height: 100dvh; overflow-x: hidden; }
main, #messages { min-width: 0; max-width: 100vw; }
#side { display: none; }
#bar { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; background: var(--bar);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--line); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 10px; }
.name { font-weight: 600; }
.status { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.on::before { content: "● "; color: var(--ok); }
.status.off::before { content: "● "; color: var(--danger); }
.stop { flex-shrink: 0; border: 0; border-radius: 16px; padding: 7px 14px; background: var(--danger); color: #fff; font-weight: 600; font-size: 15px; cursor: pointer; }
main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#pair { padding: 24px 20px; }
#pair h1 { font-size: 26px; margin: 8px 0 16px; }
#pair li { margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 14px; }
#pairform { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
#pairform input { font-size: 22px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--recv); color: var(--text); }
#code { letter-spacing: 6px; text-align: center; font-size: 28px !important; }
button { cursor: pointer; font-family: inherit; }
.primary { border: 0; border-radius: 12px; padding: 14px; background: var(--sent); color: #fff; font-size: 17px; font-weight: 600; }
.error { color: var(--danger); }

/* -- conversation ---------------------------------------------------------------------------- */
#messages { padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.bubble { max-width: 82%; padding: 8px 13px; border-radius: 19px; word-wrap: break-word; overflow-wrap: anywhere; }
.bubble.sent { align-self: flex-end; background: var(--sent); color: #fff; border-bottom-right-radius: 6px; }
.bubble.recv { align-self: flex-start; background: var(--recv); border-bottom-left-radius: 6px; }
.bubble.live { opacity: 0.92; }
.bubble p { margin: 0 0 6px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 2px 0 6px; padding-left: 22px; }
.bubble li { margin: 2px 0; }
.bubble h3 { margin: 6px 0 4px; font-size: 17px; }
.bubble code { font: 14px ui-monospace, Menlo, Consolas, monospace; background: rgba(127, 127, 127, 0.22); padding: 1px 4px; border-radius: 5px; }
.bubble pre { margin: 4px 0; padding: 8px 10px; background: var(--code); border-radius: 10px; overflow-x: auto;
  font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; white-space: pre; }
.bubble a { color: inherit; }
.tablewrap { overflow-x: auto; margin: 6px 0 8px; border-radius: 10px; border: 1px solid var(--line); }
.bubble table { border-collapse: collapse; width: 100%; font-size: 14px; overflow-wrap: normal; }
.bubble th, .bubble td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.bubble th { background: rgba(127, 127, 127, 0.14); font-weight: 600; white-space: nowrap; }
.bubble tbody tr:last-child td { border-bottom: 0; }
.bubble td.num, .bubble th.num { text-align: right; font-variant-numeric: tabular-nums; }
.origin { align-self: flex-end; font-size: 11px; color: var(--muted); margin: -2px 6px 4px; }
.line { align-self: center; max-width: 92%; font-size: 13px; color: var(--muted); text-align: center; margin: 2px 0;
  overflow-wrap: anywhere; }
.line.error { color: var(--danger); } .line.warning { color: var(--warn); }
details.steps[open] { align-self: stretch; }
details.steps { align-self: flex-start; max-width: 92%; margin: 2px 4px; font-size: 13px; color: var(--muted); }
details.steps summary { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.steps ol { margin: 6px 0 4px; padding: 8px 10px 8px 28px; background: var(--code); border-radius: 10px; }
details.steps li { margin: 2px 0; overflow-wrap: anywhere; }
details.steps li.failed { color: var(--danger); }

/* -- approvals ----------------------------------------------------------------------------------- */
.approval { position: sticky; bottom: 0; margin: 8px 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--recv); border: 1px solid var(--warn); font-size: 15px; overflow-wrap: anywhere; }
.approval.strong { border-color: var(--danger); }
.approvaltitle { font-weight: 700; color: var(--warn); margin-bottom: 4px; }
.approval.strong .approvaltitle { color: var(--danger); }
.approvalsummary { font-weight: 600; margin-bottom: 6px; white-space: pre-line; }
.approval details { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.approval details summary { cursor: pointer; }
.approval pre { white-space: pre-wrap; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; margin: 4px 0 0; }
#approvaloui { width: 100%; font-size: 18px; padding: 10px 12px; margin-bottom: 8px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); text-align: center; letter-spacing: 3px; }
.approvalbuttons { display: flex; gap: 10px; }
.approvalbuttons button { flex: 1; }

/* -- buttons, sheets ------------------------------------------------------------------------------ */
.ghost { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: transparent; color: var(--text);
  font-size: 16px; text-decoration: none; }
.ghost.small { padding: 5px 11px; font-size: 14px; border-radius: 10px; }
.actions { display: flex; align-items: center; gap: 8px; }
.actions .ghost { padding: 5px 10px; font-size: 18px; }
#bellbtn:not(.on), #netbtn:not(.on) { opacity: 0.6; }
#logoutbtn { font-size: 14px !important; }
.danger { border: 0; border-radius: 12px; padding: 14px; background: var(--danger); color: #fff; font-size: 17px; font-weight: 600; }
#net .primary, #net .danger { width: 100%; }
#siri .primary, #siri .ghost:not(.small) { width: 100%; margin-top: 8px; }
#siri .setrow { padding: 10px 0; }
#siri .secret { font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
#netsessions { list-style: none; padding: 0; margin: 4px 0 12px; font-size: 14px; color: var(--muted); }
.bigcode, .logincode { font: 700 64px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 10px; text-align: center; margin: 8px 0; }
.logincode { font-size: 44px; color: var(--text); }
#browser { padding: 24px 20px; }
#browser .primary { width: 100%; max-width: 360px; }
.screen.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.bigicon { width: 84px; height: 84px; border-radius: 20px; }
#register, #locked { padding: 24px 20px; }
#register .primary, #locked .primary { width: 100%; }
.sheet { position: fixed; inset: auto 0 0 0; max-height: 70dvh; overflow-y: auto; background: var(--bar);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0; padding: 14px 16px calc(env(safe-area-inset-bottom) + 14px); z-index: 10; }
.sheethead { display: flex; justify-content: space-between; align-items: center; }

/* -- quick answers under a question ---------------------------------------------------------------- */
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.choices button { border: 1px solid var(--accent); border-radius: 18px; padding: 7px 14px; background: transparent;
  color: var(--accent); font: inherit; font-size: 15px; cursor: pointer; }
.choices button:first-child { background: var(--accent); color: #fff; }
.choices button:disabled { opacity: 0.45; cursor: default; }
.choices button.picked { opacity: 1; outline: 2px solid var(--accent); outline-offset: 2px; }

/* -- suivi ---------------------------------------------------------------------------------------- */
#suivibtn { position: relative; }
#suivibtn .dot { position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); animation: pulse 1.6s ease-in-out infinite; }
#suivibtn .dot.stall { background: var(--warn); animation: none; }
/* The job's percentage, always in sight on the 📊 button and as a thin line under the bar. */
#suivibtn { white-space: nowrap; }
#suivibtn .pct { margin-left: 5px; font-size: 14px; font-weight: 600; color: var(--accent);
  font-variant-numeric: tabular-nums; vertical-align: 2px; }
/* On a phone the bar is full while Jarvis works (■ Arrêter): the percentage takes the icon's place. */
@media (max-width: 430px) {
  #suivibtn.haspct .ico { display: none; }
  #suivibtn.haspct .pct { margin-left: 0; font-size: 15px; vertical-align: 0; }
  /* Every button fits beside « Jarvis » on an iPhone, even while working: ■ alone, tighter buttons. */
  .actions { gap: 5px; }
  .actions .ghost { padding: 5px 7px; font-size: 17px; }
  .stop { padding: 7px 11px; }
  .stop .label { display: none; }
  /* With the notifications button too (🔔, on the user's iPhone), 🎙️ covered « Jarvis » at 390 px. */
  #bar { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .who { gap: 8px; flex-shrink: 0; }
  .name { white-space: nowrap; }
  .avatar { width: 30px; height: 30px; border-radius: 9px; }
  .actions .ghost { padding: 5px 6px; }
}
@media (max-width: 380px) {  /* iPhone mini / SE: the name stays, the picture goes while Jarvis works */
  body.working #bar .avatar { display: none; }
  .actions { gap: 4px; }
}
#suivibtn .pct.estimated { color: var(--muted); }
#suivibtn .pct.stall { color: var(--warn); }
.barprogress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; }
.barprogress .fill { height: 100%; width: 0; background: var(--accent); transition: width 0.6s ease; }
.barprogress.stall .fill { background: var(--warn); }
.requests { display: flex; flex-direction: column; gap: 6px; }
.request { display: flex; gap: 8px; align-items: baseline; font-size: 14px; padding: 8px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); }
.request .chip { flex-shrink: 0; }
.request.done .chip { color: var(--ok); }
@keyframes pulse { 50% { opacity: 0.35; } }
.suivibody { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.progress { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.progresshead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.progresshead .percent { font-size: 28px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums;
  white-space: nowrap; }
.progresshead .step { font-size: 15px; }
.progress .bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress .fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.6s ease; }
.progress small, .muted { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.health { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.health .led { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.health.ok .led { background: var(--ok); animation: pulse 1.6s ease-in-out infinite; }
.health.wait .led { background: var(--accent); }
.health.stall .led { background: var(--warn); }
.health.stall { color: var(--warn); }
.worker { display: flex; flex-direction: column; gap: 2px; font-size: 14px; padding: 10px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); }
.worker span { color: var(--muted); font-size: 13px; }
.helper { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent); }
.helper.completed { border-left-color: var(--ok); }
.helper.failed, .helper.stopped { border-left-color: var(--danger); }
.helperhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.helper small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.helper .doing { font-size: 13px; margin-top: 4px; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: var(--line); color: var(--text); white-space: nowrap; }
.helper.running .chip { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.helper.completed .chip { background: color-mix(in srgb, var(--ok) 25%, transparent); }

/* -- results list ------------------------------------------------------------------------------- */
.filelist { list-style: none; padding: 0; margin: 8px 0 0; }
.filelist li.empty { color: var(--muted); font-size: 14px; padding: 10px 4px; }
.dayhead { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent);
  padding: 10px 8px 2px; }
details.day { margin-top: 2px; }
details.day > summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--muted); padding: 7px 8px;
  border-radius: 10px; display: flex; align-items: center; gap: 6px; }
details.day > summary::-webkit-details-marker { display: none; }
details.day > summary::before { content: "▸"; font-size: 10px; transition: transform .15s; }
details.day[open] > summary::before { transform: rotate(90deg); }
details.day > summary:hover { background: rgba(127, 127, 127, 0.1); color: var(--text); }
details.day .filelist { margin: 0 0 4px 8px; }
.file.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { 0%, 30% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }
.file { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 8px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text); text-align: left; font-size: 15px; }
.file:hover { background: rgba(127, 127, 127, 0.12); }
.fileicon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.filetext { display: flex; flex-direction: column; min-width: 0; }
.filename { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filetext small { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* -- file preview ------------------------------------------------------------------------------- */
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.45); display: flex; }
.viewerpanel { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg);
  padding-top: env(safe-area-inset-top); }
.viewerhead { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.viewerhead b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.tabs { display: flex; gap: 4px; padding: 8px 12px 0; overflow-x: auto; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; font-size: 14px;
  border-radius: 10px 10px 0 0; white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.viewerbody { flex: 1; overflow: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
.sheetwrap { display: inline-block; min-width: 100%; }
.sheet-table { border-collapse: separate; border-spacing: 0; font: 13px/1.35 "Segoe UI", -apple-system, sans-serif;
  color: #1f2328; background: #ffffff; table-layout: fixed; border: 1px solid #d0d7de; border-radius: 8px; overflow: hidden; }
.sheet-table col.rownum { width: 44px; }
.sheet-table td, .sheet-table th { padding: 5px 8px; border-right: 1px solid #e6e9ed; border-bottom: 1px solid #e6e9ed;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.sheet-table td.wrap { white-space: normal; overflow-wrap: anywhere; }
.sheet-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-table td.center { text-align: center; }
.sheet-table td.formula { color: #8a919a; font-style: italic; }
.sheet-table th { background: #f3f5f7; color: #8a919a; font-weight: 500; font-size: 11px; text-align: center; position: sticky; left: 0; }
.sheet-table tr:first-child td { position: sticky; top: 0; z-index: 1; }
.docpage { max-width: 780px; margin: 0 auto; padding: 40px 48px; background: #ffffff; color: #1f2328; border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.08); font: 15px/1.6 "Segoe UI", -apple-system, sans-serif; }
.docpage h1 { font-size: 26px; margin: 0 0 12px; } .docpage h2 { font-size: 20px; margin: 22px 0 8px; color: #2596be; }
.docpage h3, .docpage h4 { font-size: 16px; margin: 16px 0 6px; }
.docpage p { margin: 0 0 10px; white-space: pre-wrap; }
.docpage table { border-collapse: collapse; width: 100%; margin: 10px 0 16px; font-size: 14px; }
.docpage th { background: #2596be; color: #fff; text-align: left; }
.docpage th, .docpage td { padding: 6px 10px; border: 1px solid #e3e7eb; }
.textview { margin: 0; white-space: pre-wrap; font: 13px/1.5 ui-monospace, Consolas, monospace; }
.previewimg { display: block; max-width: 100%; max-height: 100%; margin: 0 auto; border-radius: 8px; }
body.viewing { overflow: hidden; }

/* -- composer ------------------------------------------------------------------------------------ */
.attach { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--recv); color: var(--text); font-size: 24px; flex-shrink: 0; cursor: pointer; }
#composer { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px calc(env(safe-area-inset-bottom) + 8px);
  background: var(--bar); border-top: 1px solid var(--line); }
#composer .row { display: flex; align-items: flex-end; gap: 8px; }
#attachments { display: flex; gap: 8px; overflow-x: auto; }
.chip { display: flex; align-items: center; gap: 6px; flex-shrink: 0; max-width: 70vw; padding: 4px 4px 4px 8px;
  border-radius: 12px; background: var(--recv); font-size: 14px; }
.chip.pending { opacity: 0.55; }
.chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { border: 0; background: transparent; color: var(--muted); font-size: 15px; padding: 4px 6px; }
#input { flex: 1; resize: none; max-height: 140px; font: inherit; padding: 8px 14px; border-radius: 19px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); }
#send { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--sent); color: #fff; font-size: 20px; font-weight: 700; }
#send:disabled { opacity: 0.35; }

/* -- welcome (empty conversation) ---------------------------------------------------------------- */
.welcome { max-width: 760px; margin: 0 auto; padding: 48px 24px 12px; text-align: center; }
.welcomeicon { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 8px 30px rgba(79, 91, 213, 0.35); }
.welcome h1 { margin: 18px 0 6px; font-size: 28px; letter-spacing: -0.01em; }
.welcome p { margin: 0 auto 26px; max-width: 520px; color: var(--muted); }
.suggestions { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; text-align: left; }
.suggestion { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 14px;
  padding: 12px 14px; font-size: 14px; line-height: 1.35; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.suggestion:hover { border-color: var(--accent); transform: translateY(-1px); }

/* -- settings (the tower's window) ------------------------------------------------------------- */
.settingspanel { max-width: 720px; margin: 0 auto; }
.settingsbody { padding: 8px 24px 24px !important; }
.settingsbody h2 { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin: 22px 0 8px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.setrow > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.setrow small { color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 2px; }
.segmented { display: inline-flex; flex-shrink: 0; padding: 3px; gap: 2px; border-radius: 10px; background: var(--code);
  border: 1px solid var(--line); }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 6px 11px; border-radius: 8px; font-size: 13px; }
.segmented button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.setgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 8px; }
.settile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 14px; text-align: left; }
.settile span { font-size: 20px; }
.settile:hover { border-color: var(--accent); }
.dangerish { color: var(--danger) !important; border-color: color-mix(in srgb, var(--danger) 40%, transparent) !important; }
.switch { position: relative; flex-shrink: 0; width: 44px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: var(--line); transition: background .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
#window { padding: 24px 20px; }

/* -- drag and drop ------------------------------------------------------------------------------ */
.dropzone { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 16%, rgba(0, 0, 0, 0.35)); backdrop-filter: blur(3px); pointer-events: none; }
.dropcard { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 48px; border-radius: 20px;
  background: var(--surface); border: 2px dashed var(--accent); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); text-align: center; }
.dropicon { font-size: 40px; }
.dropcard b { font-size: 18px; }
.dropcard span { color: var(--muted); font-size: 14px; }

/* -- alive: messages that arrive, Jarvis thinking, his badge when he works ------------------------ */
.bubble, .line, details.steps, .approval { animation: arrive .26s cubic-bezier(.2, .8, .3, 1) both; }
.bubble.sent { animation-name: arrive-right; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes arrive-right { from { opacity: 0; transform: translate(10px, 6px) scale(.98); } to { opacity: 1; transform: none; } }
.thinking { align-self: flex-start; display: flex; align-items: center; gap: 10px; max-width: 78%; padding: 10px 16px;
  border-radius: 18px; border-bottom-left-radius: 6px; background: var(--recv); border: 1px solid var(--line);
  color: var(--muted); font-size: 13.5px; animation: arrive .26s ease-out both; }
.thinking .step { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dots { display: inline-flex; gap: 4px; flex-shrink: 0; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .35; animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
body.working .avatar { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 35%, transparent); } }
.welcomeicon { animation: float 5s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.suggestion { animation: arrive .4s ease-out both; }
.suggestion:nth-child(2) { animation-delay: .05s; } .suggestion:nth-child(3) { animation-delay: .1s; }
.suggestion:nth-child(4) { animation-delay: .15s; } .suggestion:nth-child(5) { animation-delay: .2s; }
.suggestion:nth-child(6) { animation-delay: .25s; }
#send { transition: transform .12s, opacity .12s; } #send:active:not(:disabled) { transform: scale(.9); }
.status.on::before { display: inline-block; margin-right: 5px; }
body.working .status.on::before { animation: blink 1s steps(2, start) infinite; color: var(--accent); }
@keyframes blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* -- a computer: side panel with the results, a roomy conversation -------------------------------- */
@media (min-width: 1000px) {
  :root { --bg: #f5f6f8; --bar: rgba(255, 255, 255, 0.85); --surface: #ffffff; --text: #1d1f24; --muted: #6b7280;
          --sent: #4f5bd5; --accent: #4f5bd5; --recv: #ffffff; --line: #e4e6eb; --code: #f3f4f6;
          --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08); }
  @media (prefers-color-scheme: dark) {
    :root { --bg: #141518; --bar: rgba(28, 29, 33, 0.9); --surface: #1c1d21; --text: #ececf1; --muted: #9a9ca5;
            --sent: #5b67e0; --accent: #7c86f0; --recv: #22242a; --line: #2e3037; --code: #1a1b1f; --shadow: none; }
  }
  html, body { font-size: 15.5px; line-height: 1.55; font-family: "Segoe UI Variable Text", "Segoe UI", -apple-system, sans-serif; }
  body.inchat { display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "side bar" "side main" "side composer"; }
  body.inchat #side { grid-area: side; display: flex; flex-direction: column; min-height: 0; padding: 18px 14px;
    background: var(--surface); border-right: 1px solid var(--line); }
  body.inchat #bar { grid-area: bar; padding: 12px 28px; }
  body.inchat main { grid-area: main; }
  body.inchat #composer { grid-area: composer; }
  body.inchat #bar .avatar, body.inchat #bar .name { display: none; }  /* the side panel shows who this is */
  body.inchat #bar .status { font-size: 13.5px; }
  body.inchat #filesbtn { display: none; }
  .brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; border-bottom: 1px solid var(--line); }
  .brand .avatar { width: 40px; height: 40px; border-radius: 12px; }
  .brand .name { font-size: 17px; }
  .tagline { font-size: 12.5px; color: var(--muted); }
  .sidehead { display: flex; align-items: center; justify-content: space-between; padding: 16px 8px 4px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
  #sidefiles { flex: 1; overflow-y: auto; margin: 0; }
  #sidefiles .filename { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; line-height: 1.3; font-size: 14px; }
  #sidefiles .file { align-items: flex-start; }
  .sidehint { font-size: 12px; color: var(--muted); padding: 10px 8px 0; margin: 0; border-top: 1px solid var(--line); }
  .ghost { font-size: 14px; border-radius: 10px; }
  .ghost:hover { background: rgba(127, 127, 127, 0.1); }
  #messages { width: 100%; max-width: 860px; margin: 0 auto; padding: 28px 28px 16px; gap: 10px; }
  .bubble { max-width: 78%; padding: 11px 16px; border-radius: 18px; }
  .bubble.recv { background: var(--recv); box-shadow: var(--shadow); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
  .bubble.sent { border-bottom-right-radius: 6px; }
  .bubble h3 { font-size: 16px; }
  .bubble code { font-size: 13px; }
  details.steps { font-size: 12.5px; margin-left: 6px; }
  .line { font-size: 12.5px; }
  .approval { max-width: 860px; margin: 8px auto; width: calc(100% - 56px); box-shadow: var(--shadow); }
  #composer { padding: 14px 28px 18px; background: transparent; border-top: 0; }
  #composer .row, #attachments { width: 100%; max-width: 860px; margin: 0 auto; }
  #composer .row { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 8px;
    box-shadow: var(--shadow); align-items: flex-end; }
  #input { border: 0; background: transparent; padding: 8px 6px; font-size: 15.5px; outline: none; }
  .attach { background: transparent; color: var(--muted); }
  .attach:hover { background: rgba(127, 127, 127, 0.12); }
  #send { width: 38px; height: 38px; border-radius: 12px; }
  .sheet { inset: auto auto 0 50%; width: 640px; transform: translateX(-50%); }
  .viewer { padding: 3vh 3vw; }
  .viewerpanel { border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); padding-top: 0; }
  .viewerbody { padding: 22px; background: var(--bg); }
  .screen { max-width: 520px; margin: 0 auto; }

  /* the tower's own window: new conversation, quota, model, settings in the side panel */
  .newchat { margin: 14px 4px 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--bg); color: var(--text); font-size: 14px; font-weight: 600; text-align: left; }
  .newchat:hover { border-color: var(--accent); color: var(--accent); }
  .sidefoot { display: flex; flex-direction: column; gap: 10px; padding: 14px 8px 0; margin-top: 10px; border-top: 1px solid var(--line); }
  .meterlabel { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
  .meterlabel b { color: var(--text); font-weight: 600; }
  .metertrack { height: 6px; border-radius: 3px; background: var(--code); overflow: hidden; }
  .meterbar { height: 100%; border-radius: 3px; background: var(--ok); transition: width .4s; }
  .meterbar.mid { background: var(--warn); } .meterbar.high { background: var(--danger); }
  .sidemode { display: flex; flex-wrap: wrap; gap: 6px; }
  .chip-mini { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: var(--code); color: var(--muted);
    border: 1px solid var(--line); }
  .chip-mini.auto { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
  .settingsbtn { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text);
    font-size: 14px; text-align: left; }
  .settingsbtn:hover { background: rgba(127, 127, 127, 0.1); }
  .hotkeys { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
  kbd { font: 600 10.5px ui-monospace, Consolas, monospace; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line);
    background: var(--bg); color: var(--text); }
  body.localmode #sidefiles { margin-top: 0; }
  body.localmode .sidehint, body.browsermode .sidehint { display: none; }
  .settingspanel { border-radius: 16px; }
  .doorinfo button, .doorinfo > span { white-space: nowrap; flex-shrink: 0; }
  .doorinfo { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
  body.browsermode #logoutbtn { display: none; }  /* in the side panel instead */
  /* thin, quiet scrollbars (the window is Edge: its default ones are heavy) */
  * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
}

/* -- season: autumn / Halloween (1 October - 2 November, set by app.js) ----------------------------
   The user's palette (2026-10-10): Autumn Ochre #D48C2B and Muted Earth #5E4B3C, serif titles.
   Always a night look (Halloween), on the iPhone as on a computer, light or dark mode. */
:root.automne {
  --bg: #1a130f; --bar: rgba(36, 27, 21, 0.9); --surface: #261d17; --text: #f3e7d6; --muted: #b59d82;
  --sent: #d48c2b; --accent: #d48c2b; --on-accent: #24170b; --recv: #3a2d23; --line: #5e4b3c;
  --danger: #e0563b; --warn: #f2b84b; --ok: #a3be5c; --code: #211812;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.25);
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  color-scheme: dark;
}
.automne body {
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(212, 140, 43, 0.16), transparent 60%),
    radial-gradient(90% 50% at 50% 115%, rgba(94, 75, 60, 0.35), transparent 70%),
    var(--bg);
}
.automne .name, .automne h1, .automne .welcome h1, .automne .sheethead b, .automne .viewerhead b,
.automne .approvaltitle, .automne .settingsbody h2, .automne .dayhead, .automne .sidehead {
  font-family: var(--serif); letter-spacing: 0.01em;
}
.automne .name { color: var(--accent); font-weight: 700; }
.automne .welcome h1 { font-size: 32px; font-weight: 700; color: var(--accent); }
.automne .settingsbody h2, .automne .dayhead, .automne .sidehead { text-transform: none; font-size: 14px; letter-spacing: 0.02em; }
/* what is ochre carries dark brown text: white on ochre would be hard to read */
.automne .bubble.sent, .automne .primary, .automne #send { color: var(--on-accent); }
.automne .bubble.sent { background: linear-gradient(160deg, #e09a3a, #c97d1f); box-shadow: 0 2px 10px rgba(212, 140, 43, 0.25); }
.automne .bubble.recv { background: var(--recv); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.automne .bubble a { color: var(--accent); }
.automne .bubble.sent a { color: inherit; }
.automne .primary { background: linear-gradient(160deg, #e09a3a, #c97d1f); }
.automne .welcomeicon, .automne .bigicon { box-shadow: 0 0 0 1px rgba(212, 140, 43, 0.5), 0 8px 34px rgba(212, 140, 43, 0.45); }
.automne .suggestion { background: color-mix(in srgb, var(--surface) 85%, transparent); }
.automne .suggestion:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.automne #input { background: var(--code); }
.automne .switch input:checked + span { background: var(--accent); }
/* three bats over the welcome, drifting slowly (an image: the page's rules allow data: pictures) */
.automne .welcome { position: relative; }
.automne .welcome::before {
  content: ""; position: absolute; inset: 0 6% auto auto; width: 190px; height: 90px; pointer-events: none; opacity: 0.6;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 70'%3E%3Cg fill='%23d48c2b'%3E%3Cpath id='b' d='M20 14c-1.4 0-2.2 1.3-2.2 1.3l-1.4-2.2-.6 3C12.6 13 8 12.4 3 15.2c2.8 0 4.8 2 4.8 4.2 2-1.4 4.8-.8 6.2 1.4 1.4-2 3.6-2 5.6-.7 2-1.3 4.2-1.3 5.6.7 1.4-2.2 4.2-2.8 6.2-1.4 0-2.2 2-4.2 4.8-4.2-5-2.8-9.6-2.2-12.4 1.1l-.6-3-1.4 2.2S21.4 14 20 14z'/%3E%3Cuse href='%23b' transform='translate(88 4) scale(.75)'/%3E%3Cuse href='%23b' transform='translate(52 38) scale(.55)'/%3E%3C/g%3E%3C/svg%3E") no-repeat center / contain;
  animation: bats 9s ease-in-out infinite;
}
@keyframes bats { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-10px, 6px); } }
/* while Jarvis works: his badge glows like a candle */
.automne body.working .avatar { animation: candle 1.6s ease-in-out infinite; }
@keyframes candle {
  0%, 100% { box-shadow: 0 0 6px 1px rgba(212, 140, 43, 0.35); }
  30% { box-shadow: 0 0 12px 3px rgba(242, 184, 75, 0.55); }
  55% { box-shadow: 0 0 7px 2px rgba(212, 140, 43, 0.4); }
  75% { box-shadow: 0 0 14px 4px rgba(224, 120, 40, 0.5); }
}
.automne .thinking { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
@media (min-width: 1000px) {
  :root.automne { --bg: #1a130f; --surface: #221a14; --recv: #2e241c; }
  .automne body.inchat #side { background: linear-gradient(180deg, #241b15, #1c1510); }
  .automne .brand .name { font-size: 20px; }
  .automne #composer .row { background: var(--surface); }
}

/* Routines in the settings menu */
.routinelist { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.routine { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line, rgba(127,127,127,.25)); border-radius: 12px; }
.routine > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.routine small { overflow-wrap: anywhere; }
.routine .routinelast { opacity: .75; }
.routine.paused { opacity: .6; }
.routinebuttons { display: flex; gap: 6px; flex-shrink: 0; }
@media (max-width: 430px) { .routine { flex-direction: column; align-items: stretch; } .routinebuttons { justify-content: flex-end; } }

/* « ◈ Finance »: a read-only instrument panel (plan F2, EF1). The gold line is the one bold element. */
:root { --gold: #d9a93a; }
@media (prefers-color-scheme: light) { :root { --gold: #a87814; } }
#financebtn { font-size: 19px; line-height: 1; }
.sidefinance { margin: 8px 4px 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: transparent; color: var(--text); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.sidefinance span { color: var(--gold); margin-right: 4px; }
.sidefinance:hover, .sidefinance:focus-visible { border-color: var(--gold); outline: none; }
.finance { position: fixed; inset: 0; z-index: 40; overflow-y: auto; background: var(--bg); color: var(--text);
  padding: calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 24px); }
.finhead, .finbody { max-width: 1040px; margin: 0 auto; }
.finhead { display: flex; align-items: center; justify-content: space-between; }
.finhead h1 { font-size: 22px; font-weight: 600; margin: 4px 0; letter-spacing: -0.01em; }
.finhead h1 span { color: var(--gold); }
.finance h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 26px 0 8px; }
.finance .num { font-variant-numeric: tabular-nums; }
.fingold { position: relative; margin-top: 14px; padding: 18px 0 6px; border-bottom: 1px solid var(--line); }
.fingold .label { font-size: 15px; color: var(--muted); }
.fingold .price { font-size: clamp(40px, 11vw, 64px); font-weight: 300; letter-spacing: -0.03em; line-height: 1.05; }
.fingold .unit { font-size: 15px; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.fingold .chg { font-size: 17px; margin-left: 2px; }
.fingold svg { display: block; width: 100%; height: 96px; margin-top: 10px; overflow: visible; }
.fingold .grid { stroke: var(--line); stroke-width: 1; }
.fingold .line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--gold) 55%, transparent)); }
.fingold .area { fill: color-mix(in srgb, var(--gold) 12%, transparent); stroke: none; }
.fingold .nodata { color: var(--muted); font-size: 15px; padding: 18px 0 24px; }
.up { color: var(--ok); }
.down { color: var(--danger); }
.finmarkets { list-style: none; margin: 0; padding: 0; }
.finmarkets li { display: grid; grid-template-columns: 1fr 84px auto 70px; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line); }
.finmarkets .nm small { display: block; color: var(--muted); font-size: 12px; }
.finmarkets svg { width: 84px; height: 26px; }
.finmarkets svg path { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.finmarkets .px { text-align: right; }
.finmarkets .chg { text-align: right; font-size: 15px; }
.fincontext { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 0; }
.fincontext div { min-width: 120px; }
.fincontext dt { font-size: 12px; color: var(--muted); }
.fincontext dd { margin: 2px 0 0; font-size: 17px; }
.finblocks h2 { margin-bottom: 6px; }
.finblock { padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 15px; }
.finfoot { margin-top: 28px; color: var(--muted); font-size: 13px; }
@media (min-width: 900px) { .fincols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; } }
@media (max-width: 380px) { .finmarkets li { grid-template-columns: 1fr auto 62px; } .finmarkets svg { display: none; } }
@media (max-width: 400px) {  /* small iPhones, while Jarvis works: ■ needs the room, ◈ comes back after */
  body.working #financebtn { display: none; }
}
