:root {
  color-scheme: light;
  --background: #f7f5f0;
  --surface: #ffffff;
  --surface-soft: #fbfaf7;
  --text: #20242c;
  --muted: #69707d;
  --muted-light: #8e949e;
  --border: #e7e3db;
  --border-strong: #d8d3c9;
  --primary: #4f5fd7;
  --primary-strong: #3f4fc2;
  --primary-soft: #eef0ff;
  --success: #3c8c68;
  --success-soft: #eaf6ef;
  --warning: #c9823a;
  --warning-soft: #fff4e8;
  --danger: #b4473d;
  --danger-soft: #fff0ee;
  --shadow-sheet: 0 16px 48px rgb(32 36 44 / 12%);
  --shadow-button: 0 8px 24px rgb(79 95 215 / 24%);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --sidebar-width: 240px;
  --content-max: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.sheet-open {
  overflow: hidden;
}

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

button,
select,
label,
input[type="checkbox"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:not(:disabled),
select:not(:disabled),
input[type="checkbox"]:not(:disabled) {
  cursor: pointer;
}

svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 14px 20px;
  border-right: 1px solid var(--border);
  background: rgb(255 255 255 / 72%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #6675e5, var(--primary));
  box-shadow: 0 6px 18px rgb(79 95 215 / 22%);
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.3;
}

.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 34px;
}

.nav-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
  text-align: left;
  transition: color 160ms ease, background-color 160ms ease, transform 120ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: #f4f1eb;
}

.nav-item:active {
  transform: scale(0.98);
}

.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
  font-weight: 650;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-count {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: rgb(255 255 255 / 72%);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.nav-item.active .nav-count {
  color: var(--primary);
  background: #fff;
}

.storage-note {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  margin-top: auto;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgb(255 255 255 / 62%);
}

.storage-note svg {
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.storage-note strong,
.storage-note span {
  display: block;
}

.storage-note strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.storage-note span {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.45;
}

.identity-action {
  min-height: 32px;
  margin-top: 9px;
  padding: 0;
  color: var(--primary);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.identity-action:hover {
  color: var(--primary-strong);
  text-decoration: underline;
}

.main-content {
  width: min(calc(100% - var(--sidebar-width)), var(--content-max));
  min-height: 100vh;
  min-height: 100dvh;
  margin-left: var(--sidebar-width);
  padding: 38px clamp(24px, 4vw, 52px) 52px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.today-label {
  min-height: 21px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-account-action {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: rgb(255 255 255 / 82%);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.mobile-account-action svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.floating-add,
.mobile-nav-item {
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-weight: 650;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}

.primary-button:active,
.secondary-button:active,
.text-button:active,
.icon-button:active,
.floating-add:active,
.mobile-nav-item:active {
  transform: scale(0.98);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 18px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 5px 16px rgb(79 95 215 / 18%);
}

.primary-button:hover {
  background: var(--primary-strong);
  box-shadow: 0 7px 20px rgb(79 95 215 / 24%);
}

.primary-button:disabled,
.floating-add:disabled {
  cursor: not-allowed;
  color: #fff;
  background: #a8adbf;
  box-shadow: none;
  opacity: 0.72;
}

.primary-button svg {
  width: 21px;
  height: 21px;
  stroke-width: 2;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 32px;
}

.stat-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 78%);
}

.stat-icon {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: 50%;
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-all .stat-icon {
  color: var(--primary);
  background: var(--primary-soft);
}

.stat-active .stat-icon {
  color: var(--warning);
  background: var(--warning-soft);
}

.stat-done .stat-icon {
  color: var(--success);
  background: var(--success-soft);
}

.stat-today .stat-icon {
  color: #767e8a;
  background: #eff0f2;
}

.stat-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stat-copy > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-copy strong {
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.task-section {
  margin-top: 34px;
}

.section-heading {
  display: flex;
  min-height: 44px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.stats {
  min-height: 19px;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.list-toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto;
  gap: 12px;
  margin-top: 16px;
}

.search-field,
.sort-field {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search-field:focus-within,
.sort-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(79 95 215 / 10%);
}

.search-field svg,
.sort-field svg {
  position: absolute;
  left: 14px;
  width: 20px;
  height: 20px;
  pointer-events: none;
}

.search-field input,
.sort-field select {
  width: 100%;
  min-height: 46px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.search-field input {
  padding: 0 14px 0 44px;
}

.search-field input::placeholder {
  color: #999ea6;
}

.sort-field {
  min-width: 172px;
}

.sort-field select {
  appearance: none;
  padding: 0 36px 0 44px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.list-area {
  display: grid;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.task-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background-color 150ms ease;
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row:hover {
  background: #fdfcf9;
}

.check-wrap {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
}

.task-toggle {
  position: absolute;
  width: 44px;
  height: 44px;
  margin: 0;
  opacity: 0;
}

.custom-check {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1.8px solid var(--border-strong);
  border-radius: 50%;
  color: transparent;
  background: #fff;
  pointer-events: none;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.custom-check svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.task-toggle:checked + .custom-check {
  color: #fff;
  border-color: var(--success);
  background: var(--success);
}

.task-toggle:focus-visible + .custom-check {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.task-toggle:active + .custom-check {
  transform: scale(0.9);
}

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

.task-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.task-title.done {
  color: var(--muted-light);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

.task-note {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-note.is-empty {
  display: none;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 7px 0 0;
  color: var(--muted-light);
  font-size: 12px;
}

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

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

.task-meta .tag.today,
.task-meta .tag.overdue {
  font-weight: 650;
}

.task-meta .tag.today {
  color: var(--warning);
}

.task-meta .tag.overdue {
  color: var(--danger);
}

.task-actions {
  display: flex;
  gap: 6px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--text);
  background: #f2efe9;
}

.delete-btn:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.task-row.empty {
  display: grid;
  width: 100%;
  min-height: 240px;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  border: 0;
  padding: 28px;
  text-align: center;
}

.empty-state {
  display: grid;
  width: min(100%, 360px);
  justify-items: center;
}

.empty-icon {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border-radius: 20px;
  color: var(--primary);
  background: var(--primary-soft);
}

.empty-icon svg {
  width: 28px;
  height: 28px;
}

.empty-state strong {
  margin-top: 16px;
  font-size: 17px;
}

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

.empty-state button {
  margin-top: 18px;
}

.message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.message.ok {
  color: var(--success);
}

.message.info {
  color: var(--primary);
}

.list-message:empty {
  display: none;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 30px;
  color: var(--muted-light);
  font-size: 12px;
}

.footer-link {
  min-height: 44px;
  padding: 0 4px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.footer-link:hover,
.footer-link:focus-visible {
  color: var(--primary);
  text-decoration-color: currentColor;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 15px;
  border: 1px solid var(--border);
  color: var(--text);
  background: rgb(255 255 255 / 68%);
}

.secondary-button:hover {
  border-color: var(--border-strong);
  background: #fff;
}

.secondary-button svg {
  width: 19px;
  height: 19px;
}

.floating-add {
  position: fixed;
  z-index: 20;
  right: 26px;
  bottom: 24px;
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 19px;
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow-button);
}

.floating-add:hover {
  background: var(--primary-strong);
}

.floating-add svg {
  width: 23px;
  height: 23px;
  stroke-width: 2;
}

.mobile-nav {
  display: none;
}

.editor-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  visibility: hidden;
  pointer-events: none;
}

.editor-layer.is-open {
  visibility: visible;
  pointer-events: auto;
}

.editor-backdrop {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgb(32 36 44 / 22%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 220ms ease;
}

.editor-layer.is-open .editor-backdrop {
  opacity: 1;
}

.editor-sheet {
  position: absolute;
  inset: 0 0 0 auto;
  display: grid;
  width: min(420px, 100%);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sheet);
  transform: translateX(18px);
  opacity: 0;
  transition: transform 220ms cubic-bezier(.2,.75,.25,1), opacity 180ms ease;
}

.editor-layer.is-open .editor-sheet {
  transform: translateX(0);
  opacity: 1;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 26px 26px 20px;
  border-bottom: 1px solid var(--border);
}

.editor-kicker {
  margin: 0 0 3px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.editor-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.task-form {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
}

.form-body {
  display: grid;
  align-content: start;
  gap: 24px;
  overflow-y: auto;
  padding: 26px;
  overscroll-behavior: contain;
}

.field-label {
  display: grid;
  gap: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.field-label > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-label em,
.field-label i {
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
}

.field-label em {
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--danger);
  background: var(--danger-soft);
}

.field-label i {
  color: var(--muted-light);
}

.field-label input,
.field-label textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: 0;
  color: var(--text);
  background: #fff;
  font-size: 16px;
  font-weight: 400;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field-label input {
  min-height: 50px;
  padding: 0 14px;
}

.field-label textarea {
  min-height: 150px;
  padding: 13px 14px;
  line-height: 1.55;
  resize: vertical;
}

.field-label input:focus,
.field-label textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(79 95 215 / 10%);
}

.field-label input::placeholder,
.field-label textarea::placeholder {
  color: #a0a4ac;
}

.field-label small {
  justify-self: end;
  margin-top: -4px;
  color: var(--muted-light);
  font-size: 11px;
  font-weight: 500;
}

.form-actions {
  display: grid;
  gap: 10px;
  padding: 18px 26px max(22px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: rgb(255 255 255 / 92%);
}

.form-submit,
.form-cancel {
  width: 100%;
  min-height: 52px;
}

.text-button {
  min-height: 40px;
  color: var(--muted);
  background: transparent;
}

.text-button:hover {
  color: var(--text);
  background: #f5f2ed;
}

.service-notice {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 44px;
  gap: 12px;
  align-items: start;
  margin-top: 24px;
  padding: 15px 14px 15px 16px;
  border: 1px solid #dddff7;
  border-radius: var(--radius-md);
  color: #414b72;
  background: #f4f4ff;
}

.service-notice.is-hidden {
  display: none;
}

.notice-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--primary);
}

.notice-icon svg {
  width: 21px;
  height: 21px;
}

.service-notice strong,
.service-notice p {
  display: block;
}

.service-notice strong {
  color: var(--text);
  font-size: 13px;
}

.service-notice p {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.notice-link {
  min-height: 32px;
  padding: 0;
  color: var(--primary);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.notice-link:hover {
  text-decoration: underline;
}

.notice-close {
  display: grid;
  width: 44px;
  height: 44px;
  margin: -8px -8px 0 0;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: transparent;
}

.notice-close:hover {
  color: var(--text);
  background: rgb(255 255 255 / 65%);
}

.notice-close svg {
  width: 18px;
  height: 18px;
}

.loading-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  background: var(--background);
  font-size: 14px;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.loading-layer.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #d9d7e5;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  visibility: hidden;
  place-items: center;
  padding: 20px;
  pointer-events: none;
}

.modal-layer.is-open {
  visibility: visible;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgb(32 36 44 / 32%);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 180ms ease;
}

.modal-layer.is-open .modal-backdrop {
  opacity: 1;
}

.info-modal {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(460px, 100%);
  max-height: min(760px, calc(100dvh - 40px));
  overflow-y: auto;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sheet);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 190ms cubic-bezier(.2,.75,.25,1), opacity 160ms ease;
}

.modal-layer.is-open .info-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.modal-symbol {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px;
  color: var(--primary);
  background: var(--primary-soft);
}

.modal-symbol svg {
  width: 25px;
  height: 25px;
}

.info-modal h2 {
  margin: 18px 52px 0 0;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.info-modal > p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.modal-warning {
  display: grid;
  gap: 4px;
  margin-top: 20px;
  padding: 14px;
  border: 1px solid #f1d7d3;
  border-radius: var(--radius-sm);
  color: #6d403c;
  background: var(--danger-soft);
}

.modal-warning strong {
  font-size: 13px;
}

.modal-warning span {
  font-size: 12px;
  line-height: 1.5;
}

.modal-primary,
.modal-secondary {
  width: 100%;
  margin-top: 20px;
  text-decoration: none;
}

.modal-secondary {
  margin-top: 10px;
}

.policy-modal h2 {
  margin-top: 0;
}

.policy-list {
  display: grid;
  gap: 14px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.policy-list li {
  display: grid;
  gap: 3px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.policy-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.policy-list strong {
  font-size: 13px;
}

.policy-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

@media (min-width: 1440px) {
  .main-content {
    margin-right: auto;
  }
}

@media (max-width: 1050px) {
  :root {
    --sidebar-width: 204px;
  }

  .sidebar {
    padding-inline: 10px;
  }

  .brand {
    padding-inline: 8px;
    font-size: 16px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .nav-item {
    padding-inline: 10px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .sidebar {
    display: none;
  }

  .main-content {
    width: 100%;
    margin-left: 0;
    padding: 28px 24px 130px;
  }

  .header-add {
    display: none;
  }

  .mobile-account-action {
    display: inline-flex;
  }

  .floating-add {
    display: flex;
    bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .mobile-nav {
    position: fixed;
    z-index: 18;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 7px max(16px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: rgb(255 255 255 / 92%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-nav-item {
    display: grid;
    min-height: 54px;
    place-items: center;
    align-content: center;
    gap: 2px;
    color: var(--muted);
    background: transparent;
    font-size: 10px;
    font-weight: 600;
  }

  .mobile-nav-item.active {
    color: var(--primary);
  }

  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 600px) {
  .service-notice {
    grid-template-columns: 34px minmax(0, 1fr) 40px;
    gap: 10px;
    padding: 14px 10px 14px 14px;
  }

  .modal-layer {
    align-items: flex-end;
    padding: 0;
  }

  .info-modal {
    width: 100%;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: 22px 22px 0 0;
    padding: 28px 18px max(20px, env(safe-area-inset-bottom));
  }

  .main-content {
    padding: 22px 16px 140px;
  }

  .topbar h1 {
    font-size: 29px;
  }

  .today-label {
    font-size: 13px;
  }

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

  .stat-card {
    min-height: 78px;
    gap: 10px;
    padding: 12px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .stat-icon svg {
    width: 19px;
    height: 19px;
  }

  .stat-copy strong {
    font-size: 20px;
  }

  .task-section {
    margin-top: 28px;
  }

  .section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .list-toolbar {
    grid-template-columns: minmax(0, 1fr) 52px;
    gap: 8px;
  }

  .sort-field {
    min-width: 52px;
    overflow: hidden;
  }

  .sort-field select {
    position: absolute;
    inset: 0;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    opacity: 0;
  }

  .sort-field svg {
    left: 15px;
  }

  .task-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 86px;
    padding: 13px 10px;
  }

  .check-wrap,
  .task-toggle {
    width: 40px;
    height: 44px;
  }

  .task-actions {
    gap: 0;
  }

  .icon-button {
    width: 44px;
  }

  .task-note {
    -webkit-line-clamp: 1;
  }

  .task-meta .updated-tag {
    display: none;
  }

  .bulk-actions {
    display: grid;
    grid-template-columns: 1fr;
    padding-right: 72px;
  }

  .secondary-button {
    min-width: 0;
    padding-inline: 10px;
    font-size: 13px;
  }

  .floating-add {
    right: 16px;
  }

  .editor-sheet {
    inset: auto 0 0;
    width: 100%;
    height: min(94dvh, 760px);
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 22px 22px 0 0;
    transform: translateY(18px);
  }

  .editor-layer.is-open .editor-sheet {
    transform: translateY(0);
  }

  .editor-header {
    padding: 20px 18px 16px;
  }

  .editor-header::before {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
    content: "";
    transform: translateX(-50%);
  }

  .editor-header h2 {
    font-size: 22px;
  }

  .form-body {
    gap: 20px;
    padding: 22px 18px;
  }

  .form-actions {
    padding: 14px 18px max(16px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .main-content {
    padding-inline: 12px;
  }

  .stat-card {
    gap: 8px;
    padding: 10px;
  }

  .stat-copy > span {
    font-size: 11px;
  }

  .task-row {
    padding-inline: 7px;
  }

  .task-title {
    font-size: 15px;
  }

  .floating-add span {
    display: none;
  }

  .floating-add {
    width: 54px;
    padding: 0;
    justify-content: center;
    border-radius: 18px;
  }
}

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