:root {
  --bg: #0b1020;
  --bg2: #111827;
  --card: rgba(255, 255, 255, 0.085);
  --card-strong: rgba(255, 255, 255, 0.13);
  --text: #f8fafc;
  --muted: rgba(248, 250, 252, 0.66);
  --soft: rgba(248, 250, 252, 0.12);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #c4b5fd;
  --accent2: #67e8f9;
  --danger: #fb7185;
  --success: #86efac;
  --warning: #fde68a;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --bottom-nav-height: 88px;
  --page-bg:
    radial-gradient(circle at 20% 0%, rgba(196, 181, 253, 0.22), transparent 34%),
    radial-gradient(circle at 90% 12%, rgba(103, 232, 249, 0.15), transparent 30%),
    linear-gradient(180deg, var(--bg), var(--bg2));
  font-family: ui-rounded, "SF Pro Rounded", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--page-bg);
  background-color: var(--bg2);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  overscroll-behavior: none;
  background: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--page-bg);
  background-color: var(--bg2);
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: 100%;
  max-width: 760px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 18px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 4px 2px;
}

.topbar > div:first-child {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: 0;
  line-height: 0.96;
}

body[data-screen="capture"] .topbar {
  margin-bottom: 8px;
}

body[data-screen="capture"] .topbar h1 {
  font-size: 28px;
}

body[data-screen]:not([data-screen="capture"]) .topbar .eyebrow {
  display: none;
}

button.topbar-greeting {
  cursor: pointer;
  text-align: right;
  font: inherit;
  position: relative;
}

.topbar-greeting {
  min-width: 78px;
  max-width: 152px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
}

.topbar-greeting > span:first-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-greeting strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.settings-hint {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.96);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  pointer-events: none;
}

.topbar-lang {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text);
  opacity: 0.75;
  vertical-align: middle;
}

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

.screen {
  animation: fadeIn 160ms ease-out;
}

.panel,
.item-card,
.empty-state {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card-strong), var(--card));
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.capture-pad {
  display: grid;
  gap: 10px;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px;
  border-radius: 24px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(248, 250, 252, 0.54));
  box-shadow: 0 22px 70px rgba(31, 38, 68, 0.14);
}

.capture-command {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.capture-mode-tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.capture-mode-tabs .preset-btn {
  min-width: 64px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.52);
  color: rgba(15, 23, 42, 0.58);
  font-size: 12px;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.preset-btn,
.action-btn,
.filter-btn,
.settings-action,
.primary-btn {
  min-width: 0;
}

.capture-mode-tabs .preset-btn.active {
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.09);
}

.capture-side-control {
  position: relative;
  margin-left: auto;
  flex: 0 0 104px;
  height: 44px;
  min-width: 0;
  align-self: center;
}

.capture-category-select,
.capture-side-placeholder {
  position: absolute;
  inset: 0;
}

.capture-category-select {
  min-width: 0;
  width: 100%;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(124, 58, 237, 0.16);
  outline: 0;
  padding: 0 24px 0 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.22));
  color: rgba(79, 70, 229, 0.82);
  font-size: 16px;
  font-weight: 700;
  box-shadow: none;
}

.capture-category-select.is-hidden,
.capture-side-placeholder.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.capture-writing-surface {
  min-height: 220px;
  border-radius: 21px;
  border: 1px solid rgba(15, 23, 42, 0.07);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.38));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 -36px 70px rgba(196, 181, 253, 0.08);
}

.capture-pad textarea.capture-input {
  width: 100%;
  min-height: 220px;
  max-height: min(46dvh, 420px);
  overflow-y: auto;
  resize: none;
  border: 0;
  outline: 0;
  border-radius: 21px;
  padding: 20px;
  background: transparent;
  color: #0f172a;
  font-size: 21px;
  line-height: 1.45;
  letter-spacing: -0.015em;
  box-shadow: none;
}

.capture-pad textarea.capture-input::placeholder {
  color: rgba(15, 23, 42, 0.36);
}

.capture-pad .capture-action-bar {
  position: sticky;
  bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 12px);
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px;
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 14px 42px rgba(15, 23, 42, 0.10);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.capture-pad .capture-action-bar .primary-btn {
  min-height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fafc, #dbeafe 52%, #c4b5fd);
  color: #111827;
  box-shadow: 0 10px 28px rgba(196, 181, 253, 0.24);
}

.capture-pad .capture-action-bar .char-count {
  color: rgba(15, 23, 42, 0.46);
}

.char-count {
  min-width: 42px;
  color: rgba(15, 23, 42, 0.54);
  text-align: center;
  font-size: 12px;
  font-weight: 850;
}

.primary-btn {
  width: 100%;
  min-height: 54px;
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fafc, #dbeafe 48%, #c4b5fd);
  color: #0f172a;
  font-size: 17px;
  font-weight: 850;
  letter-spacing: -0.025em;
  box-shadow: 0 14px 32px rgba(196, 181, 253, 0.25);
}

.primary-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.quick-list {
  margin: 16px auto 0;
  max-width: 480px;
  display: grid;
  gap: 10px;
}

.quick-chip {
  position: relative;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 18px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.3;
  touch-action: pan-y;
}

.quick-chip .swipe-track {
  border-radius: 18px;
}

.quick-chip .swipe-foreground {
  padding: 13px 14px;
  display: grid;
  gap: 6px;
}

.panel {
  padding: 14px;
  display: grid;
  gap: 12px;
  overflow: visible;
}

.item-card {
  padding: 15px;
  box-shadow: none;
  border-radius: var(--radius-lg);
}

.item-main {
  display: grid;
  gap: 8px;
}

.inbox-card.item-card {
  position: relative;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: var(--radius-lg);
  touch-action: pan-y;
}

.swipe-track {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card-strong), var(--card));
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.swipe-foreground {
  position: relative;
  z-index: 2;
  padding: 18px;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--card-strong), var(--card));
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

.swipe-foreground.dragging {
  transition: none;
}

.swipe-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 22px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  z-index: 1;
  opacity: 0;
  transition: opacity 120ms linear, background-color 120ms linear;
  pointer-events: none;
}

.swipe-bg-event {
  justify-content: flex-start;
  background: rgba(253, 230, 138, 0.16);
  color: var(--warning);
}

.swipe-bg-todo {
  justify-content: flex-end;
  background: rgba(134, 239, 172, 0.16);
  color: var(--success);
}

.swipe-bg-event.armed {
  background: rgba(253, 230, 138, 0.34);
}

.swipe-bg-todo.armed {
  background: rgba(134, 239, 172, 0.34);
}

.inbox-delete-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(248, 250, 252, 0.96);
  color: var(--danger);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  z-index: 5;
  cursor: pointer;
}

.inbox-delete-btn::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.item-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.42;
  letter-spacing: -0.018em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

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

.intent-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.intent-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.01em;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.intent-todo {
  color: var(--success);
  background: rgba(134, 239, 172, 0.14);
  border-color: rgba(134, 239, 172, 0.32);
}

.intent-event {
  color: var(--warning);
  background: rgba(253, 230, 138, 0.14);
  border-color: rgba(253, 230, 138, 0.32);
}

.suggest-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.01em;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.suggest-event {
  color: var(--warning);
  background: rgba(253, 230, 138, 0.14);
  border-color: rgba(253, 230, 138, 0.32);
}

.suggest-todo {
  color: var(--success);
  background: rgba(134, 239, 172, 0.14);
  border-color: rgba(134, 239, 172, 0.32);
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.actions.two {
  grid-template-columns: repeat(2, 1fr);
}

.action-btn {
  min-height: 44px;
  padding: 0 8px;
  border-radius: 15px;
  background: var(--soft);
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 750;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.action-btn.todo { color: var(--success); }
.action-btn.event { color: var(--warning); }
.action-btn.archive { color: var(--muted); }
.action-btn.delete { color: var(--danger); }

.inline-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.event-draft {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--soft);
}

.event-draft-hint {
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(253, 230, 138, 0.12);
  border: 1px solid rgba(253, 230, 138, 0.28);
  color: var(--warning);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.quick-dates {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-dates .filter-btn {
  flex: 1 1 auto;
  min-width: 0;
}

.time-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.time-chips .filter-btn {
  flex: 1 1 auto;
  min-width: 0;
}

.time-custom-input.hidden {
  display: none;
}

.time-chips .time-custom-input {
  flex-basis: 100%;
  margin-top: 4px;
}

.event-ro-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.event-ro-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.event-ro-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.event-icon-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--soft);
  color: var(--muted);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 17px;
  line-height: 1;
}

.event-icon-btn::after {
  content: "";
  position: absolute;
  inset: -5px;
}

.event-icon-btn.danger {
  color: var(--danger);
}

.event-draft label {
  display: grid;
  gap: 6px;
}

.event-draft label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inline-form input,
.inline-form select,
.event-draft input,
.event-draft select {
  min-height: 48px;
  width: 100%;
  border-radius: 15px;
  border: 1px solid var(--line);
  outline: 0;
  padding: 0 12px;
  color: var(--text);
  background: var(--soft);
}

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

.check-row {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: start;
  gap: 10px;
}

.todo-ro-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.todo-ro-text {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.todo-edit-card {
  display: grid;
  gap: 12px;
}

.check {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: #0f172a;
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.check::after {
  content: "";
  position: absolute;
  inset: -7px;
}

.check.completed {
  background: var(--success);
}

.completed-text {
  opacity: 0.54;
  text-decoration: line-through;
}

.filter-row {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 0 2px 14px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 750;
}

.filter-btn.active {
  background: rgba(248, 250, 252, 0.92);
  color: #0f172a;
}

.calendar-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card-strong), var(--card));
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.calendar-panel.collapsed {
  padding: 10px 12px 12px;
  border-radius: var(--radius-lg);
}

.calendar-header {
  min-height: 44px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.calendar-title-btn,
.day-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: 0;
  text-align: center;
}

.calendar-title-btn {
  min-height: 44px;
  border-radius: 15px;
  background: transparent;
  border: 0;
  font-weight: 800;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  background: var(--soft);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 28px;
  line-height: 1;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.calendar-panel.collapsed .calendar-weekdays {
  margin-top: 4px;
}

.calendar-weekdays span {
  min-height: 26px;
  display: grid;
  place-items: center;
}

.calendar-grid {
  gap: 6px;
}

.calendar-panel.collapsed .calendar-grid {
  gap: 4px;
}

.calendar-day {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
}

.calendar-panel.collapsed .calendar-day {
  border-radius: 999px;
  font-size: 14px;
}

.calendar-day.today {
  border-color: var(--line);
}

.calendar-day.selected {
  background: rgba(248, 250, 252, 0.92);
  color: #0f172a;
}

.calendar-day.blank {
  pointer-events: none;
}

.calendar-day small {
  position: absolute;
  right: 5px;
  bottom: 4px;
  min-width: 15px;
  height: 15px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent2);
  color: #0f172a;
  font-size: 9px;
  font-weight: 900;
}

.day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 2px 12px;
}

.day-heading h2 {
  text-align: left;
}

.day-heading span {
  min-width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 18px;
  font-weight: 850;
}

.section-label {
  margin: 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.compact-panel {
  margin-bottom: 14px;
  gap: 10px;
}

.compact-event {
  padding: 12px;
}

.edit-text {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: 0;
  padding: 12px;
  background: var(--soft);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  line-height: 1.42;
}

.empty-state {
  min-height: 48svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 34px 22px;
  box-shadow: none;
}

.empty-state h2 {
  margin: 0 0 8px;
  letter-spacing: -0.04em;
  font-size: 24px;
}

.empty-state p {
  margin: 0;
  max-width: 320px;
  color: var(--muted);
  line-height: 1.45;
}

.empty-orb {
  width: 74px;
  height: 74px;
  border-radius: 28px;
  margin-bottom: 16px;
  background:
    radial-gradient(circle at 30% 25%, #fff, transparent 20%),
    linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 18px 60px rgba(103, 232, 249, 0.22);
}

/* Settings screen */
.settings-screen {
  display: grid;
  gap: 14px;
}

.settings-screen .panel {
  gap: 10px;
}

.settings-row {
  display: grid;
  gap: 4px;
  padding: 4px 4px 8px;
}

.settings-row strong {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.settings-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.settings-action {
  text-align: left;
  padding: 14px 16px;
  min-height: 56px;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 16px;
  background: var(--soft);
  color: var(--text);
  border: 1px solid var(--line);
}

.settings-action .arrow {
  color: var(--muted);
  font-weight: 700;
}

.settings-select-row {
  display: grid;
  gap: 8px;
  padding: 2px 4px;
}

.settings-select-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.settings-select-row select {
  min-height: 52px;
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  outline: 0;
  padding: 0 14px;
  color: var(--text);
  background: var(--soft);
  font-weight: 800;
}

.settings-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.settings-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-category-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 800;
}

.settings-add-category {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.settings-add-category input {
  min-height: 48px;
  min-width: 0;
  border-radius: 15px;
  border: 1px solid var(--line);
  outline: 0;
  padding: 0 12px;
  color: var(--text);
  background: var(--soft);
}

.settings-add-category button {
  min-height: 48px;
  border-radius: 15px;
  padding: 0 16px;
  background: rgba(248, 250, 252, 0.92);
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  transform: translateX(-50%);
  width: min(760px, 100%);
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: linear-gradient(180deg, rgba(11,16,32,0), rgba(11,16,32,0.82) 24%, rgba(11,16,32,0.96));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform 200ms ease, opacity 160ms ease;
}

body.keyboard-open .bottom-nav {
  transform: translateX(-50%) translateY(120%);
  opacity: 0;
  pointer-events: none;
}

body.keyboard-open .app-shell {
  padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
}

body.keyboard-open .capture-action-bar {
  bottom: calc(env(safe-area-inset-bottom) + 10px);
}

.nav-btn {
  position: relative;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 800;
  min-width: 0;
}

.nav-btn.active {
  background: var(--soft);
  color: var(--text);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-badge {
  position: absolute;
  top: 7px;
  right: 18px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(248, 250, 252, 0.94);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

/* Toast — supports optional inline action button (Undo) */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 14px);
  transform: translateX(-50%) translateY(12px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.94);
  color: #0f172a;
  font-weight: 850;
  font-size: 14px;
  box-shadow: var(--shadow);
  transition: 160ms ease;
  max-width: calc(100vw - 28px);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.toast-message {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast-action {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: #0f172a;
  color: #f8fafc;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.02em;
  border: 0;
  cursor: pointer;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f7fb;
    --bg2: #eef2ff;
    --card: rgba(255, 255, 255, 0.72);
    --card-strong: rgba(255, 255, 255, 0.88);
    --text: #0f172a;
    --muted: rgba(15, 23, 42, 0.62);
    --line: rgba(15, 23, 42, 0.11);
    --soft: rgba(15, 23, 42, 0.08);
    --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
    --page-bg:
      radial-gradient(circle at 16% 0%, rgba(196, 181, 253, 0.34), transparent 34%),
      radial-gradient(circle at 90% 12%, rgba(103, 232, 249, 0.24), transparent 30%),
      linear-gradient(180deg, var(--bg), var(--bg2));
  }

  .bottom-nav {
    background: linear-gradient(180deg, rgba(244,247,251,0), rgba(244,247,251,0.86) 24%, rgba(244,247,251,0.98));
  }

  .toast-action {
    background: #0f172a;
    color: #f8fafc;
  }
}

@media (max-width: 430px) {
  :root {
    --bottom-nav-height: 78px;
    --radius-xl: 22px;
    --radius-lg: 18px;
    --radius-md: 14px;
  }

  .app-shell {
    max-width: none;
    padding: calc(env(safe-area-inset-top) + 12px) 12px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 12px);
  }

  .topbar {
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
  }

  .eyebrow {
    font-size: 12px;
  }

  h1 {
    font-size: 32px;
    line-height: 1;
  }

  body[data-screen="capture"] .topbar h1 {
    font-size: 24px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .topbar-greeting {
    max-width: 116px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 16px;
    font-size: 11px;
  }

  .topbar-greeting strong {
    font-size: 13px;
  }

  .settings-hint {
    top: -7px;
    right: -7px;
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .capture-pad {
    max-width: none;
    padding: 10px;
    border-radius: 20px;
  }

  .capture-command {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .capture-mode-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .capture-mode-tabs .preset-btn {
    min-width: 0;
    padding: 0 10px;
  }

  .capture-side-control {
    width: 100%;
    flex-basis: auto;
    margin-left: 0;
  }

  .capture-writing-surface,
  .capture-pad textarea.capture-input {
    min-height: 180px;
  }

  .capture-pad textarea.capture-input {
    max-height: min(40svh, 360px);
    padding: 16px;
    font-size: 18px;
  }

  .capture-pad .capture-action-bar {
    gap: 8px;
    border-radius: 16px;
  }

  .primary-btn {
    min-height: 50px;
    font-size: 16px;
  }

  .quick-list {
    max-width: none;
  }

  .panel,
  .calendar-panel {
    padding: 12px;
  }

  .swipe-foreground {
    padding: 15px;
  }

  .actions {
    gap: 7px;
  }

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

  .event-ro-card {
    grid-template-columns: 1fr;
  }

  .event-ro-tools {
    justify-content: flex-start;
  }

  .calendar-header {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 6px;
  }

  .calendar-title-btn,
  .day-heading h2 {
    font-size: 17px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    border-radius: 11px;
    font-size: 13px;
  }

  .day-heading {
    gap: 10px;
    padding-top: 14px;
  }

  .settings-add-category {
    grid-template-columns: 1fr;
  }

  .settings-add-category button {
    width: 100%;
  }

  .bottom-nav {
    width: 100%;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    gap: 4px;
  }

  .nav-btn {
    border-radius: 16px;
    font-size: 10px;
  }

  .nav-icon {
    font-size: 20px;
  }

  .nav-badge {
    top: 6px;
    right: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
  }

  .toast {
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 10px);
  }
}

@media (max-width: 350px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .topbar-greeting > span:first-child {
    display: none;
  }

  .topbar-greeting {
    max-width: 84px;
  }

  h1 {
    font-size: 29px;
  }

  .filter-btn {
    padding: 0 12px;
    font-size: 13px;
  }
}

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