:root {
  --bg: #0e1312;
  --bg-2: #151c1a;
  --surface: rgba(21, 28, 26, 0.92);
  --surface-2: rgba(28, 37, 34, 0.94);
  --surface-3: rgba(38, 49, 45, 0.94);
  --line: rgba(232, 247, 238, 0.12);
  --text: #eef6ef;
  --muted: #9fb1a7;
  --accent: #7be0b4;
  --accent-2: #8cc8ff;
  --income: #74ddb0;
  --expense: #ffae7f;
  --danger: #ff7d7d;
  --good: #5edb99;
  --medium: #f2c760;
  --bad: #f07d6f;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
  --radius: 20px;
  --radius-sm: 12px;
  --content: 1440px;
  --font: "Avenir Next", "Trebuchet MS", Verdana, sans-serif;
}

body[data-theme="graphite"] {
  --bg: #0b0c0f;
  --bg-2: #181a20;
  --surface: rgba(24, 26, 32, 0.94);
  --surface-2: rgba(33, 36, 43, 0.95);
  --surface-3: rgba(44, 48, 56, 0.95);
  --accent: #d8e0ea;
  --accent-2: #9aa8b8;
  --income: #9bd7c4;
  --expense: #e8aa88;
}

body[data-theme="ocean"] {
  --bg: #07131a;
  --bg-2: #0d2530;
  --surface: rgba(12, 34, 45, 0.93);
  --surface-2: rgba(17, 47, 61, 0.94);
  --surface-3: rgba(24, 65, 82, 0.94);
  --accent: #65d7ff;
  --accent-2: #6de0bd;
  --income: #6de0bd;
  --expense: #ffbf8b;
}

body[data-theme="wine"] {
  --bg: #170c11;
  --bg-2: #241019;
  --surface: rgba(38, 17, 27, 0.93);
  --surface-2: rgba(52, 22, 36, 0.95);
  --surface-3: rgba(69, 29, 47, 0.95);
  --accent: #ff9dbd;
  --accent-2: #ffd08a;
  --income: #9ee3b1;
  --expense: #ff9d82;
}

body[data-theme="ember"] {
  --bg: #15100b;
  --bg-2: #25190f;
  --surface: rgba(35, 24, 16, 0.94);
  --surface-2: rgba(49, 33, 22, 0.94);
  --surface-3: rgba(68, 45, 29, 0.94);
  --accent: #ffbd73;
  --accent-2: #ffe09a;
  --income: #a8dd8b;
  --expense: #ff8d6b;
}

body[data-theme="lemon"] {
  --bg: #10130a;
  --bg-2: #1d2310;
  --surface: rgba(31, 38, 18, 0.94);
  --surface-2: rgba(43, 52, 24, 0.94);
  --surface-3: rgba(57, 68, 31, 0.94);
  --accent: #d9f16d;
  --accent-2: #8fe7c4;
  --income: #a9ed85;
  --expense: #f5b166;
}

body[data-theme="neon"] {
  --bg: #070812;
  --bg-2: #0d1024;
  --surface: rgba(14, 17, 39, 0.94);
  --surface-2: rgba(21, 25, 56, 0.94);
  --surface-3: rgba(31, 35, 74, 0.94);
  --accent: #47f7d1;
  --accent-2: #ffcf5c;
  --income: #6cffb4;
  --expense: #ff8f70;
}

body[data-theme="mono"] {
  --bg: #050505;
  --bg-2: #111;
  --surface: rgba(19, 19, 19, 0.95);
  --surface-2: rgba(28, 28, 28, 0.95);
  --surface-3: rgba(40, 40, 40, 0.95);
  --accent: #f1f1f1;
  --accent-2: #a8a8a8;
  --income: #d8f5df;
  --expense: #ffc3a6;
}

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

html {
  scroll-behavior: smooth;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(circle at 15% 5%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 32rem),
    radial-gradient(circle at 95% 0%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 36rem),
    linear-gradient(145deg, var(--bg), var(--bg-2));
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  user-select: none;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, black, transparent 88%);
}

body.is-locked {
  overflow: hidden;
}

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

button,
label.file-button {
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

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

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

h1 {
  margin-bottom: 2px;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.08rem, 1.7vw, 1.35rem);
  line-height: 1.2;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.04rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  color: var(--text);
  font-size: 16px;
  background: rgba(0, 0, 0, 0.22);
  user-select: text;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 70%, white 8%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  color: var(--text);
}

.glow {
  position: fixed;
  z-index: -2;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.22;
  pointer-events: none;
}

.glow-one {
  top: 8rem;
  left: -7rem;
  background: var(--accent);
}

.glow-two {
  right: -8rem;
  bottom: 8rem;
  background: var(--accent-2);
}

.app-shell {
  width: min(calc(100% - 28px), var(--content));
  margin: 0 auto;
  padding: 14px 0 112px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 96%, transparent), color-mix(in srgb, var(--bg) 72%, transparent));
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  border-radius: 16px;
  color: #07100d;
  font-size: 1.2rem;
  font-weight: 900;
  background:
    linear-gradient(135deg, var(--accent), var(--accent-2)),
    var(--surface-2);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 28%, transparent);
}

.brand p,
.section-head p,
.selected-day-head p,
.dialog-head p,
.summary-card small,
.summary-card span,
.field span,
.inline-filter span,
.theme-picker span,
.empty-state,
.item-card p,
.breakdown-row small,
.muted-text,
.point-transaction p {
  color: var(--muted);
  line-height: 1.55;
}

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

.theme-picker {
  display: grid;
  min-width: 178px;
  gap: 5px;
}

.theme-picker span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.icon-button,
.button,
.mark-button,
.nav-button,
.period-button,
.chart-date-button,
.action-link {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: color-mix(in srgb, var(--surface-2) 84%, transparent);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.icon-button:hover,
.button:hover,
.mark-button:hover,
.nav-button:hover,
.period-button:hover,
.chart-date-button:hover,
.action-link:hover,
.calendar-day:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}

.icon-button {
  display: grid;
  place-items: center;
  min-width: 46px;
  height: 46px;
  padding: 0 12px;
  font-weight: 800;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-color: transparent;
  color: #07100d;
  font-weight: 850;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 28px color-mix(in srgb, var(--accent) 22%, transparent);
}

.button-muted {
  color: var(--text);
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-2) 84%, transparent);
  box-shadow: none;
}

.button-danger {
  color: #1a0505;
  background: linear-gradient(135deg, var(--danger), #ffd0c4);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--danger) 20%, transparent);
}

.compact-button {
  min-width: 142px;
}

.file-button input {
  display: none;
}

.summary-grid,
.home-grid,
.wide-grid,
.field-grid,
.stats-metrics,
.stats-grid,
.tasks-grid,
.daily-stat-grid,
.folder-grid,
.archive-shelf {
  display: grid;
  gap: 14px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.summary-card,
.panel,
.day-dialog,
.backup-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 94%, white 2%), color-mix(in srgb, var(--surface-2) 92%, black 8%));
  box-shadow: var(--shadow);
}

.summary-card {
  min-height: 146px;
  padding: 18px;
  overflow: hidden;
  position: relative;
}

.summary-card::after {
  position: absolute;
  right: -28px;
  bottom: -44px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  content: "";
}

.summary-card small,
.metric-card small {
  display: block;
  margin-bottom: 16px;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-card strong,
.metric-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(1.4rem, 3.5vw, 2.4rem);
  letter-spacing: -0.04em;
}

.accent-card {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 20%, var(--surface)), color-mix(in srgb, var(--accent-2) 13%, var(--surface-2)));
}

.page {
  display: none;
}

.page.is-active {
  display: grid;
  gap: 16px;
  animation: pageIn 240ms ease both;
}

.home-grid {
  align-items: start;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
}

.wide-grid,
.stats-grid,
.tasks-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
}

.compact-calendar-window {
  align-self: start;
  padding: 14px;
}

.compact-calendar-window .section-head {
  margin-bottom: 12px;
}

.compact-calendar-window .section-head p {
  max-width: 280px;
}

.compact-calendar-window .month-controls {
  width: 100%;
  justify-content: space-between;
}

.compact-calendar-window .month-controls strong {
  min-width: auto;
  font-size: 0.95rem;
}

.panel {
  padding: 18px;
}

.section-head,
.selected-day-head,
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.month-controls,
.period-switch,
.metric-toggles,
.form-actions,
.backup-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.month-controls strong {
  min-width: 160px;
  text-align: center;
}

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

.weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day-placeholder {
  min-height: 62px;
}

.calendar-day {
  position: relative;
  display: grid;
  min-height: 62px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  text-align: left;
  background: color-mix(in srgb, var(--surface-2) 74%, transparent);
  overflow: hidden;
}

.calendar-day::before {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 24%, transparent), transparent);
  content: "";
  transition: opacity 160ms ease;
}

.calendar-day:hover::before,
.calendar-day.is-selected::before {
  opacity: 1;
}

.calendar-day.is-selected {
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.calendar-day.is-today .day-number {
  color: var(--accent);
}

.calendar-day.mark-good {
  border-color: color-mix(in srgb, var(--good) 60%, transparent);
}

.calendar-day.mark-medium {
  border-color: color-mix(in srgb, var(--medium) 60%, transparent);
}

.calendar-day.mark-bad {
  border-color: color-mix(in srgb, var(--bad) 60%, transparent);
}

.day-number,
.day-balance,
.day-lines,
.day-pill {
  position: relative;
}

.day-number {
  font-size: 0.94rem;
  font-weight: 900;
}

.day-balance {
  align-self: end;
  font-size: 0.68rem;
  font-weight: 850;
}

.day-lines {
  display: none;
}

.day-pill {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 0.62rem;
  background: rgba(0, 0, 0, 0.16);
}

.mark-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.mark-button {
  min-height: 40px;
  padding: 0 10px;
  font-size: 0.86rem;
  font-weight: 800;
}

.mark-button.is-active {
  border-color: color-mix(in srgb, var(--accent) 70%, transparent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-2));
}

.daily-stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mini-stat {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.13);
}

.mini-stat span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.mini-stat strong {
  overflow-wrap: anywhere;
}

.breakdown-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.12);
}

.bar-track {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.stacked-form {
  display: grid;
  gap: 14px;
}

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

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

.field span,
.inline-filter span {
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inline-filter {
  display: grid;
  min-width: 190px;
  gap: 6px;
}

.inline-form {
  display: flex;
  align-items: end;
  gap: 12px;
}

.grow-field {
  flex: 1;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.empty-cell {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.1);
}

.type-pill,
.tag-pill,
.status-pill,
.note-chip,
.visibility-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
}

.tag-important {
  border-color: color-mix(in srgb, #ffd86a 55%, transparent);
  color: #ffe39b;
}

.tag-payroll {
  border-color: color-mix(in srgb, #9fd2ff 55%, transparent);
  color: #bfe0ff;
}

.tag-ads {
  border-color: color-mix(in srgb, #b9f08f 55%, transparent);
  color: #d4ffb9;
}

.tag-security {
  border-color: color-mix(in srgb, #ff9b9b 55%, transparent);
  color: #ffc1c1;
}

.tag-phone {
  border-color: color-mix(in srgb, #91e7ff 55%, transparent);
  color: #bcf2ff;
}

.row-actions,
.item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.action-link {
  min-height: 34px;
  padding: 0 11px;
  color: var(--text);
  font-weight: 850;
}

.danger-link {
  color: #ffd2d2;
  border-color: color-mix(in srgb, var(--danger) 42%, transparent);
}

.folder-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.archive-shelf {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 22px;
  background:
    linear-gradient(180deg, transparent 0 46%, rgba(255, 255, 255, 0.08) 46% 48%, transparent 48%),
    rgba(0, 0, 0, 0.1);
}

.archive-folder {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 12px 12px;
  padding: 15px;
  color: var(--text);
  text-align: left;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-3) 85%, transparent), color-mix(in srgb, var(--surface-2) 90%, transparent));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.archive-folder::before {
  position: absolute;
  left: 15px;
  top: -9px;
  width: 88px;
  height: 18px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-3));
  content: "";
}

.archive-folder:hover {
  transform: translateY(-2px) rotate(-0.4deg);
}

.archive-number {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: #07100d;
  font-weight: 950;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.archive-folder strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.archive-folder small {
  color: var(--muted);
}

.archive-mini-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.archive-mini-grid span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 850;
  background: rgba(0, 0, 0, 0.12);
}

.folder-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface-3) 86%, transparent), color-mix(in srgb, var(--surface-2) 78%, transparent));
}

.folder-kicker {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.folder-card strong {
  font-size: 1.12rem;
}

.folder-numbers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stats-hero {
  overflow: hidden;
  position: relative;
}

.stats-hero::after {
  position: absolute;
  right: -7rem;
  top: -8rem;
  width: 20rem;
  height: 20rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  content: "";
}

.period-switch {
  justify-content: flex-end;
}

.stats-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.compact-theme {
  min-width: 220px;
}

.period-button {
  min-height: 42px;
  padding: 0 14px;
  font-weight: 850;
}

.period-button.is-active,
.chart-date-button.is-active {
  color: #07100d;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.stats-metrics {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  min-height: 136px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.13);
}

.trend {
  color: var(--muted);
  font-weight: 800;
}

.trend.up {
  color: var(--income);
}

.trend.down {
  color: var(--expense);
}

.metric-toggles {
  justify-content: flex-end;
}

.metric-toggles label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.12);
}

.metric-toggles input {
  width: auto;
}

.chart-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    rgba(0, 0, 0, 0.15);
  overflow-x: auto;
}

#statsChart {
  display: block;
  min-width: 720px;
  width: 100%;
  min-height: 310px;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-zero {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1.4;
  stroke-dasharray: 7 8;
}

.chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.x-label {
  text-anchor: middle;
}

.chart-line {
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.32));
}

.chart-point {
  cursor: pointer;
  fill: var(--surface-2);
  stroke: currentColor;
  stroke-width: 3;
}

.chart-income + .chart-point,
.chart-point[data-metric="income"] {
  color: var(--income);
}

.chart-point[data-metric="expense"] {
  color: var(--expense);
}

.chart-point[data-metric="balance"] {
  color: var(--accent-2);
}

.chart-point.is-selected {
  r: 8;
  fill: var(--text);
}

.chart-note-line {
  stroke: color-mix(in srgb, var(--accent) 62%, transparent);
  stroke-width: 2;
  stroke-dasharray: 6 7;
}

.chart-note-dot {
  fill: var(--accent);
}

.chart-note-text {
  fill: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.chart-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chart-date-button {
  display: grid;
  flex: 0 0 auto;
  min-width: 96px;
  gap: 3px;
  padding: 10px 12px;
  text-align: left;
}

.chart-date-button span {
  color: inherit;
  font-size: 0.78rem;
  opacity: 0.82;
}

.details-panel {
  align-self: start;
}

.point-summary,
.point-list {
  display: grid;
  gap: 12px;
}

.point-list {
  margin-top: 14px;
}

.point-transaction,
.item-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.12);
}

.memo-line {
  color: var(--text) !important;
}

.note-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.note-chip {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 44%, transparent);
}

.stat-note-card.is-visible {
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
}

.visibility-chip {
  color: var(--muted);
}

.item-list,
.notes-list {
  display: grid;
  gap: 10px;
}

.task-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 4px;
}

.task-date-card {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent),
    rgba(0, 0, 0, 0.13);
}

.task-date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-date-head span {
  color: var(--muted);
  font-size: 0.86rem;
}

.task-date-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
}

.task-date-button {
  display: grid;
  flex: 0 0 88px;
  min-height: 92px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  color: var(--text);
  text-align: left;
  background: rgba(0, 0, 0, 0.12);
}

.task-date-button span,
.task-date-button small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.task-date-button strong {
  font-size: 1.45rem;
}

.task-date-button.is-active {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.task-card.is-overdue {
  border-color: color-mix(in srgb, var(--danger) 42%, transparent);
}

.status-pending {
  color: var(--medium);
}

.status-done {
  color: var(--income);
}

.status-failed {
  color: var(--danger);
}

.book-extra {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-3) 68%, transparent), rgba(0, 0, 0, 0.14));
  background-size: 18px 18px, auto;
}

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

.book-extra ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.book-extra strong {
  color: var(--text);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(16px);
}

.dialog-backdrop[hidden] {
  display: none;
}

.day-dialog {
  width: min(980px, 100%);
  max-height: min(860px, calc(100vh - 40px));
  padding: 20px;
  overflow: auto;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  width: min(620px, calc(100% - 24px));
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.nav-button {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 58px;
  gap: 2px;
  border: 0;
  border-color: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  background: transparent;
  box-shadow: none;
}

.nav-button span {
  font-size: 1.28rem;
  filter: saturate(0.9);
}

.nav-button.is-active {
  color: var(--text);
  background: transparent;
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 50%, transparent);
}

.nav-button.is-active::after {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 28px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  content: "";
  transform: translateX(-50%);
}

.backup-panel {
  display: flex;
  justify-content: center;
  margin-top: 16px;
  padding: 14px;
}

.is-income {
  color: var(--income);
}

.is-expense {
  color: var(--expense);
}

.is-balance {
  color: var(--accent-2);
}

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

@media (max-width: 1180px) {
  .summary-grid,
  .stats-metrics,
  .folder-grid,
  .archive-shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-grid,
  .wide-grid,
  .stats-grid,
  .tasks-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(calc(100% - 18px), var(--content));
    padding-bottom: 116px;
  }

  .topbar,
  .section-head,
  .selected-day-head,
  .dialog-head {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .theme-picker,
  .inline-filter {
    min-width: 0;
  }

  .summary-grid,
  .stats-metrics,
  .field-grid,
  .folder-grid,
  .archive-shelf {
    grid-template-columns: 1fr;
  }

  .daily-stat-grid,
  .archive-mini-grid,
  .book-extra-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weekdays,
  .calendar-grid {
    gap: 5px;
  }

  .calendar-day,
  .calendar-day-placeholder {
    min-height: 58px;
  }

  .calendar-day {
    padding: 8px;
    border-radius: 13px;
  }

  .day-lines {
    display: none;
  }

  .mark-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .period-switch,
  .metric-toggles,
  .backup-panel {
    justify-content: stretch;
  }

  .period-button,
  .metric-toggles label,
  .backup-panel .button {
    flex: 1 1 auto;
  }

  .point-transaction,
  .item-card {
    flex-direction: column;
  }

  .item-actions,
  .row-actions {
    justify-content: flex-start;
  }

  .bottom-nav {
    grid-template-columns: repeat(4, 1fr);
    border-radius: 999px;
  }

  .nav-button {
    min-height: 54px;
    padding: 6px 2px;
    font-size: 0.72rem;
  }
}
