/* ==========================================================================
   XiaoNote 待辦 — Minimalist Monochrome Design System
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Core surfaces (Pure Black Default) */
  --bg: #000000;
  --side: #000000;
  --surface: #0d0d0d;
  --hover: #121212;
  --active: #1c1c1c;
  --popover: #0e0e0e;

  /* Hairline dividers & borders (strictly 1px) */
  --line: #1c1c1c;
  --line-strong: #2e2e2e;

  /* Text hierarchy */
  --fg: #f5f5f5;
  --fg-strong: #ffffff;
  --fg-secondary: #c4c4c4;
  --muted: #969696;
  --done: #6e6e6e;

  /* Monochrome CTA & focus */
  --primary-bg: #ffffff;
  --primary-fg: #000000;
  --primary-hover: #e5e5e5;
  --focus-ring: #ffffff;

  /* Minimal semantic tones */
  --danger: #ef4444;
  --danger-text: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.32);

  /* Overlays & compatibility tokens (for access-pages.js) */
  --backdrop: rgba(0, 0, 0, 0.78);
  --shadow: 0 24px 72px rgba(0, 0, 0, 0.85);
  --card: #0e0e0e;
  --ink: #f5f5f5;
  --strong: #ffffff;
  --on: #000000;
  --accent: #ffffff;
  --accent-soft: #1c1c1c;

  --side-w: 244px;

  font-family: "Inter", "SF Pro Text", "PingFang TC", "Microsoft JhengHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px;
}

:root[data-tone="light"] {
  color-scheme: light;

  --bg: #ffffff;
  --side: #fafafa;
  --surface: #f4f4f5;
  --hover: #f3f3f3;
  --active: #ebebeb;
  --popover: #ffffff;

  --line: #ededed;
  --line-strong: #dedede;

  --fg: #111111;
  --fg-strong: #111111;
  --fg-secondary: #666666;
  --muted: #999999;
  --done: #b5b5b5;

  --primary-bg: #111111;
  --primary-fg: #ffffff;
  --primary-hover: #2b2b2b;
  --focus-ring: #111111;

  --danger: #dc2626;
  --danger-text: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --danger-border: rgba(220, 38, 38, 0.28);

  --backdrop: rgba(0, 0, 0, 0.35);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.14);
  --card: #ffffff;
  --ink: #111111;
  --strong: #111111;
  --on: #ffffff;
  --accent: #111111;
  --accent-soft: #ececec;
}

/* ==========================================================================
   Reset & Base Primitives
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  border-radius: 7px;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  touch-action: manipulation;
}

button:disabled {
  cursor: wait;
  opacity: 0.45;
}

select {
  cursor: pointer;
}

option,
optgroup {
  background-color: var(--popover);
  color: var(--fg);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 1.5px solid var(--focus-ring);
  outline-offset: 2px;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

a {
  color: inherit;
}

.skip {
  position: fixed;
  inset-inline-start: 12px;
  top: -100px;
  z-index: 20;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  background: var(--popover);
  color: var(--fg-strong);
  font-size: 0.875rem;
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7rem;
  color: var(--muted);
}

.muted,
.hint {
  color: var(--fg-secondary);
  line-height: 1.6;
}

.muted {
  margin: 0;
  font-size: 0.875rem;
}

.hint {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.load-status {
  padding: 40px 8px;
  text-align: center;
  color: var(--muted);
}

.error {
  margin: 6px 0 12px;
  padding: 9px 12px;
  border: 1px solid var(--danger-border);
  border-inline-start: 2px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Shared Buttons & Indicators */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 14px;
  border-radius: 7px;
  background: var(--primary-bg);
  color: var(--primary-fg);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.14s ease;
}

.primary.danger-confirm {
  background: var(--danger);
  color: #ffffff;
}

.quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 13px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.quiet.danger-btn {
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.icon-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 7px;
  display: inline-grid;
  place-items: center;
  color: var(--fg-secondary);
  font-size: 1.2rem;
  line-height: 1;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.color-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--muted);
}

.portrait {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background: var(--av-bg, var(--active));
  border: 1px solid var(--av-ring, var(--line-strong));
  color: var(--av-fg, var(--fg));
  line-height: 0;
}

.portrait[data-color="silver"],
.avatar-color-dot[data-color="silver"] {
  --av-fg: #f0f0f0;
  --av-bg: #1c1c1c;
  --av-ring: #333333;
  --av-dot: #e5e5e5;
}

.portrait[data-color="sky"],
.avatar-color-dot[data-color="sky"] {
  --av-fg: #60a5fa;
  --av-bg: rgba(59, 130, 246, 0.14);
  --av-ring: rgba(96, 165, 250, 0.35);
  --av-dot: #3b82f6;
}

.portrait[data-color="emerald"],
.avatar-color-dot[data-color="emerald"] {
  --av-fg: #34d399;
  --av-bg: rgba(16, 185, 129, 0.14);
  --av-ring: rgba(52, 211, 153, 0.35);
  --av-dot: #10b981;
}

.portrait[data-color="amber"],
.avatar-color-dot[data-color="amber"] {
  --av-fg: #fbbf24;
  --av-bg: rgba(245, 158, 11, 0.14);
  --av-ring: rgba(251, 191, 36, 0.35);
  --av-dot: #f59e0b;
}

.portrait[data-color="coral"],
.avatar-color-dot[data-color="coral"] {
  --av-fg: #f87171;
  --av-bg: rgba(239, 68, 68, 0.14);
  --av-ring: rgba(248, 113, 113, 0.35);
  --av-dot: #ef4444;
}

.portrait[data-color="violet"],
.avatar-color-dot[data-color="violet"] {
  --av-fg: #c084fc;
  --av-bg: rgba(168, 85, 247, 0.14);
  --av-ring: rgba(192, 132, 252, 0.35);
  --av-dot: #a855f7;
}

.portrait[data-color="rose"],
.avatar-color-dot[data-color="rose"] {
  --av-fg: #f472b6;
  --av-bg: rgba(236, 72, 153, 0.14);
  --av-ring: rgba(244, 114, 182, 0.35);
  --av-dot: #ec4899;
}

.portrait[data-color="cyan"],
.avatar-color-dot[data-color="cyan"] {
  --av-fg: #22d3ee;
  --av-bg: rgba(6, 182, 212, 0.14);
  --av-ring: rgba(34, 211, 238, 0.35);
  --av-dot: #06b6d4;
}

:root[data-tone="light"] .portrait[data-color="silver"],
:root[data-tone="light"] .avatar-color-dot[data-color="silver"] {
  --av-fg: #222222;
  --av-bg: #efefef;
  --av-ring: #d4d4d4;
  --av-dot: #525252;
}

:root[data-tone="light"] .portrait[data-color="sky"],
:root[data-tone="light"] .avatar-color-dot[data-color="sky"] {
  --av-fg: #2563eb;
  --av-bg: rgba(59, 130, 246, 0.1);
  --av-ring: rgba(37, 99, 235, 0.28);
  --av-dot: #3b82f6;
}

:root[data-tone="light"] .portrait[data-color="emerald"],
:root[data-tone="light"] .avatar-color-dot[data-color="emerald"] {
  --av-fg: #059669;
  --av-bg: rgba(16, 185, 129, 0.1);
  --av-ring: rgba(5, 150, 105, 0.28);
  --av-dot: #10b981;
}

:root[data-tone="light"] .portrait[data-color="amber"],
:root[data-tone="light"] .avatar-color-dot[data-color="amber"] {
  --av-fg: #d97706;
  --av-bg: rgba(245, 158, 11, 0.1);
  --av-ring: rgba(217, 119, 6, 0.28);
  --av-dot: #f59e0b;
}

:root[data-tone="light"] .portrait[data-color="coral"],
:root[data-tone="light"] .avatar-color-dot[data-color="coral"] {
  --av-fg: #dc2626;
  --av-bg: rgba(239, 68, 68, 0.1);
  --av-ring: rgba(220, 38, 38, 0.28);
  --av-dot: #ef4444;
}

:root[data-tone="light"] .portrait[data-color="violet"],
:root[data-tone="light"] .avatar-color-dot[data-color="violet"] {
  --av-fg: #7c3aed;
  --av-bg: rgba(168, 85, 247, 0.1);
  --av-ring: rgba(124, 58, 237, 0.28);
  --av-dot: #a855f7;
}

:root[data-tone="light"] .portrait[data-color="rose"],
:root[data-tone="light"] .avatar-color-dot[data-color="rose"] {
  --av-fg: #db2777;
  --av-bg: rgba(236, 72, 153, 0.1);
  --av-ring: rgba(219, 39, 119, 0.28);
  --av-dot: #ec4899;
}

:root[data-tone="light"] .portrait[data-color="cyan"],
:root[data-tone="light"] .avatar-color-dot[data-color="cyan"] {
  --av-fg: #0891b2;
  --av-bg: rgba(6, 182, 212, 0.1);
  --av-ring: rgba(8, 145, 178, 0.28);
  --av-dot: #06b6d4;
}

.portrait svg {
  width: 17px;
  height: 17px;
  display: block;
}

.person-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: start;
  overflow-wrap: anywhere;
}

.person-meta {
  min-width: 0;
}

.person-card strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
}

.person-card small {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ==========================================================================
   Sidebar (#side) — Equal Width & Vertical Right-Axis Count Alignment
   ========================================================================== */

#shade {
  position: fixed;
  inset: 0;
  z-index: 3;
  border-radius: 0;
  background: var(--backdrop);
}

#side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 4;
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  background: var(--side);
  border-inline-end: 1px solid var(--line);
  padding: 20px 10px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 12px 22px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
}

.brand small {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}

.mark {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--primary-bg);
  color: var(--primary-fg);
  font-size: 0.82rem;
  font-weight: 800;
}

#side nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

#side nav h2,
.lists-label {
  margin: 0 12px 6px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.lists-label {
  margin-top: 22px;
}

#views,
#lists,
.group-tables {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
}

.group-block {
  min-width: 0;
  margin-top: 2px;
}

/* Shared 100%-width row geometry so .nav-count aligns on one vertical axis */
.nav-item,
.group-heading {
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-inline-start: 12px;
  padding-inline-end: 12px;
  border-radius: 7px;
  font-size: 0.875rem;
  color: var(--fg-secondary);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.nav-item {
  text-align: start;
}

.group-tables .nav-item.list-item {
  width: 100%;
  padding-inline-start: 28px;
  padding-inline-end: 12px;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
}

.nav-icon svg {
  width: 15px;
  height: 15px;
}

.nav-item.list-item .color-dot {
  margin-inline: 5px;
}

.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-indicator {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--muted);
}

.shared-indicator svg {
  width: 13px;
  height: 13px;
}

.nav-item[aria-current="page"] {
  background: var(--active);
  color: var(--fg-strong);
  font-weight: 500;
}

.nav-item[aria-current="page"] .nav-icon {
  color: var(--fg-strong);
}

.group-toggle {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: start;
  color: inherit;
}

.group-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
}

.group-chevron svg {
  width: 13px;
  height: 13px;
}

.group-more {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.group-heading:hover .group-more,
.group-heading:focus-within .group-more {
  opacity: 1;
  pointer-events: auto;
}

/* Right-aligned tabular count text (no pill box) */
.nav-count {
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--muted);
  flex-shrink: 0;
  margin-inline-start: auto;
}

.nav-item[aria-current="page"] .nav-count:not(.is-overdue) {
  color: var(--fg);
}

.nav-count.is-overdue {
  color: var(--danger-text);
}

/* Sidebar footer */
.side-foot {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.creation-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 8px;
}

.side-create-btn {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 0.8125rem;
  color: var(--fg-secondary);
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.side-create-btn svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.account-tools {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

#preferences.account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  height: 42px;
  padding: 0 10px;
  border-radius: 8px;
  text-align: start;
  transition: background-color 0.12s ease;
}

#self-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  font-size: 0.875rem;
  color: var(--fg);
}

.self-name {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-action {
  font-size: 0.8125rem;
  line-height: 1.2;
  color: var(--fg-secondary);
  flex-shrink: 0;
}

.account-sub-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 10px 0;
}

#admin-link,
#logout-link {
  padding: 4px 0;
  font-size: 0.8125rem;
  line-height: 1.2;
  color: var(--muted);
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.12s ease;
}

#logout-link {
  margin-inline-start: auto;
}

/* ==========================================================================
   Main Workspace, Header & Filters
   ========================================================================== */

main#main {
  margin-inline-start: var(--side-w);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main#main:focus {
  outline: none;
}

header.top,
section.desk {
  width: 100%;
  max-width: 780px;
  margin-inline: auto;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 24px 16px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

h1#heading {
  margin: 0;
  min-width: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heading-dot {
  width: 8px;
  height: 8px;
  vertical-align: 0.12em;
  margin-inline-end: 10px;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.text-action {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.search-box {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: 196px;
  height: 32px;
  padding: 0 9px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid transparent;
  color: var(--muted);
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.search-box svg {
  width: 14px;
  height: 14px;
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 0.8125rem;
  padding: 4px 0;
  outline: none;
}

.search-box input:focus-visible {
  outline: 0;
}

.search-box:focus-within {
  border-color: var(--line-strong);
  background: var(--popover);
}

#new-task-btn.primary {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.8125rem;
}

section.desk {
  padding: 0 24px 56px;
}

/* Filters: plain text tabs + borderless sort */
.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

#tabs {
  display: flex;
  align-items: center;
  gap: 18px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: 4px;
  transition: color 0.12s ease;
}

.tab[aria-pressed="true"] {
  color: var(--fg-strong);
  font-weight: 600;
}

.tab-count {
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--muted);
}

.tab[aria-pressed="true"] .tab-count {
  color: var(--fg-secondary);
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.sort-control select {
  border: 0;
  background-color: transparent;
  color: var(--fg-secondary);
  font-size: 0.8125rem;
  padding: 4px 2px 4px 4px;
  cursor: pointer;
}

#results-info {
  padding: 10px 10px 4px;
  font-size: 0.8125rem;
  color: var(--fg-secondary);
  overflow-wrap: anywhere;
}

/* ==========================================================================
   Task List (#tasks & article.task) — Equal Width, Strict Single-Line
   ========================================================================== */

#tasks {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

article.task {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: 0;
  scroll-margin-top: 24px;
  transition: background-color 0.12s ease;
}

article.task:focus-visible {
  outline: 1.5px solid var(--focus-ring);
  outline-offset: -1px;
  background: var(--hover);
}

.check {
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.25px solid #7a7a7a;
  background: transparent;
  display: inline-grid;
  place-items: center;
  color: var(--bg);
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

:root[data-tone="light"] .check {
  border-color: #c2c2c2;
}

.check::before {
  content: "";
  position: absolute;
  inset: -10px;
}

.check svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.3;
}

article.task.done .check {
  background: var(--done);
  border-color: var(--done);
  color: var(--bg);
}

.task-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--fg);
}

article.task.done .task-title {
  color: var(--done);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.task-side {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--muted);
}

.task-indicator {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.task-indicator svg {
  width: 13px;
  height: 13px;
}

.task-indicator.is-today-mark {
  color: var(--fg-secondary);
}

.task-due.status-overdue {
  color: var(--danger-text);
}

.task-due.status-today {
  color: #e0e0e0;
}

:root[data-tone="light"] .task-due.status-today {
  color: #111111;
  font-weight: 500;
}

.task-list {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.task-list-name {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}



article.task.done .task-indicator,
article.task.done .task-due,
article.task.done .task-list {
  color: var(--done);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 72px 16px;
  text-align: center;
}

.empty-title {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ==========================================================================
   Centered Minimalist Modal (dialog#dialog)
   ========================================================================== */

dialog#dialog {
  margin: auto;
  width: min(460px, calc(100vw - 32px));
  max-height: 88dvh;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--popover);
  color: var(--fg);
  box-shadow: var(--shadow);
}

dialog#dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

dialog#dialog::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(4px);
}

.dialog-top {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-top h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg-secondary);
}

.dialog-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 20px;
  scrollbar-width: thin;
}

/* Form stack inside modal */
.stack {
  display: grid;
  gap: 14px;
}

.stack label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-secondary);
}

.stack input,
.stack select,
.stack textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background-color: var(--surface);
  color: var(--fg);
  font-size: 0.9375rem;
  transition: border-color 0.14s ease;
}

.stack select {
  padding-inline-end: 10px;
  cursor: pointer;
}

.stack textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
}

.stack input:focus,
.stack select:focus,
.stack textarea:focus {
  border-color: var(--fg-secondary);
  outline: none;
}

.stack input:is([type="date"], [type="datetime-local"]):not(:disabled):not([readonly]) {
  cursor: pointer;
}

.stack input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stack input.modal-title-input {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.45;
  min-height: 44px;
  padding: 4px 0 10px;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--fg-strong);
}

.stack input.modal-title-input:focus {
  border-bottom-color: var(--fg-strong);
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.stack select.quick-select {
  width: auto;
  min-width: 112px;
  max-width: 190px;
  min-height: 30px;
  padding: 4px 10px;
  font-size: 0.8125rem;
  border-radius: 7px;
}

.task-creator-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.task-creator-bar .portrait {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.task-creator-bar .portrait svg {
  width: 13px;
  height: 13px;
}

.task-creator-bar strong {
  color: var(--fg-secondary);
  font-weight: 500;
}

.quick-toggles,
.modal-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.toggle-chip svg {
  width: 13px;
  height: 13px;
}

.toggle-chip.is-active {
  background: #1f1f1f;
  border-color: #363636;
  color: var(--fg-strong);
}

:root[data-tone="light"] .toggle-chip.is-active {
  background: #ececec;
  border-color: #d4d4d4;
  color: #111111;
}

.more-fields summary {
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
  font-size: 0.8125rem;
  color: var(--muted);
  user-select: none;
}

.more-fields summary::-webkit-details-marker {
  display: none;
}

.more-fields summary::before {
  content: "▸ ";
}

.more-fields[open] summary::before {
  content: "▾ ";
}

.more-fields-body {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detected-links {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.detected-links-label {
  font-size: 0.75rem;
  color: var(--muted);
}

.detected-links-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detected-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--popover);
  color: var(--fg-secondary);
  font-size: 0.78rem;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.detected-link-btn svg {
  width: 12px;
  height: 12px;
}

.detected-link-btn span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reminder-device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.8125rem;
  color: var(--fg-secondary);
}

.reminder-device > span {
  flex: 1 1 200px;
}

.reminder-device .quiet {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 0.8125rem;
}

.reminder-device small {
  flex: 1 0 100%;
  color: var(--danger-text);
  font-size: 0.75rem;
}

.stack fieldset {
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  max-height: 13rem;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.stack fieldset legend {
  padding: 0 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.stack label.person-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 4px;
  cursor: pointer;
}

.stack .person-choice input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: var(--fg-strong);
}

.share-details summary {
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--fg-secondary);
  padding: 4px 0;
}

.share-details fieldset {
  margin-top: 8px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.actions .left {
  margin-inline-end: auto;
}

.confirm-text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--fg-secondary);
}

/* Color Swatch Picker */
.color-field {
  display: grid;
  gap: 8px;
}

.field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-secondary);
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.swatch-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--swatch-color);
  display: inline-grid;
  place-items: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.swatch-check {
  display: grid;
  place-items: center;
  color: #ffffff;
  opacity: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.swatch-check svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.5;
}

.swatch-btn.is-selected {
  box-shadow: 0 0 0 2px var(--popover), 0 0 0 3.5px var(--swatch-color);
}

.swatch-btn.is-selected .swatch-check {
  opacity: 1;
}

.custom-color-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px 0 6px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--fg-secondary);
  font-size: 0.78rem;
  cursor: pointer;
}

.stack label.custom-color-btn {
  display: inline-flex;
  gap: 6px;
  font-size: 0.78rem;
}

.custom-color-btn input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.custom-color-preview {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--swatch-color);
}

.custom-color-btn.is-selected {
  border-color: var(--fg-secondary);
  color: var(--fg-strong);
}

.custom-color-btn:focus-within {
  outline: 1.5px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Sharing Dialog */
.share-dialog {
  gap: 18px;
}

.share-section {
  display: grid;
  gap: 8px;
}

.share-heading {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.share-list {
  display: grid;
  gap: 6px;
}

.share-row {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.role-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.role-badge.is-owner {
  color: var(--fg-secondary);
}

.invite-btn {
  min-height: 30px;
  padding: 4px 11px;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

/* Settings & Profile Avatar Picker */
.settings-panel > button.quiet,
.settings-panel > a.quiet {
  width: 100%;
  justify-content: flex-start;
  min-height: 42px;
  padding: 8px 14px;
  text-decoration: none;
}

.settings-panel > a.logout-btn {
  justify-content: center;
}

.settings-panel > button.profile-link {
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
}

.settings-panel .profile-link > span:last-child {
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.profile-avatar-suite {
  display: grid;
  gap: 14px;
}

.stack .avatar-color-picker,
.stack .avatar-picker {
  max-height: none;
  overflow: visible;
  padding: 12px;
}

.avatar-color-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.stack .avatar-color-choice {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  gap: 0;
  cursor: pointer;
}

.stack .avatar-color-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: 0;
  pointer-events: none;
}

.avatar-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--av-dot);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.avatar-color-choice:has(:checked) .avatar-color-dot {
  box-shadow: 0 0 0 2px var(--popover), 0 0 0 4px var(--fg-strong);
  transform: scale(1.06);
}

.avatar-color-choice:focus-within {
  outline: 1.5px solid var(--focus-ring);
  outline-offset: 2px;
}

.avatar-picker > div {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.stack .avatar-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.stack .avatar-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: 0;
  pointer-events: none;
}

.avatar-choice .portrait {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  background: transparent;
  border-color: transparent;
  color: var(--av-fg, var(--fg-secondary));
  transition: color 0.14s ease;
}

.avatar-choice .portrait svg {
  width: 24px;
  height: 24px;
}

.avatar-choice .avatar-label {
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--muted);
}

.stack .avatar-choice:has(:checked) {
  border-color: var(--fg-strong);
  background: var(--active);
}

.stack .avatar-choice:has(:checked) .portrait,
.stack .avatar-choice:has(:checked) .avatar-label {
  color: var(--fg-strong);
}

.stack .avatar-choice:has(:checked) .avatar-label {
  font-weight: 500;
}

.avatar-choice:focus-within {
  outline: 1.5px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Live color preview across all 12 avatar portraits via :has() */
.profile-avatar-suite:has(input[name="avatar_color"][value="silver"]:checked) {
  --av-preview-fg: #f0f0f0;
  --av-preview-bg: #1c1c1c;
  --av-preview-ring: #f0f0f0;
}

.profile-avatar-suite:has(input[name="avatar_color"][value="sky"]:checked) {
  --av-preview-fg: #60a5fa;
  --av-preview-bg: rgba(59, 130, 246, 0.14);
  --av-preview-ring: #60a5fa;
}

.profile-avatar-suite:has(input[name="avatar_color"][value="emerald"]:checked) {
  --av-preview-fg: #34d399;
  --av-preview-bg: rgba(16, 185, 129, 0.14);
  --av-preview-ring: #34d399;
}

.profile-avatar-suite:has(input[name="avatar_color"][value="amber"]:checked) {
  --av-preview-fg: #fbbf24;
  --av-preview-bg: rgba(245, 158, 11, 0.14);
  --av-preview-ring: #fbbf24;
}

.profile-avatar-suite:has(input[name="avatar_color"][value="coral"]:checked) {
  --av-preview-fg: #f87171;
  --av-preview-bg: rgba(239, 68, 68, 0.14);
  --av-preview-ring: #f87171;
}

.profile-avatar-suite:has(input[name="avatar_color"][value="violet"]:checked) {
  --av-preview-fg: #c084fc;
  --av-preview-bg: rgba(168, 85, 247, 0.14);
  --av-preview-ring: #c084fc;
}

.profile-avatar-suite:has(input[name="avatar_color"][value="rose"]:checked) {
  --av-preview-fg: #f472b6;
  --av-preview-bg: rgba(236, 72, 153, 0.14);
  --av-preview-ring: #f472b6;
}

.profile-avatar-suite:has(input[name="avatar_color"][value="cyan"]:checked) {
  --av-preview-fg: #22d3ee;
  --av-preview-bg: rgba(6, 182, 212, 0.14);
  --av-preview-ring: #22d3ee;
}

:root[data-tone="light"] .profile-avatar-suite:has(input[name="avatar_color"][value="silver"]:checked) {
  --av-preview-fg: #222222;
  --av-preview-bg: #efefef;
  --av-preview-ring: #222222;
}

:root[data-tone="light"] .profile-avatar-suite:has(input[name="avatar_color"][value="sky"]:checked) {
  --av-preview-fg: #2563eb;
  --av-preview-bg: rgba(59, 130, 246, 0.1);
  --av-preview-ring: #2563eb;
}

:root[data-tone="light"] .profile-avatar-suite:has(input[name="avatar_color"][value="emerald"]:checked) {
  --av-preview-fg: #059669;
  --av-preview-bg: rgba(16, 185, 129, 0.1);
  --av-preview-ring: #059669;
}

:root[data-tone="light"] .profile-avatar-suite:has(input[name="avatar_color"][value="amber"]:checked) {
  --av-preview-fg: #d97706;
  --av-preview-bg: rgba(245, 158, 11, 0.1);
  --av-preview-ring: #d97706;
}

:root[data-tone="light"] .profile-avatar-suite:has(input[name="avatar_color"][value="coral"]:checked) {
  --av-preview-fg: #dc2626;
  --av-preview-bg: rgba(239, 68, 68, 0.1);
  --av-preview-ring: #dc2626;
}

:root[data-tone="light"] .profile-avatar-suite:has(input[name="avatar_color"][value="violet"]:checked) {
  --av-preview-fg: #7c3aed;
  --av-preview-bg: rgba(168, 85, 247, 0.1);
  --av-preview-ring: #7c3aed;
}

:root[data-tone="light"] .profile-avatar-suite:has(input[name="avatar_color"][value="rose"]:checked) {
  --av-preview-fg: #db2777;
  --av-preview-bg: rgba(236, 72, 153, 0.1);
  --av-preview-ring: #db2777;
}

:root[data-tone="light"] .profile-avatar-suite:has(input[name="avatar_color"][value="cyan"]:checked) {
  --av-preview-fg: #0891b2;
  --av-preview-bg: rgba(6, 182, 212, 0.1);
  --av-preview-ring: #0891b2;
}

.profile-avatar-suite .avatar-choice .portrait,
.stack .profile-avatar-suite .avatar-choice:has(:checked) .portrait {
  color: var(--av-preview-fg, var(--av-fg, var(--fg-secondary)));
}

.stack .profile-avatar-suite .avatar-choice:has(:checked) {
  border-color: var(--av-preview-ring, var(--fg-strong));
  background: var(--av-preview-bg, var(--active));
}

/* ==========================================================================
   Toast Notification (#toast)
   ========================================================================== */

#toast {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: calc(50% + var(--side-w) / 2);
  transform: translateX(-50%);
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: min(92vw, 440px);
  padding: 9px 14px 9px 16px;
  border-radius: 999px;
  background: var(--primary-bg);
  color: var(--primary-fg);
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--shadow);
}

.toast-message {
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-action {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-fg);
  color: var(--primary-bg);
  font-size: 0.78rem;
  font-weight: 600;
}

/* ==========================================================================
   Access & Admin Pages Compatibility (src/access-pages.js)
   ========================================================================== */

.access-page {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.access-panel {
  width: min(100%, 30rem);
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--side);
  overflow-wrap: anywhere;
  box-shadow: var(--shadow);
}

/* ==========================================================================
   Hover, Motion & Responsive Breakpoints
   ========================================================================== */

@media (min-width: 781px) {
  .mobile,
  .icon-btn.mobile,
  #menu {
    display: none !important;
  }
}

@media (hover: hover) {
  .primary:where(:not(:disabled)):hover {
    background: var(--primary-hover);
  }

  .primary.danger-confirm:where(:not(:disabled)):hover {
    background: var(--danger);
    filter: brightness(1.08);
  }

  .quiet:where(:not(:disabled)):hover {
    background: var(--hover);
    border-color: var(--fg-secondary);
    color: var(--fg);
  }

  .quiet.danger-btn:where(:not(:disabled)):hover {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: var(--danger-text);
  }

  .icon-btn:where(:not(:disabled)):hover,
  .text-action:where(:not(:disabled)):hover,
  .side-create-btn:where(:not(:disabled)):hover,
  .account:where(:not(:disabled)):hover,
  .group-heading:hover,
  .nav-item:where(:not([aria-current="page"])):hover,
  article.task:hover {
    background: var(--hover);
  }

  .text-action:where(:not(:disabled)):hover,
  .side-create-btn:where(:not(:disabled)):hover,
  .group-heading:hover,
  .nav-item:where(:not([aria-current="page"])):hover,
  #admin-link:hover,
  #logout-link:hover {
    color: var(--fg);
  }

  .group-more:where(:not(:disabled)):hover {
    background: var(--active);
    color: var(--fg-strong);
  }

  .tab:not([aria-pressed="true"]):hover {
    color: var(--fg-secondary);
  }

  .check:hover {
    border-color: #b8b8b8;
  }

  :root[data-tone="light"] .check:hover {
    border-color: #777777;
  }

  .toggle-chip:where(:not(:disabled)):hover,
  .detected-link-btn:hover {
    border-color: var(--fg-secondary);
    color: var(--fg);
  }

  .swatch-btn:hover,
  .avatar-color-choice:not(:has(:checked)):hover .avatar-color-dot {
    transform: scale(1.08);
  }

  .stack .avatar-choice:not(:has(:checked)):hover {
    background: var(--hover);
    border-color: var(--fg-secondary);
  }
}

@media (hover: none) {
  .group-more {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  #side {
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  }

  dialog#dialog[open] {
    animation: modalAppear 0.16s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes modalAppear {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

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

@media (max-width: 780px) {
  #side {
    width: min(280px, 84vw);
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    transform: translateX(-105%);
    box-shadow: var(--shadow);
  }

  body.menu #side {
    transform: translateX(0);
  }

  body.menu {
    overflow: hidden;
  }

  main#main {
    margin-inline-start: 0;
  }

  header.top {
    flex-wrap: wrap;
    padding: max(14px, env(safe-area-inset-top)) 16px 12px;
    gap: 10px 12px;
  }

  .header-title {
    flex: 1 1 100%;
    gap: 8px;
  }

  .header-controls {
    flex: 1 1 100%;
  }

  .search-box {
    flex: 1;
    width: auto;
    height: 36px;
  }

  .search-box kbd {
    display: none;
  }

  #new-task-btn.primary {
    height: 36px;
  }

  section.desk {
    padding: 0 16px max(40px, env(safe-area-inset-bottom));
  }

  .nav-item,
  .group-heading {
    height: 42px;
  }

  .group-more {
    width: 32px;
    height: 32px;
    opacity: 1;
    pointer-events: auto;
  }

  .side-create-btn,
  .account {
    min-height: 40px;
  }

  article.task {
    height: 48px;
    padding: 0 6px;
  }

  .sort-control > span {
    display: none;
  }

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

  .stack input,
  .stack select,
  .stack textarea {
    font-size: 1rem;
    min-height: 42px;
  }

  .stack .person-choice input {
    min-height: 16px;
  }

  .stack .avatar-color-choice input,
  .stack .avatar-choice input,
  .custom-color-btn input[type="color"] {
    min-height: 0;
  }

  dialog#dialog {
    inset: auto 0 0 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    max-height: 90dvh;
    border-radius: 16px 16px 0 0;
    border-width: 1px 0 0;
  }

  dialog#dialog #dialog-body {
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }

  #toast {
    left: 50%;
    bottom: max(18px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 480px) {
  .task-side {
    gap: 7px;
    font-size: 0.75rem;
  }

  .task-list-name {
    max-width: 72px;
  }


}

@media (max-width: 780px) and (prefers-reduced-motion: no-preference) {
  dialog#dialog[open] {
    animation: sheetSlideUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes sheetSlideUp {
    from {
      opacity: 0;
      transform: translateY(24px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
