:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1d2420;
  --muted: #6a716c;
  --line: #e2ddd2;
  --brand: #1f3b2d;
  --brand-2: #2f5a44;
  --accent: #c8875a;
  --ok: #2e7d4f;
  --bad: #b3261e;
  --warn-bg: #fff4e0;
  --in: #ffffff;
  --out: #dcf3e3;
  --owner: #e3ecfb;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614; --card: #1b211e; --ink: #e8ebe8; --muted: #9aa39d; --line: #2c3530;
    --brand: #6fbf91; --brand-2: #8fd3ab; --warn-bg: #3a2f1a; --in: #222a26; --out: #1f3a2b; --owner: #1f2b3d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand-2); }
.top { background: #1f3b2d; color: #f4f1ea; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; position: sticky; top: 0; z-index: 5; }
.brand { color: #f4f1ea; text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.brand span { color: #e0b48f; font-weight: 500; }
.top nav { display: flex; gap: 4px; overflow-x: auto; flex: 1 1 auto; align-items: center; scrollbar-width: none; }
.top nav a { color: #dfe7e2; text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: 15px; }
.top nav a.active, .top nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.logout { margin-left: auto; }
.logout button { background: transparent; border: 1px solid rgba(255, 255, 255, .3); color: #dfe7e2; padding: 5px 10px; font-size: 14px; }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.narrow { max-width: 440px; margin: 40px auto; }
.card.warn { background: var(--warn-bg); }
.card.warn ul { margin: 0; padding-left: 20px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--bad); }
.warnline { background: var(--warn-bg); padding: 8px 10px; border-radius: 8px; }
label { display: block; margin: 0 0 12px; font-size: 15px; }
label.check { display: flex; gap: 8px; align-items: center; }
.inline-check { display: inline-flex; margin: 0; }
input, select, textarea { width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
input[type=checkbox] { width: auto; margin: 0; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 10px 12px 0; }
legend { padding: 0 6px; color: var(--muted); font-size: 14px; }
button { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
button.secondary { background: transparent; color: var(--brand-2); border: 1px solid var(--line); }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }
button.small { padding: 4px 10px; font-size: 14px; }
button[disabled] { opacity: .5; cursor: not-allowed; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.buttons form { margin: 0; }
.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.inline label { flex: 1 1 200px; margin: 0; }
.inline input, .inline select { margin-top: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 12px; }
.grid.hours { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.row:first-of-type { border-top: 0; }
.row span { grid-column: 1; color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.row small { grid-column: 2; grid-row: 1; color: var(--muted); white-space: nowrap; }
.badge { display: inline-block; background: var(--bad); color: #fff; border-radius: 999px; font-size: 12px; padding: 1px 7px; margin-left: 4px; vertical-align: middle; }
.badge.blue { background: #2f63b3; }
.tag { display: inline-block; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; font-size: 12px; padding: 0 8px; margin-left: 4px; font-weight: 400; vertical-align: middle; }
.tabs a { margin-right: 12px; text-decoration: none; }
.tabs a.active { font-weight: 700; text-decoration: underline; }
.app { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; }
.app small { grid-column: 2; color: var(--muted); font-size: 13px; }
.app .dot { width: 10px; height: 10px; border-radius: 50%; background: #aaa; }
.app.up .dot { background: var(--ok); }
.app.down { border-color: var(--bad); }
.app.down .dot { background: var(--bad); }
.app.off { opacity: .6; }
.event { padding: 6px 0; border-top: 1px solid var(--line); font-size: 15px; }
.event:first-of-type { border-top: 0; }
.event small { color: var(--muted); }
.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 85%; padding: 8px 12px; border-radius: 12px; background: var(--in); border: 1px solid var(--line); overflow-wrap: anywhere; }
.bubble small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.bubble.out { align-self: flex-end; background: var(--out); }
.bubble.out.owner { background: var(--owner); }
.draft { border: 1px dashed var(--accent); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.draft-head { margin-bottom: 6px; }
.draft-head small { color: var(--muted); }
.note { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.note small { color: var(--muted); }
details { border-top: 1px solid var(--line); padding: 8px 0; }
details summary { cursor: pointer; }
table.levels { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.levels td { padding: 3px 4px; font-size: 14px; }
table.levels select { margin: 0; padding: 4px 6px; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; background: #e6f4ea; color: #174d2a; }
.flash.error { background: #fde8e7; color: var(--bad); }
code { background: var(--bg); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  main { padding: 12px; }
  .card { padding: 12px; }
  .bubble { max-width: 95%; }
}
