:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --line: rgba(30, 41, 59, 0.1);
  --text: #111827;
  --muted: #667085;
  --muted-strong: #475467;
  --blue: #007aff;
  --blue-2: #5ac8fa;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #af52de;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  --shadow-soft: 0 12px 34px rgba(15, 23, 42, 0.08);
  --radius-lg: 34px;
  --radius-md: 24px;
  --radius-sm: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(90, 200, 250, 0.26), transparent 36rem),
    radial-gradient(circle at right 10%, rgba(175, 82, 222, 0.18), transparent 34rem),
    linear-gradient(135deg, #fbfcff 0%, #eef3fb 100%);
  overflow-x: hidden;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.app {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0 56px;
  position: relative;
  z-index: 1;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 420px;
  height: 420px;
  border-radius: 999px;
  filter: blur(18px);
  opacity: 0.36;
  pointer-events: none;
}

.ambient-one {
  top: -180px;
  right: -80px;
  background: radial-gradient(circle, rgba(0, 122, 255, 0.32), transparent 68%);
}

.ambient-two {
  bottom: -220px;
  left: -90px;
  background: radial-gradient(circle, rgba(52, 199, 89, 0.26), transparent 68%);
}

.glass-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(28px) saturate(1.22);
  -webkit-backdrop-filter: blur(28px) saturate(1.22);
}

.auth-page {
  min-height: calc(100vh - 88px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.78fr);
  gap: 28px;
  align-items: center;
}

.brand-card,
.auth-card,
.loading {
  border-radius: var(--radius-lg);
}

.brand-card {
  min-height: 560px;
  padding: clamp(34px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.brand-card::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -90px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.24), rgba(175, 82, 222, 0.24));
}

.brand-mark {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  margin-bottom: 34px;
  background: linear-gradient(145deg, #1f2937, #020617);
  box-shadow: 0 18px 48px rgba(2, 6, 23, 0.22);
}

.brand-mark span {
  width: 34px;
  height: 42px;
  display: block;
  background: linear-gradient(180deg, #fff, #dbeafe);
  border-radius: 18px 18px 14px 14px;
  transform: rotate(-18deg);
  position: relative;
}

.brand-mark span::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 18px 0 18px 0;
  background: #fff;
  right: -4px;
  top: -12px;
  transform: rotate(36deg);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
  font-weight: 760;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.8rem, 7vw, 5.7rem);
  line-height: 0.95;
  letter-spacing: -0.075em;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  letter-spacing: -0.045em;
}

h3 {
  margin-bottom: 0;
  letter-spacing: -0.025em;
}

.lead {
  max-width: 650px;
  margin-bottom: 34px;
  color: var(--muted-strong);
  font-size: clamp(1rem, 1.8vw, 1.28rem);
  line-height: 1.72;
}

.muted {
  color: var(--muted);
  line-height: 1.65;
}

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

.feature-row span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.72);
  color: var(--muted-strong);
  font-weight: 650;
}

.auth-card {
  padding: 28px;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 5px;
  margin-bottom: 28px;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.12);
}

.segment {
  border: 0;
  min-width: 94px;
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--muted-strong);
  background: transparent;
  font-weight: 700;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.segment:hover {
  transform: translateY(-1px);
}

.segment.active {
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

.segmented.small {
  margin: 0;
}

.segmented.small .segment {
  min-width: auto;
  padding: 8px 13px;
  font-size: 0.92rem;
}

.stack-form,
.todo-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(30, 41, 59, 0.09);
  outline: none;
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  padding: 14px 15px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 122, 255, 0.42);
  box-shadow: 0 0 0 5px rgba(0, 122, 255, 0.12);
  background: rgba(255, 255, 255, 0.96);
}

.primary-btn,
.ghost-btn,
.icon-btn,
.check {
  border: 0;
}

.primary-btn {
  width: 100%;
  padding: 15px 22px;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 34px rgba(0, 122, 255, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-btn,
.ghost-btn {
  text-decoration: none;
}

a.primary-btn,
a.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(0, 122, 255, 0.34);
}

.ghost-btn {
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.62);
  font-weight: 760;
  transition: transform 0.18s ease, background 0.18s ease;
}

.ghost-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.92);
}

.workspace {
  display: grid;
  gap: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: clamp(24px, 4vw, 38px);
  border-radius: var(--radius-lg);
}

.topbar h1 {
  font-size: clamp(2.4rem, 5vw, 4.7rem);
  margin-bottom: 8px;
}

.topbar .muted {
  margin-bottom: 0;
}

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

.stat-card {
  padding: 22px;
  border-radius: var(--radius-md);
}

.stat-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 2.35rem;
  font-weight: 840;
  letter-spacing: -0.06em;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 720;
}

.stat-card.accent {
  background: linear-gradient(145deg, rgba(0, 122, 255, 0.96), rgba(90, 200, 250, 0.88));
  color: #fff;
}

.stat-card.accent p {
  color: rgba(255, 255, 255, 0.78);
}

.composer,
.list-panel {
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--radius-lg);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}

.section-heading h2,
.section-heading p {
  margin-bottom: 0;
}

.todo-form {
  grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 0.5fr) minmax(150px, 0.42fr) auto;
  align-items: end;
}

.todo-form .wide:nth-of-type(4) {
  grid-column: 1 / 4;
}

.add-btn {
  height: 52px;
  min-width: 118px;
}

.todo-list {
  list-style: none;
  display: grid;
  gap: 13px;
  padding: 0;
  margin: 0;
}

.todo-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 17px;
  border-radius: 24px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.todo-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.todo-item.completed {
  opacity: 0.72;
}

.todo-item.completed h3,
.todo-item.completed .todo-notes {
  text-decoration: line-through;
}

.check {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-top: 2px;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.14);
  color: transparent;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.check:hover {
  transform: scale(1.05);
}

.check.checked {
  color: #fff;
  background: var(--green);
}

.check svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 3.1;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.todo-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.todo-notes {
  margin-bottom: 12px;
  color: var(--muted-strong);
  line-height: 1.56;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 640;
}

.priority {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 820;
}

.priority.high {
  color: #9f1d16;
  background: rgba(255, 59, 48, 0.12);
}

.priority.medium {
  color: #0756a5;
  background: rgba(0, 122, 255, 0.12);
}

.priority.low {
  color: #166b2b;
  background: rgba(52, 199, 89, 0.13);
}

.todo-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.12);
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.icon-btn.danger:hover {
  color: #fff;
  background: var(--red);
}

.empty-state,
.loading {
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 30px;
}

.empty-state h3,
.empty-state p,
.loading p {
  margin-bottom: 0;
}

.empty-state p,
.loading p {
  color: var(--muted);
}

.empty-orb {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--green), #30d158);
  box-shadow: 0 18px 40px rgba(52, 199, 89, 0.22);
  font-size: 2rem;
  font-weight: 900;
}

.loading {
  width: min(420px, 100%);
  margin: 18vh auto 0;
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 4px solid rgba(0, 122, 255, 0.16);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}

.toast {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 28px;
  max-width: min(520px, calc(100% - 32px));
  padding: 13px 18px;
  border-radius: 999px;
  color: #fff;
  background: rgba(17, 24, 39, 0.9);
  box-shadow: var(--shadow);
  transform: translate(-50%, 28px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-weight: 700;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast.error {
  background: rgba(255, 59, 48, 0.95);
}

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

@media (max-width: 920px) {
  .auth-page {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .brand-card {
    min-height: auto;
  }

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

  .todo-form {
    grid-template-columns: 1fr 1fr;
  }

  .todo-form .wide,
  .todo-form .wide:nth-of-type(4),
  .add-btn {
    grid-column: 1 / -1;
  }

  .list-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented.small {
    width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 640px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .auth-card,
  .brand-card,
  .topbar,
  .composer,
  .list-panel {
    border-radius: 26px;
  }

  .brand-card,
  .auth-card,
  .topbar,
  .composer,
  .list-panel {
    padding: 22px;
  }

  h1 {
    font-size: 2.75rem;
  }

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

  .stats-grid,
  .todo-form {
    grid-template-columns: 1fr;
  }

  .todo-form .wide:nth-of-type(4) {
    grid-column: auto;
  }

  .todo-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .todo-actions {
    grid-column: 2;
  }

  .todo-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .segmented.small {
    grid-template-columns: repeat(4, max-content);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #05070d;
    --surface: rgba(18, 22, 31, 0.68);
    --surface-strong: rgba(37, 43, 56, 0.92);
    --line: rgba(255, 255, 255, 0.1);
    --text: #f8fafc;
    --muted: #a6adbb;
    --muted-strong: #c5cad5;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
    --shadow-soft: 0 12px 34px rgba(0, 0, 0, 0.24);
  }

  body {
    background:
      radial-gradient(circle at top left, rgba(0, 122, 255, 0.22), transparent 34rem),
      radial-gradient(circle at right 8%, rgba(175, 82, 222, 0.2), transparent 34rem),
      linear-gradient(135deg, #05070d 0%, #101522 100%);
  }

  .glass-card {
    border-color: rgba(255, 255, 255, 0.1);
  }

  input,
  select,
  textarea,
  .feature-row span,
  .ghost-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
  }

  input:focus,
  select:focus,
  textarea:focus,
  .ghost-btn:hover,
  .icon-btn:hover {
    background: rgba(255, 255, 255, 0.14);
  }

  .brand-mark {
    background: linear-gradient(145deg, #f8fafc, #a6adbb);
  }

  .brand-mark span,
  .brand-mark span::after {
    background: #05070d;
  }
}

/* Mobile view tabs: keep the phone layout short without changing the desktop dashboard. */
.mobile-view-tabs {
  display: none;
}

@media (max-width: 640px) {
  .workspace {
    gap: 12px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .topbar h1 {
    margin-bottom: 0;
    font-size: clamp(1.9rem, 8vw, 2.3rem);
    line-height: 1.03;
    letter-spacing: -0.06em;
  }

  .topbar .eyebrow {
    margin-bottom: 4px;
    font-size: 0.68rem;
  }

  .topbar .muted {
    display: none;
  }

  .ghost-btn {
    padding: 10px 12px;
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .mobile-view-tabs {
    position: sticky;
    top: 8px;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
  }

  .mobile-view-tab {
    border: 0;
    border-radius: 999px;
    padding: 10px 8px;
    color: var(--muted-strong);
    background: transparent;
    font-weight: 820;
  }

  .mobile-view-tab.active {
    color: var(--text);
    background: var(--surface-strong);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  }

  .mobile-panel:not(.active-mobile) {
    display: none;
  }

  .stats-grid.mobile-panel.active-mobile {
    display: grid;
  }

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

  .stat-card {
    min-height: 104px;
    padding: 16px;
    border-radius: 22px;
  }

  .stat-card span {
    margin-bottom: 4px;
    font-size: 1.9rem;
  }

  .stat-card p {
    font-size: 0.9rem;
  }

  .brand-card,
  .auth-card,
  .topbar,
  .composer,
  .list-panel {
    padding: 18px;
  }

  .section-heading {
    margin-bottom: 14px;
  }

  .section-heading h2 {
    font-size: 1.65rem;
  }

  .composer .eyebrow,
  .list-panel .eyebrow {
    font-size: 0.68rem;
  }

  .todo-form {
    gap: 12px;
  }

  label {
    gap: 6px;
    font-size: 0.86rem;
  }

  input,
  select,
  textarea {
    border-radius: 16px;
    padding: 12px 14px;
  }

  textarea {
    min-height: 76px;
  }

  .add-btn {
    height: 48px;
  }

  .list-heading {
    gap: 12px;
  }

  .segmented.small .segment {
    padding: 8px 12px;
  }

  .empty-state {
    min-height: 190px;
    padding: 20px 10px;
  }

  .empty-orb {
    width: 58px;
    height: 58px;
    margin-bottom: 14px;
    border-radius: 20px;
    font-size: 1.65rem;
  }

  .todo-item {
    padding: 14px;
    border-radius: 20px;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 640px) {
  .mobile-view-tabs {
    background: rgba(18, 22, 31, 0.72);
  }
}

/* Clearer todo controls: colored completion button and labeled actions. */
.check {
  width: auto;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 0;
  padding: 6px 10px 6px 7px;
  border: 1px solid rgba(0, 122, 255, 0.28);
  border-radius: 999px;
  color: #0756a5;
  background: rgba(0, 122, 255, 0.1);
  font-weight: 820;
  white-space: nowrap;
}

.check-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
}

.check svg,
.action-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.check.checked {
  color: #137333;
  background: rgba(52, 199, 89, 0.14);
  border-color: rgba(52, 199, 89, 0.28);
}

.check.checked .check-icon {
  background: linear-gradient(135deg, var(--green), #30d158);
}

.todo-actions {
  align-items: center;
}

.action-btn {
  border: 0;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.12);
  font-weight: 800;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.action-btn.edit {
  color: #0756a5;
  background: rgba(0, 122, 255, 0.1);
}

.action-btn.delete {
  color: #9f1d16;
  background: rgba(255, 59, 48, 0.1);
}

.action-btn:focus-visible,
.check:focus-visible {
  outline: 3px solid rgba(0, 122, 255, 0.22);
  outline-offset: 2px;
}

@media (hover: hover) {
  .check:hover,
  .action-btn:hover {
    transform: translateY(-1px);
  }

  .action-btn.edit:hover {
    color: #fff;
    background: var(--blue);
  }

  .action-btn.delete:hover {
    color: #fff;
    background: var(--red);
  }
}

@media (hover: none) {
  .action-btn:hover,
  .icon-btn:hover,
  .ghost-btn:hover {
    transform: none;
  }

  .action-btn.delete:hover {
    color: #9f1d16;
    background: rgba(255, 59, 48, 0.1);
  }

  .action-btn.edit:hover {
    color: #0756a5;
    background: rgba(0, 122, 255, 0.1);
  }
}

.action-btn.delete:active {
  color: #fff;
  background: var(--red);
}

@media (max-width: 640px) {
  .todo-item {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
  }

  .check {
    height: 34px;
    padding: 5px 9px 5px 6px;
    font-size: 0.88rem;
  }

  .check-icon {
    width: 21px;
    height: 21px;
  }

  .todo-actions {
    grid-column: 2;
    gap: 8px;
    margin-top: 2px;
  }

  .action-btn {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.88rem;
  }
}

/* Keep delete visually neutral at rest; only the label is red as a destructive hint. */
.action-btn.delete {
  color: #9f1d16;
  background: rgba(118, 118, 128, 0.12);
}

@media (hover: none) {
  .action-btn.delete:hover {
    color: #9f1d16;
    background: rgba(118, 118, 128, 0.12);
  }
}

/* v5: Card layout with full-width titles and unambiguous completion action. */
.todo-item {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.todo-content,
.todo-title-row,
.todo-title-row h3 {
  min-width: 0;
}

.todo-title-row {
  align-items: flex-start;
  flex-wrap: wrap;
}

.todo-title-row h3 {
  flex: 1 1 260px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.18;
}

.todo-actions {
  grid-column: auto;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.action-btn.complete {
  color: #0756a5;
  background: rgba(0, 122, 255, 0.1);
}

.action-btn.complete.completed {
  color: #137333;
  background: rgba(52, 199, 89, 0.14);
}

.action-btn.complete.completed svg {
  color: var(--green);
}

@media (hover: hover) {
  .action-btn.complete:hover {
    color: #fff;
    background: var(--blue);
  }

  .action-btn.complete.completed:hover {
    color: #fff;
    background: var(--green);
  }
}

@media (hover: none) {
  .action-btn.complete:hover {
    color: #0756a5;
    background: rgba(0, 122, 255, 0.1);
  }

  .action-btn.complete.completed:hover {
    color: #137333;
    background: rgba(52, 199, 89, 0.14);
  }
}

@media (max-width: 640px) {
  .todo-item {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
  }

  .todo-title-row {
    gap: 8px;
  }

  .todo-title-row h3 {
    flex-basis: 100%;
    font-size: clamp(1.22rem, 5.7vw, 1.55rem);
    letter-spacing: -0.04em;
  }

  .priority {
    font-size: 0.82rem;
    padding: 5px 9px;
  }

  .todo-meta {
    font-size: 0.9rem;
    gap: 6px 10px;
  }

  .todo-actions {
    grid-column: auto;
    gap: 8px;
  }

  .action-btn {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.86rem;
  }
}

/* v6: More polished reminder cards. */
.todo-list {
  gap: 18px;
}

.todo-item {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.84)),
    radial-gradient(circle at 92% 0%, rgba(0, 122, 255, 0.09), transparent 34%);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.todo-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--blue), var(--blue-2));
}

.todo-item.priority-high::before {
  background: linear-gradient(180deg, var(--red), var(--orange));
}

.todo-item.priority-low::before {
  background: linear-gradient(180deg, var(--green), #30d158);
}

.todo-card-glow {
  position: absolute;
  right: -62px;
  top: -72px;
  z-index: -1;
  width: 190px;
  height: 190px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(0, 122, 255, 0.14), transparent 68%);
}

.todo-item.priority-high .todo-card-glow {
  background: radial-gradient(circle, rgba(255, 59, 48, 0.13), transparent 68%);
}

.todo-item.priority-low .todo-card-glow {
  background: radial-gradient(circle, rgba(52, 199, 89, 0.13), transparent 68%);
}

.todo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.todo-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #0756a5;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.todo-state.done {
  color: #137333;
}

.state-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 5px rgba(0, 122, 255, 0.1);
}

.todo-state.done .state-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(52, 199, 89, 0.12);
}

.todo-title-row {
  display: contents;
}

.todo-title,
.todo-title-row h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: clamp(1.28rem, 3vw, 1.7rem);
  font-weight: 880;
  line-height: 1.18;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.todo-notes {
  margin: -4px 0 12px;
  padding: 10px 12px;
  border-radius: 16px;
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.08);
}

.todo-meta {
  gap: 8px;
  margin-top: 2px;
}

.meta-pill {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.09);
  font-size: 0.86rem;
  font-weight: 760;
}

.meta-pill svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.meta-pill.due.today {
  color: #0756a5;
  background: rgba(0, 122, 255, 0.1);
}

.meta-pill.due.overdue {
  color: #9f1d16;
  background: rgba(255, 59, 48, 0.1);
}

.meta-pill.due.upcoming {
  color: #684800;
  background: rgba(255, 204, 0, 0.16);
}

.meta-pill.due.done {
  color: #137333;
  background: rgba(52, 199, 89, 0.12);
}

.todo-actions {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid rgba(30, 41, 59, 0.07);
}

.action-btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

@media (max-width: 640px) {
  .todo-list {
    gap: 14px;
  }

  .todo-item {
    padding: 16px 16px 14px;
    border-radius: 26px;
  }

  .todo-card-header {
    margin-bottom: 8px;
  }

  .todo-title,
  .todo-title-row h3 {
    margin-bottom: 10px;
    font-size: clamp(1.25rem, 5.3vw, 1.45rem);
    line-height: 1.2;
  }

  .priority {
    font-size: 0.74rem;
    padding: 5px 9px;
  }

  .todo-state {
    font-size: 0.74rem;
  }

  .todo-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .meta-pill {
    width: 100%;
    border-radius: 14px;
    padding: 9px 10px;
    font-size: 0.84rem;
  }

  .meta-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .todo-actions {
    display: grid;
    grid-template-columns: 1fr 0.78fr 0.78fr;
    gap: 8px;
    padding-top: 12px;
  }

  .action-btn {
    justify-content: center;
    min-width: 0;
    padding: 8px 8px;
    font-size: 0.82rem;
  }
}

@media (prefers-color-scheme: dark) {
  .todo-item {
    border-color: rgba(255, 255, 255, 0.1);
    background:
      linear-gradient(145deg, rgba(30, 36, 49, 0.92), rgba(18, 22, 31, 0.78)),
      radial-gradient(circle at 92% 0%, rgba(0, 122, 255, 0.16), transparent 34%);
  }

  .meta-pill,
  .todo-notes {
    background: rgba(255, 255, 255, 0.08);
  }

  .todo-actions {
    border-top-color: rgba(255, 255, 255, 0.08);
  }
}

/* v7: Icon-only action bar. */
.todo-actions {
  justify-content: flex-end;
  gap: 10px;
}

.action-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  justify-content: center;
  padding: 0;
  border-radius: 15px;
  font-size: 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 22px rgba(15, 23, 42, 0.06);
}

.action-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.25;
}

.action-btn.complete {
  color: #0b63ce;
  background: linear-gradient(145deg, rgba(0, 122, 255, 0.14), rgba(90, 200, 250, 0.2));
}

.action-btn.complete.completed {
  color: #178a3b;
  background: linear-gradient(145deg, rgba(52, 199, 89, 0.16), rgba(48, 209, 88, 0.22));
}

.action-btn.edit {
  color: #0756a5;
  background: linear-gradient(145deg, rgba(0, 122, 255, 0.12), rgba(90, 200, 250, 0.16));
}

.action-btn.delete {
  color: #b42318;
  background: linear-gradient(145deg, rgba(255, 59, 48, 0.1), rgba(255, 149, 0, 0.12));
}

@media (hover: hover) {
  .action-btn:hover {
    transform: translateY(-2px);
  }
}

@media (hover: none) {
  .action-btn.complete:hover {
    color: #0b63ce;
    background: linear-gradient(145deg, rgba(0, 122, 255, 0.14), rgba(90, 200, 250, 0.2));
  }

  .action-btn.complete.completed:hover {
    color: #178a3b;
    background: linear-gradient(145deg, rgba(52, 199, 89, 0.16), rgba(48, 209, 88, 0.22));
  }

  .action-btn.edit:hover {
    color: #0756a5;
    background: linear-gradient(145deg, rgba(0, 122, 255, 0.12), rgba(90, 200, 250, 0.16));
  }

  .action-btn.delete:hover {
    color: #b42318;
    background: linear-gradient(145deg, rgba(255, 59, 48, 0.1), rgba(255, 149, 0, 0.12));
  }
}

@media (max-width: 640px) {
  .todo-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
  }

  .action-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: 14px;
  }

  .action-btn svg {
    width: 19px;
    height: 19px;
  }
}

/* v8: Mobile scroll performance profile.
   Huawei/Chromium mobile repaints heavily when backdrop-filter, fixed blurred
   blobs, large shadows and radial glows move under the viewport. Keep the Apple
   look, but use cheaper static layers on phones. */
@media (max-width: 640px) {
  html,
  body {
    background: linear-gradient(180deg, #f6f9ff 0%, #edf6f3 100%);
  }

  body {
    overscroll-behavior-y: contain;
  }

  .ambient {
    display: none;
  }

  .glass-card {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .topbar,
  .composer,
  .list-panel,
  .auth-card,
  .brand-card {
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
  }

  .mobile-view-tabs {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: translateZ(0);
  }

  .segment.active,
  .mobile-view-tab.active {
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
  }

  .todo-list {
    contain: layout paint;
  }

  .todo-item {
    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: auto 218px;
    background: #ffffff;
    border-color: rgba(226, 232, 240, 0.88);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    transition: none;
  }

  .todo-item:hover {
    transform: none;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  }

  .todo-card-glow {
    display: none;
  }

  .meta-pill,
  .todo-notes {
    background: #f5f7fb;
  }

  .meta-pill.due.today {
    background: #eaf4ff;
  }

  .meta-pill.due.overdue {
    background: #fff0ee;
  }

  .meta-pill.due.upcoming {
    background: #fff7d6;
  }

  .meta-pill.due.done {
    background: #ecfdf1;
  }

  .todo-actions {
    border-top-color: rgba(226, 232, 240, 0.75);
  }

  .action-btn {
    box-shadow: none;
    transition: none;
  }

  .priority,
  .state-dot {
    box-shadow: none;
  }

  .toast {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 640px) {
  html,
  body {
    background: linear-gradient(180deg, #080b12 0%, #101722 100%);
  }

  .glass-card,
  .mobile-view-tabs {
    background: rgba(18, 22, 31, 0.96);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .todo-item {
    background: #161b26;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  }

  .meta-pill,
  .todo-notes {
    background: rgba(255, 255, 255, 0.07);
  }
}

/* v9: Move the main mobile tabs to a bottom tab bar. */
@media (max-width: 640px) {
  .app {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .workspace {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .mobile-view-tabs {
    position: fixed;
    left: 50%;
    right: auto;
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(calc(100% - 24px), 430px);
    z-index: 20;
    transform: translateX(-50%) translateZ(0);
    padding: 6px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.88);
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
  }

  .mobile-view-tab {
    padding: 12px 8px;
    border-radius: 22px;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 640px) {
  .mobile-view-tabs {
    background: rgba(18, 22, 31, 0.96);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.32);
  }
}

/* v10: Profile management inspired by mainstream account menus. */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  color: #fff;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.85), transparent 24%),
    linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 10px 24px rgba(0, 122, 255, 0.18);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.avatar-sm {
  width: 42px;
  height: 42px;
  font-size: 1.05rem;
}

.avatar-lg {
  width: 92px;
  height: 92px;
  font-size: 2.4rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 18px 38px rgba(0, 122, 255, 0.22);
}

.profile-chip {
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 24px rgba(15, 23, 42, 0.08);
  transition: transform 0.18s ease, background 0.18s ease;
}

.profile-chip:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.94);
}

.profile-chip-text {
  min-width: 0;
  display: grid;
  gap: 1px;
  text-align: left;
  line-height: 1.15;
}

.profile-chip-text strong,
.profile-chip-text small {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip-text strong {
  font-size: 0.94rem;
  font-weight: 850;
}

.profile-chip-text small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.profile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.profile-modal {
  position: relative;
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  padding: 26px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 92% 0%, rgba(90, 200, 250, 0.22), transparent 34%),
    rgba(255, 255, 255, 0.9);
}

.profile-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.12);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-right: 30px;
  margin-bottom: 22px;
}

.profile-hero h2,
.profile-hero p {
  margin-bottom: 0;
}

.profile-form {
  display: grid;
  gap: 16px;
}

.avatar-controls,
.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.avatar-upload,
.avatar-remove {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 16px;
  font-weight: 820;
}

.avatar-upload {
  color: #0756a5;
  background: rgba(0, 122, 255, 0.1);
}

.avatar-remove {
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.12);
}

.profile-actions {
  align-items: center;
  margin-top: 4px;
}

.profile-actions .primary-btn,
.profile-actions .ghost-btn {
  width: 100%;
  height: 48px;
  border-radius: 16px;
}

@media (max-width: 640px) {
  .topbar-actions {
    gap: 8px;
  }

  .profile-chip {
    padding: 5px;
  }

  .profile-chip-text {
    display: none;
  }

  .avatar-sm {
    width: 38px;
    height: 38px;
    font-size: 0.98rem;
  }

  .profile-backdrop {
    align-items: end;
    padding: 12px 10px calc(82px + env(safe-area-inset-bottom));
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .profile-modal {
    width: 100%;
    max-height: calc(100vh - 118px - env(safe-area-inset-bottom));
    padding: 22px;
    border-radius: 28px;
  }

  .profile-hero {
    align-items: flex-start;
    gap: 14px;
    padding-right: 24px;
  }

  .avatar-lg {
    width: 76px;
    height: 76px;
    font-size: 2rem;
  }

  .profile-hero .muted {
    font-size: 0.9rem;
  }

  .avatar-controls,
  .profile-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  .profile-chip,
  .profile-modal {
    background: rgba(18, 22, 31, 0.92);
  }

  .avatar-remove,
  .profile-close {
    background: rgba(255, 255, 255, 0.09);
  }
}

/* v11: Account menu owns sign-out and password management. */
.profile-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(30, 41, 59, 0.08);
}

.section-mini-heading,
.account-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-mini-heading {
  margin-bottom: 14px;
}

.section-mini-heading h3,
.account-section h3,
.account-section p {
  margin-bottom: 0;
}

.section-mini-heading h3,
.account-section h3 {
  font-size: 1.08rem;
  letter-spacing: -0.03em;
}

.security-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: #137333;
  background: rgba(52, 199, 89, 0.12);
  font-size: 0.78rem;
  font-weight: 850;
}

.security-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.security-form label:first-child {
  grid-column: 1 / -1;
}

.security-info {
  display: grid;
  gap: 10px;
}

.account-profile-link {
  width: fit-content;
}

.password-save {
  grid-column: 1 / -1;
  height: 48px;
  border-radius: 16px;
}

.danger-btn {
  border: 0;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 16px;
  color: #b42318;
  background: linear-gradient(145deg, rgba(255, 59, 48, 0.1), rgba(255, 149, 0, 0.12));
  font-weight: 850;
}

.danger-btn:hover {
  color: #fff;
  background: var(--red);
}

@media (max-width: 640px) {
  .topbar-actions {
    justify-self: end;
  }

  .security-form {
    grid-template-columns: 1fr;
  }

  .section-mini-heading,
  .account-section {
    align-items: flex-start;
    flex-direction: column;
  }

  .danger-btn {
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  .profile-section {
    border-top-color: rgba(255, 255, 255, 0.08);
  }
}

/* v12: Full todo edit dialog for title, notes, date, priority and status. */
.todo-edit-backdrop {
  position: fixed;
  inset: 0;
  z-index: 61;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.todo-edit-modal {
  position: relative;
  width: min(560px, 100%);
  max-height: min(780px, calc(100vh - 36px));
  overflow: auto;
  padding: 26px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 90% 0%, rgba(0, 122, 255, 0.18), transparent 34%),
    rgba(255, 255, 255, 0.92);
}

.edit-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 32px;
  margin-bottom: 22px;
}

.edit-hero h2,
.edit-hero p {
  margin-bottom: 0;
}

.edit-icon {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: #0756a5;
  background: linear-gradient(145deg, rgba(0, 122, 255, 0.12), rgba(90, 200, 250, 0.2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 12px 24px rgba(0, 122, 255, 0.14);
}

.edit-icon svg {
  width: 27px;
  height: 27px;
  stroke: currentColor;
  stroke-width: 2.25;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.edit-todo-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.edit-todo-form .wide {
  grid-column: 1 / -1;
}

.edit-todo-form textarea {
  min-height: 112px;
}

.completion-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 18px;
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.09);
  font-weight: 820;
}

.completion-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.edit-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.edit-actions .primary-btn,
.edit-actions .ghost-btn {
  width: 100%;
  height: 48px;
  border-radius: 16px;
}

@media (max-width: 640px) {
  .todo-edit-backdrop {
    align-items: end;
    padding: 12px 10px calc(82px + env(safe-area-inset-bottom));
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .todo-edit-modal {
    width: 100%;
    max-height: calc(100vh - 118px - env(safe-area-inset-bottom));
    padding: 22px;
    border-radius: 28px;
  }

  .edit-hero {
    align-items: flex-start;
    gap: 12px;
    padding-right: 24px;
  }

  .edit-icon {
    width: 50px;
    height: 50px;
    border-radius: 18px;
  }

  .edit-icon svg {
    width: 24px;
    height: 24px;
  }

  .edit-todo-form,
  .edit-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  .todo-edit-modal {
    background:
      radial-gradient(circle at 90% 0%, rgba(0, 122, 255, 0.16), transparent 34%),
      rgba(18, 22, 31, 0.94);
  }

  .completion-row {
    background: rgba(255, 255, 255, 0.08);
  }
}

/* v13: Avatar cropper with draggable region selection. */
.avatar-crop-backdrop {
  position: fixed;
  inset: 0;
  z-index: 72;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.avatar-crop-modal {
  position: relative;
  width: min(620px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  overflow: auto;
  padding: 24px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 88% 0%, rgba(90, 200, 250, 0.18), transparent 34%),
    rgba(255, 255, 255, 0.94);
}

.avatar-crop-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-right: 34px;
  margin-bottom: 18px;
}

.avatar-crop-heading h2,
.avatar-crop-heading p {
  margin-bottom: 0;
}

.avatar-crop-preview {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.8), transparent 26%),
    linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 14px 28px rgba(0, 122, 255, 0.18);
}

.avatar-crop-stage {
  position: relative;
  height: clamp(300px, 54vh, 520px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 26px;
  background:
    linear-gradient(45deg, rgba(148, 163, 184, 0.16) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(148, 163, 184, 0.16) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.16) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.16) 75%),
    rgba(2, 6, 23, 0.78);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 18px 38px rgba(15, 23, 42, 0.18);
  touch-action: none;
}

.avatar-crop-stage img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.avatar-crop-selection {
  position: absolute;
  left: 0;
  top: 0;
  border: 2px solid rgba(255, 255, 255, 0.98);
  border-radius: 999px;
  box-shadow:
    0 0 0 9999px rgba(2, 6, 23, 0.46),
    0 14px 36px rgba(2, 6, 23, 0.24),
    inset 0 0 0 1px rgba(15, 23, 42, 0.18);
  cursor: grab;
  touch-action: none;
  will-change: transform, width, height;
}

.avatar-crop-selection.dragging {
  cursor: grabbing;
}

.avatar-crop-selection::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.58);
  pointer-events: none;
}

.crop-grid {
  position: absolute;
  display: block;
  background: rgba(255, 255, 255, 0.36);
  pointer-events: none;
}

.crop-grid-v1,
.crop-grid-v2 {
  top: 8%;
  bottom: 8%;
  width: 1px;
}

.crop-grid-v1 {
  left: 33.333%;
}

.crop-grid-v2 {
  left: 66.666%;
}

.crop-grid-h1,
.crop-grid-h2 {
  left: 8%;
  right: 8%;
  height: 1px;
}

.crop-grid-h1 {
  top: 33.333%;
}

.crop-grid-h2 {
  top: 66.666%;
}

.avatar-crop-grip {
  position: absolute;
  right: 10%;
  bottom: 10%;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.24);
}

.avatar-crop-grip::before,
.avatar-crop-grip::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
}

.avatar-crop-grip::after {
  transform: rotate(90deg);
}

.avatar-crop-size {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted-strong);
  font-weight: 820;
}

.avatar-crop-size input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.avatar-crop-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.avatar-crop-actions .primary-btn,
.avatar-crop-actions .ghost-btn {
  width: 100%;
  height: 48px;
  border-radius: 16px;
}

@media (max-width: 640px) {
  .avatar-crop-backdrop {
    align-items: end;
    padding: 12px 10px calc(82px + env(safe-area-inset-bottom));
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .avatar-crop-modal {
    width: 100%;
    max-height: calc(100vh - 118px - env(safe-area-inset-bottom));
    padding: 20px;
    border-radius: 28px;
  }

  .avatar-crop-heading {
    align-items: flex-start;
    padding-right: 24px;
  }

  .avatar-crop-heading .muted {
    font-size: 0.9rem;
  }

  .avatar-crop-preview {
    width: 62px;
    height: 62px;
  }

  .avatar-crop-stage {
    height: min(54vh, 390px);
    border-radius: 22px;
  }

  .avatar-crop-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-color-scheme: dark) {
  .avatar-crop-modal {
    background:
      radial-gradient(circle at 88% 0%, rgba(90, 200, 250, 0.14), transparent 34%),
      rgba(18, 22, 31, 0.95);
  }
}

/* v14: Keep avatar cropper fully visible on phone and make the + handle resize. */
.avatar-crop-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.avatar-crop-selection.resizing,
.avatar-crop-grip {
  cursor: nwse-resize;
}

.avatar-crop-grip {
  touch-action: none;
  pointer-events: auto;
}

@media (max-width: 640px) {
  .avatar-crop-backdrop {
    padding: 8px 8px calc(72px + env(safe-area-inset-bottom));
  }

  .avatar-crop-modal {
    display: grid;
    grid-template-rows: auto minmax(176px, 1fr) auto auto;
    gap: 10px;
    width: 100%;
    height: calc(100dvh - 92px - env(safe-area-inset-bottom));
    max-height: calc(100dvh - 92px - env(safe-area-inset-bottom));
    overflow: hidden;
    padding: 16px;
    border-radius: 24px;
  }

  @supports (height: 100svh) {
    .avatar-crop-modal {
      height: calc(100svh - 92px - env(safe-area-inset-bottom));
      max-height: calc(100svh - 92px - env(safe-area-inset-bottom));
    }
  }

  .avatar-crop-heading {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 0;
    padding-right: 32px;
  }

  .avatar-crop-heading .eyebrow {
    margin-bottom: 3px;
    font-size: 0.66rem;
  }

  .avatar-crop-heading h2 {
    margin-bottom: 4px;
    font-size: 1.55rem;
    line-height: 1.06;
  }

  .avatar-crop-heading .muted {
    max-width: 220px;
    font-size: 0.82rem;
    line-height: 1.36;
  }

  .avatar-crop-preview {
    width: 54px;
    height: 54px;
  }

  .avatar-crop-stage {
    align-self: stretch;
    width: 100%;
    min-height: 0;
    height: 100%;
    border-radius: 20px;
  }

  .avatar-crop-size {
    gap: 6px;
    margin-top: 0;
  }

  .avatar-crop-size span {
    font-size: 0.9rem;
  }

  .avatar-crop-actions {
    grid-template-columns: 1fr 1fr;
    margin-top: 0;
  }

  .avatar-crop-actions .primary-btn,
  .avatar-crop-actions .ghost-btn {
    height: 44px;
    border-radius: 14px;
  }
}

@media (max-width: 360px) {
  .avatar-crop-modal {
    grid-template-rows: auto minmax(150px, 1fr) auto auto;
    padding: 14px;
  }

  .avatar-crop-heading h2 {
    font-size: 1.38rem;
  }

  .avatar-crop-preview {
    width: 48px;
    height: 48px;
  }
}

/* v15: Fixed avatar frame; users move/zoom the image underneath instead. */
.avatar-crop-stage {
  cursor: grab;
}

.avatar-crop-stage.dragging {
  cursor: grabbing;
}

.avatar-crop-stage img {
  max-width: none;
  max-height: none;
  object-fit: fill;
  transform-origin: 0 0;
  will-change: left, top, width, height;
}

.avatar-crop-selection {
  pointer-events: none;
  cursor: default;
}

.avatar-crop-selection.dragging,
.avatar-crop-selection.resizing {
  cursor: default;
}

.avatar-crop-grip {
  display: none;
}

/* v16: Password fields support show/hide with a compact eye toggle. */
.field-group {
  display: grid;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.field-group > label {
  display: block;
  color: inherit;
  font: inherit;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 58px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.12);
  transform: translateY(-50%);
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  touch-action: manipulation;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--blue);
  background: rgba(0, 122, 255, 0.11);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.11);
  outline: none;
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.96);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle .password-eye-off {
  display: none;
}

.password-toggle.visible .password-eye {
  display: none;
}

.password-toggle.visible .password-eye-off {
  display: block;
}

.security-form .password-group:first-child,
.security-password-current {
  grid-column: 1 / -1;
}

@media (prefers-color-scheme: dark) {
  .password-toggle {
    background: rgba(255, 255, 255, 0.08);
  }

  .password-toggle:hover,
  .password-toggle:focus-visible {
    background: rgba(90, 200, 250, 0.14);
  }
}

/* v17: Eisenhower matrix by important / urgent attributes. */
.quadrant-panel {
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--radius-lg);
}

.quadrant-heading {
  align-items: flex-start;
}

.quadrant-heading .muted {
  margin: 4px 0 0;
}

.quadrant-summary {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  color: #0756a5;
  background: rgba(0, 122, 255, 0.1);
  font-size: 0.84rem;
  font-weight: 850;
  white-space: nowrap;
}

.quadrant-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.quadrant-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(30, 41, 59, 0.08);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.quadrant-card header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.quadrant-card h3,
.quadrant-card p {
  margin: 0;
}

.quadrant-card h3 {
  font-size: 1.08rem;
  letter-spacing: -0.035em;
}

.quadrant-card p,
.quadrant-card > small {
  color: var(--muted);
  line-height: 1.45;
}

.quadrant-card header strong {
  min-width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--text);
  background: rgba(118, 118, 128, 0.1);
  font-size: 0.95rem;
}

.quadrant-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.quadrant-card.q-do .quadrant-icon,
.matrix-mini.q-do {
  background: linear-gradient(135deg, var(--red), var(--orange));
}

.quadrant-card.q-plan .quadrant-icon,
.matrix-mini.q-plan {
  background: linear-gradient(135deg, var(--blue), var(--purple));
}

.quadrant-card.q-delegate .quadrant-icon,
.matrix-mini.q-delegate {
  background: linear-gradient(135deg, var(--orange), #ffcc00);
}

.quadrant-card.q-later .quadrant-icon,
.matrix-mini.q-later {
  background: linear-gradient(135deg, #8e8e93, #c7c7cc);
}

.matrix-task-list {
  display: grid;
  gap: 8px;
}

.matrix-task {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(30, 41, 59, 0.06);
}

.matrix-task-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.matrix-task-main strong,
.matrix-task-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-task-main strong {
  color: var(--text);
  font-size: 0.96rem;
  letter-spacing: -0.025em;
}

.matrix-task-main span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.matrix-action {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: 12px;
}

.matrix-action svg {
  width: 16px;
  height: 16px;
}

.matrix-empty {
  padding: 14px;
  border: 1px dashed rgba(30, 41, 59, 0.12);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(118, 118, 128, 0.06);
  text-align: center;
  font-size: 0.88rem;
  font-weight: 760;
}

.todo-header-badges {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.matrix-mini {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
}

.meta-pill.matrix-flag.important {
  color: #7f1d1d;
  background: rgba(255, 59, 48, 0.1);
}

.meta-pill.matrix-flag.urgent {
  color: #8a4b00;
  background: rgba(255, 149, 0, 0.13);
}

.meta-pill.matrix-flag.minor,
.meta-pill.matrix-flag.relaxed {
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.08);
}

.quadrant-field {
  display: grid;
  gap: 10px;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.field-label > span {
  color: var(--muted-strong);
}

.field-label small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.quadrant-toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quadrant-toggle {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 12px;
  border: 1px solid rgba(30, 41, 59, 0.08);
  border-radius: 18px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.58);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.quadrant-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-visual {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.11);
}

.toggle-visual svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quadrant-toggle strong,
.quadrant-toggle small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quadrant-toggle strong {
  color: var(--text);
  font-size: 0.95rem;
}

.quadrant-toggle small {
  color: var(--muted);
  margin-top: 2px;
  font-size: 0.76rem;
  font-weight: 700;
}

.quadrant-toggle:has(input:checked) {
  border-color: rgba(0, 122, 255, 0.28);
  background: rgba(0, 122, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08);
}

.quadrant-toggle.important:has(input:checked) .toggle-visual {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--orange));
}

.quadrant-toggle.urgent:has(input:checked) .toggle-visual {
  color: #fff;
  background: linear-gradient(135deg, var(--orange), #ffcc00);
}

.todo-form .quadrant-field,
.edit-todo-form .quadrant-field {
  grid-column: 1 / -1;
}

@media (max-width: 920px) {
  .quadrant-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .mobile-view-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mobile-view-tab {
    padding: 11px 6px;
    font-size: 0.9rem;
  }

  .quadrant-panel {
    padding: 18px;
    border-radius: 26px;
  }

  .quadrant-heading {
    gap: 10px;
    margin-bottom: 14px;
  }

  .quadrant-heading {
    flex-direction: column;
  }

  .quadrant-summary {
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  .quadrant-board {
    gap: 12px;
  }

  .quadrant-card {
    padding: 14px;
    border-radius: 22px;
  }

  .matrix-task {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

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

  .todo-card-header {
    align-items: flex-start;
  }

  .todo-header-badges {
    max-width: 58%;
    gap: 6px;
  }

  .matrix-mini {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 5px 8px;
    font-size: 0.7rem;
  }

  .quadrant-toggle-row {
    grid-template-columns: 1fr;
  }

  .field-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

@media (prefers-color-scheme: dark) {
  .quadrant-card,
  .matrix-task,
  .quadrant-toggle {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .matrix-empty {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
  }

  .quadrant-toggle:has(input:checked) {
    border-color: rgba(90, 200, 250, 0.28);
    background: rgba(90, 200, 250, 0.1);
  }
}

/* v17 compatibility: checked state still visible on browsers without :has(). */
.quadrant-toggle.important input:checked + .toggle-visual {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--orange));
}

.quadrant-toggle.urgent input:checked + .toggle-visual {
  color: #fff;
  background: linear-gradient(135deg, var(--orange), #ffcc00);
}

/* v20: Compact auth landing and admin registration whitelist management. */
.brand-card {
  min-height: 440px;
}

.brand-mark {
  margin-bottom: 24px;
}

.brand-card h1 {
  margin-bottom: 14px;
}

.brand-card .lead {
  max-width: 560px;
  margin-bottom: 24px;
}

.auth-card .segmented {
  margin-bottom: 18px;
}

.auth-card > .muted {
  margin-bottom: 20px;
}

.unified-login-panel {
  display: grid;
  gap: 12px;
  padding: 4px 0 22px;
}

.unified-login-panel h2,
.unified-login-panel p {
  margin-bottom: 0;
}

.unified-login-btn {
  margin-top: 4px;
}

.local-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.local-auth-divider::before,
.local-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(30, 41, 59, 0.12);
}

.admin-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: #0756a5;
  background: rgba(0, 122, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 850;
}

.whitelist-help {
  margin: -4px 0 14px;
}

.whitelist-help strong {
  color: var(--text);
  font-weight: 850;
}

.whitelist-form {
  display: grid;
  gap: 12px;
}

.whitelist-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.whitelist-entry-field {
  min-width: 0;
}

.whitelist-add-btn {
  height: 50px;
  padding-inline: 18px;
  border-radius: 16px;
}

.whitelist-chips {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(30, 41, 59, 0.08);
  border-radius: 18px;
  background: rgba(118, 118, 128, 0.06);
}

.whitelist-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 8px 8px 11px;
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(30, 41, 59, 0.07);
  font-size: 0.86rem;
  font-weight: 780;
}

.whitelist-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whitelist-chip button {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(118, 118, 128, 0.14);
  font-size: 1rem;
  line-height: 1;
}

.whitelist-chip button:hover {
  color: #fff;
  background: var(--red);
}

.whitelist-empty,
.whitelist-loading {
  width: 100%;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 720;
  line-height: 1.45;
}

.whitelist-save {
  height: 48px;
  border-radius: 16px;
}

@media (max-width: 640px) {
  .auth-page {
    min-height: auto;
    align-items: start;
    gap: 10px;
  }

  .brand-card {
    min-height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px 12px;
    padding: 14px 16px;
    border-radius: 22px;
  }

  .brand-card::after,
  .brand-card .feature-row {
    display: none;
  }

  .brand-card .brand-mark {
    grid-row: 1 / 4;
    width: 46px;
    height: 46px;
    margin: 0;
    border-radius: 16px;
  }

  .brand-mark span {
    width: 21px;
    height: 27px;
    border-radius: 12px 12px 10px 10px;
  }

  .brand-mark span::after {
    width: 11px;
    height: 11px;
    right: -3px;
    top: -7px;
  }

  .brand-card .eyebrow {
    margin: 0;
    font-size: 0.62rem;
  }

  .brand-card h1 {
    margin: 0;
    font-size: clamp(1.34rem, 5.8vw, 1.62rem);
    line-height: 1.08;
    letter-spacing: -0.045em;
  }

  .brand-card h1 br {
    display: none;
  }

  .brand-card .lead {
    grid-column: 2;
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.36;
  }

  .auth-card {
    padding: 16px;
    border-radius: 22px;
  }

  .auth-card .segmented {
    margin-bottom: 12px;
  }

  .auth-card h2 {
    margin-bottom: 2px;
    font-size: 1.42rem;
  }

  .auth-card > .muted {
    margin-bottom: 12px;
    font-size: 0.86rem;
    line-height: 1.4;
  }

  .auth-card .stack-form {
    gap: 10px;
  }

  .auth-card input {
    padding: 11px 13px;
  }

  .auth-card .password-field input {
    padding-right: 52px;
  }

  .auth-card .password-toggle {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .auth-card .primary-btn {
    padding: 12px 18px;
    border-radius: 15px;
  }

  .whitelist-input-row {
    grid-template-columns: 1fr;
  }

  .whitelist-add-btn {
    width: 100%;
    height: 44px;
  }

  .whitelist-chip {
    max-width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  .whitelist-chips {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
  }

  .whitelist-chip {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.08);
  }
}

/* v8: 更紧凑的清单卡片（meta 与操作同排）+ 统一登录视觉层级。 */
.todo-footer {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(30, 41, 59, 0.07);
}

.todo-footer .todo-meta {
  margin-top: 0;
  flex: 1 1 auto;
}

.todo-footer .todo-actions {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  flex: 0 0 auto;
  margin-left: auto;
}

@media (max-width: 640px) {
  .todo-footer {
    padding-top: 10px;
  }

  .todo-footer .todo-meta,
  .todo-footer .todo-actions {
    width: 100%;
    flex: 1 1 100%;
  }
}

.unified-login-btn {
  gap: 8px;
}

.unified-login-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.local-auth-toggle {
  width: 100%;
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px dashed rgba(30, 41, 59, 0.2);
  border-radius: 16px;
  color: var(--muted-strong);
  background: transparent;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.local-auth-toggle:hover {
  color: var(--text);
  border-color: rgba(30, 41, 59, 0.34);
  background: rgba(118, 118, 128, 0.06);
}

.local-auth-submit {
  width: 100%;
  height: 48px;
  justify-content: center;
  font-size: 1rem;
}

@media (prefers-color-scheme: dark) {
  .todo-footer {
    border-top-color: rgba(255, 255, 255, 0.08);
  }

  .local-auth-toggle {
    border-color: rgba(255, 255, 255, 0.18);
  }

  .local-auth-toggle:hover {
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.05);
  }

  .local-auth-divider::before,
  .local-auth-divider::after {
    background: rgba(255, 255, 255, 0.12);
  }
}
