/* Dayline — styles. Light and dark themes, mobile first. */

:root {
  color-scheme: light;
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f5f6fb;
  --border: #e3e6ef;
  --border-strong: #ccd1e0;
  --text: #151823;
  --text-muted: #5f6679;
  --text-faint: #8a91a5;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eceeff;
  --accent-contrast: #ffffff;
  --event: #0d9488;
  --event-soft: #e4f6f4;
  --warn: #c26a05;
  --warn-soft: #fff2dc;
  --danger: #d92d20;
  --danger-soft: #fdeceb;
  --success: #16a34a;
  --success-soft: #e6f6ec;
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, 0.06);
  --shadow: 0 6px 18px rgba(20, 24, 40, 0.09);
  --shadow-lg: 0 18px 48px rgba(20, 24, 40, 0.2);
  --radius: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1117;
  --surface: #171a23;
  --surface-2: #1f2330;
  --border: #2a2f3e;
  --border-strong: #3b4154;
  --text: #e9ebf2;
  --text-muted: #a0a8bc;
  --text-faint: #7d869c;
  --accent: #8b95ff;
  --accent-hover: #a9b1ff;
  --accent-soft: #252a4a;
  --accent-contrast: #0f1117;
  --event: #2dd4bf;
  --event-soft: #12312f;
  --warn: #fbbf24;
  --warn-soft: #33290f;
  --danger: #f87171;
  --danger-soft: #3a1c1c;
  --success: #4ade80;
  --success-soft: #14301f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55);
}

/* ------------------------------------------------------------ base */

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
p,
ul,
dl,
dd {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

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

a {
  color: var(--accent);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 5px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.icon {
  flex: none;
}

.is-collapsed {
  transform: rotate(-90deg);
}

/* ------------------------------------------------------------ layout */

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

.sidebar {
  display: none;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(76px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) 14px 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.topbar-brand img,
.brand img,
.auth-brand img,
.boot img {
  border-radius: 9px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 2px 2px 0;
}

.view-head-text {
  min-width: 0;
}

.view-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.view-sub {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 14px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
}

/* ------------------------------------------------------------ navigation */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  padding: 6px 4px calc(6px + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 10px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
}

.nav-item.is-active {
  color: var(--accent);
}

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(82px + var(--safe-bottom));
  z-index: 31;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-lg);
  transition: transform 0.1s;
}

.fab:active {
  transform: scale(0.94);
}

/* ------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 8px 14px;
}

.card-head h2 {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.head-sub {
  margin-left: 6px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-faint);
}

.count {
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.card-empty {
  padding: 4px 14px 14px;
  color: var(--text-faint);
  font-size: 14px;
}

.card-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
}

.card-toggle h2 {
  flex: none;
}

.card-toggle .icon {
  transition: transform 0.15s;
}

.card-overdue {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
}

.card-overdue .card-head h2 {
  color: var(--danger);
}

.day-grid,
.day-col-main,
.day-col-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ------------------------------------------------------------ rows */

.row {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 6px 10px 12px;
  border-top: 1px solid var(--border);
}

.card > .row:first-child,
.card-head + .row,
.quick-add + .row {
  border-top: 0;
}

.row:hover {
  background: var(--surface-2);
}

.row-time {
  flex: none;
  width: 62px;
  padding-top: 2px;
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.row-time-start {
  font-weight: 650;
  color: var(--text);
}

.row-time-end,
.row-time-allday {
  font-size: 11.5px;
  color: var(--text-faint);
}

.check {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

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

.check:active {
  transform: scale(0.88);
}

.check.is-checked {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.kind-event .check {
  border-radius: 7px;
}

.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}

.row-title {
  font-size: 15px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.kind-event .row-title {
  font-weight: 650;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.chip-warn {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
}

.is-done .row-title {
  text-decoration: line-through;
  color: var(--text-faint);
}

.is-done .chip {
  opacity: 0.6;
}

.row-more {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-faint);
}

.row-more:hover {
  background: var(--border);
  color: var(--text);
}

.row-action {
  flex: none;
  align-self: center;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.kind-event {
  box-shadow: inset 3px 0 0 var(--event);
}

.prio-1 {
  box-shadow: inset 3px 0 0 var(--warn);
}

.prio-2 {
  box-shadow: inset 3px 0 0 var(--danger);
}

/* ------------------------------------------------------------ checklists */

.row {
  flex-wrap: wrap;
}

.row.has-time {
  --row-indent: 104px;
}

.check-sm {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

/* Checklist items are always round, also inside an event row. */
.row-checklist .check,
.checklist .check {
  border-radius: 50%;
}

.row-checklist-toggle {
  flex: none;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-checklist-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.row-checklist-toggle.is-open {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.row-checklist {
  flex-basis: 100%;
  min-width: 0;
  margin-left: var(--row-indent, 32px);
  padding: 2px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.row-checklist-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 0;
}

.row-checklist-title {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  overflow-wrap: anywhere;
}

.row-checklist-item.is-done .row-checklist-title {
  color: var(--text-faint);
  text-decoration: line-through;
}

.checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.checklist-progress {
  font-size: 12.5px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.checklist-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-title {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 16px;
}

.checklist-title:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.checklist-item.is-done .checklist-title {
  color: var(--text-faint);
  text-decoration: line-through;
}

.checklist-add {
  display: flex;
  gap: 8px;
}

.checklist-add .input {
  flex: 1;
  min-width: 0;
}

/* ------------------------------------------------------------ quick add */

.quick-add {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.quick-add:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.quick-add-icon {
  display: grid;
  place-items: center;
  color: var(--text-faint);
}

.quick-add-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 8px 0;
  font-size: 16px;
  outline: none;
}

.quick-add-input::placeholder {
  color: var(--text-faint);
}

.card .quick-add {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 650;
  transition: background 0.15s, transform 0.08s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

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

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--border);
}

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

.btn-sm {
  padding: 7px 12px;
  font-size: 13.5px;
  border-radius: 9px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 7px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 650;
}

.link-btn:hover {
  background: var(--accent-soft);
}

.back-btn {
  flex-basis: 100%;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 2px;
  border-radius: 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}

/* ------------------------------------------------------------ forms */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface);
  font-size: 16px;
}

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

.input:disabled {
  opacity: 0.6;
}

textarea.input {
  resize: vertical;
  min-height: 72px;
}

.input-compact {
  padding: 7px 10px;
  border-radius: 9px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-hint {
  font-size: 12.5px;
  color: var(--text-faint);
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.chip-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.segmented {
  display: flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.segmented button {
  flex: 1;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 650;
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.more-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: -6px;
  padding: 4px 6px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 650;
}

.more-toggle .icon {
  transition: transform 0.15s;
}

.more-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.icon-choice {
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 20px;
}

.icon-choice.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.switch {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  flex: none;
  position: relative;
  width: 44px;
  height: 26px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.15s;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.switch-text small {
  color: var(--text-muted);
  font-size: 13px;
}

/* ------------------------------------------------------------ sheets (modals) */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(12, 14, 24, 0.5);
  animation: fade 0.15s ease;
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow-lg);
  outline: none;
  animation: rise 0.2s ease;
}

.sheet-wide {
  max-width: 720px;
}

.sheet-grabber {
  width: 40px;
  height: 4px;
  margin: 8px auto 0;
  border-radius: 99px;
  background: var(--border-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 8px 18px;
}

.sheet-head h2 {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-body {
  padding: 4px 18px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--border);
}

.spacer {
  flex: 1;
}

.sheet-note {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 11px;
  color: var(--text);
  font-size: 15px;
  font-weight: 550;
  text-align: left;
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item .icon {
  color: var(--text-muted);
}

.menu-item.is-danger,
.menu-item.is-danger .icon {
  color: var(--danger);
}

.postpone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.postpone-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-align: left;
}

.postpone-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.postpone-option small {
  color: var(--text-muted);
  font-size: 12.5px;
}

.sheet-body > .btn-block {
  margin-top: 14px;
}

/* ------------------------------------------------------------ toasts */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 14px;
  border-radius: 12px;
  background: #1b1e2b;
  color: #f3f4f8;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.2s ease;
}

.toast-text {
  flex: 1;
  min-width: 0;
}

.toast-action {
  padding: 4px 7px;
  border-radius: 6px;
  color: #a9b1ff;
  font-weight: 700;
}

.toast-close {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #9aa2b6;
}

/* ------------------------------------------------------------ status and banners */

.sync-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.sync-chip.is-demo {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.sync-chip.is-offline {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
}

.sync-chip.is-error {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

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

.demo-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--accent-soft);
  color: var(--text-muted);
  font-size: 13px;
}

.demo-banner .icon {
  color: var(--accent);
}

.demo-banner span {
  flex: 1;
  min-width: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  width: min(60vw, 320px);
  padding: 2px 4px 2px 10px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-muted);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 7px 0;
  font-size: 16px;
  outline: none;
}

@media (max-width: 520px) {
  .topbar.has-search .topbar-brand,
  .topbar.has-search .sync-chip span {
    display: none;
  }

  .topbar.has-search .search-box {
    width: 100%;
  }
}

/* ------------------------------------------------------------ progress ring */

.ring {
  position: relative;
  flex: none;
  width: 46px;
  height: 46px;
}

.ring svg {
  display: block;
}

.ring-track {
  stroke: var(--border);
}

.ring-value {
  stroke: var(--success);
  transition: stroke-dashoffset 0.4s ease;
}

.ring-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ calendar */

.calendar-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 4px;
}

.calendar-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.calendar {
  width: calc(100% - 16px);
  margin: 0 8px 10px;
  border-collapse: collapse;
  table-layout: fixed;
}

.calendar th {
  padding: 6px 0;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.calendar td {
  padding: 2px;
}

.cal-day {
  width: 100%;
  min-height: 46px;
  padding: 5px 2px 4px;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text);
}

.cal-day:hover {
  background: var(--surface-2);
}

.cal-day.is-outside {
  color: var(--text-faint);
}

.cal-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.cal-day.is-today .cal-num {
  background: var(--accent-soft);
  color: var(--accent);
}

.cal-day.is-selected {
  background: var(--accent);
  color: var(--accent-contrast);
}

.cal-day.is-selected.is-today .cal-num {
  background: transparent;
  color: inherit;
}

.cal-dots {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 8px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot-event {
  background: var(--event);
}

.dot-task {
  background: var(--accent);
}

.dot-done {
  background: var(--border-strong);
}

.is-selected .dot-event {
  background: #ffffff;
}

.is-selected .dot-task,
.is-selected .dot-done {
  background: rgba(255, 255, 255, 0.7);
}

.cal-more {
  color: var(--text-faint);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
}

.calendar-layout,
.calendar-agenda {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ------------------------------------------------------------ lists */

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

.list-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.12s;
}

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

.list-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.list-icon {
  font-size: 22px;
}

.list-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-card-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.list-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text-muted);
  font-size: 14px;
}

.list-preview li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-preview li::before {
  content: '○ ';
  color: var(--text-faint);
}

.list-preview .list-preview-more::before {
  content: '';
}

.list-preview-more {
  color: var(--text-faint);
  font-size: 13px;
}

.bar {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-2);
}

.bar::-webkit-progress-bar {
  background: var(--surface-2);
  border-radius: 99px;
}

.bar::-webkit-progress-value {
  background: var(--success);
  border-radius: 99px;
}

.bar::-moz-progress-bar {
  background: var(--success);
  border-radius: 99px;
}

.badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.is-hidden-list {
  border-style: dashed;
}

.hidden-section,
.hidden-lists {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hidden-toggle {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 600;
}

.hidden-toggle:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

/* ------------------------------------------------------------ empty state */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.empty-art {
  width: 110px;
  height: 82px;
  color: var(--text-faint);
}

.empty-title {
  font-size: 16px;
  font-weight: 700;
}

.empty-sub {
  max-width: 36ch;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ------------------------------------------------------------ settings */

.setting-note {
  padding: 0 14px 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

.card > .btn,
.card > .segmented,
.card > .field {
  margin: 0 14px 14px;
}

.card > .field {
  width: auto;
}

.card > .field-error {
  padding: 0 14px 12px;
}

.status-list {
  display: grid;
  gap: 6px;
  margin: 0 14px 12px;
  font-size: 14px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.status-list dd {
  font-weight: 600;
}

.about {
  padding-top: 6px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ------------------------------------------------------------ sign in */

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand img {
  border-radius: 14px;
}

.auth-brand h1 {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.auth-brand p {
  color: var(--text-muted);
  font-size: 14px;
}

.auth-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 14px;
}

.auth-foot {
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
}

.boot img {
  border-radius: 16px;
  animation: pulse 1.6s ease-in-out infinite;
}

/* ------------------------------------------------------------ motion */

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
}

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

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------ larger screens */

@media (min-width: 640px) {
  .backdrop {
    align-items: center;
    padding: 24px;
  }

  .sheet {
    border-radius: 20px;
  }

  .sheet-grabber {
    display: none;
  }

  .sheet-head {
    padding-top: 16px;
  }

  .sheet-foot {
    padding-bottom: 14px;
  }

  .lists-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

@media (min-width: 900px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    flex: none;
    width: 232px;
    height: 100vh;
    height: 100dvh;
    position: sticky;
    top: 0;
    padding: 20px 14px;
    background: var(--surface);
    border-right: 1px solid var(--border);
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 18px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .side-nav .nav-item {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-muted);
    font-size: 14px;
  }

  .side-nav .nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
  }

  .side-nav .nav-item.is-active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .sidebar-foot {
    margin-top: auto;
    padding: 10px;
  }

  .bottom-nav,
  .topbar-brand {
    display: none;
  }

  .topbar {
    position: static;
    justify-content: flex-end;
    padding: 14px 28px 0;
    background: transparent;
    border-bottom: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .main {
    padding-bottom: 0;
  }

  .content {
    padding: 10px 28px 56px;
  }

  .demo-banner {
    padding-right: 28px;
    padding-left: 28px;
  }

  .fab {
    right: 32px;
    bottom: 32px;
  }

  .toasts {
    bottom: 32px;
  }

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

  .calendar-layout {
    display: grid;
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
    align-items: start;
    gap: 18px;
  }

  .calendar-card {
    position: sticky;
    top: 18px;
  }
}
