:root {
  --ink: #173d38;
  --muted: #71807c;
  --paper: #f5f7f3;
  --card: #ffffff;
  --line: #e3e9e3;
  --green: #236b5c;
  --green-dark: #174d43;
  --green-soft: #e9f3ed;
  --lime: #d9efab;
  --red: #b54a43;
  --red-soft: #fff1ed;
  --amber: #9b6a22;
  --amber-soft: #fff7e6;
  --blue: #52758b;
  --shadow: 0 1px 2px rgba(23, 61, 56, .03), 0 7px 24px rgba(23, 61, 56, .035);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand, .login-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -.5px;
  text-decoration: none;
}
.brand-mark { display: inline-flex; align-items: flex-end; gap: 3px; height: 25px; }
.brand-mark i { display: block; width: 6px; border-radius: 4px; background: var(--green); }
.brand-mark i:nth-child(1) { height: 19px; }
.brand-mark i:nth-child(2) { height: 13px; background: #8bbca9; }
.brand-mark i:nth-child(3) { height: 25px; background: #accb62; }

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 38px 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(217, 239, 171, .34), transparent 27rem),
    radial-gradient(circle at 85% 80%, rgba(141, 216, 200, .2), transparent 30rem),
    var(--paper);
}
.login-brand { align-self: flex-start; }
.login-card {
  width: min(100%, 550px);
  margin: auto;
  padding: 48px;
  border: 1px solid rgba(227, 233, 227, .9);
  border-radius: 22px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 24px 80px rgba(23, 61, 56, .08);
}
.eyebrow {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 1.5px;
  line-height: 1.4;
  text-transform: uppercase;
}
.login-card h1 { margin: 0; font-size: clamp(32px, 6vw, 44px); letter-spacing: -1.8px; }
.login-copy { margin: 13px 0 32px; color: var(--muted); line-height: 1.65; }
.login-card label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 650; }
.password-row { display: flex; gap: 10px; }
.password-row input { flex: 1; min-width: 0; }
.login-footer { margin: auto 0 0; color: var(--muted); font-size: 12px; }

input, select, textarea {
  width: 100%;
  border: 1px solid #dce4dd;
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input, select { height: 43px; padding: 0 12px; }
textarea { padding: 11px 12px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: #72a595;
  box-shadow: 0 0 0 3px rgba(35, 107, 92, .1);
}
input::placeholder, textarea::placeholder { color: #9aa6a1; }
.button {
  min-height: 43px;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .15s, transform .15s;
}
.button:active { transform: translateY(1px); }
.button.primary { color: #fff; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: var(--line); background: #fff; }
.button.secondary:hover { background: var(--paper); }
.button:disabled { opacity: .6; cursor: wait; }
.form-error { min-height: 18px; margin: 9px 0 0; color: var(--red); font-size: 12px; }

.app-shell { min-height: 100vh; }
.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(28px, calc((100vw - 1280px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .85);
}
.topbar-right { display: flex; align-items: center; gap: 18px; }
.sync-status { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #60a17c; }
.status-dot.busy { background: #d5a54a; animation: pulse 1s infinite alternate; }
.status-dot.error { background: var(--red); }
.topbar-divider { height: 19px; width: 1px; background: var(--line); }
.text-button { padding: 5px 0; border: 0; background: none; color: var(--muted); font-size: 12px; }
.text-button:hover { color: var(--ink); }
@keyframes pulse { to { opacity: .35; } }

main { width: min(1280px, calc(100% - 56px)); margin: 0 auto; padding: 45px 0 28px; }
.welcome { display: flex; align-items: center; justify-content: space-between; gap: 30px; margin-bottom: 34px; }
.welcome h1 { margin: 0; font-size: clamp(30px, 4vw, 42px); letter-spacing: -1.7px; line-height: 1.1; }
.day-summary { margin: 11px 0 0; color: var(--muted); font-size: 15px; }
.focus-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border: 1px solid #e0e8d4;
  border-radius: 12px;
  color: #6f7e65;
  background: #f0f4e8;
  font-size: 12px;
  line-height: 1.55;
}
.focus-note strong { color: #4d634a; font-weight: 700; }
.focus-note-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--green);
  background: #dce9c8;
  font-weight: 800;
}

.quick-add {
  margin-bottom: 22px;
  padding: 24px 26px 19px;
  border: 1px solid #dfe7df;
  border-radius: 15px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.section-heading.compact { margin-bottom: 15px; }
.section-heading h2 { margin: 0; font-size: 16px; letter-spacing: -.25px; }
.section-heading.compact h2 { font-size: 19px; letter-spacing: -.5px; }
.section-heading.compact .eyebrow { margin-bottom: 4px; }
.quick-title-row { display: flex; gap: 11px; }
.quick-title-row input { height: 47px; padding: 0 15px; font-size: 14px; }
.quick-title-row .button { height: 47px; }
.quick-options { display: flex; align-items: flex-end; gap: 12px; margin-top: 13px; }
.field label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 650; }
.inline-field { display: flex; align-items: center; gap: 7px; }
.inline-field label { margin: 0; color: var(--muted); font-size: 11px; font-weight: 600; }
.inline-field input, .inline-field select { width: auto; height: 33px; padding: 0 8px; border-color: transparent; background: #f5f7f4; color: #52645e; font-size: 11px; }
.inline-field input[type="date"] { width: 128px; }
.inline-field input[placeholder] { width: 130px; }
.keyboard-hint { margin: 0 0 8px auto; color: #9aa6a1; font-size: 10px; }
.quick-add .form-error { margin-bottom: -10px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  background: rgba(255, 255, 255, .7);
}
button.stat-card { transition: border-color .15s, transform .15s; }
button.stat-card:hover { border-color: #b7c9be; transform: translateY(-1px); }
.stat-card > span:last-child { display: flex; flex-direction: column; }
.stat-card strong { font-size: 23px; line-height: 1.1; letter-spacing: -.6px; }
.stat-card small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.stat-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; font-size: 16px; font-weight: 700; }
.today-icon { color: var(--green); background: var(--green-soft); }
.overdue-icon { color: var(--red); background: var(--red-soft); }
.waiting-icon { color: var(--amber); background: var(--amber-soft); }
.done-icon { color: #6f8752; background: #eff4e6; }

.board-error { margin: 0 0 20px; padding: 13px 16px; border: 1px solid #eccbc6; border-radius: 10px; color: var(--red); background: var(--red-soft); font-size: 13px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 22px; align-items: start; }
.main-column, .side-column { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.task-section {
  scroll-margin-top: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .65);
}
.task-section:has(.task-card) { background: var(--card); box-shadow: var(--shadow); }
.section-title-wrap { display: flex; align-items: center; gap: 9px; min-width: 0; }
.section-marker { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; }
.section-marker.red { background: #d6776c; }
.section-marker.green { background: #63a38a; }
.section-marker.blue { background: #85a7b8; }
.section-marker.amber { background: #d5a54a; }
.section-marker.gray { background: #a7b0ac; }
.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 7px;
  color: var(--muted);
  background: #edf1ed;
  font-size: 10px;
  font-weight: 750;
}
.section-caption { color: #97a29e; font-size: 10px; }
.task-list { display: flex; flex-direction: column; gap: 9px; }
.task-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px 14px;
  border: 1px solid #e5eae5;
  border-radius: 10px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.task-card:hover { border-color: #c7d5cb; box-shadow: 0 3px 12px rgba(23, 61, 56, .045); }
.complete-control { position: relative; flex: 0 0 20px; margin-top: 1px; cursor: pointer; }
.complete-checkbox { position: absolute; opacity: 0; width: 20px; height: 20px; margin: 0; }
.custom-checkbox {
  display: block;
  width: 19px;
  height: 19px;
  border: 1.5px solid #b6c5bc;
  border-radius: 6px;
  background: #fff;
}
.complete-checkbox:focus-visible + .custom-checkbox { outline: 3px solid rgba(35, 107, 92, .18); }
.complete-checkbox:checked + .custom-checkbox { border-color: var(--green); background: var(--green); }
.complete-checkbox:checked + .custom-checkbox::after {
  content: "";
  display: block;
  width: 8px;
  height: 4px;
  margin: 5px 0 0 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}
.task-content { min-width: 0; flex: 1; }
.task-title { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; line-height: 1.5; }
.task-notes { margin: 6px 0 0; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.task-meta:empty { display: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 5px; color: #6d7d76; background: #f1f4f1; font-size: 9px; font-weight: 650; line-height: 1.4; }
.badge.due { color: var(--blue); background: #edf4f7; }
.badge.due-today { color: var(--green); background: var(--green-soft); }
.badge.due-overdue { color: var(--red); background: var(--red-soft); }
.badge.priority-high { color: var(--red); background: var(--red-soft); }
.badge.priority-low { color: #76856f; background: #f0f3eb; }
.badge.waiting-badge { color: var(--amber); background: var(--amber-soft); }
.task-actions { display: flex; align-items: center; gap: 3px; opacity: 0; transition: opacity .15s; }
.task-card:hover .task-actions, .task-card:focus-within .task-actions { opacity: 1; }
.icon-button { min-width: 28px; height: 28px; padding: 0 6px; border: 0; border-radius: 6px; color: #87958f; background: transparent; font-size: 10px; }
.icon-button:hover { color: var(--ink); background: #f0f4f0; }
.danger-button { font-size: 18px; line-height: 1; }
.danger-button:hover { color: var(--red); background: var(--red-soft); }
.task-card.is-done { opacity: .65; }
.task-card.is-done .task-title { text-decoration: line-through; }
.empty-state { margin: 0; padding: 12px 3px 4px; color: #9aa6a1; font-size: 11px; line-height: 1.5; }
.overdue-section:has(.task-card) { border-color: #edddd7; }
.waiting-section:has(.task-card) { border-color: #ebe2ce; }
.completed-section { padding: 16px 20px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .5); }
.completed-section summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 650; list-style: none; }
.completed-section summary::-webkit-details-marker { display: none; }
.completed-section summary::after { content: "+"; order: 2; margin-left: auto; margin-right: 12px; color: #9aa6a1; font-size: 16px; }
.completed-section[open] summary::after { content: "−"; }
.completed-section[open] .task-list { margin-top: 15px; }
.app-footer { padding: 28px 0 0; color: #9aa6a1; text-align: center; font-size: 10px; }
.app-footer span { padding: 0 6px; }

dialog {
  width: min(600px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 25px 100px rgba(12, 39, 34, .22);
}
dialog::backdrop { background: rgba(17, 42, 37, .45); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.dialog-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.7px; }
.dialog-heading .eyebrow { margin-bottom: 5px; }
#edit-form > .field { margin-bottom: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.optional { margin-left: 5px; color: #9aa6a1; font-size: 10px; font-weight: 400; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

@media (max-width: 950px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-column { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .completed-section { grid-column: 1 / -1; }
  .keyboard-hint { display: none; }
  .quick-options { flex-wrap: wrap; }
}
@media (max-width: 680px) {
  .topbar { height: 62px; padding: 0 18px; }
  .brand { font-size: 18px; }
  .sync-status, .topbar-divider { display: none; }
  main { width: calc(100% - 32px); padding-top: 30px; }
  .welcome { margin-bottom: 25px; }
  .focus-note { display: none; }
  .quick-add { padding: 20px; }
  .quick-title-row { flex-direction: column; }
  .quick-title-row .button { align-self: flex-end; }
  .quick-options { align-items: flex-start; gap: 9px 13px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 14px; }
  .stat-icon { width: 31px; height: 31px; flex-basis: 31px; }
  .stat-card strong { font-size: 20px; }
  .side-column { display: flex; }
  .task-section { padding: 18px; }
  .section-caption { display: none; }
  .task-actions { opacity: 1; }
  .login-card { padding: 30px 24px; }
  .password-row { flex-direction: column; }
  .password-row .button { align-self: flex-end; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
