@font-face { font-family: "Sora"; font-weight: 700; font-display: swap; src: url(sora-700.woff2) format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 800; font-display: swap; src: url(sora-800.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(inter-400.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(inter-500.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(inter-600.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url(jbmono-400.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url(jbmono-700.woff2) format("woff2"); }

/* The same look as the invoice PDF: see the palette in invoice/make_invoice.py. */
:root {
  color-scheme: light;
  --display: "Sora", "Segoe UI", system-ui, sans-serif;
  --body: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;
  --green: #1e6e52;
  --green-text: #1e7a56;
  --gold: #f2b233;
  --mint: #bfe3d2;
  --bg: #eeeff2;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #5e6166;
  --line: #d9dbdf;
  --accent: #111111;
  --accent-ink: #ffffff;
  --in: #ffffff;
  --out: #dcf0e6;
  --warn-bg: #fff5dc;
  --warn-ink: #7a540b;
  --error: #a32020;
  --hover: #eeeff2;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.4 var(--body); }
h1 { font: 800 1.2rem/1.2 var(--display); letter-spacing: -.01em; margin: 0; }
.slash { color: var(--gold); margin: 0 .04em; }
h2 { font: 700 1.05rem/1.25 var(--display); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }
label.small.muted { font: 400 .64rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.who .small { font-family: var(--mono); }
.small { font-size: .82rem; }
.error { color: var(--error); margin: 0; font-size: .9rem; }
.error:empty { display: none; }
input, textarea, button { font: inherit; color: inherit; }
input, textarea { width: 100%; padding: .6rem .7rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
textarea { resize: vertical; line-height: 1.4; min-height: 7em; max-height: 30dvh; field-sizing: content; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
button { padding: .6rem 1rem; border-radius: 99px; border: 1px solid var(--line); font-weight: 500; background: transparent; cursor: pointer; min-height: 44px; }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.ghost:hover:not(:disabled) { background: var(--hover); }

.login { max-width: 340px; margin: 18vh auto 0; padding: 0 16px; display: grid; gap: .6rem; }
.login h1 { font-size: 1.7rem; margin-bottom: .6rem; }
.login label { font: 400 .68rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.app { height: 100dvh; display: grid; grid-template-columns: 340px 1fr; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .7rem 1rem; min-height: 64px; color: #fff; background-color: var(--green); background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 26px 26px; }
.bar .muted { color: var(--mint); font-family: var(--mono); font-size: .72rem; }
.bar .ghost { color: #fff; border-color: rgba(255,255,255,.45); }
.bar .ghost:hover:not(:disabled) { background: rgba(255,255,255,.14); }
.bar select { background: #fff; color: var(--ink); border-color: transparent; }
.list-pane { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-pane > .bar { justify-content: flex-start; }
.who { min-width: 0; }
.back { display: none; padding: .3rem .7rem; }
.note { margin: 0; padding: .6rem 1rem; background: var(--warn-bg); color: var(--warn-ink); font-size: .85rem; }

.chats { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chats button { width: 100%; text-align: left; border: 0; border-bottom: 1px dashed var(--line); border-radius: 0; padding: .7rem 1rem; display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; }
.chats button:hover, .chats button[aria-current="true"] { background: var(--hover); }
.chat-name { font: 700 .95rem/1.3 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-last { grid-column: 1; color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { color: var(--muted); font: 400 .7rem var(--mono); }
.badge { grid-column: 2; justify-self: end; background: var(--gold); color: var(--ink); font: 700 .66rem var(--mono); letter-spacing: .04em; padding: .05rem .45rem; border-radius: 99px; }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; margin: 0; }

.messages { flex: 1 1 0; min-height: 30dvh; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.bubble { max-width: min(78%, 560px); padding: .5rem .75rem; border-radius: 14px; background: var(--in); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.out { align-self: flex-end; background: var(--out); }
.bubble img { display: block; max-width: 100%; max-height: 320px; border-radius: 6px; margin-bottom: .3rem; }
.bubble .meta { display: block; font: 400 .66rem var(--mono); color: var(--muted); margin-top: .15rem; }

.draft { background: var(--panel); border-top: 1px solid var(--line); padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom)); display: grid; grid-auto-rows: max-content; gap: .5rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; }
.draft.free textarea { min-height: 3.4em; }
.bubble a { color: var(--green-text); font-weight: 600; overflow-wrap: anywhere; }
.draft > .send-row { position: sticky; bottom: 0; z-index: 1; background: var(--panel); padding: .4rem 0; }
.row .primary { flex: 1 1 120px; }
.warnings { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.warnings li { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--gold); padding: .4rem .7rem; border-radius: 10px; font-size: .84rem; }
.redo { display: grid; gap: .4rem; }
.actions { flex-shrink: 0; max-height: 56dvh; overflow-y: auto; }
.order-panel { background: var(--panel); border-top: 1px solid var(--line); padding: .5rem 1rem; display: grid; gap: .4rem; }
.orders { background: var(--panel); border-top: 1px solid var(--line); padding: .5rem 1rem; display: grid; gap: .5rem; }
.order-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.order-row .title { font: 700 .95rem/1.3 var(--display); margin-right: auto; }
.order-row a, .order-row button { min-height: 38px; padding: .35rem .8rem; font-size: .88rem; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: inherit; text-decoration: none; display: inline-flex; align-items: center; cursor: pointer; }
.order-row a:hover, .order-row button:hover:not(:disabled) { background: var(--hover); }
.order-row button.main { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.order-row button.main:hover:not(:disabled) { background: var(--accent); }
.order-note { font-size: .84rem; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--gold); padding: .3rem .7rem; border-radius: 10px; flex-basis: 100%; }
.orders-error { padding: 0 1rem .4rem; background: var(--panel); }
.order { border: 1px solid var(--line); border-radius: 14px; padding: .5rem .7rem; }
.order[open] { display: grid; gap: .45rem; }
.order summary { cursor: pointer; font: 700 .95rem/1.6 var(--display); min-height: 28px; }
.line { display: grid; grid-template-columns: 1fr 96px; gap: .6rem; align-items: center; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.line-title { font-size: .9rem; overflow-wrap: anywhere; }

.tools { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem 1rem; }
.tools button { min-height: 38px; padding: .3rem .7rem; font-size: .88rem; }
.tools-error { padding: .4rem 1rem; }
.armed, .order-row button.armed, .unpaid-row button.armed { background: var(--warn-bg) !important; color: var(--warn-ink) !important; border-color: var(--warn-ink) !important; }
.older { border-top: 1px solid var(--line); padding-top: .4rem; }
.older summary { cursor: pointer; font-size: .88rem; color: var(--muted); min-height: 28px; }
.older[open] { display: grid; gap: .5rem; }
.order-sub { flex-basis: 100%; font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
.bubble audio { display: block; width: min(280px, 100%); margin-bottom: .2rem; }
.preview { display: block; max-width: 100%; max-height: 180px; border: 1px solid var(--line); border-radius: 10px; justify-self: start; }
.chip { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--line); border-radius: 10px; padding: .3rem .5rem; min-width: 0; }
.chip img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.chip span { flex: 1; min-width: 0; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button { min-height: 36px; padding: .1rem .7rem; }
.quick button { flex: 1 1 auto; min-height: 38px; padding: .3rem .6rem; font-size: .88rem; }
.unpaid-view { flex: 1 1 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.unpaid-view .error { padding: .6rem 1rem; }
.unpaid-list { display: grid; align-content: start; }
.unpaid-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .8rem 1rem; background: var(--panel); border-bottom: 1px dashed var(--line); }
.unpaid-row .title { font: 700 .95rem/1.3 var(--display); margin-right: auto; }
.unpaid-row button { min-height: 38px; padding: .35rem .7rem; font-size: .88rem; }
.unpaid-row button.main { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.bar #spend { text-align: right; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--ink); }
.tabs button { border: 0; border-radius: 0; border-bottom: 3px solid transparent; padding: .45rem .1rem; font: 400 .64rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-height: 44px; }
.tabs button[aria-pressed="true"] { border-bottom-color: var(--green); color: var(--ink); font-weight: 700; }
.tabs b { display: block; font: 700 .85rem var(--mono); }
select { font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .6rem; width: 100%; }
.chat-tab { width: auto; margin-left: auto; font-size: .85rem; min-height: 38px; }
.order-open { flex-basis: 100%; display: grid; gap: .25rem; font-size: .88rem; padding: .7rem .8rem; background: var(--hover); border-radius: 14px; overflow-wrap: anywhere; }
.order-open a { justify-self: start; }
.add-item { flex-basis: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; padding: .7rem .8rem; background: var(--hover); border-radius: 14px; }
.add-item label { display: grid; gap: .25rem; font: 400 .64rem var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); min-width: 0; }
.add-item input, .add-item select { font: 400 .95rem var(--body); letter-spacing: 0; text-transform: none; color: var(--ink); padding: .45rem .5rem; }
.add-item .wide { grid-column: 1 / -1; }

.order-filter { grid-template-columns: repeat(4, 1fr); background: var(--panel); flex-shrink: 0; }
.order-search { padding: .5rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-shrink: 0; }

.overdue { background: var(--panel); border-top: 1px solid var(--line); }
.overdue summary { cursor: pointer; padding: .7rem 1rem; color: var(--warn-ink); font-size: .9rem; }

.label-bar { display: flex; justify-content: space-between; gap: .5rem; padding: .5rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.label-bar button { min-height: 40px; padding: .35rem 1rem; font-size: .88rem; }
.label-tick { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 38px; flex-shrink: 0; margin-left: -.3rem; cursor: pointer; }
.label-tick input { width: 22px; height: 22px; padding: 0; margin: 0; accent-color: var(--green); cursor: pointer; }

.print-failed { color: var(--error); }

.tell { display: flex; gap: .5rem; }
.tell input { flex: 1; min-width: 0; }
.tell button { flex-shrink: 0; min-height: 44px; }
.more summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; min-height: 38px; padding: .35rem .8rem; font-size: .88rem; font-weight: 500; border: 1px solid var(--line); border-radius: 99px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "▾"; margin-left: .35rem; font-size: .7rem; }
.more summary:hover { background: var(--hover); }
.more[open] { flex-basis: 100%; }
.more[open] summary { background: var(--hover); }
.more-items { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .5rem; }

.home { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: .75rem 1rem .5rem; }
.home button { display: grid; gap: .3rem; justify-items: start; align-content: center; text-align: left; min-height: 68px; padding: .6rem .75rem; border-radius: 14px; background: var(--bg); border-color: transparent; }
.home button:hover { border-color: var(--line); }
.home b { font: 800 1.5rem/1 var(--display); }
.home span { font: 400 .6rem/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.home .hot { background: var(--gold); }
.home .hot span { color: var(--ink); }
.tools:not(:has(button:not([hidden]))) { display: none; }
#create-only { justify-self: start; min-height: 38px; padding: .3rem .8rem; font-size: .88rem; }

.unpaid-row .title { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .5rem; min-width: 0; }
.when { font: 700 .72rem/1 var(--mono); background: var(--bg); padding: .3rem .45rem; border-radius: 6px; white-space: nowrap; }
.pill { font: 700 .62rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: .28rem .45rem; border: 1.5px solid var(--ink); border-radius: 6px; white-space: nowrap; }
.pill.owed { background: var(--ink); color: #fff; }

.questions { display: grid; gap: .5rem; padding: .75rem; border: 2px solid var(--ink); border-radius: 14px; }
.questions-title { font: 700 .64rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.questions label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
.questions input { font-weight: 400; }
.questions button { justify-self: start; min-height: 40px; padding: .35rem 1.2rem; }

@media (min-width: 1000px) {
  .chat-pane.has-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, min(42%, 520px)); grid-template-rows: auto minmax(0, 1fr); }
  .chat-pane.has-actions > .bar { grid-column: 1 / -1; }
  .chat-pane.has-actions > .messages { min-height: 0; }
  .chat-pane.has-actions > .actions { max-height: none; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
  .chat-pane.has-actions textarea { max-height: 44dvh; }
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .chat-pane { display: none; }
  .app.in-chat .list-pane { display: none; }
  .app.in-chat .chat-pane { display: flex; }
  .back { display: inline-block; }
  .label-tick + .title { flex-basis: calc(100% - 3rem); margin-right: 0; }
  .bubble { max-width: 88%; }
}
