:root {
  --bg: #f4f6f8; --card: #fff; --ink: #1d2733; --muted: #5d6b7a; --line: #dfe4ea;
  --accent: #b3262d; --accent-ink: #fff; --ok: #1f7a4d; --err: #b3262d; --soft: #fbeeee;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11161c; --card: #1a2129; --ink: #e8edf2; --muted: #9aa8b6; --line: #2c3540; --accent: #e0545b; --soft: #2a1d1f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.top { background: #fff; } /* stays white in dark mode: the logo has black lettering */
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 44px; width: auto; display: block; }
.brand span { color: #5d6b7a; font-weight: 600; font-size: .95rem; padding-left: 12px; border-left: 1px solid #dfe4ea; }
.top .link { color: #b3262d; }
@media (max-width: 420px) { .brand img { height: 34px; } .brand span { font-size: .85rem; } }
main { max-width: 860px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.35rem; margin: 4px 0 14px; }
h2 { font-size: 1.05rem; margin: 18px 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.narrow { max-width: 420px; margin: 24px auto; }
label { display: block; font-weight: 600; margin: 10px 0; }
input, textarea { display: block; width: 100%; max-width: 100%; min-width: 0; margin-top: 6px; padding: 12px 14px; font: inherit; font-size: 16px; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 10px; -webkit-appearance: none; appearance: none; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(179, 38, 45, .18); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
@media (prefers-color-scheme: dark) { input, textarea { background: #232c36; border-color: #3a4552; } }
textarea { min-height: 110px; resize: vertical; }
button { font: inherit; cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 10px 18px; font-weight: 600; margin-top: 6px; }
.primary:disabled { opacity: .6; cursor: default; }
.link { background: none; border: 0; color: var(--accent); padding: 6px 0; text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.err { color: var(--err); min-height: 1.2em; }
.ok { color: var(--ok); }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs button { flex: none; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; color: var(--ink); }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tabs b { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--accent-ink); color: var(--accent); font-size: .8rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .when { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg); text-align: left; color: var(--ink); }
.tile b { display: block; font-size: 1.05rem; }
.tile span { color: var(--muted); font-size: .9rem; }
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; margin-bottom: 12px; }
.bubble { max-width: 85%; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { align-self: flex-end; background: var(--soft); }
.bubble.office { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.bubble small { display: block; color: var(--muted); margin-top: 4px; font-size: .78rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; }
.items { color: var(--muted); font-size: .88rem; }
.preview { max-width: 100%; max-height: 180px; border-radius: 8px; border: 1px solid var(--line); margin-top: 6px; }
.foot { max-width: 860px; margin: 8px auto 30px; padding: 0 16px; color: var(--muted); font-size: .85rem; }
@media (max-width: 520px) { .list li { flex-direction: column; align-items: flex-start; gap: 4px; } }
