:root {
  color-scheme: dark;
  --canvas: #111214;
  --surface: #1a1b1f;
  --surface-muted: #24252b;
  --surface-warm: #231f1a;
  --ink: #f2f2f4;
  --muted: #a5a6ad;
  --quiet: #777982;
  --line: #2d2f35;
  --line-strong: #41434b;
  --green: #7657ff;
  --green-dark: #957fff;
  --green-soft: #2b2642;
  --blue: #72a7d8;
  --blue-soft: #1c2731;
  --coral: #e47766;
  --coral-soft: #3a2424;
  --amber: #d7a65a;
  --amber-soft: #3a2f1e;
  --success: #f0c75e;
  --success-soft: #3a301d;
  --shadow: 0 18px 48px rgb(0 0 0 / 38%);
  --sidebar-width: 244px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
}

body {
  min-height: 100vh;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
label[for]:focus-visible {
  outline: 3px solid rgb(118 87 255 / 32%);
  outline-offset: 2px;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  flex: 0 0 auto;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #151619;
}

.brand-row {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 11px;
  padding: 16px 18px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 6px;
  border: 1px solid #927dff;
  background: #7657ff;
  overflow: hidden;
}

.brand-mark img {
  width: 31px;
  height: 31px;
  object-fit: contain;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.nav-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 12px;
}

.nav-label {
  margin: 20px 10px 6px;
  color: var(--quiet);
  font-size: 11px;
  font-weight: 700;
}

.nav-item {
  display: grid;
  min-height: 42px;
  cursor: pointer;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 9px;
  border-radius: 6px;
  background: transparent;
  color: #b7b8be;
  padding: 0 11px;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}

.nav-item:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.nav-item.active {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
}

.nav-count {
  min-width: 22px;
  border-radius: 10px;
  background: rgb(0 0 0 / 20%);
  color: var(--muted);
  font-size: 11px;
  line-height: 20px;
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 14px 14px 16px;
}

.storage-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--quiet);
  font-size: 11px;
}

.storage-status svg {
  width: 15px;
  height: 15px;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}

.text-button,
.file-button {
  display: flex;
  min-height: 34px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}

.text-button:hover,
.file-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.text-button svg,
.file-button svg {
  width: 14px;
  height: 14px;
}

.sidebar-close,
.menu-button {
  display: none;
}

.sidebar-scrim {
  display: none;
}

.main-area {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.app-notice {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 7px 24px;
  border-bottom: 1px solid var(--line);
  background: #211d31;
  color: #d8ceff;
  font-size: 13px;
}

.app-notice[hidden], .install-prompt[hidden] { display: none; }
.app-notice .text-button { margin-left: auto; }
.app-notice .text-button + .text-button { margin-left: 0; }
.offline-notice { background: #29251b; color: var(--success); }

.backup-overview, .backup-section {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.backup-overview { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.backup-overview h2 { margin: 5px 0 8px; font-size: 20px; }
.backup-overview p { margin: 0; max-width: 680px; color: var(--muted); line-height: 1.65; }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line); }
.backup-main { display: flex; min-width: 0; align-items: center; gap: 12px; }
.backup-main > svg { color: var(--green-dark); }
.backup-main div { min-width: 0; }
.backup-main strong, .backup-main span { display: block; }
.backup-main span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.backup-actions { display: flex; align-items: center; gap: 6px; }
.retain-toggle { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.retain-toggle input { accent-color: var(--green); }
.backup-dialog { padding: 22px; }
.backup-preview { color: var(--muted); line-height: 1.65; }
.backup-preview strong { color: var(--ink); }

.install-prompt {
  position: fixed;
  z-index: 50;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex;
  width: min(390px, calc(100vw - 32px));
  align-items: flex-start;
  gap: 12px;
  padding: 18px 46px 18px 18px;
  border: 1px solid #7657ff;
  background: #1b1a22;
  box-shadow: var(--shadow);
}
.install-prompt > svg { color: var(--success); }
.install-prompt p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.install-prompt .icon-button { position: absolute; top: 8px; right: 8px; }

.topbar {
  display: flex;
  min-height: 92px;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgb(17 18 20 / 92%);
  padding: 14px clamp(22px, 4vw, 54px);
}

.page-heading {
  min-width: 0;
  flex: 1;
}

.date-line,
.dialog-eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}

h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
}

h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.workspace {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px clamp(22px, 4vw, 54px) 56px;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  cursor: pointer;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.icon-button.sidebar-close,
.icon-button.menu-button {
  display: none;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  min-height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 5px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid #8a72ff;
  background: #7657ff;
  color: white;
}

.primary-button:hover {
  background: #876cff;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover {
  background: var(--surface-muted);
}

.danger-button {
  background: var(--coral);
  color: #fff;
}

.overview-band {
  display: grid;
  grid-template-columns: minmax(240px, 1.1fr) repeat(3, minmax(120px, 0.65fr));
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.progress-lead,
.stat-block {
  min-height: 132px;
  padding: 21px 22px;
}

.progress-lead {
  display: flex;
  align-items: center;
  gap: 18px;
}

.stat-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--line);
}

.progress-ring {
  --progress: 0;
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--progress) * 1%), var(--green-soft) 0);
  position: relative;
}

.progress-ring::after {
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.progress-ring strong {
  z-index: 1;
  font-size: 17px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 6px;
  font-size: 25px;
  font-weight: 760;
  line-height: 1.2;
}

.metric-caption {
  margin-top: 5px;
  color: var(--quiet);
  font-size: 11px;
}

.section-kicker {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.section-copy {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.reminder-strip {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  border-left: 3px solid var(--amber);
  background: var(--surface-warm);
  padding: 10px 14px;
}

.reminder-strip .reminder-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--amber);
}

.reminder-strip .reminder-icon svg {
  width: 16px;
  height: 16px;
}

.reminder-copy {
  min-width: 0;
  flex: 1;
  font-size: 13px;
}

.reminder-copy strong {
  margin-right: 7px;
}

.reminder-meta {
  color: var(--muted);
  font-size: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.8fr);
  gap: 28px;
  margin-top: 30px;
}

.section-header {
  display: flex;
  min-height: 38px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.section-title-row > svg {
  color: var(--green);
}

.section-caption {
  margin: 3px 0 0 27px;
  color: var(--quiet);
  font-size: 11px;
}

.link-button {
  display: inline-flex;
  min-height: 32px;
  cursor: pointer;
  align-items: center;
  gap: 4px;
  background: transparent;
  color: var(--blue);
  padding: 0 4px;
  font-size: 12px;
  font-weight: 700;
}

.link-button:hover {
  color: var(--ink);
}

.link-button svg {
  width: 14px;
  height: 14px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: grid;
  min-height: 64px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 10px 10px 10px 14px;
  transition: border-color 140ms ease, background 140ms ease;
}

.task-item:hover {
  border-color: var(--line-strong);
}

.task-item.completed {
  background: #17181b;
}

.task-check {
  display: grid;
  width: 24px;
  height: 24px;
  cursor: pointer;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
}

.task-check:hover {
  border-color: var(--green);
}

.task-item.completed .task-check {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.task-check svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
}

.task-main {
  min-width: 0;
}

.task-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.task-item.completed .task-title {
  color: var(--quiet);
  text-decoration: line-through;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.task-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-meta svg {
  width: 12px;
  height: 12px;
}

.task-actions {
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 120ms ease;
}

.task-item:hover .task-actions,
.task-actions:focus-within {
  opacity: 1;
}

.task-actions .icon-button {
  width: 30px;
  height: 30px;
}

.task-actions svg {
  width: 15px;
  height: 15px;
}

.side-panel {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 18px;
}

.side-panel + .side-panel {
  margin-top: 14px;
}

.weekly-progress {
  margin-top: 16px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-muted);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 240ms ease;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.summary-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #c3c4ca;
  font-size: 12px;
  line-height: 1.55;
}

.summary-line svg {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: var(--green);
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: rgb(255 255 255 / 2%);
  padding: 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 11px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
}

.empty-state p {
  margin: 5px 0 13px;
  color: var(--muted);
  font-size: 12px;
}

.view-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.view-intro h2 {
  font-size: 21px;
}

.view-intro p {
  max-width: 620px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.task-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
}

.task-group + .task-group {
  margin-top: 26px;
}

.group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.group-heading h3 {
  font-size: 13px;
}

.group-count {
  color: var(--quiet);
  font-size: 11px;
}

.guide-panel {
  align-self: start;
  border-left: 2px solid var(--blue);
  background: var(--blue-soft);
  padding: 16px;
}

.guide-panel h3 {
  color: #91bde4;
}

.guide-panel p {
  margin: 7px 0 0;
  color: #9eb2c3;
  font-size: 12px;
  line-height: 1.7;
}

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.review-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 21px;
}

.review-panel.wide {
  grid-column: 1 / -1;
}

.review-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--quiet);
  font-size: 11px;
}

.save-state svg {
  width: 13px;
  height: 13px;
}

.review-textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #151619;
  padding: 13px;
  font-size: 13px;
  line-height: 1.75;
}

.review-textarea-large {
  min-height: 270px;
}

.review-prompts {
  margin: 12px 0 0;
  color: var(--quiet);
  font-size: 11px;
  line-height: 1.65;
}

.history-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.history-controls .icon-button {
  width: 34px;
  height: 34px;
  border-color: var(--line);
  background: var(--surface);
}

.history-controls .icon-button:disabled {
  cursor: not-allowed;
  color: var(--quiet);
  opacity: 0.45;
}

.history-range {
  min-width: 190px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.history-current {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.history-metrics {
  margin-bottom: 24px;
}

.history-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.75fr);
  gap: 22px;
}

.history-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 18px;
}

.history-panel + .history-panel,
.history-panel + aside,
.history-panel + aside .history-panel + .history-panel {
  margin-top: 14px;
}

.history-grid > aside .history-panel + .history-panel {
  margin-top: 14px;
}

.history-table-wrap {
  overflow-x: auto;
  margin-top: 15px;
}

.history-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 11px;
}

.history-table th,
.history-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: center;
}

.history-table thead th {
  color: var(--muted);
  font-weight: 700;
}

.history-table thead th:first-child {
  min-width: 150px;
  text-align: left;
}

.history-table thead small,
.history-table tbody th small {
  display: block;
  margin-top: 3px;
  color: var(--quiet);
  font-size: 10px;
  font-weight: 400;
}

.history-table tbody th {
  max-width: 190px;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}

.history-table tbody td {
  color: var(--quiet);
}

.history-table tbody td svg {
  width: 15px;
  height: 15px;
}

.history-table tbody td.is-done {
  color: var(--success);
}

.history-table tr:last-child th,
.history-table tr:last-child td {
  border-bottom: 0;
}

.table-empty {
  padding: 28px 12px !important;
  color: var(--quiet) !important;
  text-align: center !important;
}

.history-weekly-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.history-weekly-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.history-weekly-row > svg {
  margin-top: 2px;
  color: var(--quiet);
}

.history-weekly-row > svg[data-lucide="check-circle-2"] {
  color: var(--success);
}

.history-weekly-row strong,
.history-weekly-row span {
  display: block;
}

.history-weekly-row strong {
  font-size: 12px;
  line-height: 1.4;
}

.history-weekly-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.history-note {
  margin: 16px 0 0;
  color: #d0d1d6;
  font-size: 13px;
  line-height: 1.8;
}

.history-empty {
  display: grid;
  min-height: 150px;
  margin-bottom: 22px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: rgb(255 255 255 / 2%);
  padding: 22px;
  text-align: center;
}

.history-empty p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.auto-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.auto-summary-item {
  border-left: 3px solid var(--green);
  background: var(--surface-muted);
  padding: 12px;
}

.auto-summary-item.blue {
  border-color: var(--blue);
}

.auto-summary-item.coral {
  border-color: var(--coral);
}

.auto-summary-item.amber {
  border-color: var(--amber);
}

.auto-summary-item strong {
  display: block;
  font-size: 18px;
}

.auto-summary-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.task-dialog,
.confirm-dialog {
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0;
}

.task-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgb(0 0 0 / 64%);
  backdrop-filter: blur(2px);
}

.task-dialog form {
  padding: 22px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.dialog-eyebrow {
  color: var(--green);
  font-weight: 700;
}

.form-field {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  margin-top: 15px;
}

.field-label {
  color: #c3c4ca;
  font-size: 12px;
  font-weight: 700;
}

.form-row {
  display: flex;
  gap: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  padding: 10px 11px;
  font-size: 13px;
}

input,
select {
  min-height: 42px;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: #666872;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  padding: 3px;
}

.segmented-control button {
  min-height: 34px;
  cursor: pointer;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segmented-control button.active {
  background: var(--surface);
  box-shadow: 0 1px 6px rgb(0 0 0 / 32%);
  color: var(--green-dark);
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
}

.confirm-dialog {
  width: min(390px, calc(100vw - 32px));
  text-align: center;
}

.confirm-dialog form {
  padding: 26px;
}

.confirm-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin: 0 auto 13px;
  place-items: center;
  border-radius: 50%;
  background: var(--coral-soft);
  color: var(--coral);
}

.confirm-dialog p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.confirm-dialog .dialog-actions {
  justify-content: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  display: flex;
  min-height: 44px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
  align-items: center;
  gap: 9px;
  border: 1px solid #806a2f;
  border-radius: 6px;
  background: #2a2417;
  box-shadow: var(--shadow);
  color: var(--success);
  padding: 10px 14px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .overview-band {
    grid-template-columns: 1.4fr repeat(3, 1fr);
  }

  .progress-lead,
  .stat-block {
    min-height: 118px;
    padding: 18px;
  }

  .content-grid,
  .task-page-grid,
  .history-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-page-grid > aside {
    order: -1;
  }

  .guide-panel {
    max-width: none;
  }

  .auto-summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .sidebar {
    width: min(284px, calc(100vw - 48px));
    padding-top: env(safe-area-inset-top);
    box-shadow: var(--shadow);
    transform: translateX(-104%);
    transition: transform 180ms ease;
  }

  .sidebar-footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  body.sidebar-open {
    overflow: hidden;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: block;
    pointer-events: none;
    background: rgb(0 0 0 / 64%);
    opacity: 0;
    transition: opacity 180ms ease;
  }

  body.sidebar-open .sidebar-scrim {
    pointer-events: auto;
    opacity: 1;
  }

  .icon-button.sidebar-close {
    display: inline-grid;
    margin-left: auto;
  }

  .main-area {
    margin-left: 0;
  }
  .app-notice { padding-inline: 16px; flex-wrap: wrap; }
  .backup-overview, .backup-row { align-items: stretch; flex-direction: column; }
  .backup-actions { justify-content: flex-end; flex-wrap: wrap; }

  .topbar {
    min-height: 76px;
    padding: 12px 16px;
  }

  .icon-button.menu-button {
    display: inline-grid;
    flex: 0 0 auto;
  }

  h1 {
    font-size: 20px;
  }

  .date-line {
    font-size: 11px;
  }

  .workspace {
    padding: 20px 16px 44px;
  }

  .overview-band {
    grid-template-columns: 1fr 1fr;
  }

  .progress-lead {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--line);
  }

  .stat-block {
    min-height: 96px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .stat-block:nth-child(even) {
    border-right: 1px solid var(--line);
  }

  .stat-block:last-child {
    grid-column: 1 / -1;
  }

  .content-grid {
    gap: 24px;
    margin-top: 24px;
  }

  .review-grid {
    grid-template-columns: 1fr;
  }

  .review-panel.wide {
    grid-column: auto;
  }

  .view-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .history-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .history-range {
    min-width: 0;
    flex: 1;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .primary-button span {
    display: none;
  }

  .topbar .primary-button {
    width: 40px;
    flex: 0 0 auto;
    padding: 0;
  }

  .overview-band {
    grid-template-columns: 1fr 1fr;
  }

  .progress-lead {
    min-height: 116px;
  }

  .stat-block {
    padding: 15px;
  }

  .metric-value {
    font-size: 21px;
  }

  .reminder-strip {
    align-items: flex-start;
  }

  .reminder-meta {
    display: block;
    margin-top: 3px;
  }

  .task-item {
    grid-template-columns: 27px minmax(0, 1fr) 32px;
    padding-left: 11px;
  }

  .task-actions {
    justify-content: flex-end;
    opacity: 1;
  }

  .task-actions .delete-task {
    display: none;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .auto-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dialog-actions > button {
    flex: 1;
  }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
