:root {
  --paper: #f3f4f6;
  --paper-deep: #e6e8ed;
  --paper-card: #ffffff;
  --paper-tint: #ecedf1;
  --ink: #0d1117;
  --ink-2: #3d4452;
  --ink-3: #6c7480;
  --ink-faint: #a3aab6;
  --rule: #e1e3e8;
  --rule-strong: #c8cdd5;
  --rule-soft: #eceef2;
  --accent: #ea580c;
  --accent-strong: #c2410c;
  --accent-soft: #fde0c0;
  --accent-tint: #fff5ec;
  --danger: #be123c;
  --sidebar-bg: #0d1117;
  --sidebar-bg-hover: rgba(240, 243, 246, 0.06);
  --sidebar-ink: #b8bec9;
  --sidebar-ink-strong: #f0f3f6;
  --sidebar-active-bg: #ffffff;
  --sidebar-active-ink: #0d1117;
  --sidebar-rule: rgba(240, 243, 246, 0.08);
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(13, 17, 23, 0.04), 0 4px 14px rgba(13, 17, 23, 0.06);
  --sh-2: 0 14px 36px rgba(13, 17, 23, 0.12);
  --t-fast: 140ms;
  --t-base: 220ms;
  --ease: cubic-bezier(0.22, 0.8, 0.28, 1);
  --sidebar-width: 264px;
  --font-display: "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

button {
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.auth-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 600px at 18% -10%, rgba(234, 88, 12, 0.06), transparent 60%),
    radial-gradient(800px 500px at 90% 110%, rgba(13, 17, 23, 0.05), transparent 55%),
    var(--paper);
}

.login-panel {
  position: relative;
  width: min(100%, 420px);
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 40px 36px 32px;
}

.login-panel::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: linear-gradient(90deg, var(--accent) 0%, #ca8a04 60%, var(--ink) 100%);
  opacity: 0.86;
}

.login-panel h1 {
  margin: 0 0 26px;
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0;
}

.login-panel h1 em,
.sidebar h1 em,
.empty-state h3 em {
  color: var(--accent);
  font-style: normal;
}

.login-panel label {
  display: grid;
  gap: 8px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-panel input,
.quick-add input,
.row-title {
  width: 100%;
  border: 1px solid var(--rule);
  background: var(--paper-card);
  color: var(--ink);
  border-radius: var(--r-md);
  min-height: 42px;
  padding: 10px 12px;
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}

.login-panel input:hover,
.quick-add input:hover,
.row-title:hover {
  border-color: var(--rule-strong);
}

.login-panel input:focus,
.quick-add input:focus,
.row-title:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--paper-card);
}

.login-panel button[type="submit"] {
  width: 100%;
  min-height: 46px;
  margin-top: 18px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition:
    background var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.login-panel button[type="submit"]:hover {
  background: var(--accent-strong);
}

.passkey-login-button {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper-card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.passkey-login-button:hover {
  border-color: var(--rule-strong);
  background: var(--paper-tint);
}

.login-panel button[type="submit"]:active,
.passkey-login-button:active,
.primary-button:active,
.ghost-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.form-error {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow: hidden;
  position: relative;
  background: var(--paper);
}

.sidebar-backdrop {
  display: none;
}

.sidebar {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(234, 88, 12, 0.05), transparent 60%),
    var(--sidebar-bg);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 18px 12px 14px;
  border-right: 1px solid #06080c;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 10px 18px;
  margin-bottom: 12px;
}

.sidebar h1 {
  margin: 0;
  color: var(--sidebar-ink-strong);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}

.icon-button,
.sidebar-toggle,
.ghost-button,
.row-icon,
.date-row-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  color: inherit;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.icon-button svg,
.sidebar-toggle svg,
.dialog-close svg,
.ghost-button svg,
.row-icon svg,
.date-row-icon svg,
.settings-button svg,
.settings-menu-item svg,
.quick-add button svg {
  width: 17px;
  height: 17px;
  display: block;
}

.sidebar .icon-button {
  color: var(--sidebar-ink);
}

.sidebar .icon-button:hover,
.settings-button:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-ink-strong);
}

.date-nav {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: 1px;
  align-content: start;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 2px 4px 4px 0;
}

.sidebar-action {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0 4px 18px;
}

.sidebar-start-button {
  width: min(100%, 184px);
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid rgba(240, 243, 246, 0.18);
  border-radius: var(--r-pill);
  background: rgba(240, 243, 246, 0.06);
  color: var(--sidebar-ink-strong);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  transition:
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.sidebar-start-button:hover {
  border-color: rgba(234, 88, 12, 0.72);
  background: var(--accent);
  color: #fff;
}

.sidebar-start-button:active {
  transform: translateY(1px);
}

.date-nav::-webkit-scrollbar {
  width: 6px;
}

.date-nav::-webkit-scrollbar-thumb {
  background: rgba(240, 243, 246, 0.1);
  border-radius: var(--r-pill);
}

.date-row {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-md);
  color: var(--sidebar-ink);
  text-align: left;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.date-row:hover {
  background: var(--sidebar-bg-hover);
  color: var(--sidebar-ink-strong);
}

.date-row.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-ink);
}

.date-row-select {
  min-width: 0;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 11px;
  border-radius: var(--r-sm);
  color: inherit;
  text-align: left;
}

.date-row-main {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.date-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}

.date-row-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: currentColor;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: 0.62;
  text-transform: uppercase;
}

.date-row-count {
  min-width: 34px;
  color: currentColor;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.72;
  text-align: right;
  font-feature-settings: "tnum";
}

.date-row-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0.62;
  transition: opacity var(--t-fast) var(--ease);
}

.date-row:hover .date-row-actions,
.date-row.active .date-row-actions {
  opacity: 1;
}

.date-row-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  color: currentColor;
  opacity: 0.72;
}

.date-row-icon svg {
  width: 13px;
  height: 13px;
}

.date-row-icon:hover {
  background: var(--sidebar-bg-hover);
  opacity: 1;
}

.date-row.active .date-row-icon:hover {
  background: var(--paper-tint);
}

.date-row-icon.danger:hover {
  color: var(--danger);
  background: rgba(190, 18, 60, 0.12);
}

.date-row-menu {
  position: absolute;
  top: 30px;
  right: 0;
  z-index: 90;
  width: 116px;
  display: grid;
  gap: 1px;
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: var(--sh-2);
}

.date-row-menu[hidden] {
  display: none;
}

.date-row-menu-item {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.date-row-menu-item:hover {
  background: var(--paper-tint);
}

.date-row-menu-item.danger:hover {
  color: var(--danger);
  background: #ffeef2;
}

.date-row-menu-item span:first-child {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  color: currentColor;
}

.date-row-menu-item svg {
  width: 14px;
  height: 14px;
}

.sidebar-foot {
  position: relative;
  flex: 0 0 auto;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--sidebar-rule);
}

.settings-button {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-md);
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--sidebar-ink);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.settings-button.active {
  background: var(--paper-card);
  color: var(--ink);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.settings-button.active:hover {
  background: var(--paper-card);
  color: var(--ink);
}

.settings-button span:first-child {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.settings-button span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40px;
  z-index: 70;
  display: grid;
  gap: 0;
  padding: 4px;
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: 0 -14px 30px -10px rgba(13, 17, 23, 0.2), 0 -2px 6px rgba(13, 17, 23, 0.06);
}

.settings-menu[hidden] {
  display: none;
}

.settings-menu-item {
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  transition: background var(--t-fast) var(--ease);
}

.settings-menu-item:hover,
.settings-menu-item.active {
  background: var(--paper-tint);
}

.settings-menu-item span:first-child {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  color: var(--ink-3);
}

.settings-menu-item svg {
  width: 14px;
  height: 14px;
}

.settings-menu-item span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  min-height: 0;
  padding: 28px 36px 36px;
  display: grid;
  align-content: start;
  gap: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(1100px 600px at 110% -10%, rgba(234, 88, 12, 0.04), transparent 60%),
    var(--paper);
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--rule);
}

.topbar.topbar-empty {
  padding-bottom: 0;
  border-bottom: 0;
}

.sidebar-toggle {
  display: none;
  color: var(--ink-2);
}

.sidebar-toggle:hover,
.ghost-button:hover,
.row-icon:hover {
  background: var(--paper-tint);
}

.current-heading {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.current-heading h2,
.rail-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: 0;
}

.muted {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  font-feature-settings: "tnum";
}

.ghost-button {
  border: 1px solid transparent;
  color: var(--ink-2);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.content-grid.routine-visible {
  grid-template-columns: minmax(0, 1fr);
}

.day-column,
.routine-rail {
  min-width: 0;
}

.routine-rail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  width: min(380px, calc(100vw - 32px));
  padding: 26px 24px 28px;
  border-left: 1px solid var(--rule);
  background: var(--paper-card);
  box-shadow: -18px 0 42px rgba(13, 17, 23, 0.14);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

.rail-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.rail-head h2 {
  font-size: 30px;
}

.routine-close-button {
  flex: 0 0 auto;
}

.primary-button {
  min-height: 38px;
  padding: 0 15px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.dialog {
  width: min(100% - 32px, 380px);
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: var(--sh-2);
}

.dialog::backdrop {
  background: rgba(13, 17, 23, 0.32);
}

.dialog form {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.dialog header,
.dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.05;
}

.dialog label {
  display: grid;
  gap: 8px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dialog input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper-card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  font-feature-settings: "tnum";
}

.dialog input:hover {
  border-color: var(--rule-strong);
}

.dialog input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.date-stepper {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
}

.date-step-button {
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper-tint);
  color: var(--ink-2);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  transition:
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.date-step-button:hover {
  border-color: var(--rule-strong);
  background: var(--paper-deep);
  color: var(--ink);
}

.date-step-button:active {
  transform: translateY(1px);
}

.date-today-button {
  justify-self: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease);
}

.date-today-button:hover {
  background: var(--accent-tint);
  color: var(--accent-strong);
}

.security-dialog {
  width: min(100% - 32px, 460px);
}

.security-dialog-body {
  display: grid;
  gap: 20px;
  padding: 20px;
}

.security-dialog-body > header,
.security-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.security-form {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.security-form label {
  display: grid;
  gap: 8px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.security-form .button {
  width: 100%;
  margin-top: 2px;
}

.security-section {
  display: grid;
  gap: 12px;
}

.security-section h4 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.passkey-add {
  margin-bottom: 0;
}

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

.passkey-row {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.passkey-main {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.passkey-name,
.passkey-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.passkey-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.passkey-sub {
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
}

.form-message {
  min-height: 18px;
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 600;
}

.dialog-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  color: var(--ink-3);
}

.dialog-close:hover {
  background: var(--paper-tint);
  color: var(--ink);
}

.button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button.primary {
  background: var(--ink);
  color: var(--paper);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary {
  background: var(--paper-tint);
  color: var(--ink-2);
}

.button.secondary:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

.quick-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  margin-bottom: 14px;
}

.quick-add input:disabled {
  color: var(--ink-faint);
  background: var(--paper-tint);
}

.quick-add button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  transition:
    background var(--t-fast) var(--ease),
    opacity var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.quick-add button:hover:not(:disabled) {
  background: var(--accent-strong);
}

.quick-add button:disabled {
  cursor: default;
  opacity: 0.38;
}

.task-list,
.routine-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.task-row,
.routine-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 4px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.routine-row {
  grid-template-columns: 30px minmax(0, 1fr) auto;
}

.routine-row.sortable-enabled {
  touch-action: pan-y;
}

.routine-sorting-active .routine-row.sortable-enabled {
  cursor: grabbing;
}

/* Promote rows to their own layers only while a drag is active, so the FLIP
   shuffle composites smoothly; dropped automatically when the class is removed. */
.routine-dnd-active .routine-row.sortable-enabled {
  will-change: transform;
}

.routine-row.sortable-source {
  position: relative;
  opacity: 1;
  transform: none;
  border-bottom-color: transparent;
  background: var(--accent-tint);
  box-shadow:
    inset 3px 0 0 var(--accent),
    inset 0 1px 0 rgba(234, 88, 12, 0.24),
    inset 0 -1px 0 rgba(234, 88, 12, 0.24);
  outline: 1px dashed rgba(234, 88, 12, 0.42);
  outline-offset: -3px;
  pointer-events: none;
}

.routine-row.sortable-source > * {
  visibility: hidden;
}

.routine-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.routine-drag-handle {
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.routine-drag-handle:active {
  cursor: grabbing;
}

.routine-sorting-active .routine-drag-handle {
  cursor: grabbing;
}

.sortable-overlay {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  margin: 0;
  pointer-events: none;
  transform-origin: top left;
  transition: none;
  will-change: transform;
  user-select: none;
}

.sortable-overlay * {
  user-select: none;
}

.routine-drag-overlay {
  list-style: none;
  background: var(--paper-card);
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  opacity: 0.98;
  cursor: grabbing;
}

.routine-drag-overlay .routine-actions {
  opacity: 0.45;
}

.check-control {
  position: relative;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
}

.check-control input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 24px;
  height: 24px;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.check-mark {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--rule-strong);
  border-radius: var(--r-pill);
  background: var(--paper-card);
  color: #fff;
  transition:
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}

.check-mark svg {
  width: 14px;
  height: 14px;
  display: block;
}

/* The tick is white at all times; visibility is driven purely by the dash
   offset so it "draws" in on check and "un-draws" on uncheck. pathLength="1"
   on the path makes the dash math resolution-independent. */
.check-mark svg path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset var(--t-base) var(--ease);
}

.check-control:hover .check-mark {
  border-color: var(--accent);
}

.check-control input:checked + .check-mark {
  border-color: var(--accent);
  background: var(--accent);
}

.check-control input:checked + .check-mark svg path {
  stroke-dashoffset: 0;
}

/* Springy press-and-settle, added by JS only on a user-initiated check so it
   never fires when completed rows render on load or on a day switch. */
.check-mark.check-pop {
  animation: check-pop var(--t-base) var(--ease);
}

@keyframes check-pop {
  0% { transform: scale(1); }
  35% { transform: scale(0.86); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.row-title {
  min-height: 38px;
  padding: 7px 9px;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}

.task-title {
  min-width: 0;
  padding: 7px 9px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t-base) var(--ease);
}

/* Strikethrough that wipes across the text instead of snapping in. The line
   lives on an inner span so it hugs the text width rather than the cell. */
.task-title-text {
  position: relative;
}

.task-title-text::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  transform: translateY(-50%) scaleX(0);
  transform-origin: left center;
  transition: transform var(--t-base) var(--ease);
  pointer-events: none;
}

.task-row.completed .task-title {
  color: var(--ink-faint);
}

.task-row.completed .task-title-text::after {
  transform: translateY(-50%) scaleX(1);
}

@media (prefers-reduced-motion: reduce) {
  .check-mark,
  .check-mark svg path,
  .task-title,
  .task-title-text::after {
    transition-duration: 1ms;
  }

  .check-mark.check-pop {
    animation: none;
  }
}

.row-icon {
  width: 30px;
  height: 30px;
  color: var(--ink-3);
}

.row-icon.danger:hover {
  color: var(--danger);
  background: #ffeef2;
}

.row-icon:disabled {
  cursor: default;
  opacity: 0.28;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  border-top: 1px solid var(--rule-soft);
  color: var(--ink-3);
}

.empty-state h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  padding: 10px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--sh-2);
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(82vw, var(--sidebar-width));
    transform: translateX(-100%);
    transition: transform var(--t-base) var(--ease);
  }

  .app-shell.drawer-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: block;
    background: rgba(13, 17, 23, 0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-base) var(--ease);
  }

  .app-shell.drawer-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle {
    display: grid;
  }

  .main {
    padding: 22px 18px 28px;
  }

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

  .content-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  .routine-rail {
    width: min(88vw, 360px);
    padding: 22px 18px 24px;
    border-left: 1px solid var(--rule);
  }
}

@media (max-width: 560px) {
  .login-panel {
    padding: 34px 26px 28px;
  }

  .login-panel h1 {
    font-size: 48px;
  }

  .current-heading h2 {
    font-size: 36px;
  }

  .rail-head h2 {
    font-size: 28px;
  }

  .topbar {
    gap: 12px;
  }

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