:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f0f1f6;
  --text: #191a22;
  --muted: #666978;
  --line: #e5e6ed;
  --accent: #5b5bd6;
  --accent-soft: #e9e9ff;
  --gold: #b77932;
  --rose: #cb5765;
  --shadow: 0 12px 35px rgba(30, 32, 49, 0.07);
  --radius: 20px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1016;
  --surface: #181a22;
  --surface-soft: #22242e;
  --text: #f2f2f7;
  --muted: #989aa9;
  --line: #2d303b;
  --accent: #a7a6ff;
  --accent-soft: #29294b;
  --gold: #e0a75e;
  --rose: #e17a85;
  --shadow: 0 12px 35px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

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

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 58%, transparent);
  outline-offset: 3px;
}

#page-title:focus {
  outline: 0;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 240px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  padding: 28px 22px;
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: #ffffff;
  font-family: Georgia, serif;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 50px;
}

.nav-list a,
.nav-button {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  padding: 11px 13px;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
}

.nav-list a span,
.nav-button span {
  width: 18px;
  font-size: 17px;
  text-align: center;
}

.nav-list a:hover,
.nav-list a.active,
.nav-button:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.sidebar-foot {
  display: grid;
  gap: 18px;
  margin-top: auto;
}

.privacy-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #7373e8;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.main {
  min-height: 100vh;
  margin-left: 240px;
  padding: 44px clamp(28px, 5vw, 76px) 60px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto 36px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(31px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

h3 {
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 650;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

#mobile-settings-button {
  display: none;
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 42px;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 650;
}

.icon-button {
  width: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.primary-button:hover {
  filter: brightness(1.08);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
}

.danger-button {
  border: 1px solid color-mix(in srgb, var(--rose) 40%, var(--line));
  background: transparent;
  color: var(--rose);
}

#app {
  max-width: 1180px;
  margin: 0 auto;
}

.storage-alert {
  margin-bottom: 18px;
  border: 1px solid color-mix(in srgb, var(--rose) 45%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--rose) 8%, var(--surface));
  padding: 16px 18px;
}

.storage-alert p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.dashboard-grid,
.module-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

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

.card-pad {
  padding: 22px;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: 1 / -1;
}

.span-9 {
  grid-column: span 9;
}

.span-7 {
  grid-column: span 7;
}

.span-6 {
  grid-column: span 6;
}

.span-5 {
  grid-column: span 5;
}

.span-4 {
  grid-column: span 4;
}

.span-3 {
  grid-column: span 3;
}

.card-head,
.section-head,
.row,
.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-head {
  margin-bottom: 20px;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.card-actions .text-button {
  white-space: nowrap;
}

.journal-card {
  overflow: visible;
}

.journal-head {
  align-items: flex-start;
}

.journal-helper,
.journal-status,
.journal-privacy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.journal-date-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.journal-date-control label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.journal-date-control input,
.journal-text {
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: var(--bg);
}

.journal-date-control input {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 12px;
}

.journal-text {
  display: block;
  width: 100%;
  min-height: 128px;
  resize: vertical;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.65;
}

.journal-date-control input:focus,
.journal-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.journal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.journal-status {
  margin: 0;
}

.journal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.journal-privacy {
  font-size: 11px;
}

.card-head p,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 4px;
  font-size: 12px;
  font-weight: 700;
}

.summary-card {
  position: relative;
  min-height: 215px;
  border-color: transparent;
  background:
    radial-gradient(circle at 82% 18%, rgba(179, 178, 255, 0.32), transparent 32%),
    linear-gradient(135deg, #29294f 0%, #4f4fc4 100%);
  color: #ffffff;
}

.summary-card::after {
  position: absolute;
  right: -30px;
  bottom: -70px;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  content: "";
}

.summary-card .eyebrow,
.summary-card .muted {
  color: rgba(255, 255, 255, 0.65);
}

.summary-number {
  margin: 18px 0 12px;
  font-family: Georgia, serif;
  font-size: 48px;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.summary-percent {
  font-family: Inter, ui-sans-serif, sans-serif;
  font-size: 22px;
  opacity: 0.65;
}

.summary-copy {
  max-width: 440px;
  line-height: 1.55;
}

.summary-progress {
  margin-top: 18px;
}

.progress {
  display: block;
  width: 100%;
  overflow: hidden;
  height: 6px;
  border: 0;
  border-radius: 99px;
  appearance: none;
  background: var(--surface-soft);
}

.progress::-webkit-progress-bar {
  border-radius: inherit;
  background: var(--surface-soft);
}

.progress::-webkit-progress-value {
  border-radius: inherit;
  background: var(--accent);
}

.progress::-moz-progress-bar {
  border-radius: inherit;
  background: var(--accent);
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.summary-card .progress {
  width: min(320px, 75%);
  background: rgba(255, 255, 255, 0.16);
}

.summary-card .progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.16);
}

.summary-card .progress::-webkit-progress-value {
  background: #e6eee3;
}

.summary-card .progress::-moz-progress-bar {
  background: #e6eee3;
}

.summary-card .progress > span {
  background: #e6eee3;
}

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

.stat {
  border-radius: 15px;
  background: var(--surface-soft);
  padding: 15px;
}

.stat strong {
  display: block;
  margin-bottom: 5px;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 500;
}

.stat span {
  color: var(--muted);
  font-size: 11px;
}

.item-list {
  display: grid;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 56px;
  border-top: 1px solid var(--line);
}

.list-item:first-child {
  border-top: 0;
}

.list-main {
  min-width: 0;
  flex: 1;
}

.list-main strong {
  display: block;
  overflow: hidden;
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-main span,
.list-meta {
  color: var(--muted);
  font-size: 11px;
}

.check {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: transparent;
}

.check:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.check.done {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.list-item.completed .list-main strong {
  color: var(--muted);
  text-decoration: line-through;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 99px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 0 9px;
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
}

.badge.personal {
  background: #fff0e1;
  color: #a15e20;
}

[data-theme="dark"] .badge.personal {
  background: #493422;
  color: #f0b674;
}

.tabs {
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  gap: 4px;
  margin-bottom: 18px;
  border-radius: 13px;
  background: var(--surface-soft);
  padding: 4px;
}

.tab {
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 650;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  margin-bottom: 20px;
}

.day {
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 10px 5px;
  text-align: center;
}

.day span,
.day strong {
  display: block;
}

.day span {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.day strong {
  font-family: Georgia, serif;
  font-size: 17px;
  font-weight: 500;
}

.day.today {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.amount.expense {
  color: var(--rose);
}

.finance-total {
  margin: 4px 0 20px;
  font-family: Georgia, serif;
  font-size: 38px;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.metric {
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.review-metrics {
  display: grid;
  gap: 15px;
}

.review-metrics > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

.review-metrics > div:first-child {
  border-top: 0;
  padding-top: 0;
}

.review-metrics strong {
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 500;
}

.review-metrics strong span,
.review-metrics small {
  color: var(--muted);
  font-size: 11px;
}

.calendar-toolbar,
.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calendar-toolbar {
  margin-bottom: 24px;
}

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

.calendar-weekdays {
  color: var(--muted);
  padding-bottom: 9px;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.month-grid {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
}

.calendar-day {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 104px;
  border-top: 0;
  border-left: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  padding: 9px;
  text-align: left;
}

.calendar-day:nth-child(7n) {
  border-right: 0;
}

.calendar-day:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.calendar-day.outside {
  background: var(--bg);
  color: var(--muted);
  opacity: 0.62;
}

.calendar-day.today {
  background: var(--accent-soft);
}

.calendar-day.selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.calendar-date {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}

.calendar-day.today .calendar-date {
  background: var(--accent);
  color: #fff;
}

.calendar-dots {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.calendar-count {
  display: none;
}

.calendar-entry {
  overflow: hidden;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 3px 5px;
  font-size: 8px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-entry.reminder {
  background: var(--accent-soft);
  color: var(--accent);
}

.calendar-entry.holiday,
.calendar-entry.birthday {
  background: #fff0e1;
  color: #a15e20;
}

.task-entry {
  color: var(--muted);
}

.calendar-dots small {
  color: var(--muted);
  font-size: 8px;
}

.compact-list .list-item {
  align-items: flex-start;
  min-height: 64px;
  padding: 10px 0;
}

.compact-list .badge {
  display: none;
}

.full-button {
  width: 100%;
  margin-top: 18px;
}

.budget-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.budget-item {
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 15px;
}

.budget-item strong {
  font-size: 12px;
  text-transform: capitalize;
}

.progress.over::-webkit-progress-value {
  background: var(--rose);
}

.progress.over::-moz-progress-bar {
  background: var(--rose);
}

.budget-empty {
  grid-column: 1 / -1;
  min-height: 76px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.mini-chart {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: clamp(8px, 3vw, 28px);
  height: 155px;
  border-bottom: 1px solid var(--line);
  padding: 5px 14px 0;
}

.chart-column {
  display: grid;
  grid-template-rows: 1fr 24px;
  gap: 7px;
  min-width: 0;
  text-align: center;
}

.chart-column > div {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chart-column > div span {
  display: block;
  width: min(34px, 72%);
  border-radius: 8px 8px 3px 3px;
  background: var(--accent);
  min-height: 6px;
}

.chart-column > div span.level-0 { height: 6px; opacity: 0.2; }
.chart-column > div span.level-1 { height: 10%; }
.chart-column > div span.level-2 { height: 20%; }
.chart-column > div span.level-3 { height: 30%; }
.chart-column > div span.level-4 { height: 40%; }
.chart-column > div span.level-5 { height: 50%; }
.chart-column > div span.level-6 { height: 60%; }
.chart-column > div span.level-7 { height: 70%; }
.chart-column > div span.level-8 { height: 80%; }
.chart-column > div span.level-9 { height: 90%; }
.chart-column > div span.level-10 { height: 100%; }

.section-card {
  margin-top: 18px;
}

.money-note {
  margin: 0 0 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  padding-left: 12px;
  font-size: 11px;
  line-height: 1.55;
}

.result-highlight {
  border-radius: 10px;
  animation: result-highlight 1.8s ease;
}

@keyframes result-highlight {
  0%, 35% { background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
  100% { background: transparent; box-shadow: none; }
}

.chart-column small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.search-dialog {
  width: min(620px, calc(100% - 28px));
  min-height: 180px;
  padding: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 15px 18px;
}

.search-box > span {
  color: var(--muted);
  font-size: 22px;
}

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

kbd {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 3px 6px;
  font-size: 9px;
}

.search-results {
  max-height: 430px;
  overflow: auto;
  padding: 8px;
}

.search-result {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 13px;
  width: 100%;
  border: 0;
  border-radius: 11px;
  background: transparent;
  padding: 11px;
  text-align: left;
}

.search-result:hover {
  background: var(--surface-soft);
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result strong {
  margin-bottom: 3px;
  font-size: 12px;
}

.search-result small,
.search-result b {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.search-hint {
  display: grid;
  min-height: 130px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.metric:first-child {
  border-top: 0;
}

.metric-head {
  margin-bottom: 9px;
  font-size: 12px;
}

.metric-head span:last-child {
  color: var(--muted);
}

.delete-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 16px;
}

.delete-button:hover {
  color: var(--rose);
}

dialog {
  width: min(520px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 28px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  padding: 24px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
  background: rgba(19, 21, 17, 0.42);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: var(--bg);
  padding: 10px 12px;
  font-size: 13px;
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.settings-list {
  display: grid;
  gap: 13px;
}

.settings-list p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.capability-note {
  font-weight: 650;
}

.settings-list button,
.settings-list label {
  display: grid;
  place-items: center;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  cursor: pointer;
  opacity: 0.001;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  transform: translateY(20px);
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 16px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}

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

.toast button {
  margin-left: 12px;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: inherit;
  padding: 2px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.mobile-nav {
  display: none;
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    padding: 28px 20px 100px;
  }

  #mobile-settings-button {
    display: inline-grid;
    place-items: center;
  }

  .mobile-nav {
    position: fixed;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    padding: 7px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(18px);
  }

  .mobile-nav a {
    display: grid;
    gap: 3px;
    place-items: center;
    border-radius: 12px;
    color: var(--muted);
    padding: 6px 2px;
    font-size: 9px;
    font-weight: 650;
    text-decoration: none;
  }

  .mobile-nav a span {
    font-size: 18px;
  }

  .mobile-nav a.active {
    background: var(--surface-soft);
    color: var(--text);
  }
}

@media (max-width: 700px) {
  .topbar {
    margin-bottom: 28px;
  }

  .topbar-actions #theme-button {
    display: none;
  }

  .primary-button {
    padding: 0 13px;
  }

  .span-4,
  .span-3,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-9 {
    grid-column: 1 / -1;
  }

  .summary-card {
    min-height: 200px;
  }

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

  .budget-grid {
    grid-template-columns: 1fr;
  }

  .calendar-card {
    padding: 16px 10px;
  }

  .calendar-toolbar {
    padding: 0 6px;
  }

  .calendar-toolbar h2 {
    font-size: 21px;
  }

  .calendar-controls .secondary-button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 11px;
  }

  .calendar-day {
    min-height: 63px;
    padding: 5px;
  }

  .calendar-dots {
    display: none;
  }

  .calendar-count {
    position: absolute;
    right: 5px;
    bottom: 5px;
    display: grid;
    min-width: 17px;
    height: 17px;
    place-items: center;
    border-radius: 99px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
  }

  .field {
    grid-column: 1;
  }

  dialog {
    padding: 20px;
  }

  .toast {
    right: 16px;
    bottom: 90px;
    left: 16px;
    text-align: center;
  }
}

@media (max-width: 520px) {
  .main {
    padding-right: 14px;
    padding-left: 14px;
  }

  .journal-head,
  .journal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .journal-date-control {
    flex-wrap: wrap;
  }

  .journal-date-control input {
    flex: 1;
    min-width: 150px;
  }

  .journal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .journal-actions button {
    width: 100%;
  }

  .topbar {
    align-items: center;
    gap: 10px;
  }

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

  .topbar h1 {
    overflow: hidden;
    font-size: 27px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions .icon-button {
    width: 40px;
    min-height: 40px;
  }

  #quick-add-button {
    min-height: 40px;
    padding: 0 10px;
  }

  .list-item {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
  }

  .list-main {
    flex: 1 1 150px;
  }

  .section-head {
    align-items: flex-start;
  }

  .finance-total {
    font-size: 33px;
  }
}

@media (max-width: 360px) {
  #quick-add-button span {
    display: none;
  }

  .calendar-card {
    padding-right: 6px;
    padding-left: 6px;
  }

  .calendar-toolbar {
    flex-wrap: wrap;
  }

  .calendar-controls {
    margin-left: auto;
  }

  .calendar-day {
    min-height: 58px;
    padding: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
