@font-face {
  font-family: 'Old Standard TT';
  src: url('old-standard-tt-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
:root {
  --page: var(--brand-paper);
  --surface: #fffef7;
  --surface-soft: #f8edbd;
  --surface-hover: #fff4c6;
  --row-line: #eee6c7;
  --border: #dacd97;
  --ink: #393821;
  --muted: #77704b;
  --plum: #ebd36d;
  --plum-hover: #ddc358;
  --plum-ink: #6d6022;
  --focus: #9b822a;
  --doing: #63733a;
  --waiting: #92773c;
  --waiting-line: #c9b47a;
  --done-surface: #f7f5e7;
  --danger: #a24935;
  --brand-paper: #fff9dc;
  --check: #82701f;
  --primary-text: #38310e;
  font: 15px/1.35 "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { padding: 7px 9px; min-height: 100dvh; }
.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.brand img {
  display: block;
  width: 77px;
  height: auto;
  mask-image: linear-gradient(90deg, transparent, #000 2%, #000 98%, transparent),
              linear-gradient(transparent, #000 1.5%, #000 98%, transparent);
  mask-composite: intersect;
}
.brand h1 {
  margin: 0;
  color: var(--plum-ink);
  font: italic 400 clamp(29px, 3vw, 36px)/1.05 'Old Standard TT', Georgia, serif;
  font-synthesis: none;
  white-space: nowrap;
}
h2 { margin: 0 0 14px; font-size: 20px; }
p { margin: 0; }
.top, .summary, .toolbar, .actions, footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.top, footer { justify-content: space-between; }
.summary { gap: 14px; margin-bottom: 10px; }
.summary .actions { margin-left: auto; }
.counts { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; color: var(--muted); font-size: 14px; }
#done-today { border: 0; padding: 0; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
#done-today[aria-pressed="true"] { color: var(--plum-ink); font-weight: 700; }
#balance { font-weight: 600; white-space: nowrap; }
#balance[data-sign="1"] { color: var(--plum-ink); border-bottom: 2px solid currentColor; }
#balance[data-sign="-1"] { color: var(--danger); border-bottom: 2px solid currentColor; }
.hint, footer { color: var(--muted); }
.toolbar { gap: 7px; margin-bottom: 10px; }
.toolbar input[type="search"] { width: 265px; }
.toolbar select { max-width: 100%; }
.toolbar .spacer { flex: 1; }
button, input, select, textarea { font: inherit; color: inherit; }
button, input:not([type="checkbox"]), select, textarea { border: 1px solid var(--border); border-radius: 5px; padding: 5px 10px; background: var(--surface); }
button { cursor: pointer; }
button:not(:disabled):hover { background: var(--surface-hover); }
button.primary { background: var(--plum); border-color: var(--plum); color: var(--primary-text); }
button.primary:not(:disabled):hover { background: var(--plum-hover); }
button:disabled { opacity: .55; cursor: wait; }
button.danger { color: var(--danger); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.check { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
input[type="checkbox"] { accent-color: var(--check); width: 15px; height: 15px; }
.table-wrap { overflow: auto; min-height: 0; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; min-width: 970px; }
thead { position: sticky; top: 0; z-index: 1; }
.number-col { width: 30px; }
.done-col { width: 58px; }
.doing-col { width: 64px; }
.waiting-col { width: 48px; }
.section-col { width: 135px; }
.date-col { width: 119px; }
.paint-col { width: 27px; }
.comment-col { width: 23%; }
.attachments-col { width: 36px; }
th, td { text-align: left; overflow-wrap: anywhere; }
th { height: 28px; padding: 4px 7px; font-size: 13px; font-weight: 600; color: var(--plum-ink); background: var(--surface-soft); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { height: 30px; padding: 1px 5px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
tbody tr:hover { background: var(--surface-hover); }
.comfortable td { height: 38px; font-size: 16px; }
th.center, .status-cell { text-align: center; padding-inline: 1px; }
.row-number { font-size: 12px; color: var(--muted); text-align: right; }
.status-cell input { vertical-align: middle; cursor: pointer; }
.status-cell .doing { accent-color: var(--doing); }
.status-cell .waiting { accent-color: var(--waiting); }
.comment { font-size: 14px; }
.date { white-space: nowrap; font-size: 13px; }
.task-title, .comment { white-space: pre-wrap; }
.row-todo { color: var(--ink); }
.row-doing { color: var(--doing); font-weight: 700; }
.row-done { color: var(--muted); background: var(--done-surface); }
.row-done .task-title { text-decoration: line-through; }
.row-waiting { color: var(--waiting); }
.row-waiting > td { border-top: 1px solid var(--waiting-line); border-bottom-color: var(--waiting-line); }
.row-waiting > td:first-child { border-left: 1px solid var(--waiting-line); }
.row-waiting > td:last-child { border-right: 1px solid var(--waiting-line); }
[data-color="blue"], [data-paint="blue"] { --paint-color: #9fc9f5; }
[data-color="yellow"], [data-paint="yellow"] { --paint-color: #ffdf63; }
[data-color="green"], [data-paint="green"] { --paint-color: #8ed695; }
[data-color="red"], [data-paint="red"] { --paint-color: #f59a91; }
[data-color="brown"], [data-paint="brown"] { --paint-color: #d1aa81; }
tbody tr[data-color]:not([data-color=""]) { background: var(--paint-color); color: var(--ink); }
.paint-cell { text-align: center; padding-inline: 2px; }
.swatch { display: inline-block; width: 13px; height: 13px; border: 1px solid var(--border); border-radius: 3px; background: var(--paint-color); vertical-align: middle; }
.paint { appearance: none; display: grid; place-content: center; width: 17px; height: 17px; margin: auto; padding: 0; border: 1px solid var(--muted); border-radius: 3px; background: var(--paint-color); cursor: pointer; }
.paint:checked::after { content: '✓'; font-weight: 700; color: var(--ink); }
.group td { background: var(--surface-soft); color: var(--plum-ink); font-weight: 600; font-size: 13px; padding: 5px 9px; }
#rows tr.is-selected { outline: 2px solid var(--plum); outline-offset: -2px; }
#rows tr.is-selected > .row-number { box-shadow: inset 3px 0 var(--plum); font-weight: 700; }
#rows input.inline-field { width: 100%; min-width: 0; min-height: 0; height: 27px; line-height: 21px; padding: 2px; font: inherit; border: 1px solid transparent; border-radius: 3px; background: transparent; }
#rows input.inline-field:hover { border-color: var(--border); }
#rows input.inline-field:focus { border-color: var(--focus); background: var(--surface); outline: none; }
.keyboard-hint { font-size: 12px; }
.empty { padding: 18px 4px; color: var(--muted); }
footer { margin-top: 8px; font-size: 13px; }
.login, dialog { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 20px; }
.login { max-width: 420px; margin: min(13vh, 95px) auto 0; }
.login form { display: grid; gap: 14px; }
.login form button { justify-self: start; }
dialog { width: min(92vw, 560px); max-height: calc(100dvh - 24px); color: inherit; }
dialog::backdrop { background: #24302045; }
form label { display: grid; gap: 4px; margin: 0 0 10px; }
form input, form select, form textarea { width: 100%; min-width: 0; }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.dialog-actions { margin-top: 12px; justify-content: end; }
.hint { font-size: 13px; margin: -4px 0 12px; }
.message { color: var(--danger); margin-top: 8px; }
.message:empty { display: none; }
.section-form, .section-row { display: flex; gap: 7px; align-items: end; }
.section-form label { flex: 1; margin: 0; }
#section-list { list-style: none; margin: 14px 0 0; padding: 0; }
.section-row { padding: 6px 0; }
.section-row input { flex: 1; min-width: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); white-space: nowrap; overflow: hidden; }
@media (min-width: 761px) {
  #planner { display: flex; flex-direction: column; height: calc(100dvh - 14px); }
  .summary, .toolbar, footer { flex-shrink: 0; }
  .table-wrap { flex: 1; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  main { padding-inline: 8px; }
  .toolbar input[type="search"] { width: 220px; }
  .summary { gap: 9px; }
  .comment-col { width: 21%; }
}
@media (max-width: 760px) {
  main { padding: 6px; }
  .brand img { width: 62px; }
  button, input:not([type="checkbox"]), select, textarea { min-height: 42px; font-size: 16px; }
  .summary .actions { width: 100%; justify-content: space-between; margin-left: 0; }
  #done-today { font-size: inherit; min-height: 0; }
  .toolbar input[type="search"] { width: 100%; }
  .toolbar select { flex: 1; }
  .toolbar .spacer, .compact-control { display: none; }
  .table-wrap, table, tbody { display: block; min-width: 0; border: 0; background: none; }
  thead, colgroup { display: none; }
  tbody { display: grid; gap: 8px; }
  tbody tr { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px 6px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
  tbody tr.row-waiting { border-color: var(--waiting-line); }
  tbody tr.row-done { background: var(--done-surface); }
  tbody tr > td, tbody tr.row-waiting > td { padding: 0; height: auto; border: 0; }
  tbody tr.row-waiting > td:first-child, tbody tr.row-waiting > td:last-child { border: 0; }
  .row-number, tbody .paint-cell { display: none; }
  .task-title, .comment, .date, .group td { grid-column: 1 / -1; }
  .section-cell { grid-column: 1 / 3; grid-row: 1; }
  .attachmentcell { grid-column: 3; grid-row: 1; justify-self: end; order: -5; }
  .attachmentcell:empty { display: none; }
  .task-title { order: -4; font-size: 16px; }
  .section-cell { order: -5; font-size: 13px; }
  .date { order: -3; }
  .comment { order: -2; }
  .status-cell { display: flex; align-items: center; justify-content: center; }
  .status-cell label { display: flex; align-items: center; justify-content: center; min-height: 38px; gap: 3px; font-size: 12px; white-space: nowrap; }
  .status-cell .visually-hidden { position: static; width: auto; height: auto; clip-path: none; }
  #rows input.inline-field { min-height: 38px; height: 38px; font-size: 16px; }
  .keyboard-hint { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .section-row button { font-size: 13px; padding-inline: 6px; }
}

.recovery-link { margin-top: 14px; }
.login p { line-height: 1.5; }
#password-help { color: var(--muted); font-size: 13px; }
