/* VyBooks. These are the prototype's styles (prototype/index.html), as they are. The sign-in page's few rules are at the end. */
body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }

/* Built for a phone first. One column, big rows a thumb can hit, a bottom bar with the agent in the middle.
   On a wide screen the bar becomes a left column and the agent sits on the right, always open. */
:root {
  --bg: #eef1f4; --surface: #ffffff; --sunk: #e4e9ee; --ink: #14212f; --muted: #5b6878; --line: #d2d9e1;
  --accent: #0c5c8a; --accent-ink: #ffffff; --accent-soft: #dcebf4;
  --ok: #1f7a4d; --ok-soft: #dff1e7; --soon: #9a5b00; --soon-soft: #fbedcf; --due: #b3261e; --due-soft: #fbe3e0;
  --paper: #f6f0df; --paper-ink: #1d2a4a;
  --sans: "IBM Plex Sans", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --hand: "Caveat", "Segoe Script", cursive;
  --r: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1319; --surface: #161e27; --sunk: #101820; --ink: #e6ebf1; --muted: #98a5b4; --line: #293441;
    --accent: #6cb6e0; --accent-ink: #08131b; --accent-soft: #15303f;
    --ok: #5fce97; --ok-soft: #12301f; --soon: #efb54a; --soon-soft: #3a2c0d; --due: #ff8f85; --due-soft: #3d1815;
    --paper: #e9e2cd; --paper-ink: #1d2a4a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1319; --surface: #161e27; --sunk: #101820; --ink: #e6ebf1; --muted: #98a5b4; --line: #293441;
  --accent: #6cb6e0; --accent-ink: #08131b; --accent-soft: #15303f;
  --ok: #5fce97; --ok-soft: #12301f; --soon: #efb54a; --soon-soft: #3a2c0d; --due: #ff8f85; --due-soft: #3d1815;
  --paper: #e9e2cd; --paper-ink: #1d2a4a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 13.5px; } .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 0; min-width: 0; } .nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.wide { display: none; }

/* the frame */
.app { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
.side { display: none; }
.main { overflow-y: auto; min-width: 0; -webkit-overflow-scrolling: touch; }
.page { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; padding-block: 16px 28px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.head .sub { color: var(--muted); }
.tail { font-family: var(--mono); font-weight: 600; letter-spacing: .04em; }
.tailbtn { border: 0; background: none; padding: 0; display: inline-flex; align-items: center; gap: 4px; font-size: 24px; }
.chev { color: var(--muted); display: inline-flex; flex: none; } .chev.down { transform: rotate(90deg); }
.link { border: 0; background: none; padding: 4px 0; color: var(--accent); font-weight: 600; text-align: left; align-self: flex-start; }

/* bottom bar */
.tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; background: var(--surface); border-top: 1px solid var(--line);
  padding: 4px max(6px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); }
.tabbar button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); position: relative; min-width: 0; }
.tabbar button[aria-current="page"] { color: var(--accent); }
.tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 99px; background: var(--due); color: var(--surface); font-size: 11px; line-height: 17px; padding: 0 4px; }
.tabbar .ask .orb { width: 50px; height: 50px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin-top: -20px; box-shadow: 0 4px 14px rgba(0, 0, 0, .28); border: 3px solid var(--surface); }
.tabbar .ask .lab { color: var(--accent); }
.btn.fab { display: none; }

/* panels and rows */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; text-align: left; }
button.panel.tap { width: 100%; }
.list { display: flex; flex-direction: column; min-width: 0; }
.rowbtn { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 11px 0; min-width: 0; min-height: 48px; }
.rowbtn:first-child { border-top: 0; }
.rowbtn .t { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rowbtn .tt { font-weight: 500; overflow-wrap: anywhere; }
.rowbtn .rt { flex: none; text-align: right; max-width: 55%; overflow-wrap: anywhere; }
.rowbtn.plain .rt { color: var(--ink); }
.rstack { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.item:first-child { border-top: 0; }
.item .t { min-width: 0; flex: 1 1 0; display: flex; flex-direction: column; }
.item.tick input { width: 22px; height: 22px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; padding: 2px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.soon { background: var(--soon-soft); color: var(--soon); } .pill.due { background: var(--due-soft); color: var(--due); }
.pill.plain { background: var(--sunk); color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.lvl.due { background: var(--due); } .dot.lvl.soon { background: var(--soon); } .dot.lvl.plain, .dot.lvl.ok { background: var(--muted); }
.warn { color: var(--soon); font-size: 13.5px; }
.err { color: var(--due); font-weight: 500; }
.note { background: var(--sunk); border-radius: 8px; padding: 9px 11px; font-size: 14.5px; }
.life { height: 5px; border-radius: 99px; background: var(--sunk); overflow: hidden; margin-top: 6px; display: block; }
.life i { display: block; height: 100%; background: var(--ok); } .life.soon i { background: var(--soon); } .life.due i { background: var(--due); }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 14px; font-weight: 600; white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.btn:hover { border-color: var(--accent); }
.btn.go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.quiet { border-color: transparent; background: none; color: var(--accent); padding: 6px 8px; }
.btn.small { padding: 6px 11px; font-size: 14px; min-height: 36px; white-space: normal; text-align: left; }
.btn.danger { color: var(--due); }
.btn:disabled { opacity: .45; cursor: default; }
.actions .btn { flex: 1 1 auto; }
.askbox { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--ink); border-radius: 12px; padding: 13px 14px; font-weight: 500; }
.askbox svg { color: var(--accent); flex: none; }

/* the row of choices at the top of a screen */
.seg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 8px 14px; font-weight: 600; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; min-height: 40px; }
.seg button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg .badge { background: var(--due); color: var(--surface); border-radius: 99px; font-size: 12px; padding: 0 6px; line-height: 18px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; font-size: 14px; text-align: left; min-height: 36px; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* numbers */
.meters { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: flex-end; }
.meter { display: flex; flex-direction: column; gap: 4px; }
.drum { display: inline-flex; gap: 2px; font-family: var(--mono); font-weight: 600; font-size: 20px; }
.drum span { background: var(--ink); color: var(--bg); border-radius: 3px; padding: 2px 5px; min-width: 20px; text-align: center; }
.drum span.tenth { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-size: clamp(15px, 4.4vw, 22px); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat h3 { font-size: 11px; letter-spacing: .05em; }

/* schedule: a list of days on a phone, a week grid on a wide screen */
.agenda { display: flex; flex-direction: column; }
.day { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.day:first-child { border-top: 0; }
.day .d { width: 48px; flex: none; text-align: center; display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); line-height: 1.2; }
.day .d b { font-size: 21px; color: var(--ink); }
.day.today .d b { color: var(--accent); }
.slots { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.slot { border: 0; border-left: 5px solid; border-radius: 8px; background: var(--surface); padding: 9px 11px; text-align: left; display: flex; flex-direction: column; gap: 1px; box-shadow: inset 0 0 0 1px var(--line); }
.open { border: 1px dashed var(--line); border-radius: 8px; background: none; color: var(--muted); padding: 9px 11px; text-align: left; font-size: 14.5px; min-height: 42px; }
.open.more { border: 0; padding: 2px 4px; min-height: 30px; color: var(--accent); font-weight: 600; font-size: 13.5px; align-self: flex-start; }
.week { display: grid; grid-template-columns: 46px repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.week .dh { padding: 6px 6px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); text-align: center; }
.week .dh.today { background: var(--accent-soft); }
.week .dh small { display: block; font-weight: 400; color: var(--muted); }
.week .gutter { position: relative; height: 600px; }
.week .gutter span { position: absolute; right: 6px; font-size: 11.5px; color: var(--muted); transform: translateY(-50%); }
.week .daycol { position: relative; height: 600px; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% 40px; cursor: copy; }
.bk { position: absolute; left: 3px; right: 3px; border-radius: 5px; padding: 3px 6px; font-size: 12.5px; line-height: 1.25; color: #fff; overflow: hidden; border: 0; text-align: left; cursor: pointer; }
.bk b { display: block; font-weight: 600; }
.bk.flag { box-shadow: inset 0 0 0 2px var(--soon); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.month .mh { padding: 6px; font-size: 12.5px; font-weight: 600; text-align: center; color: var(--muted); }
.month .mc { min-height: 104px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: copy; min-width: 0; }
.month .mc:nth-child(7n+1) { border-left: 0; }
.month .mc.off { background: var(--sunk); } .month .mc.off .mday { color: var(--muted); }
.month .mday { font-size: 12.5px; font-weight: 600; align-self: flex-end; padding: 0 6px; border-radius: 99px; }
.month .mc.today .mday { background: var(--accent); color: var(--accent-ink); }
.mb { border: 0; border-radius: 4px; color: #fff; font-size: 12px; padding: 2px 5px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.mb.flag { box-shadow: inset 0 0 0 2px var(--soon); }
.mdue { font-size: 11.5px; color: var(--soon); background: var(--soon-soft); border-radius: 4px; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weekwrap { overflow-x: auto; }
.weekwrap .week { min-width: 640px; }

/* money */
.bl { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.bl .desc { font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.bl .in { color: var(--ok); }
.agentnote { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; font-size: 14.5px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 0; padding-left: 8px; }
.rep tr.sec td { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding-top: 14px; border-bottom: 0; }
.rep tr.tot td { font-weight: 700; border-top: 1.5px solid var(--ink); border-bottom: 0; }
.rep tr.big td { font-size: 16.5px; padding-top: 12px; }
.jrow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.maprow { flex-wrap: wrap; } .mapto { flex: 1 1 200px; min-width: 0; }
.filein { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps span { font-size: 13px; font-weight: 600; border-radius: 99px; padding: 3px 10px; background: var(--sunk); color: var(--muted); }
.steps span.on { background: var(--ink); color: var(--bg); } .steps span.past { background: var(--ok-soft); color: var(--ok); }
.says { display: flex; gap: 10px; align-items: flex-start; }
.says .who { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.says p { background: var(--sunk); border-radius: 12px; border-top-left-radius: 3px; padding: 10px 12px; max-width: 60ch; }
.setup { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.personrow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 6px; align-items: center; }

/* logbooks */
input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="search"], input[type="email"], select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 10px; width: 100%; min-height: 44px; font-size: 16px; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
mark { background: var(--soon-soft); color: inherit; border-radius: 3px; padding: 0 2px; }
.entry { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.entry:hover { border-color: var(--accent); }
.entry p { max-width: 75ch; }
.pagepic { width: 100%; max-width: 560px; border: 1px solid var(--line); border-radius: 4px; display: block; background: var(--paper); }

/* the agent: a full sheet on a phone */
.agent { background: var(--surface); display: flex; flex-direction: column; min-height: 0; position: fixed; inset: 0; width: 100%; z-index: 20; transform: translateY(104%); transition: transform .2s ease; visibility: hidden; }
.agent.open { transform: none; visibility: visible; }
.agent header { padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.msgs { flex: 1 1 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.you { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 3px; }
.msg.agent-say { align-self: flex-start; background: var(--sunk); border-bottom-left-radius: 3px; }
.did { align-self: flex-start; max-width: 96%; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 8px; padding: 8px 10px; font-size: 14.5px; display: flex; flex-direction: column; gap: 4px; }
.did.undone { border-left-color: var(--line); color: var(--muted); text-decoration: line-through; }
.chipsrow { display: flex; gap: 6px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
.chipsrow::-webkit-scrollbar { display: none; }
.chipsrow .chip { flex: none; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { resize: none; min-height: 44px; max-height: 120px; }
.typing { align-self: flex-start; color: var(--muted); font-size: 14px; }

/* messages */
.mail { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.mail.out { background: var(--accent-soft); }
.chan { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border-radius: 4px; padding: 2px 7px; background: var(--sunk); color: var(--muted); }
.chan.text { background: var(--ok-soft); color: var(--ok); } .chan.email { background: var(--accent-soft); color: var(--accent); }
.mail.out .chan.email { background: var(--surface); }
.quote { border-left: 3px solid var(--line); padding-left: 10px; max-width: 75ch; overflow-wrap: anywhere; }
.didlist { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 2px; }

/* dialogs: a sheet from the bottom on a phone */
.veil { position: fixed; inset: 0; background: rgba(8, 14, 20, .55); display: grid; align-items: end; z-index: 30; }
.dialog { background: var(--surface); border-radius: 16px 16px 0 0; width: 100%; max-height: 94vh; overflow-y: auto; padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--line); }
.dhead { position: sticky; top: -16px; background: var(--surface); padding: 6px 0; margin: -6px 0; z-index: 1; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field .lab { font-size: 13.5px; font-weight: 600; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; text-align: left; background: var(--surface); min-height: 44px; }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice b { display: block; }
#errbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--due); color: #fff; padding: 6px 12px; font-size: 13px; }

/* wider than a phone: a left column, and room for the week grid */
@media (min-width: 761px) {
  .wide { display: block; } .wide.stack, .panel.wide { display: flex; } .narrow, .btn.narrowbtn { display: none; }
  .app { grid-template-columns: 208px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .tabbar { display: none; }
  .side { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
  .brand { font-weight: 700; font-size: 18px; letter-spacing: .02em; padding: 0 6px; display: flex; align-items: baseline; gap: 8px; }
  .brand small { font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
  .acs { display: flex; flex-direction: column; gap: 4px; }
  .acbtn { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 8px 10px; display: flex; flex-direction: column; gap: 1px; }
  .acbtn[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); }
  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav button { text-align: left; border: 0; background: none; border-radius: 6px; padding: 9px 10px; font-weight: 500; display: flex; justify-content: space-between; gap: 8px; }
  .nav button:hover { background: var(--sunk); }
  .nav button[aria-current="page"] { background: var(--ink); color: var(--bg); }
  .nav .badge { font-size: 12px; font-weight: 600; background: var(--due-soft); color: var(--due); border-radius: 99px; padding: 0 7px; }
  .side .foot { margin-top: auto; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; padding: 0 6px; }
  .page { gap: 18px; padding-block: 22px 40px; }
  h1, .tailbtn { font-size: 26px; }
  .seg { margin-inline: 0; padding-inline: 0; flex-wrap: wrap; }
  .actions .btn { flex: 0 0 auto; }
  .btn { min-height: 38px; padding: 7px 13px; } .btn.small { min-height: 32px; padding: 4px 10px; }
  .stat b { font-size: 22px; }
  .setup { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .veil { place-items: center; padding: 16px; }
  .dialog { border-radius: 12px; width: min(560px, 100%); max-height: 92vh; padding: 18px 20px; }
  .dialog.wide { width: min(760px, 100%); }
  .dhead { top: -18px; }
  .agent { inset: 0 0 0 auto; width: min(400px, 100%); border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(0, 0, 0, .25); transform: translateX(105%); }
  .agent header { padding-top: 14px; }
  .chipsrow { flex-wrap: wrap; overflow: visible; }
  .btn.fab { display: inline-flex; position: fixed; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 15; border-radius: 99px; padding: 12px 18px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
}
/* a full desktop: the agent is always there on the right */
@media (min-width: 1181px) {
  .app { grid-template-columns: 208px minmax(0, 1fr) 360px; }
  .agent { position: static; transform: none; visibility: visible; width: auto; box-shadow: none; }
  .agent .close, .btn.fab { display: none; }
}
@media (prefers-reduced-motion: reduce) { .agent { transition: none; } }

/* sign in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.signin form { width: min(400px, 100%); gap: 14px; }
.signin .name { font-weight: 700; font-size: 26px; letter-spacing: .02em; }
input[type="password"] { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 10px; width: 100%; min-height: 44px; font-size: 16px; }
.dialog:focus { outline: none; }
