:root {
  --bg: #f7f5f0; --card: #ffffff; --ink: #1f2933; --muted: #6b7280; --line: #e5e1d8;
  --brand: #0f766e; --brand-ink: #ffffff; --draft: #b45309; --ready: #15803d; --error: #b91c1c;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .04em; }
.brand span { font-weight: 400; color: var(--muted); }
.tabs { display: flex; gap: 4px; margin-right: auto; margin-left: 24px; }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; }
.tabs a.current { background: var(--bg); color: var(--ink); font-weight: 600; }
.who { display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--muted); }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }
h1 { font-size: 24px; margin: 0 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.narrow { max-width: 420px; margin: 40px auto; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; }
button { font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.link { border: none; background: none; color: var(--brand); padding: 4px; }
button:disabled { opacity: .5; cursor: default; }
#login-form, #code-form { display: grid; gap: 12px; }
#code-form { margin-top: 16px; }
.msg { min-height: 1.2em; font-size: 14px; }
.msg.error { color: var(--error); white-space: pre-line; }
.muted { color: var(--muted); font-size: 14px; }
.inbox-head { display: flex; justify-content: space-between; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 16px; }
.filters input[type=search] { flex: 1 1 220px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td:first-child { white-space: normal; min-width: 220px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #faf8f3; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.draft { background: #fef3c7; color: var(--draft); }
.badge.ready { background: #dcfce7; color: var(--ready); }
dialog { width: min(760px, calc(100vw - 32px)); border: none; border-radius: 14px; padding: 0; }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
#item-form { padding: 20px; max-height: 88vh; overflow-y: auto; }
.editor-head { display: flex; align-items: center; gap: 10px; }
.editor-head h2 { margin: 0; font-size: 20px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.grid .wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }
.chips label { flex-direction: row; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--ink); }
.editor-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.spacer { flex: 1; }
.small { font-size: 13px; }
.art { margin: 4px 0 12px; }
.art img { display: block; width: 100%; max-width: 420px; border-radius: 14px; border: 1px solid var(--line); }
.art .caption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.art .missing { padding: 12px 14px; border-radius: 10px; background: #fef3c7; color: var(--draft); font-size: 14px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
.plan { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.plan-head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.plan-head h3 { margin: 0; font-size: 17px; }
.plan-head .spacer { flex: 1; }
.facts, .weather { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.idea { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px 12px; padding: 12px 0;
  border-top: 1px solid var(--line); margin-top: 10px; align-items: start; }
.idea .role { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); }
.idea .title { font-weight: 600; }
.idea .meta { font-size: 13px; color: var(--muted); }
.idea textarea { width: 100%; margin-top: 6px; }
.idea .note { font-size: 12px; color: var(--draft); margin-top: 4px; }
.badge.proposed { background: #e0f2fe; color: #0369a1; }
.badge.approved { background: #dcfce7; color: var(--ready); }
.badge.sent { background: #ede9fe; color: #6d28d9; }
.badge.failed, .badge.skipped { background: #fee2e2; color: var(--error); }
.badge.pending, .badge.working { background: #f3f4f6; color: var(--muted); }
.badge.rain { background: #dbeafe; color: #1d4ed8; }
.badge.movie { background: #fce7f3; color: #be185d; }
.badge.backup { background: #fff7ed; color: #c2410c; }
.headsup-note { background: #eff6ff; color: #1e3a8a; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 6px 0; }
.backup-note { background: #fff7ed; color: #7c2d12; border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 6px 0; }
.options { display: grid; gap: 6px; max-height: 300px; overflow-y: auto; margin: 10px 0; }
.option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; color: var(--ink); flex-direction: row; }
.option:has(input:checked) { border-color: var(--brand); background: #f0fdfa; }
.option .meta { font-size: 12px; color: var(--muted); }
.totals { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 16px; }
.total { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; min-width: 160px; }
.total .value { font-size: 22px; font-weight: 700; }
.total .label { font-size: 13px; color: var(--muted); }
button.danger { color: var(--error); }
@media (max-width: 640px) {
  .idea { grid-template-columns: 1fr; }
  .grid, fieldset { grid-template-columns: 1fr; }
  th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) { display: none; }
}
