/* Úkolníček — Rubricated Rule of Obedience
   A committed dark-red/black operating shell. Ink hairline rules on a
   near-black oxblood ground, warm parchment text, a bookish serif carrying
   authority with rubricated red initials. Crimson is the single rubric
   accent (primary actions, selection, the mark of an attained obligation);
   scarlet is reserved for overdue / critical / destructive; brass for due and
   pending. Tabular figures for every number. Layout, navigation and controls
   stay the category-standard app shell. */

@font-face { font-family: "Spectral"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/spectral-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/spectral-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/spectral-500-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/spectral-500-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/spectral-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/spectral-600-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/spectral-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/spectral-700-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: dark;
  /* grounds */
  --bg: #140d0f;
  --panel: #1d1417;
  --panel-hi: #25181b;
  --well: #0e0809;
  --rail: #281215;        /* oxblood top bar — the committed shell colour */
  --rail-2: #1b0f11;      /* nav rail */
  --rule: #3a2427;        /* ink hairline */
  --rule-2: #4d2f33;      /* stronger rule */
  /* ink */
  --text: #f2e8dd;        /* warm parchment */
  --muted: #c3ae9f;       /* tan, tinted from the ground — never gray */
  --muted-2: #ad927e;     /* faint tan */
  /* rubric accents */
  --rubric: #b3122e;      /* crimson fill — primary / authority */
  --rubric-hi: #cf2740;   /* hover */
  --rubric-text: #f2707a; /* rubric as text/initial/selection on dark */
  --rubric-soft: rgba(179, 18, 46, 0.18);
  --signal: #ff5a54;      /* scarlet — error / overdue / destructive */
  --signal-soft: rgba(255, 90, 84, 0.14);
  --brass: #e0a94f;       /* due / pending */
  --brass-soft: rgba(224, 169, 79, 0.16);
  /* type */
  --serif: "Spectral", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { caret-color: var(--rubric-text); }

body {
  margin: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, #1c1013 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font: 15px/1.55 var(--serif);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--rubric); color: #fff; }

/* themed browser surfaces */
* { scrollbar-color: var(--rule-2) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--well); }
::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 8px; border: 2px solid var(--well); }
::-webkit-scrollbar-thumb:hover { background: var(--rubric); }
a { color: var(--text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--rubric-text); }

/* ============ top bar (the committed oxblood shell) ============ */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  background: var(--rail);
  border-bottom: 1px solid var(--rubric);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 10px 24px -18px #000;
}

.topbar .brand {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.28rem;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}
.topbar .brand::first-letter { color: var(--rubric-text); }

.topbar .who {
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.topbar form { margin-left: auto; }

/* ============ nav rail ============ */
.navmenu {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 9px 22px;
  background: var(--rail-2);
  border-bottom: 1px solid var(--rule);
}
.navmenu a {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}
.navmenu a:hover {
  color: var(--text);
  border-bottom-color: var(--rubric);
}
.navmenu a.is-active {
  color: var(--text);
  border-bottom-color: var(--rubric);
}

/* ============ layout ============ */
.container {
  max-width: 880px;
  margin: 26px auto 64px;
  padding: 0 18px;
  display: grid;
  gap: 18px;
}
.container > * { min-width: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 20px 22px;
  min-width: 0;
}
.card.narrow {
  max-width: 380px;
  margin: 64px auto;
  padding: 28px 28px 30px;
  border-color: var(--rule-2);
  box-shadow: 0 24px 60px -30px #000;
}

h1, h2, h3 { margin: 0 0 12px; font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h1 { font-size: 1.62rem; letter-spacing: -0.01em; }
h2 { font-size: 1.16rem; }
/* rubricated initials — the signature move: authority written in red */
h2::first-letter, .card.narrow h1::first-letter { color: var(--rubric-text); }
h3 {
  font-size: 0.82rem;
  font-weight: 600;
  font-variant-caps: small-caps;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 22px 0 12px;
}
.card h3:first-child, form h3:first-child { margin-top: 0; }

.muted { color: var(--muted); }
.hint { font-family: var(--sans); font-size: 12px; }

/* ============ ledger stats strip ============ */
.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border-color: var(--rule-2);
}
.stat span {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.stat strong {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.balance { display: flex; gap: 16px; align-items: baseline; }
.balance-value {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 2.1rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ============ tables (ink-ruled ledger columns) ============ */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.table th {
  font-family: var(--sans);
  color: var(--muted-2);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom-color: var(--rule-2);
  padding-top: 4px;
}
.table tr:last-child td { border-bottom: none; }
.counter, .table td:only-child { font-variant-numeric: tabular-nums; }
.table .counter { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.proof-row td { padding-top: 2px; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.proof-row:last-child td { border-bottom: none; }

/* ============ lists ============ */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}
.list li:last-child { border-bottom: none; }
/* attained obligations: marked in rubric red, dimmed like a ruled-off line */
.list li.done {
  opacity: 1;
  color: var(--muted);
  position: relative;
}
.list li.done > *:first-child {
  padding-left: 24px;
  position: relative;
}
.list li.done > *:first-child::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 16px; height: 16px;
  transform: translateY(-50%);
  background: var(--rubric-text);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ============ tags / states ============ */
.tag {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--well);
  color: var(--muted-2);
  border: 1px solid var(--rule);
}
.tag.due { background: var(--brass-soft); color: var(--brass); border-color: transparent; }
.tag.paused { background: var(--well); color: var(--muted-2); border-color: var(--rule); }
.tag.status, .status.tag { background: var(--well); color: var(--muted); border-color: var(--rule); }

/* ============ buttons ============ */
.btn {
  font-family: var(--sans);
  background: var(--rubric);
  color: #fff;
  border: 1px solid var(--rubric);
  border-radius: 5px;
  padding: 6px 13px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
  transition: background .14s ease, border-color .14s ease, color .14s ease, transform .05s ease;
}
.btn:hover { background: var(--rubric-hi); border-color: var(--rubric-hi); }
.btn:active { transform: translateY(1px); }

.btn.ghost {
  background: transparent;
  border: 1px solid var(--rule-2);
  color: var(--muted);
}
.btn.ghost:hover {
  background: transparent;
  color: var(--text);
  border-color: var(--rubric);
}

.sub-switcher { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

/* ============ form controls ============ */
select {
  background: var(--well);
  color: var(--text);
  border: 1px solid var(--rule-2);
  border-radius: 5px;
  padding: 7px 10px;
  font-family: var(--sans);
  font-size: 13px;
}
select:hover { border-color: var(--rubric); }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="time"], textarea {
  font-family: var(--sans);
  background: var(--well);
  color: var(--text);
  border: 1px solid var(--rule-2);
  border-radius: 5px;
  padding: 8px 10px;
}
input:hover, textarea:hover { border-color: var(--rule-2); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .tab:focus-visible, a:focus-visible {
  outline: 2px solid var(--rubric-hi);
  outline-offset: 2px;
  border-color: var(--rubric);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input[type="checkbox"] { accent-color: var(--rubric); width: 15px; height: 15px; }

label { color: var(--muted); font-family: var(--sans); font-size: 12.5px; display: block; margin-bottom: 4px; }

.card.narrow input {
  width: 100%;
  background: var(--well);
  color: var(--text);
  border: 1px solid var(--rule-2);
  border-radius: 5px;
  padding: 9px 11px;
  margin-bottom: 14px;
}
.card.narrow button { width: 100%; }
.card.narrow .error { margin-bottom: 14px; }

.error { color: var(--signal); font-family: var(--sans); font-size: 13px; }

/* ============ notification bell + panel ============ */
.notif-wrap { position: relative; }
.notif-badge {
  display: none;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--signal);
  color: #1a0b0b;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 11px;
}
.notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 328px;
  max-height: 380px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.7);
  z-index: 50;
}
.notif-panel.hidden { display: none; }
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--serif);
}
.notif-items { list-style: none; margin: 0; padding: 0; }
.notif-items li { padding: 11px 14px; border-bottom: 1px solid var(--rule); font-size: 13px; }
.notif-items li:last-child { border-bottom: none; }
.notif-items a { color: var(--text); text-decoration: none; }
.notif-items a:hover { color: var(--rubric-text); }

/* ============ generic graphic form + fields ============ */
.graphic-form .field { display: block; margin-bottom: 12px; }
.graphic-form .field > span { display: block; color: var(--muted); font-family: var(--sans); font-size: 12.5px; margin-bottom: 4px; }
.graphic-form input[type="text"],
.graphic-form input[type="number"],
.graphic-form textarea,
.graphic-form select {
  width: 100%;
}
.graphic-form > .field, .graphic-form > .habit-time, .graphic-form > .habit-check { max-width: 460px; }

/* ============ graphic picker ============ */
.graphic-picker { border: 1px solid var(--rule-2); border-radius: 6px; padding: 12px; margin: 12px 0; background: var(--well); }
.graphic-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.graphic-tabs .tab {
  font-family: var(--sans);
  background: transparent;
  border: 1px solid var(--rule-2);
  color: var(--muted);
  border-radius: 5px;
  padding: 5px 11px;
  cursor: pointer;
  font-size: 13px;
}
.graphic-tabs .tab:hover { color: var(--text); border-color: var(--rubric); }
.graphic-tabs .tab.active { background: var(--rubric); color: #fff; border-color: var(--rubric); }
.graphic-pane.hidden { display: none; }

.graphic-anim-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.graphic-anim {
  height: 64px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  background: var(--panel);
}
.graphic-anim:hover, .graphic-anim.sel { border-color: var(--rubric); }
.graphic-anim.selected {
  border-color: var(--rubric);
  outline: 2px solid var(--rubric);
  outline-offset: -2px;
  background: var(--rubric-soft);
}
.graphic-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.graphic-emoji {
  font-size: 22px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  padding: 4px 0;
}
.graphic-emoji:hover { border-color: var(--rubric); }
.graphic-emoji.selected {
  border-color: var(--rubric);
  outline: 2px solid var(--rubric);
  outline-offset: -2px;
  background: var(--rubric-soft);
}
.tab#graphic-none.selected {
  border-color: var(--rubric);
  outline: 2px solid var(--rubric);
  outline-offset: -2px;
  color: var(--text);
}
.graphic-inline { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; font-size: 20px; }
.graphic-inline.anim { width: 28px; height: 28px; }
.graphic-inline img { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; }

/* ============ graphic overlay (reward/punishment wheel) ============ */
.graphic-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 4, 5, 0.86);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; cursor: pointer;
}
.graphic-overlay-box { text-align: center; color: var(--text); }
.graphic-overlay-graphic { width: 220px; height: 220px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.graphic-overlay-name { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--rubric-text); }

/* ============ overlays (typing / text / camera) ============ */
#typing-overlay, #text-overlay, #camera-modal {
  position: fixed; inset: 0;
  background: rgba(10, 4, 5, 0.86);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
#typing-overlay.hidden, #text-overlay.hidden, #camera-modal.hidden { display: none; }
#typing-overlay > .typing-box, #text-overlay > .text-box, .camera-modal-box {
  width: min(680px, 92vw);
  max-height: min(88dvh, 900px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  padding: 22px 24px;
  box-shadow: 0 30px 80px -30px #000;
}

.typing-description { margin-bottom: 10px; white-space: pre-wrap; }
.typing-target {
  font: 18px/1.7 var(--serif);
  font-variant-numeric: tabular-nums;
  background: var(--well);
  border: 1px solid var(--rule-2);
  border-radius: 6px;
  padding: 16px;
  margin: 12px 0;
  word-break: break-word;
}
.tchar.typed { color: var(--rubric-text); }         /* written in red ink */
.tchar.cursor { text-decoration: underline; text-decoration-color: var(--rubric); text-underline-offset: 4px; }
/* faint by hue, not by opacity: dimming muted-2 into the well dropped the
   letters she has not reached under 4.5:1 */
.tchar.pending { color: var(--muted-2); }
/* struck through as well as red, so a mistake is not only a shade */
.tchar.wrong { color: var(--signal); text-decoration: line-through; text-decoration-thickness: 2px; }
.typing-stats { color: var(--muted); font-family: var(--sans); font-size: 13px; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.typing-input {
  width: 100%;
  min-height: 44px;
  font: 16px/1.4 var(--serif);
  color: var(--text);
  background: var(--well);
  border: 1px solid var(--rule-2);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  caret-color: var(--rubric);
}
.typing-input:focus { outline: none; border-color: var(--rubric); box-shadow: 0 0 0 3px rgba(179, 18, 46, 0.22); }
.typing-input::placeholder { color: var(--muted-2); }
.typing-result { color: var(--muted); font-family: var(--sans); font-size: 13px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.typing-consequence { color: var(--muted); font-family: var(--sans); font-size: 13px; margin: 2px 0 12px; font-variant-numeric: tabular-nums; }
.typing-rules {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13px;
}
.typing-rules li { padding: 5px 0; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.typing-rules li:last-child { border-bottom: none; }
.typing-note { margin-bottom: 12px; }
.typing-target.err { border-color: var(--signal); animation: err-flash 0.45s ease-out; }
@keyframes err-flash {
  from { background: var(--signal-soft); border-color: var(--signal); }
  to { background: var(--well); border-color: var(--rule-2); }
}
.ink-alert {
  color: var(--signal);
  font-family: var(--sans);
  font-size: 13px;
  background: var(--signal-soft);
  border: 1px solid var(--signal);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}
/* kept rendered so an aria-live update is announced, just collapsed */
.ink-alert:empty { padding: 0; border: 0; background: none; }
.overlay-actions { display: flex; gap: 10px; }
.overlay-actions .btn { flex: 1 1 0; min-height: 44px; }
.overlay-actions .btn.ghost { flex: 0 0 auto; }
@media (prefers-reduced-motion: reduce) {
  .typing-target.err { animation: none; }
}

.text-description { margin-bottom: 10px; white-space: pre-wrap; }
.text-input {
  width: 100%;
  font: 16px/1.6 var(--serif);
  background: var(--well);
  color: var(--text);
  border: 1px solid var(--rule-2);
  border-radius: 6px;
  padding: 14px;
  margin: 12px 0;
  resize: vertical;
}
.text-counter { color: var(--muted); font-family: var(--sans); font-size: 13px; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.text-counter.out { color: var(--signal); }
.text-submissions { margin: 8px 0 8px 16px; color: var(--muted); }

/* ============ habit editor ============ */
.habit-days { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.habit-days label { display: inline-flex; align-items: center; gap: 5px; margin: 0; color: var(--text); font-size: 13px; }
.graphic-form .habit-time { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.graphic-form .habit-time input { width: 90px; }
.graphic-form .habit-check { display: flex; gap: 8px; align-items: center; }
.graphic-form .habit-check label, .graphic-form .habit-time span { display: inline; }

#habit-conditions { margin: 8px 0; display: grid; gap: 6px; }
.condition-row {
  display: grid;
  grid-template-columns: 1.3fr 1.3fr 0.5fr 0.7fr 0.7fr auto;
  gap: 6px;
  align-items: center;
}
.condition-row select, .condition-row input {
  width: 100%;
  background: var(--well);
  color: var(--text);
  border: 1px solid var(--rule-2);
  border-radius: 5px;
  padding: 6px 8px;
}

/* ============ notes ============ */
.note-block { margin-bottom: 18px; }
.note-block:last-child { margin-bottom: 0; }
.note-content {
  background: var(--well);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 12px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.note-edit {
  width: 100%;
  font: 15px/1.6 var(--serif);
  background: var(--well);
  color: var(--text);
  border: 1px solid var(--rubric);
  border-radius: 6px;
  padding: 12px 14px;
  min-height: 96px;
  resize: vertical;
}
.note-msg { font-family: var(--sans); font-size: 12.5px; color: var(--muted); }

/* ============ proofs ============ */
.proof-upload { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 4px 0; font-family: var(--sans); font-size: 13px; }
.proof-upload input[type="file"] { color: var(--muted); font-size: 12.5px; }
.proofs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.proof-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--rule-2); display: block; }

/* ============ wheel ============ */
.wheel-spin { font-family: var(--sans); }
h3 .wheel-spin { float: right; margin-top: -3px; }

/* ============ camera ============ */
#camera-video { width: 100%; border-radius: 6px; background: #000; margin: 12px 0; }
.camera-modal-actions { display: flex; gap: 10px; }

/* ============ focus visibility ============ */
:focus-visible { outline: 2px solid var(--rubric-hi); outline-offset: 2px; }

/* ============ responsive ============ */
/* ============ phone: the sub's workbench ============
   The subs live on phones (PRODUCT.md). At this width the day's ledger, not
   the management chrome, is the page: one handed, thumb-reachable, every
   obligation's own action inside the entry it belongs to. */
@media (max-width: 700px) {
  .container { margin: 16px auto 44px; gap: 14px; padding: 0 12px; }
  .card, .card.narrow { padding: 15px 15px; }
  .card.narrow { margin: 24px auto; }
  h1 { font-size: 1.42rem; }

  /* the exercise panel takes the sheet and keeps its own scroll */
  #typing-overlay > .typing-box, #text-overlay > .text-box {
    width: min(680px, 94vw);
    max-height: 92dvh;
    padding: 16px 14px;
  }

  /* shell: 44px targets, the role line drops to its own rule */
  .topbar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar .brand { display: inline-flex; align-items: center; min-height: 44px; }
  .topbar .who { order: 3; flex: 1 0 100%; }
  .bell-btn { width: 44px; height: 44px; font-size: 17px; }
  .topbar .btn { min-height: 44px; }

  /* the rail is one-handed and ordered by what the sub actually opens */
  .navmenu {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 7px;
    padding: 6px 12px;
    scrollbar-width: none;
  }
  .navmenu::-webkit-scrollbar { display: none; }
  .navmenu a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 11px;
    font-size: 13.5px;
    border: 1px solid var(--rule);
    border-radius: 5px;
  }
  .navmenu a:hover { background: var(--well); border-color: var(--rule-2); color: var(--text); }
  .navmenu a.is-active { background: var(--well); border-color: var(--rubric); color: var(--text); }

  /* the ledger readout stays a readout: three figures, never three stacked cards */
  .stats-strip { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .card.stat { padding: 9px 11px; gap: 1px; background: var(--panel); }
  .stat span { font-size: 10px; }
  .stat strong { font-size: 1.28rem; }
  /* and it reads after the work: today's obligations come first under the thumb */
  .container > * { order: 3; }
  .container > section.card:first-of-type { order: 1; }
  .container > .stats-strip { order: 2; }

  /* touch floor */
  .btn { min-height: 44px; min-width: 44px; padding: 10px 14px; font-size: 13.5px; }
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="date"], input[type="time"],
  input[type="file"], select, textarea { font-size: 16px; min-height: 44px; }

  /* an obligation is one ruled entry; its action belongs to it, not to a column */
  .table { display: block; }
  .table thead, .table tr:has(> th) { display: none; }
  .table tr { display: block; border-bottom: 1px solid var(--rule); }
  .table td { display: block; border: 0; padding: 0; }
  .table tr[data-kind="habit"] { padding: 13px 0 11px; border-bottom: 0; }
  .table tr[data-kind="habit"] > td:first-child { font-weight: 600; }
  .table tr[data-kind="habit"] > td:nth-child(2),
  .table tr[data-kind="habit"] > td:nth-child(3) { display: inline-block; margin-top: 5px; }
  .table tr[data-kind="habit"] > td:nth-child(2) { margin-right: 10px; color: var(--muted); }
  .table tr[data-kind="habit"] > td:last-child {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .table tr[data-kind="habit"] > td:last-child > .btn { flex: 1 1 auto; }
  .table tr[data-kind="habit"] > td:last-child > .btn.ghost { flex: 0 0 auto; }
  .proof-row { padding: 0 0 15px; }
  .proof-row td { padding: 0; }
  .proof-upload { display: flex; flex-wrap: wrap; gap: 8px; }
  .proof-upload input[type="file"] { flex: 1 1 100%; padding: 10px; }
  .proof-upload .btn { flex: 1 1 auto; }
  .table tr[data-kind="habit"]:last-child, .proof-row:last-child,
  .table tr:last-child { border-bottom: none; }

  /* the few tables that are not ledgers read as ruled rows, never sideways columns */
  .table:not(:has([data-kind="habit"])) tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px 12px;
    padding: 11px 0;
  }
  .table:not(:has([data-kind="habit"])) td { display: block; }

  .condition-row { grid-template-columns: 1fr 1fr; }
  .graphic-emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .notif-panel { width: min(320px, 92vw); }
  h3 .wheel-spin { float: none; }
}
