:root {
  --ink: #08090b;
  --paper: #f4f0e8;
  --lime: #f2ff5a;
  --coral: #ff6846;
  --sky: #78dcff;
  --deep-blue: #3158df;
  --violet: #b58cff;
  --mint: #c9ebdc;
  --peach: #ffb49d;
  --periwinkle: #dce8ff;
  --work-ink: #0b1325;
  --lab-acid: #dfff00;
  --midnight: var(--work-ink);
  --teal: var(--deep-blue);
  --cream: var(--lime);
  --orange: var(--coral);
  --plum: var(--violet);
  --muted: rgba(11, 19, 37, 0.68);
  --subtle: rgba(11, 19, 37, 0.5);
  --line: rgba(8, 9, 11, 0.16);
  --border-strong: rgba(8, 9, 11, 0.28);
  --canvas: var(--paper);
  --forest: var(--lime);
  --forest-dark: var(--lab-acid);
  --incoming: var(--deep-blue);
  --incoming-soft: var(--mint);
  --outgoing: var(--coral);
  --outgoing-soft: var(--peach);
  --shadow: 0 16px 40px rgba(11, 19, 37, 0.12);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 7% -10%, rgba(120, 220, 255, 0.34), transparent 31rem),
    radial-gradient(circle at 92% 3%, rgba(181, 140, 255, 0.18), transparent 27rem),
    var(--canvas);
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(49, 88, 223, 0.28);
  outline-offset: 2px;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 0 48px 56px;
}

.app-header {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  padding: 9px 8px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  border-radius: 11px;
  border: 1px solid var(--ink);
  background: var(--deep-blue);
  box-shadow: 4px 4px 0 var(--ink);
}

.brand-mark span {
  display: block;
  width: 5px;
  border-radius: 4px;
  background: var(--sky);
}

.brand-mark span:nth-child(1) { height: 10px; background: var(--sky); }
.brand-mark span:nth-child(2) { height: 16px; background: var(--coral); }
.brand-mark span:nth-child(3) { height: 21px; background: var(--lime); }

.brand > span:last-child {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
}

.brand strong {
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.055em;
}

.brand-dot { color: var(--coral); }

.brand small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.calendar-section-control {
  min-height: 44px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(244, 240, 232, 0.9);
}

.calendar-section-control:hover { border-color: var(--deep-blue); background: var(--periwinkle); }
.calendar-section-control svg { width: 16px; color: var(--deep-blue); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.calendar-section-control select {
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.today-button,
.icon-button,
.close-button,
.delete-button {
  border: 0;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  min-height: 44px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--forest);
  border-radius: 12px;
  font-weight: 750;
  box-shadow: 4px 4px 0 var(--ink);
}

.primary-button:hover {
  background: var(--forest-dark);
  transform: translateY(-1px);
  box-shadow: 5px 5px 0 var(--ink);
}

.primary-button svg,
.delete-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.header-icon-button,
.install-button,
.workspace-button,
.tool-button {
  border: 1px solid var(--border-strong);
  color: var(--ink);
  background: rgba(244, 240, 232, 0.86);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.header-icon-button {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
}

.header-icon-button svg,
.install-button svg,
.workspace-button svg,
.tool-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-icon-button:hover,
.install-button:hover,
.workspace-button:hover,
.tool-button:hover {
  border-color: var(--deep-blue);
  background: var(--periwinkle);
  transform: translateY(-1px);
}

.workspace-button {
  min-height: 42px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
}

.install-button {
  min-height: 42px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 750;
}

.notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 2px solid var(--canvas);
  border-radius: 9px;
  color: var(--ink);
  background: var(--orange);
  font-size: 9px;
  font-weight: 800;
}

.notification-count[hidden] { display: none; }

main { padding-top: 28px; }

.cashflow-view-toolbar { display: flex; justify-content: flex-end; }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

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

.hero h1 {
  margin: 0;
  max-width: 680px;
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.hero-copy {
  margin: 15px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.view-switcher {
  flex-shrink: 0;
  padding: 5px;
  display: flex;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(244, 240, 232, 0.88);
  box-shadow: 0 8px 24px rgba(11, 19, 37, 0.07);
}

.view-tab {
  min-height: 42px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
}

.view-tab:hover {
  color: var(--ink);
  background: rgba(120, 220, 255, 0.2);
}

.view-tab.active {
  color: var(--ink);
  background: var(--lime);
  box-shadow: 0 4px 14px rgba(11, 19, 37, 0.12);
}

.tab-dot,
.legend-dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
}

.incoming-dot { background: var(--incoming); }
.outgoing-dot { background: var(--outgoing); }
.both-dot { background: linear-gradient(135deg, var(--incoming) 48%, var(--outgoing) 52%); }

.summary-grid {
  margin: 20px 0 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.summary-card {
  min-height: 106px;
  padding: 21px 23px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(244, 240, 232, 0.9);
  box-shadow: 0 8px 26px rgba(11, 19, 37, 0.06);
}

.summary-icon {
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 13px;
}

.summary-icon svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.incoming-summary .summary-icon { color: var(--incoming); background: var(--incoming-soft); }
.outgoing-summary .summary-icon { color: var(--outgoing); background: var(--outgoing-soft); }
.net-summary .summary-icon { color: var(--ink); background: var(--violet); }

.summary-card p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.summary-card strong {
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: 22px;
  letter-spacing: -0.035em;
}

.summary-card strong.negative { color: var(--outgoing); }
.summary-card strong.positive { color: var(--incoming); }

.utility-bar {
  margin: 0 0 22px;
  padding: 11px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 170px 170px auto;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(244, 240, 232, 0.88);
  box-shadow: 0 8px 24px rgba(11, 19, 37, 0.05);
}

.search-control {
  height: 42px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--paper);
}

.search-control:focus-within {
  border-color: var(--deep-blue);
  box-shadow: 0 0 0 3px rgba(49, 88, 223, 0.14);
}

.search-control svg {
  width: 17px;
  margin-left: 12px;
  flex: 0 0 17px;
  fill: none;
  stroke: var(--subtle);
  stroke-width: 1.7;
  stroke-linecap: round;
}

.search-control input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.search-control input::placeholder { color: var(--subtle); }

.utility-bar > select {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font-size: 12px;
  font-weight: 600;
}

.data-actions {
  display: flex;
  gap: 6px;
}

.tool-button {
  min-height: 42px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.insights-grid {
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
  gap: 14px;
}

.insight-card {
  min-height: 300px;
  padding: 23px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(244, 240, 232, 0.92);
  box-shadow: 0 10px 30px rgba(11, 19, 37, 0.07);
}

.insight-header {
  min-height: 49px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.insight-header .eyebrow { margin-bottom: 4px; }

.insight-header h2 {
  margin: 0;
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.insight-header > strong {
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--teal);
  background: var(--incoming-soft);
  font-size: 13px;
}

.insight-header > strong.negative {
  color: var(--orange);
  background: var(--outgoing-soft);
}

.upcoming-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.upcoming-item {
  width: 100%;
  min-height: 51px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 39px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  background: rgba(220, 232, 255, 0.42);
  text-align: left;
}

.upcoming-item:hover { border-color: var(--deep-blue); background: var(--periwinkle); }

.upcoming-date {
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--ink);
  background: var(--violet);
  line-height: 1;
}

.upcoming-date small { font-size: 8px; font-weight: 800; text-transform: uppercase; }
.upcoming-date strong { margin-top: 3px; font-size: 13px; }
.upcoming-copy { min-width: 0; }
.upcoming-copy strong,
.upcoming-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-copy strong { font-size: 11px; }
.upcoming-copy small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.upcoming-amount { font-size: 11px; font-weight: 800; }
.upcoming-amount.incoming { color: var(--teal); }
.upcoming-amount.outgoing { color: var(--orange); }

.empty-insight {
  min-height: 165px;
  display: grid;
  place-items: center;
  color: var(--subtle);
  font-size: 12px;
  text-align: center;
}

.report-legend {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.report-legend span { display: inline-flex; align-items: center; gap: 5px; }

.report-chart {
  height: 205px;
  margin-top: 18px;
  padding: 8px 2px 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.report-month {
  min-width: 0;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 5px;
  text-align: center;
}

.report-bars {
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.report-bar {
  width: min(18px, 35%);
  min-height: 2px;
  border-radius: 5px 5px 2px 2px;
  transition: height 250ms ease;
}

.report-bar.incoming { background: var(--teal); }
.report-bar.outgoing { background: var(--orange); }
.report-month > strong { color: var(--ink); font-size: 9px; }
.report-month > small { min-height: 12px; color: var(--muted); font-size: 8px; }
.report-month > small.positive { color: var(--teal); }
.report-month > small.negative { color: var(--orange); }

.calendar-card {
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.calendar-toolbar {
  min-height: 99px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.calendar-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

.month-heading p {
  margin: 0 0 3px;
  color: var(--plum);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.month-heading h2 {
  margin: 0;
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-button,
.today-button {
  height: 38px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--paper);
}

.icon-button {
  width: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
}

.icon-button svg,
.close-button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.today-button {
  padding: 0 15px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.icon-button:hover,
.today-button:hover {
  background: var(--canvas);
  border-color: var(--deep-blue);
}

.calendar-scroll {
  overflow-x: auto;
}

.weekday-row,
.calendar-grid {
  min-width: 760px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  height: 46px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  position: relative;
  min-height: 132px;
  padding: 12px 10px 9px;
  overflow: hidden;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
}

.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day:nth-last-child(-n + 7) { border-bottom: 0; }
.calendar-day:hover { background: rgba(120, 220, 255, 0.16); }
.calendar-day.outside-month { background: rgba(220, 232, 255, 0.38); }
.calendar-day.outside-month .day-number { color: rgba(11, 19, 37, 0.42); }

.day-heading {
  height: 29px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.day-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.calendar-day.today .day-number {
  color: var(--paper);
  background: var(--midnight);
}

.day-add {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--incoming);
  background: var(--incoming-soft);
  opacity: 0;
  transition: opacity 150ms ease;
}

.calendar-day:hover .day-add,
.calendar-day:focus-within .day-add { opacity: 1; }
.day-add svg { width: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.day-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-event {
  width: 100%;
  min-height: 26px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 600;
  text-align: left;
}

.calendar-event:hover { filter: saturate(1.1) brightness(0.98); }
.calendar-event.incoming { color: var(--teal); background: var(--incoming-soft); }
.calendar-event.outgoing { color: var(--ink); background: var(--outgoing-soft); }
.calendar-event.status-completed { opacity: 0.64; }
.calendar-event.status-completed .event-name { text-decoration: line-through; }
.calendar-event.status-skipped { opacity: 0.48; border: 1px dashed currentColor; background: transparent; }
.calendar-event.status-skipped .event-name { text-decoration: line-through; }
.calendar-event.status-late { box-shadow: inset 0 0 0 1px currentColor; }

.event-marker {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  border-radius: 50%;
  background: currentColor;
}

.event-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-amount {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.82;
}

.more-events {
  padding: 2px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.calendar-legend {
  min-height: 56px;
  padding: 15px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.calendar-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.storage-note { margin-left: auto; }
.storage-note svg {
  width: 16px;
  fill: none;
  stroke: var(--incoming);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.event-dialog {
  width: min(660px, calc(100vw - 32px));
  max-height: min(880px, calc(100vh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(11, 19, 37, 0.28);
}

.event-dialog::backdrop {
  background: rgba(11, 19, 37, 0.62);
  backdrop-filter: blur(3px);
}

.event-dialog[open] { animation: dialog-in 180ms ease-out; }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#event-form {
  max-height: inherit;
  display: flex;
  flex-direction: column;
}

.dialog-header {
  padding: 24px 26px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.dialog-header .eyebrow { margin-bottom: 5px; }
.dialog-header h2 {
  margin: 0;
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: 23px;
  letter-spacing: -0.035em;
}

.close-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
  background: var(--canvas);
}

.close-button:hover { color: var(--ink); background: var(--periwinkle); }

.form-body {
  padding: 23px 26px 25px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 19px;
  overflow-y: auto;
}

.full-width { grid-column: 1 / -1; }
.form-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}

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

.form-field label,
.form-field legend {
  padding: 0;
  color: var(--plum);
  font-size: 12px;
  font-weight: 700;
}

.form-field > .field-label { color: var(--plum); font-size: 12px; font-weight: 700; }

.form-field label span { color: var(--subtle); font-weight: 500; }

.form-field input,
.form-field select,
.form-field textarea,
.currency-input,
.url-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-field input,
.form-field select {
  height: 43px;
  padding: 0 12px;
}

.form-field textarea {
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.5;
}

.form-field input:hover,
.form-field select:hover,
.form-field textarea:hover,
.currency-input:hover,
.url-input:hover { border-color: var(--deep-blue); }

.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--subtle); }

.form-field input.invalid,
.form-field select.invalid,
.form-field textarea.invalid { border-color: var(--outgoing); }

.field-error {
  min-height: 0;
  color: var(--outgoing);
  font-size: 11px;
}

.field-error:empty { display: none; }
.field-help { color: var(--subtle); font-size: 10px; }

.repeat-picker { position: relative; }
.repeat-picker svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.repeat-picker-native { display: none !important; }
.repeat-picker-button { width: 100%; min-height: 62px; padding: 8px 12px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--border-strong); border-radius: 12px; color: var(--ink); background: var(--paper); text-align: left; }
.repeat-picker-button:hover, .repeat-picker-button[aria-expanded="true"] { border-color: var(--deep-blue); background: var(--periwinkle); box-shadow: 0 0 0 3px rgba(49, 88, 223, 0.12); }
.repeat-picker-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; border-radius: 10px; color: var(--paper); background: var(--deep-blue); }
.repeat-picker-icon svg { width: 18px; }
.repeat-picker-button > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.repeat-picker-button small { color: var(--subtle); font-size: 8px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.repeat-picker-button strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.repeat-picker-chevron { width: 16px; margin-left: auto; flex: 0 0 16px; transition: transform 160ms ease; }
.repeat-picker-button[aria-expanded="true"] .repeat-picker-chevron { transform: rotate(180deg); }
.repeat-picker-menu { margin-top: 9px; max-height: min(430px, 48vh); padding: 14px; overflow-y: auto; border: 1px solid var(--ink); border-radius: 15px; background: var(--work-ink); box-shadow: 6px 6px 0 var(--ink); }
.repeat-picker-menu[hidden] { display: none !important; }
.repeat-picker-menu > button, .repeat-picker-group button { border: 1px solid rgba(244, 240, 232, 0.17); border-radius: 10px; color: var(--paper); background: rgba(244, 240, 232, 0.06); text-align: left; }
.repeat-picker-menu > button { width: 100%; min-height: 58px; padding: 9px 11px; display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 10px; }
.repeat-option-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: var(--ink); background: var(--lime); font-weight: 850; }
.repeat-picker-menu button > span:last-child, .repeat-picker-group button { display: grid; gap: 2px; }
.repeat-picker-menu button:hover { border-color: var(--sky); background: rgba(120, 220, 255, 0.16); }
.repeat-picker-menu button[aria-selected="true"] { border-color: var(--lime); background: rgba(242, 255, 90, 0.16); box-shadow: inset 3px 0 0 var(--lime); }
.repeat-picker-menu strong { font-size: 11px; }
.repeat-picker-menu small { color: rgba(244, 240, 232, 0.66); font-size: 8px; line-height: 1.35; }
.repeat-picker-group { margin-top: 13px; }
.repeat-picker-group > span { display: block; margin: 0 0 6px 2px; color: var(--sky); font-size: 8px; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.repeat-picker-group > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.repeat-picker-group button { min-height: 54px; padding: 9px 10px; }

.website-open-link {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--incoming);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.website-open-link:hover { text-decoration: underline; }
.website-open-link[hidden] { display: none; }
.website-open-link svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.payment-type-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.payment-type-field legend { margin-bottom: 8px; }

.edit-scope-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.edit-scope-field[hidden] { display: none; }
.edit-scope-field legend {
  margin-bottom: 8px;
  color: var(--plum);
  font-size: 11px;
  font-weight: 800;
}

.scope-switcher {
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border-radius: 11px;
  background: var(--periwinkle);
}

.scope-switcher label { position: relative; cursor: pointer; }
.scope-switcher input { position: absolute; opacity: 0; pointer-events: none; }
.scope-switcher span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.scope-switcher input:checked + span {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 3px 10px rgba(11, 19, 37, 0.12);
}

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

.type-option {
  position: relative;
  min-height: 64px;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-radio {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border: 1.5px solid rgba(8, 9, 11, 0.42);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--paper);
}

.type-option > span:last-child {
  display: flex;
  flex-direction: column;
}

.type-option strong { font-size: 12px; }
.type-option small { margin-top: 2px; color: var(--subtle); font-size: 10px; }
.incoming-option:has(input:checked) { border-color: var(--deep-blue); background: var(--incoming-soft); }
.outgoing-option:has(input:checked) { border-color: var(--coral); background: var(--outgoing-soft); }
.incoming-option:has(input:checked) .type-radio { border-color: var(--incoming); background: var(--incoming); }
.outgoing-option:has(input:checked) .type-radio { border-color: var(--outgoing); background: var(--outgoing); }

.currency-input,
.url-input {
  height: 43px;
  display: flex;
  align-items: center;
}

.currency-input:focus-within,
.url-input:focus-within {
  border-color: var(--incoming);
  box-shadow: 0 0 0 3px rgba(49, 88, 223, 0.16);
}

.currency-input > span {
  padding-left: 12px;
  color: var(--muted);
  font-size: 13px;
}

.currency-input input,
.url-input input {
  height: 41px;
  border: 0;
  outline: 0;
  box-shadow: none;
}

.currency-input input:focus-visible,
.url-input input:focus-visible { outline: none; }

.url-input svg {
  width: 18px;
  margin-left: 12px;
  flex: 0 0 18px;
  fill: none;
  stroke: var(--subtle);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.recurrence-panel {
  padding: 17px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(220, 232, 255, 0.42);
}

.recurrence-panel[hidden],
.end-setting[hidden],
.series-note[hidden],
.custom-repeat-setting[hidden] { display: none; }
.end-setting { align-self: end; }
.duration-setting { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 8px; }
.compact-label label { visibility: hidden; }

.custom-repeat-setting {
  padding: 14px 17px;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(220, 232, 255, 0.42);
}

.attachment-picker {
  min-height: 70px;
  padding: 12px;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  column-gap: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 11px;
  color: var(--teal);
  background: rgba(220, 232, 255, 0.42);
  cursor: pointer;
}

.attachment-picker:hover { border-color: var(--deep-blue); background: var(--periwinkle); }
.attachment-picker svg {
  grid-row: 1 / 3;
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.attachment-picker span { color: var(--ink); font-size: 11px; font-weight: 800; }
.attachment-picker small { color: var(--muted); font-size: 9px; }

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.attachment-chip {
  min-height: 32px;
  padding: 5px 7px 5px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--paper);
  font-size: 10px;
  font-weight: 700;
}

.attachment-chip .attachment-open {
  max-width: 180px;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: inherit;
  background: transparent;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip .attachment-remove {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: var(--orange);
  background: var(--outgoing-soft);
}

.attachment-chip svg { width: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.workspace-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(11, 19, 37, 0.28);
}

.workspace-dialog::backdrop {
  background: rgba(11, 19, 37, 0.62);
  backdrop-filter: blur(3px);
}

.workspace-dialog-content {
  max-height: inherit;
  display: flex;
  flex-direction: column;
}

.workspace-body {
  padding: 23px 26px;
  display: flex;
  flex-direction: column;
  gap: 19px;
  overflow-y: auto;
}

.workspace-status-card {
  padding: 15px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--incoming-soft);
}

.workspace-status-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--teal);
  background: var(--paper);
}
.workspace-status-icon svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.workspace-status-card strong { font-size: 12px; }
.workspace-status-card p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }

.status-pill {
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--plum);
  background: var(--violet);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.status-pill.local { color: var(--teal); background: var(--paper); }
.status-pill.connected { color: var(--teal); background: var(--incoming-soft); }

.cloud-connect-panel {
  padding: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: rgba(220, 232, 255, 0.42);
}

.cloud-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.cloud-kicker { color: var(--orange); font-size: 9px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.cloud-panel-heading h3 { margin: 4px 0 0; font-size: 16px; letter-spacing: -0.02em; }
.cloud-connect-panel > p { margin: 10px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.cloud-actions,
.cloud-auth,
.cloud-workspace-actions { display: flex; align-items: center; gap: 9px; }
.cloud-actions { margin-top: 14px; }
.cloud-actions > span { color: var(--subtle); font-size: 9px; }
.cloud-auth { margin-top: 15px; align-items: flex-end; }
.cloud-auth .form-field { flex: 1; }
.cloud-workspace-actions { margin-top: 15px; flex-wrap: wrap; }
.cloud-workspace-actions[hidden],
.cloud-auth[hidden] { display: none; }
.workspace-save-state { color: var(--muted); font-size: 10px; }

.series-note {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 9px;
  color: var(--plum);
  background: var(--periwinkle);
  font-size: 11px;
}

.series-note svg {
  width: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dialog-footer {
  min-height: 78px;
  padding: 16px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: rgba(220, 232, 255, 0.42);
}

.footer-actions {
  margin-left: auto;
  display: flex;
  gap: 9px;
}

.secondary-button,
.delete-button {
  min-height: 43px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 600;
}

.secondary-button:hover { background: var(--canvas); }

.delete-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--outgoing);
  border-color: var(--coral);
  background: var(--peach);
}

.delete-button[hidden] { display: none; }
.delete-button:hover { background: var(--outgoing-soft); }

.toast {
  position: fixed;
  z-index: 20;
  right: 28px;
  bottom: 26px;
  padding: 12px 16px;
  border-radius: 11px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--lime);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 5px 5px 0 var(--ink);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible { opacity: 1; transform: translateY(0); }

.offline-banner {
  position: fixed;
  z-index: 19;
  left: 50%;
  bottom: 24px;
  max-width: calc(100vw - 28px);
  padding: 11px 15px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  color: var(--ink);
  background: var(--coral);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 11px;
  font-weight: 750;
  text-align: center;
  transform: translateX(-50%);
}

@media (max-width: 820px) {
  .app-shell { padding: 0 22px 36px; }
  .app-header { min-height: 76px; flex-wrap: wrap; gap: 12px; padding: 14px 0; }
  .calendar-section-control { width: 100%; order: 3; }
  .calendar-section-control select { width: 100%; }
  main { padding-top: 26px; }
  .hero { align-items: flex-start; flex-direction: column; }
  .view-switcher { width: 100%; }
  .view-tab { flex: 1; justify-content: center; }
  .summary-grid { grid-template-columns: 1fr; gap: 9px; margin-top: 26px; }
  .summary-card { min-height: 84px; padding: 15px 18px; }
  .utility-bar { grid-template-columns: minmax(0, 1fr) minmax(140px, 0.55fr); }
  .search-control { grid-column: 1 / -1; }
  .data-actions { justify-content: flex-end; }
  .insights-grid { grid-template-columns: 1fr; }
  .insight-card { min-height: 280px; }
  .calendar-card { border-radius: 17px; }
  .calendar-toolbar { padding: 18px 20px; align-items: stretch; flex-direction: column; gap: 14px; }
  .calendar-toolbar-actions { align-items: stretch; flex-direction: column; }
  .calendar-controls { justify-content: flex-end; }
  .calendar-legend { padding: 14px 20px; }
}

@media (max-width: 560px) {
  .app-shell { padding: 0 14px 28px; }
  body:has(.install-button:not([hidden])) .brand > span:last-child { display: none; }
  .brand small { display: none; }
  .header-actions { gap: 5px; }
  .header-icon-button { width: 38px; height: 38px; }
  .install-button { width: 38px; min-height: 38px; padding: 0; justify-content: center; }
  .install-button span { display: none; }
  .workspace-button { width: 38px; min-height: 38px; padding: 0; justify-content: center; font-size: 0; }
  .add-event-button { min-height: 40px; padding: 0 12px; font-size: 12px; }
  .hero h1 { font-size: 34px; }
  .hero-copy { font-size: 14px; }
  .view-tab { padding: 0 8px; font-size: 11px; }
  .utility-bar { grid-template-columns: 1fr 1fr; padding: 9px; }
  .utility-bar > select { font-size: 10px; }
  .search-control,
  .data-actions { grid-column: 1 / -1; }
  .data-actions { justify-content: stretch; }
  .tool-button { flex: 1; padding: 0 7px; }
  .insight-card { padding: 18px; }
  .report-chart { gap: 6px; }
  .upcoming-item { grid-template-columns: 37px minmax(0, 1fr) auto; }
  .calendar-toolbar { align-items: stretch; gap: 16px; }
  .month-heading h2 { font-size: 20px; }
  .calendar-controls { padding-top: 2px; }
  .today-button { padding: 0 10px; }
  .calendar-legend { flex-wrap: wrap; gap: 10px 16px; }
  .storage-note { width: 100%; margin: 2px 0 0; }
  .event-dialog { width: calc(100vw - 18px); max-height: calc(100vh - 18px); border-radius: 17px; }
  .dialog-header { padding: 19px 18px 16px; }
  .form-body { padding: 19px 18px; display: block; }
  .form-body > * + * { margin-top: 17px; }
  .form-row { grid-template-columns: 1fr; gap: 17px; }
  .type-options { grid-template-columns: 1fr; }
  .recurrence-panel { grid-template-columns: 1fr; }
  .custom-repeat-setting { grid-template-columns: 0.7fr 1.3fr; }
  .dialog-footer { padding: 13px 18px; }
  .delete-button { width: 43px; padding: 0; justify-content: center; font-size: 0; }
  .footer-actions { flex: 1; justify-content: flex-end; }
  .footer-actions button { padding: 0 13px; }
  .toast { right: 14px; bottom: 14px; left: 14px; text-align: center; }
  .offline-banner { bottom: 72px; }
  .workspace-dialog { width: calc(100vw - 18px); max-height: calc(100vh - 18px); border-radius: 17px; }
  .workspace-body { padding: 19px 18px; }
  .workspace-status-card { grid-template-columns: 40px minmax(0, 1fr); }
  .workspace-status-card .status-pill { grid-column: 2; width: fit-content; }
  .cloud-connect-panel .form-row { grid-template-columns: 1fr; }
  .cloud-auth { align-items: stretch; flex-direction: column; }
  .cloud-auth .primary-button { width: 100%; }
  .workspace-save-state { display: none; }
}

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