:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eceff3;
  --text: #171a20;
  --muted: #68707d;
  --border: #dfe3e8;
  --shadow: 0 12px 34px rgba(20, 24, 32, 0.08);
  --primary: #335cff;
  --primary-strong: #2648d8;
  --primary-soft: #e8edff;
  --danger: #c43c4c;
  --danger-soft: #fdebed;
  --success: #21845d;
  --warning: #9a6416;
  --radius: 18px;
  --radius-small: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #171a20;
  --surface-2: #1d2128;
  --surface-3: #262b34;
  --text: #f5f7fa;
  --muted: #a1a9b5;
  --border: #2d333d;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
  --primary: #6f8cff;
  --primary-strong: #8ca2ff;
  --primary-soft: #242d55;
  --danger: #ff7b89;
  --danger-soft: #42242a;
  --success: #62d5a3;
  --warning: #f0b55b;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #0f1115;
    --surface: #171a20;
    --surface-2: #1d2128;
    --surface-3: #262b34;
    --text: #f5f7fa;
    --muted: #a1a9b5;
    --border: #2d333d;
    --shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
    --primary: #6f8cff;
    --primary-strong: #8ca2ff;
    --primary-soft: #242d55;
    --danger: #ff7b89;
    --danger-soft: #42242a;
    --success: #62d5a3;
    --warning: #f0b55b;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% -10%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 34rem),
    var(--bg);
  color: var(--text);
}

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

button {
  color: inherit;
}

button,
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent);
  outline-offset: 2px;
}

[hidden],
.is-hidden {
  display: none !important;
}

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

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 10px max(18px, calc((100vw - 1160px) / 2));
  border-bottom: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 4px;
  border: 0;
  background: transparent;
  text-align: left;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--text);
  color: var(--surface);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.06em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

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

.topbar-actions,
.button-row,
.tracker-actions,
.hero-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.button-row.wrap {
  flex-wrap: wrap;
}

.sync-chip {
  display: inline-flex;
  align-items: center;
  max-width: 240px;
  gap: 7px;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  box-shadow: 0 4px 14px rgba(20, 24, 32, 0.04);
}

.sync-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 800;
}

.sync-syncing .sync-icon {
  animation: spin 1s linear infinite;
}

.sync-synced .sync-icon {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}

.sync-error .sync-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.pending-badge {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 750;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
}

.icon-button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.icon-button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.app-main {
  width: min(1160px, calc(100% - 32px));
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: 34px 0 calc(104px + var(--safe-bottom));
}

.install-invite {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding: 14px 16px;
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface));
}

.install-invite-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: var(--text);
  color: var(--surface);
  font-weight: 850;
  letter-spacing: -0.05em;
}

.install-invite-copy strong,
.install-invite-copy span {
  display: block;
}

.install-invite-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.install-invite-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.install-status {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.success-text {
  color: var(--success);
}

.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.view-heading h1,
.empty-hero h1 {
  margin: 4px 0 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1;
  letter-spacing: -0.055em;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

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

.tracker-card,
.card-surface {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tracker-card {
  position: relative;
  overflow: hidden;
  padding: 19px;
}

.tracker-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: transparent;
  content: "";
}

.tracker-card.is-running::before {
  background: var(--primary);
}

.tracker-card.is-over::before {
  background: var(--danger);
}

.tracker-card-head,
.tracker-status,
.running-row,
.modal-header,
.section-title,
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tracker-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.tracker-icon {
  display: grid;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 23px;
}

.tracker-title strong,
.tracker-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracker-title strong {
  font-size: 16px;
}

.tracker-title small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.total-button {
  display: flex;
  max-width: 100%;
  align-items: baseline;
  gap: 7px;
  margin: 26px 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.current-total {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 820;
  letter-spacing: -0.055em;
}

.goal-separator,
.target-total {
  color: var(--muted);
}

.target-total {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 280ms ease;
}

.is-over .progress-track span {
  background: var(--danger);
}

/* Active timers update their allocation locally. Avoid repeatedly animating a
   nearly-identical width on desktop while the stopwatch is running. */
.tracker-card.is-running .progress-track span {
  transition: none;
}

.tracker-status {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.running-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.running-row {
  justify-content: flex-start;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--primary-soft);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 45%, transparent);
  animation: pulse 1.7s infinite;
}

.running-label {
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
}

.live-clock {
  margin-right: auto;
  font-variant-numeric: tabular-nums;
}

.tracker-actions {
  margin-top: 18px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 720;
  line-height: 1.15;
}

.button:hover,
.icon-button:hover,
.sync-chip:hover,
.record-row:hover,
.quick-log-item:hover {
  filter: brightness(0.98);
  transform: translateY(-1px);
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.button.danger {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: var(--danger-soft);
  color: var(--danger);
}

.button.quiet {
  background: transparent;
}

.button.compact {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 13px;
}

.grow {
  flex: 1;
}

.empty-hero {
  display: grid;
  min-height: 62vh;
  place-content: center;
  justify-items: center;
  max-width: 670px;
  margin: auto;
  text-align: center;
}

.hero-icon {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 24px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 40px;
}

.empty-hero p {
  max-width: 560px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.privacy-note,
.fine-print {
  color: var(--muted) !important;
  font-size: 12px !important;
  line-height: 1.5;
}

.filter-bar {
  display: grid;
  grid-template-columns: 1fr 1fr minmax(220px, 1.35fr);
  gap: 12px;
  margin-bottom: 26px;
  padding: 14px;
  box-shadow: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 690;
}

label > span small {
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--text);
}

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

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.records-list,
.settings-grid,
.stack-form,
.period-history,
.detail-records {
  display: grid;
  gap: 16px;
}

.record-day h2 {
  margin: 22px 4px 9px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.record-stack {
  overflow: hidden;
  box-shadow: none;
}

.record-row {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
}

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

.record-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 20px;
}

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

.record-main strong,
.record-main small,
.record-note {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-main small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.record-note {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.record-value {
  font-weight: 790;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.record-value.negative {
  color: var(--danger);
}

.record-value.running {
  color: var(--primary);
}

.chevron {
  color: var(--muted);
  font-size: 22px;
}

.empty-state {
  padding: 38px 24px;
  text-align: center;
}

.empty-state h2 {
  margin: 0;
}

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

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.settings-card {
  padding: 20px;
}

.section-title {
  justify-content: flex-start;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-title > span {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 20px;
}

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

.section-title h2 {
  font-size: 17px;
}

.section-title p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

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

.field-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-list {
  display: grid;
  gap: 0;
  margin: 0 0 18px;
}

.stats-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.stats-list dt {
  color: var(--muted);
}

.stats-list dd {
  margin: 0;
  font-weight: 720;
  text-align: right;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.sync-summary {
  display: grid;
  gap: 3px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.sync-summary span,
.sync-summary small {
  color: var(--muted);
  font-size: 12px;
}

.error-text {
  color: var(--danger) !important;
}

.inline-form {
  display: flex;
  align-items: end;
  gap: 10px;
  margin-top: 15px;
}


.auth-code-panel {
  display: grid;
  gap: 14px;
  margin-top: 15px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.auth-code-copy {
  display: grid;
  gap: 3px;
}

.auth-code-copy span,
.auth-help {
  color: var(--muted);
}

.auth-code-form {
  gap: 10px;
}

.auth-code-form input[name="token"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  font-weight: 760;
  letter-spacing: 0.12em;
}

.auth-code-actions {
  margin-top: 0;
}

hr {
  height: 1px;
  margin: 20px 0;
  border: 0;
  background: var(--border);
}

.bottom-nav {
  position: fixed;
  z-index: 25;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  padding: 7px 14px calc(7px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 5px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
}

.bottom-nav button span {
  font-size: 19px;
}

.bottom-nav button small {
  font-size: 10px;
  font-weight: 700;
}

.bottom-nav button.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  align-items: center;
  justify-items: center;
  overflow-y: auto;
  padding: 22px;
  background: rgba(7, 9, 13, 0.6);
  backdrop-filter: blur(8px);
}

.modal-panel {
  width: min(580px, 100%);
  max-height: min(90vh, 860px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.36);
}

.modal-panel.wide {
  width: min(820px, 100%);
}

.modal-header {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}

.modal-header h2,
.modal-header p {
  margin: 0;
}

.modal-header h2 {
  font-size: 20px;
  letter-spacing: -0.025em;
}

.modal-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.modal-body {
  padding: 20px;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding-top: 10px;
}

.modal-footer {
  position: sticky;
  bottom: 0;
  margin: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}

.icon-name-row {
  display: flex;
  align-items: end;
  gap: 12px;
}

.icon-field {
  flex: 0 0 82px;
}

.icon-field input {
  text-align: center;
  font-size: 22px;
}

.target-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  color: var(--text);
}

.target-toggle input {
  width: 18px;
  min-height: 18px;
}

.target-fields {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-2);
}

.detail-body {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
}

.history-row {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.history-row.current {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: var(--primary-soft);
}

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

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

.detail-records h3 {
  margin: 0;
  font-size: 14px;
}

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

.quick-log-item {
  display: grid;
  min-height: 112px;
  place-content: center;
  justify-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-2);
}

.quick-log-item span {
  font-size: 28px;
}

.quick-log-item small {
  color: var(--muted);
}

.choice-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
}

.choice-card input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.choice-card span strong,
.choice-card span small {
  display: block;
}

.choice-card span small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.4;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 22px;
  max-width: min(390px, calc(100vw - 40px));
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--text);
  color: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700;
  animation: toast-in 180ms ease-out;
}

.toast.error {
  background: var(--danger);
  color: #fff;
}

.fatal-error {
  display: grid;
  min-height: 100vh;
  place-content: center;
  padding: 30px;
  text-align: center;
}

.fatal-error p {
  color: var(--muted);
}

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

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 62px;
    padding: 8px 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand strong {
    font-size: 15px;
  }

  .sync-chip-label {
    display: none;
  }

  .sync-chip {
    padding: 6px;
  }

  .app-main {
    width: min(100% - 24px, 700px);
    padding-top: 23px;
  }

  .install-invite {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 11px;
    padding: 13px;
  }

  .install-invite-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .view-heading {
    align-items: center;
    margin-bottom: 18px;
  }

  .view-heading h1 {
    font-size: 34px;
  }

  .tracker-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .tracker-card {
    padding: 16px;
  }

  .current-total {
    font-size: 34px;
  }

  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .filter-search {
    grid-column: 1 / -1;
  }

  .detail-body {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    display: grid;
  }

  .toast {
    right: 12px;
    bottom: calc(78px + var(--safe-bottom));
    left: 12px;
    max-width: none;
  }

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

  .modal-panel,
  .modal-panel.wide {
    width: 100%;
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .field-row.three {
    grid-template-columns: 1fr 1fr;
  }

  .field-row.three > :first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 470px) {
  .tracker-actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .running-row {
    flex-wrap: wrap;
  }

  .running-row .button {
    margin-left: auto;
  }

  .filter-bar,
  .field-row,
  .field-row.three {
    grid-template-columns: 1fr;
  }

  .field-row.three > :first-child,
  .filter-search {
    grid-column: auto;
  }

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

  .record-value {
    grid-column: 2;
    justify-self: start;
    color: var(--primary);
  }

  .chevron {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .quick-log-grid {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-actions > .button-row,
  .modal-actions > .button-row .button {
    width: 100%;
  }

  .modal-actions > .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }
}

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

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  margin-right: 14px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.desktop-nav button {
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.desktop-nav button.active {
  background: var(--primary-soft);
  color: var(--primary);
}

@media (max-width: 760px) {
  .desktop-nav {
    display: none;
  }
}

.archived-list {
  display: grid;
  gap: 0.65rem;
}

.archived-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--surface-2);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.archived-row:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

.archived-row small {
  color: var(--muted);
}
