/* 42 — dark, calm, low clutter (DEC-91). */
:root {
  --bg: #15171a;
  --panel: #1d2024;
  --line: #2c3036;
  --text: #d9dcdf;
  --muted: #8a9099;
  --accent: #8fb3d9;
  --accent-bg: #23303d;
  --ok: #8fc79a;
  --warn: #d9b36c;
  --bad: #d98c8c;
  --radius: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header#top {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.brand { font-weight: 700; font-size: 20px; color: var(--text); }
nav { display: flex; gap: 14px; flex: 1; justify-content: flex-end; flex-wrap: wrap; }
main { max-width: 820px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 12px; font-weight: 600; }
h2 { font-size: 16px; margin: 24px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stack > * + * { margin-top: 10px; }

input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px;
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; min-height: 260px; }
input[type=text], input[type=password], input[type=search], input:not([type]) { width: 100%; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
input[type=checkbox], input[type=radio] {
  width: 18px; height: 18px; margin: 0; padding: 0; flex: none; accent-color: var(--accent);
}
input[type=number] { width: 100%; }
select { max-width: 100%; }
button:disabled { opacity: .35; cursor: default; }
button.primary { background: #2d4a66; border-color: #4a6f94; font-weight: 600; }
button { cursor: pointer; background: var(--accent-bg); border-color: #34475a; }
button:hover { border-color: var(--accent); }
button.plain { background: none; border-color: transparent; color: var(--accent); padding: 4px 6px; }
button.danger { color: var(--bad); }
label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 3px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 4px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: none; }
.id {
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  color: var(--accent); background: var(--accent-bg); padding: 1px 6px; border-radius: 4px;
  white-space: nowrap;
}
.chip { font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.silent { border-style: dashed; }
.part { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.part:last-child { border-bottom: none; }
.part .kind { color: var(--muted); font-size: 13px; min-width: 90px; }
.part.highlight { background: var(--accent-bg); border-radius: 6px; }
.part.conclusion .text { font-weight: 600; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
a.ref { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
a.ref.missing { color: var(--bad); text-decoration: line-through; }
.snippet { color: var(--muted); font-size: 14px; }

.preview {
  position: absolute; z-index: 20; max-width: 340px;
  background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 10px; font-size: 14px; box-shadow: 0 6px 24px #0008;
}
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; max-width: 90vw;
}
.toast.error { border-color: var(--bad); color: var(--bad); }
.diff div { font-family: ui-monospace, Consolas, monospace; font-size: 13px; white-space: pre-wrap; padding: 0 6px; }
.diff .add { background: #1f3324; color: var(--ok); }
.diff .del { background: #3a2222; color: var(--bad); }
.suggestion { border-color: var(--warn); }
.suggestion pre { white-space: pre-wrap; font-size: 13px; margin: 6px 0; }
.secret { font-family: ui-monospace, Consolas, monospace; word-break: break-all; color: var(--warn); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
td, th { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }

h3 { font-size: 14px; margin: 18px 0 4px; font-weight: 600; }
details > summary { cursor: pointer; padding: 2px 0; }
details[open] > summary { margin-bottom: 10px; }
.field > label { margin-bottom: 4px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
label.check {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  color: var(--text); font-size: 14px; min-height: 32px;
}
.edit-row label.check { font-size: 13px; min-height: 28px; }
.edit-row input:not([type=checkbox]):not([type=radio]), .edit-row select { padding: 5px 8px; }
.edit-first .pair { gap: 6px; }
.rows { border-top: 1px solid var(--line); }
.edit-row { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.edit-first { display: flex; gap: 6px; align-items: flex-start; }
.edit-tools { display: flex; flex: none; }
.edit-tools button { min-width: 32px; min-height: 36px; padding: 4px; }
button.add { margin-top: 4px; padding-left: 0; }
.advanced { border-top: 1px solid var(--line); padding-top: 10px; }
.advanced textarea { margin-bottom: 8px; }

.num-row { display: grid; grid-template-columns: 1fr 11em; gap: 4px 12px; align-items: center; }
.num-row > label { margin: 0; color: var(--text); font-size: 15px; }
.num-input { display: flex; align-items: center; gap: 8px; }
.num-input input { width: 5.5em; flex: none; }

.cards { display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.card > * + * { margin-top: 4px; }
.card.revoked { opacity: .55; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets button { font-size: 14px; padding: 6px 10px; background: var(--panel); }
.presets button.on { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.grid-rights {
  display: grid; grid-template-columns: 1fr repeat(3, 4.2em); align-items: center;
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px;
}
.grid-rights > * { padding: 6px 0; }
.grid-rights .head, .grid-rights .cell { text-align: center; justify-self: stretch; }
.grid-rights .cell { display: flex; justify-content: center; margin: 0; min-height: 36px; align-items: center; cursor: pointer; }
.once { border-color: var(--warn); }
.audit li { padding: 6px 2px; overflow-wrap: anywhere; }

.banner {
  background: #6b4a12; color: #ffe2a8; text-align: center; font-weight: 700; letter-spacing: .08em;
  padding: 3px 8px; font-size: 13px; position: sticky; top: 0; z-index: 6;
}
.banner .small { font-weight: 400; letter-spacing: 0; margin-left: 10px; }
.banner + header#top { top: 25px; }

/* statement editor: id, kind, text, remove in one line; on phones the text gets its own line */
.part-edit { display: grid; grid-template-columns: auto auto 1fr auto; gap: 8px; align-items: center; }
.part-edit textarea { min-height: 44px; }

/* backup problem (DEC-252) */
.warning { background: #3a2a14; color: #f0d29a; border-bottom: 1px solid #6b4a12; padding: 6px 16px; font-size: 14px; text-align: center; }
.warning a { color: #ffe2a8; text-decoration: underline; }
.bad { color: var(--bad); }

/* first screen: capture, quick actions, timeline (M2) */
.capture textarea { min-height: 76px; font-size: 16px; }
.when { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.when button.plain { padding-left: 0; }
.when-box { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.when-box[hidden] { display: none; }
.when-box input[type=datetime-local] { padding: 6px 8px; }
.when-box label.check { margin: 0; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.quick[hidden] { display: none; }
.quick button { flex: 1 1 auto; min-height: 44px; padding: 8px 14px; font-size: 15px; }
.ask { margin: 0 0 12px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.chip-btn { flex: none; font-size: 13px; padding: 4px 12px; border-radius: 14px; background: none; border-color: var(--line); color: var(--muted); }
.chip-btn.on { background: var(--accent-bg); border-color: var(--accent); color: var(--text); }
.timeline li.tl { display: flex; gap: 12px; align-items: flex-start; padding: 9px 2px; }
.timeline li.tl-day { padding: 16px 2px 4px; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.tl-time { flex: none; width: 3.4em; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 2px; text-align: right; }
.tl-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.tl.by-ai .tl-body { font-style: italic; color: #c3c7cc; }
.tl.waiting { opacity: .7; }
.tl.other .tl-time, .tl.value .tl-time { opacity: .8; }
.chip.ai { border-color: #6c5a8f; color: #b9a6dc; margin-left: 6px; }
.journal-text { white-space: pre-wrap; font-size: 16px; }
button.install { margin-top: 16px; }

/* New menu (DEC-255), settings tabs (DEC-256), field values (DEC-254) */
details.menu { position: relative; }
details.menu > summary { list-style: none; color: var(--accent); padding: 0; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary { margin-bottom: 0; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; min-width: 190px; max-height: 70vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 0; box-shadow: 0 6px 24px #0008;
}
.menu-list a { display: block; padding: 7px 14px; color: var(--text); }
.menu-list a:hover { background: var(--accent-bg); text-decoration: none; }
.menu-group { padding: 8px 14px 2px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-top: 1px solid var(--line); margin-top: 4px; }
nav.tabs { display: flex; justify-content: flex-start; flex: none; gap: 4px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); margin: 0 0 14px; flex-wrap: nowrap; }
nav.tabs a { flex: none; padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
nav.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
nav.tabs a:hover { text-decoration: none; color: var(--text); }
.triple { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.values .value-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.values .value-row + .value-row { border-top: 1px solid var(--line); }
.tl.value.done a { text-decoration: line-through; color: var(--muted); }

/* phones (Galaxy S25 Ultra: 384 css px wide) */
@media (max-width: 560px) {
  .quick button { flex: 1 1 40%; }
  .warning { padding: 6px 12px; }
  main { padding: 12px; }
  header#top { padding: 8px 12px; gap: 10px; }
  nav { gap: 12px; font-size: 15px; }
  .pair { grid-template-columns: 1fr; }
  .num-row { grid-template-columns: 1fr; }
  .num-row + .num-row { border-top: 1px solid var(--line); padding-top: 10px; }
  .panel { padding: 10px; }
  .grid-rights { grid-template-columns: 1fr repeat(3, 3.6em); padding: 4px 8px; }
  .banner .small { display: block; margin-left: 0; }
  .banner + header#top { top: 44px; }
  textarea.code { font-size: 12px; }
  .part-edit { grid-template-columns: auto 1fr auto; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .part-edit textarea { grid-column: 1 / -1; grid-row: 2; }
}
