@font-face {
  font-family: "Poppins";
  src: url("assets/fonts/Poppins-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("assets/fonts/Poppins-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("assets/fonts/Poppins-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --navy-950: #142634;
  --navy-900: #1b3041;
  --navy-800: #29445a;
  --navy-700: #3e5c73;
  --coral-700: #9f3048;
  --coral-600: #ba3e56;
  --coral-500: #ce5065;
  --coral-100: #fce9ed;
  --teal-700: #127b7e;
  --teal-600: #168f91;
  --teal-100: #e4f5f4;
  --amber-700: #b76e22;
  --amber-100: #fff2df;
  --green-700: #257a51;
  --green-100: #e5f5ec;
  --red-700: #b13c4b;
  --red-100: #fbe8eb;
  --blue-100: #e9f0fb;
  --violet-700: #7048a0;
  --violet-100: #f1eafb;
  --ink-900: #1d2b36;
  --ink-700: #455865;
  --ink-500: #758590;
  --ink-400: #97a4ad;
  --line: #e3e8eb;
  --line-strong: #d4dce1;
  --surface: #ffffff;
  --surface-soft: #f7f8f8;
  --canvas: #f2f4f5;
  --shadow-sm: 0 1px 2px rgba(20, 38, 52, 0.04), 0 4px 14px rgba(20, 38, 52, 0.04);
  --shadow-md: 0 16px 38px rgba(20, 38, 52, 0.12);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --sidebar-width: 244px;
}

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

html {
  min-width: 320px;
  background: var(--canvas);
  font-family: "Poppins", "Segoe UI", sans-serif;
  font-size: 17px;
  color: var(--ink-900);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 72% -10%, rgba(22, 143, 145, 0.08), transparent 30rem),
    var(--canvas);
}

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

button {
  color: inherit;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(22, 143, 145, 0.23);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  color: #fff;
  background:
    radial-gradient(circle at 15% 100%, rgba(22, 143, 145, 0.2), transparent 19rem),
    linear-gradient(155deg, var(--navy-900), var(--navy-950));
  box-shadow: 8px 0 30px rgba(20, 38, 52, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 95px;
  padding: 1.25rem 1.25rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 9px 20px rgba(60, 104, 166, 0.28);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-mark-small {
  width: 34px;
  height: 34px;
  border-radius: 11px;
}

.brand-copy {
  display: grid;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand-copy small {
  margin-top: 0.35rem;
  color: rgba(255, 255, 255, 0.57);
  font-size: 0.66rem;
  font-weight: 400;
}

.main-nav {
  flex: 1;
  padding: 1.45rem 0.8rem;
}

.nav-label {
  margin: 0 0.7rem 0.75rem;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 0.8rem;
  padding: 0 0.85rem;
  color: rgba(255, 255, 255, 0.67);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item + .nav-item {
  margin-top: 0.3rem;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.065);
}

.nav-item:active {
  transform: translateY(1px);
}

.nav-item svg {
  width: 19px;
  height: 19px;
}

.nav-item span:not(.nav-badge, .nav-pill) {
  font-size: 0.82rem;
  font-weight: 500;
}

.nav-item.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.nav-item.is-active::before {
  position: absolute;
  left: -0.8rem;
  width: 4px;
  height: 24px;
  background: #54c3bf;
  border-radius: 0 5px 5px 0;
  content: "";
}

.nav-badge,
.nav-pill {
  margin-left: auto;
  line-height: 1;
  border-radius: 99px;
}

.nav-badge {
  padding: 0.28rem 0.46rem;
  color: #fff;
  font-size: 0.63rem;
  background: var(--coral-600);
}

.nav-pill {
  padding: 0.3rem 0.45rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.53rem;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
  padding: 0.85rem;
}

.local-status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.7rem;
  padding: 0.8rem;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 13px;
}

.status-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  color: #6bd0cb;
  background: rgba(84, 195, 191, 0.11);
  border-radius: 10px;
}

.status-icon svg {
  width: 16px;
  height: 16px;
}

.local-status > span:last-child {
  display: grid;
}

.local-status strong {
  font-size: 0.68rem;
  font-weight: 600;
}

.local-status small {
  margin-top: 0.18rem;
  color: rgba(255, 255, 255, 0.38);
  font-size: 0.52rem;
  line-height: 1.35;
}

.settings-button {
  min-height: 42px;
}

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 2rem clamp(1.25rem, 3vw, 3rem) 3rem;
}

#cahierScreen[hidden],
.budget-screen[hidden] {
  display: none;
}

.budget-screen {
  width: min(100%, 1460px);
  margin-inline: auto;
}

.manager-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.manager-heading h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.045em;
}

.manager-heading p:not(.eyebrow) {
  max-width: 650px;
  margin: 0.55rem 0 0;
  color: var(--ink-500);
  font-size: 0.78rem;
}

.manager-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.manager-summary-card {
  display: flex;
  min-height: 104px;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.manager-summary-icon {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
}

.manager-summary-icon svg {
  width: 19px;
  height: 19px;
}

.manager-summary-icon.budget-icon,
.manager-summary-icon.hidden-icon {
  color: var(--amber-700);
  background: var(--amber-100);
}

.manager-summary-icon.recurring-icon {
  color: #087b78;
  background: #d8f4f1;
}

.manager-summary-icon.schedule-icon {
  color: var(--violet-700);
  background: var(--violet-100);
}

.manager-summary-icon.expense-icon {
  color: var(--coral-700);
  background: var(--coral-100);
}

.manager-summary-icon.income-icon {
  color: var(--green-700);
  background: var(--green-100);
}

.manager-summary-card div {
  display: grid;
  gap: 0.2rem;
}

.manager-summary-card small {
  color: var(--ink-500);
  font-size: 0.56rem;
}

.manager-summary-card strong {
  font-size: 1.05rem;
  letter-spacing: -0.035em;
}

.manager-list-card {
  margin-top: 1rem;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.manager-list-card > header {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--line);
}

.manager-list-card h2,
.manager-list-card p {
  margin: 0;
}

.manager-list-card h2 {
  font-size: 1rem;
}

.manager-list-card p {
  margin-top: 0.3rem;
  color: var(--ink-500);
  font-size: 0.58rem;
}

.manager-list-count {
  flex: 0 0 auto;
  padding: 0.45rem 0.65rem;
  color: var(--amber-700);
  font-size: 0.58rem;
  background: var(--amber-100);
  border-radius: 99px;
}

.budget-list {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  background: #f6f7f7;
}

.budget-list[hidden] {
  display: none;
}

.budget-definition-card {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: start;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
}

.budget-definition-card.is-expense {
  border-left: 4px solid #e5a148;
}

.budget-definition-card.is-income {
  border-left: 4px solid #56a77c;
}

.recurring-definition-card.is-expense {
  border-left-color: #18a8a3;
}

.budget-card-accent {
  display: grid;
  min-height: 100%;
  place-items: start center;
  padding-top: 1rem;
  background: #fff7e8;
}

.budget-definition-card.is-income .budget-card-accent {
  background: var(--green-100);
}

.recurring-definition-card .budget-card-accent {
  background: #e4f8f6;
}

.budget-card-accent span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--amber-700);
  font-size: 0.54rem;
  font-weight: 700;
  background: #ffe8bf;
  border-radius: 10px;
}

.budget-definition-card.is-income .budget-card-accent span {
  color: var(--green-700);
  background: #ccebd9;
}

.recurring-definition-card .budget-card-accent span {
  color: #087b78;
  background: #c8eeeb;
}

.recurring-screen .eyebrow,
.recurring-screen .hidden-months summary {
  color: #087b78;
}

.recurring-count {
  color: #087b78;
  background: #d8f4f1;
}

.recurring-primary {
  background: linear-gradient(135deg, #109b97, #087b78);
  box-shadow: 0 8px 18px rgba(8, 123, 120, 0.2);
}

.recurring-empty > span {
  color: #087b78;
  background: #d8f4f1;
}

.recurring-form-note {
  border-color: #bde9e6;
  background: #effbf9;
}

.recurring-form-note span {
  color: #087b78;
  background: #c8eeeb;
}

.schedule-screen .eyebrow,
.schedule-card details summary {
  color: var(--violet-700);
}

.schedule-count {
  color: var(--violet-700);
  background: var(--violet-100);
}

.schedule-primary {
  background: linear-gradient(135deg, #8157ad, #67408f);
  box-shadow: 0 8px 18px rgba(112, 72, 160, 0.22);
}

.schedule-empty > span {
  color: var(--violet-700);
  background: var(--violet-100);
}

.schedule-list {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  background: #f6f7f7;
}

.schedule-list[hidden] {
  display: none;
}

.schedule-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid #8962b5;
  border-radius: 15px;
  box-shadow: var(--shadow-sm);
}

.schedule-card.is-provisioned {
  border-left-color: #5f3b88;
  box-shadow: 0 8px 24px rgba(93, 55, 133, 0.12);
}

.schedule-card.is-archived {
  border-left-color: #9da4aa;
  background: #fbfbfb;
  box-shadow: none;
}

.schedule-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem;
}

.schedule-card-main.is-editable {
  cursor: pointer;
}

.schedule-card-main.is-editable:hover {
  background: #fdfbff;
}

.schedule-card-main.is-editable button {
  cursor: pointer;
}

.schedule-card-title {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.schedule-card-title > span {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--violet-700);
  font-size: 0.52rem;
  font-weight: 700;
  background: var(--violet-100);
  border-radius: 10px;
}

.schedule-card h3 {
  margin: 0;
  font-size: 0.84rem;
}

.schedule-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.schedule-provision-badge,
.schedule-archive-badge {
  width: fit-content;
  padding: 0.24rem 0.45rem;
  font-size: 0.5rem;
  font-weight: 700;
  border-radius: 999px;
}

.schedule-provision-badge {
  color: #5f3b88;
  background: #efe5f8;
}

.schedule-archive-badge {
  color: var(--ink-500);
  background: #eceff1;
}

.schedule-progress-copy {
  margin: 0.2rem 0 0;
  color: var(--ink-500);
  font-size: 0.55rem;
}

.schedule-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, auto));
  gap: 0.8rem;
  margin-top: 0.85rem;
}

.schedule-metrics span {
  display: grid;
  gap: 0.12rem;
}

.schedule-metrics small {
  color: var(--ink-500);
  font-size: 0.5rem;
}

.schedule-metrics strong {
  font-size: 0.65rem;
}

.schedule-card-actions {
  display: flex;
  gap: 0.45rem;
}

.schedule-card-actions .button,
.schedule-card-actions .icon-button {
  min-height: 36px;
  font-size: 0.61rem;
}

.schedule-archive-button {
  color: #5f3b88;
  border-color: #d9c8e8;
  background: #f8f4fc;
}

.schedule-archive-card {
  margin-top: 1rem;
}

.schedule-archive-card[hidden] {
  display: none;
}

.schedule-archive-list {
  background: #f2f3f4;
}

.schedule-card details {
  border-top: 1px solid var(--line);
}

.schedule-card details summary {
  padding: 0.7rem 1rem;
  font-size: 0.56rem;
  font-weight: 600;
  background: #fbf9fd;
  cursor: pointer;
}

.schedule-occurrences {
  display: grid;
}

.schedule-occurrence {
  display: grid;
  grid-template-columns: 54px 110px minmax(0, 1fr) 110px;
  gap: 0.8rem;
  align-items: center;
  min-height: 46px;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.57rem;
}

.schedule-occurrence:first-child {
  border-top: 0;
}

.schedule-occurrence.is-locked {
  color: var(--ink-500);
  background: #f4f7fb;
}

.schedule-occurrence.is-past:not(.is-locked) {
  color: var(--ink-500);
  background: #f7f7f7;
}

.schedule-occurrence.is-past time,
.schedule-occurrence.is-past strong {
  opacity: 0.72;
}

.schedule-past-action {
  color: var(--ink-700);
  background: #f0f2f3;
}

.schedule-occurrence-index,
.schedule-occurrence-status {
  width: fit-content;
  padding: 0.25rem 0.45rem;
  border-radius: 7px;
}

.schedule-occurrence-index {
  color: var(--violet-700);
  background: var(--violet-100);
}

.schedule-occurrence-status {
  color: var(--green-700);
  background: var(--green-100);
}

.schedule-occurrence > .schedule-occurrence-status,
.schedule-occurrence > [data-edit-schedule-occurrence] {
  grid-column: 4;
  grid-row: 1;
}

.schedule-occurrence:not(.is-locked) {
  cursor: pointer;
}

.schedule-occurrence:not(.is-locked):hover {
  background: #faf7fd;
}

.schedule-form-note {
  border-color: #ded0ed;
  background: #f8f4fc;
}

.schedule-form-note span {
  color: var(--violet-700);
  background: var(--violet-100);
}

.schedule-form-error {
  margin: 0.8rem 0 0;
  padding: 0.7rem;
  color: var(--red-700);
  font-size: 0.62rem;
  background: var(--red-100);
  border-radius: 10px;
}

.schedule-dialog output {
  display: flex;
  min-height: 43px;
  align-items: center;
  padding: 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  background: #f5f2f9;
  border: 1px solid #e3d9ec;
  border-radius: 10px;
}

.schedule-provision-field {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem;
  color: #5f3b88;
  background: #f8f4fc;
  border: 1px solid #ded0ed;
  border-radius: 12px;
  cursor: pointer;
}

.schedule-provision-field input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 0.05rem;
  accent-color: #7048a0;
}

.schedule-provision-field > span {
  display: grid;
  gap: 0.25rem;
}

.schedule-provision-field strong {
  font-size: 0.65rem;
}

.schedule-provision-field small {
  color: var(--ink-500);
  font-size: 0.55rem;
  line-height: 1.45;
}

.budget-card-main {
  min-width: 0;
  padding: 0.95rem 0;
}

.budget-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.budget-card-title h3 {
  margin: 0.15rem 0 0;
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-direction {
  color: var(--ink-500);
  font-size: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.budget-card-title > strong {
  flex: 0 0 auto;
  font-size: 0.8rem;
}

.budget-card-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.35rem;
  color: var(--ink-500);
  font-size: 0.52rem;
}

.budget-card-meta span + span::before {
  content: "·";
  margin-right: 0.75rem;
}

.hidden-months {
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.hidden-months summary {
  width: fit-content;
  color: var(--teal-700);
  font-size: 0.56rem;
  font-weight: 600;
  cursor: pointer;
}

.hidden-months ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.hidden-months li {
  display: inline-flex;
  min-height: 31px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.25rem 0.2rem 0.55rem;
  color: var(--ink-700);
  font-size: 0.54rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hidden-months li button {
  min-height: 24px;
  padding: 0 0.45rem;
  color: var(--teal-700);
  font-size: 0.5rem;
  font-weight: 600;
  background: var(--teal-100);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.hidden-months .no-hidden-month {
  color: var(--green-700);
  background: var(--green-100);
  border-color: transparent;
  padding-right: 0.55rem;
}

.budget-card-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.85rem;
}

.budget-card-actions .button {
  min-height: 36px;
  font-size: 0.61rem;
}

.budget-delete {
  width: 36px;
  height: 36px;
  color: var(--red-700);
  background: var(--red-100);
  border-color: transparent;
}

.manager-empty {
  display: grid;
  min-height: 310px;
  place-items: center;
  align-content: center;
  gap: 0.55rem;
  padding: 2rem;
  text-align: center;
}

.manager-empty[hidden] {
  display: none;
}

.manager-empty > span {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: var(--amber-700);
  background: var(--amber-100);
  border-radius: 17px;
}

.manager-empty h3,
.manager-empty p {
  margin: 0;
}

.manager-empty h3 {
  font-size: 0.9rem;
}

.manager-empty p {
  max-width: 500px;
}

.page-heading,
.period-toolbar,
.summary-grid,
.ledger-card {
  width: min(100%, 1460px);
  margin-inline: auto;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--coral-600);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.045em;
}

.page-heading h1 span {
  display: inline-block;
  font-size: 0.8em;
  transform: rotate(-4deg);
}

.page-intro {
  max-width: 560px;
  margin: 0.55rem 0 0;
  color: var(--ink-500);
  font-size: 0.8rem;
}

.heading-actions {
  display: flex;
  gap: 0.7rem;
  padding-top: 0.25rem;
}

.button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0 1rem;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 11px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.35);
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button-primary {
  color: #fff;
  background: linear-gradient(145deg, var(--coral-500), var(--coral-700));
  border: 1px solid transparent;
  box-shadow: 0 8px 18px rgba(186, 62, 86, 0.18);
}

.button-primary:hover {
  box-shadow: 0 10px 22px rgba(186, 62, 86, 0.25);
}

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

.button-secondary:hover {
  border-color: #b9c5cc;
  box-shadow: var(--shadow-sm);
}

.button-ghost {
  color: var(--ink-700);
  background: transparent;
  border: 1px solid transparent;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: var(--ink-700);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--navy-900);
  border-color: var(--line-strong);
}

.period-toolbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 0.9rem;
  margin-top: 1.6rem;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(212, 220, 225, 0.72);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.month-control {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.month-button {
  border: 0;
  box-shadow: none;
}

.month-label {
  display: flex;
  min-width: 148px;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
  line-height: 1;
}

.month-label span {
  font-size: 1rem;
  font-weight: 700;
  text-transform: capitalize;
}

.month-label strong {
  color: var(--ink-500);
  font-size: 0.8rem;
  font-weight: 500;
}

.today-button,
.compact-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.75rem;
  color: var(--ink-700);
  font-size: 0.67rem;
  font-weight: 600;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.today-button svg,
.compact-button svg {
  width: 15px;
  height: 15px;
}

.period-note {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0.45rem 0 auto;
  color: var(--ink-500);
  font-size: 0.62rem;
}

.compact-sticky-actions {
  display: none;
  align-items: center;
  gap: 0.45rem;
}

.compact-sticky-actions[hidden],
.compact-selection-actions[hidden] {
  display: none;
}

.compact-selection-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.compact-selection-actions > span {
  color: var(--teal-700);
  font-size: 0.58rem;
  white-space: nowrap;
}

.compact-selection-actions .selection-button {
  min-height: 32px;
}

.pulse-dot,
.success-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #3ca875;
  border-radius: 50%;
}

.pulse-dot {
  box-shadow: 0 0 0 4px rgba(60, 168, 117, 0.11);
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.65fr) repeat(3, minmax(170px, 0.78fr));
  gap: 0.9rem;
  margin-top: 0.9rem;
}

.summary-card {
  position: relative;
  min-height: 158px;
  overflow: hidden;
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid rgba(227, 232, 235, 0.9);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.balance-card {
  min-height: 181px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 5%, rgba(255, 255, 255, 0.17), transparent 13rem),
    linear-gradient(145deg, #27475c, #173042 70%);
  border-color: transparent;
}

.summary-card-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card-label {
  margin: 0;
  color: var(--ink-500);
  font-size: 0.65rem;
  font-weight: 500;
}

.balance-card .card-label {
  color: rgba(255, 255, 255, 0.65);
}

.balance-value {
  margin: 0.3rem 0 0;
  font-size: clamp(1.7rem, 2.3vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.05em;
}

.balance-caption {
  position: relative;
  z-index: 2;
  margin: 0.1rem 0 0;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.61rem;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.32rem 0.45rem;
  font-size: 0.58rem;
  font-weight: 600;
  border-radius: 99px;
}

.trend-badge[hidden] {
  display: none;
}

.trend-positive {
  color: #bdf3d4;
  background: rgba(64, 189, 123, 0.16);
  border: 1px solid rgba(122, 222, 166, 0.16);
}

.trend-negative {
  color: #ffd2d9;
  background: rgba(206, 80, 101, 0.2);
  border: 1px solid rgba(255, 188, 200, 0.18);
}

.trend-badge svg {
  width: 12px;
  height: 12px;
}

.balance-visual {
  position: absolute;
  inset: auto 0 0;
  height: 78px;
  opacity: 0.86;
}

.balance-visual svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.balance-visual .area {
  fill: url(#areaGradient);
  stroke: none;
}

.balance-visual .line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.78);
  stroke-width: 2;
}

.balance-visual circle {
  fill: #fff;
  stroke: rgba(255, 255, 255, 0.25);
  stroke-width: 6;
}

.account-card,
.sync-card,
.planned-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.summary-icon svg {
  width: 18px;
  height: 18px;
}

.teal-icon {
  color: var(--teal-700);
  background: var(--teal-100);
}

.coral-icon {
  color: var(--coral-700);
  background: var(--coral-100);
}

.amber-icon {
  color: var(--amber-700);
  background: var(--amber-100);
}

.metric-value {
  margin: 0.28rem 0 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.metric-date {
  font-size: 0.9rem;
}

.metric-caption {
  margin: 0.24rem 0 0;
  color: var(--ink-400);
  font-size: 0.55rem;
}

.metric-caption .success-dot {
  width: 6px;
  height: 6px;
  margin-right: 0.25rem;
}

.ledger-card {
  margin-top: 0.9rem;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.ledger-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.2rem 1.35rem 0.9rem;
}

.title-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.ledger-header h2 {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: -0.025em;
}

.ledger-header p {
  margin: 0.3rem 0 0;
  color: var(--ink-500);
  font-size: 0.68rem;
}

.count-badge {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  padding: 0 0.35rem;
  color: var(--teal-700);
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--teal-100);
  border-radius: 99px;
}

.search-field {
  display: flex;
  width: min(100%, 310px);
  min-height: 40px;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.65rem;
  color: var(--ink-400);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.search-field:focus-within {
  color: var(--teal-700);
  background: #fff;
  border-color: rgba(22, 143, 145, 0.42);
  box-shadow: 0 0 0 3px rgba(22, 143, 145, 0.08);
}

.search-field svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.search-field input {
  width: 100%;
  min-width: 0;
  color: var(--ink-900);
  font-size: 0.7rem;
  background: transparent;
  border: 0;
  outline: 0;
}

.search-field input::placeholder {
  color: var(--ink-400);
}

.search-field kbd {
  flex: 0 0 auto;
  padding: 0.16rem 0.32rem;
  color: var(--ink-400);
  font-family: inherit;
  font-size: 0.52rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.ledger-toolbar {
  display: flex;
  min-height: 51px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.35rem;
  border-top: 1px solid var(--line);
}

.filter-tabs {
  display: flex;
  align-self: stretch;
  gap: 1.25rem;
}

.filter-tab {
  position: relative;
  padding: 0;
  color: var(--ink-500);
  font-size: 0.68rem;
  font-weight: 500;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.filter-tab::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: transparent;
  border-radius: 4px 4px 0 0;
  content: "";
}

.filter-tab.is-active {
  color: var(--ink-900);
  font-weight: 600;
}

.filter-tab.is-active::after {
  background: var(--coral-600);
}

.filter-tab span {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  margin-left: 0.2rem;
  padding: 0 0.3rem;
  color: var(--coral-700);
  font-size: 0.53rem;
  font-weight: 700;
  background: var(--coral-100);
  border-radius: 99px;
}

.compact-button {
  background: #fff;
}

.selection-bar {
  display: flex;
  min-height: 51px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1.35rem;
  color: var(--teal-700);
  font-size: 0.68rem;
  font-weight: 600;
  background: linear-gradient(90deg, var(--teal-100), #f4fbfa);
  border-top: 1px solid rgba(22, 143, 145, 0.11);
}

.selection-bar[hidden] {
  display: none;
}

.ledger-table[hidden],
.suggestions-panel[hidden] {
  display: none;
}

.suggestions-panel {
  border-top: 1px solid var(--line);
}

.suggestions-heading {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.35rem;
  background: #f8fafb;
  border-bottom: 1px solid var(--line);
}

.suggestions-heading h3,
.suggestions-heading p {
  margin: 0;
}

.suggestions-heading-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 0.55rem;
}

.suggestions-heading h3 {
  font-size: 0.78rem;
}

.suggestions-heading p {
  margin-top: 0.2rem;
  color: var(--ink-500);
  font-size: 0.56rem;
}

.suggestions-list {
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem 1.1rem 1.1rem;
  background: #f3f6f7;
}

.suggestion-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
  transition: border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.suggestion-card.is-selected {
  border-color: rgba(22, 143, 145, 0.45);
  box-shadow: inset 4px 0 0 var(--teal-600), var(--shadow-sm);
}

.suggestion-card.is-rejected {
  opacity: 0.58;
}

.suggestion-check {
  margin-left: 0.85rem;
}

.suggestion-pair {
  display: grid;
  cursor: pointer;
}

.suggestion-operation {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  min-height: 52px;
  padding: 0.55rem 0.8rem;
}

.suggestion-operation.row-budget {
  background: #fff7e8;
}

.suggestion-operation.row-recurring {
  background: #eaf7f6;
}

.suggestion-operation.row-schedule {
  background: #f5effc;
}

.suggestion-operation.row-manual {
  background: #fff;
}

.suggestion-operation.row-imported {
  background: #c9f3d4;
}

.suggestion-operation-copy {
  display: grid;
  min-width: 0;
}

.suggestion-operation-copy strong {
  overflow: hidden;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-operation-copy small {
  color: var(--ink-500);
  font-size: 0.52rem;
}

.suggestion-link {
  display: flex;
  min-height: 25px;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  color: var(--ink-500);
  font-size: 0.49rem;
  background: #f4f7f8;
  border-block: 1px dashed var(--line-strong);
}

.suggestion-link em {
  padding: 0.15rem 0.35rem;
  color: var(--amber-700);
  font-style: normal;
  background: var(--amber-100);
  border-radius: 5px;
}

.suggestion-link.has-date-gap {
  color: var(--amber-700);
  background: var(--amber-100);
  border-color: rgba(176, 117, 26, 0.28);
}

.suggestion-actions {
  display: grid;
  gap: 0.4rem;
  padding-right: 0.85rem;
}

.suggestion-actions button {
  min-width: 66px;
  min-height: 30px;
  font-size: 0.58rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.suggestion-accept {
  color: #fff;
  background: var(--teal-600);
  border: 1px solid var(--teal-600);
}

.suggestion-reject {
  color: var(--ink-700);
  background: #fff;
  border: 1px solid var(--line-strong);
}

.suggestion-restore {
  color: var(--teal-700);
  background: #fff;
  border: 1px solid rgba(22, 143, 145, 0.42);
}

.suggestion-actions.is-rejected button {
  min-width: 112px;
}

.suggestion-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.suggestions-empty {
  padding: 2.4rem 1rem;
  text-align: center;
}

.suggestions-empty strong {
  font-size: 0.75rem;
}

.suggestions-empty p {
  margin: 0.35rem 0 0;
  color: var(--ink-500);
  font-size: 0.58rem;
}

.suggestions-empty[hidden] {
  display: none;
}

.selection-count {
  display: inline-grid;
  min-width: 26px;
  height: 26px;
  place-items: center;
  margin-right: 0.35rem;
  padding: 0 0.35rem;
  color: #fff;
  background: var(--teal-600);
  border-radius: 99px;
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.selection-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.65rem;
  font-size: 0.65rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid rgba(22, 143, 145, 0.18);
  border-radius: 8px;
  cursor: pointer;
}

.selection-button svg {
  width: 14px;
  height: 14px;
}

.delete-button {
  color: var(--red-700);
  border-color: rgba(177, 60, 75, 0.16);
}

.clear-selection {
  width: 34px;
  height: 34px;
  color: var(--ink-500);
  background: transparent;
  border: 0;
}

.ledger-table {
  border-top: 1px solid var(--line);
}

.ledger-row {
  display: grid;
  grid-template-columns: 38px 78px minmax(190px, 1.35fr) 92px 92px minmax(130px, 0.85fr) minmax(150px, 1.1fr) 36px;
  align-items: center;
  min-height: 57px;
  padding: 0 1.1rem;
  border-bottom: 1px solid var(--line);
}

.ledger-table-head {
  min-height: 39px;
  color: var(--ink-500);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: #f7f9f9;
  text-transform: uppercase;
}

#operationsList .ledger-row {
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: background 140ms ease, box-shadow 140ms ease;
}

#operationsList .ledger-row:hover {
  z-index: 1;
  background: #fafcfc;
  box-shadow: inset 3px 0 0 var(--line-strong);
}

#operationsList .ledger-row.is-selected {
  background: #f2faf9;
  box-shadow: inset 3px 0 0 var(--teal-600);
}

#operationsList .ledger-row.row-imported {
  background: #c9f3d4;
}

#operationsList .ledger-row.row-imported:hover {
  background: #b7ebc5;
}

#operationsList .ledger-row.row-budget {
  background: #fff7e8;
}

#operationsList .ledger-row.row-budget:hover {
  background: #fff0d3;
}

#operationsList .ledger-row.row-recurring {
  background: #eaf7f6;
}

#operationsList .ledger-row.row-recurring:hover {
  background: #dff2f1;
}

#operationsList .ledger-row.row-schedule {
  background: #f5effc;
}

#operationsList .ledger-row.row-schedule:hover {
  background: #eee4fa;
}

.provision-mini {
  color: #5f3b88;
  font-weight: 700;
}

#operationsList .ledger-row.row-reconciled {
  background: #eef4fc;
}

#operationsList .ledger-row.row-reconciled:hover {
  background: #e7f0fb;
}

#operationsList .ledger-row.row-reconciled .operation-name {
  font-style: italic;
}

.cell {
  min-width: 0;
  padding: 0 0.4rem;
  font-size: 0.68rem;
}

.cell-check {
  padding-left: 0;
}

.amount-column {
  text-align: right;
}

.check-control {
  position: relative;
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  cursor: pointer;
}

.check-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-control span {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  background: #fff;
  border: 1px solid #bdc8ce;
  border-radius: 5px;
  transition: background 120ms ease, border 120ms ease;
}

.check-control input:checked + span {
  background: var(--teal-600);
  border-color: var(--teal-600);
}

.check-control input:checked + span::after {
  width: 7px;
  height: 4px;
  margin-top: -2px;
  border-bottom: 1.8px solid #fff;
  border-left: 1.8px solid #fff;
  content: "";
  transform: rotate(-45deg);
}

.date-cell {
  color: var(--ink-500);
  font-size: 0.64rem;
}

.budget-date-placeholder {
  color: var(--amber-700);
  font-weight: 600;
}

.operation-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
}

.operation-indicator {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 9px;
}

.indicator-manual {
  color: var(--navy-700);
  background: #edf1f4;
}

.indicator-imported {
  color: #126b3f;
  background: #9fe5b2;
}

.row-reconciled .indicator-imported {
  color: #496a9a;
  background: var(--blue-100);
}

.indicator-budget {
  color: var(--amber-700);
  background: var(--amber-100);
}

.indicator-recurring {
  color: var(--teal-700);
  background: var(--teal-100);
}

.indicator-schedule {
  color: var(--violet-700);
  background: var(--violet-100);
}

.operation-copy {
  min-width: 0;
}

.operation-name {
  overflow: hidden;
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operation-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
  color: var(--ink-400);
  font-size: 0.56rem;
}

.bank-category-mini {
  max-width: 120px;
  overflow: hidden;
  color: #5578a9;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
}

.status-mini::before {
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
  content: "";
}

.status-imported {
  color: #5578a9;
}

.status-reconciled {
  color: var(--green-700);
}

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

.status-planned {
  color: var(--amber-700);
}

.amount {
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-debit {
  color: var(--red-700);
}

.amount-credit {
  color: var(--green-700);
}

.category-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  overflow: hidden;
  padding: 0.28rem 0.45rem;
  color: var(--ink-700);
  font-size: 0.56rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #f0f3f4;
  border-radius: 7px;
}

.chip-income {
  color: var(--green-700);
  background: var(--green-100);
}

.chip-budget {
  color: var(--amber-700);
  background: var(--amber-100);
}

.chip-recurring {
  color: var(--teal-700);
  background: var(--teal-100);
}

.chip-schedule {
  color: var(--violet-700);
  background: var(--violet-100);
}

.comment-text {
  display: block;
  overflow: hidden;
  color: var(--ink-500);
  font-size: 0.6rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-menu {
  width: 30px;
  height: 30px;
  color: var(--ink-400);
  background: transparent;
  border: 0;
}

.row-menu:hover {
  color: var(--ink-900);
  background: var(--surface-soft);
}

.mobile-amount {
  display: none;
}

.empty-state {
  padding: 3.5rem 1rem;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  margin: 0 auto 0.85rem;
  color: var(--ink-400);
  background: var(--surface-soft);
  border-radius: 16px;
}

.empty-state h3 {
  margin: 0;
  font-size: 0.88rem;
}

.empty-state p {
  margin: 0.3rem 0 1rem;
  color: var(--ink-500);
  font-size: 0.65rem;
}

.ledger-footer {
  display: flex;
  min-height: 47px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.35rem;
  color: var(--ink-400);
  background: #fafbfb;
}

.ledger-footer p {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.53rem;
}

.info-dot {
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: var(--teal-700);
  font-size: 0.52rem;
  font-weight: 700;
  background: var(--teal-100);
  border-radius: 50%;
}

.ledger-footer button {
  padding: 0;
  color: var(--teal-700);
  font-size: 0.57rem;
  font-weight: 600;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.mobile-header,
.mobile-bottom-nav,
.sidebar-overlay {
  display: none;
}

.app-dialog {
  width: min(calc(100% - 2rem), 610px);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 0;
  color: var(--ink-900);
  background: #fff;
  border: 0;
  border-radius: 22px;
  box-shadow: var(--shadow-md);
}

.app-dialog::backdrop {
  background: rgba(15, 29, 40, 0.62);
  backdrop-filter: blur(4px);
}

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

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

.operation-dialog form,
.budget-dialog form,
.import-dialog,
.confirmation-dialog {
  padding: 1.45rem;
}

.import-dialog {
  width: min(calc(100% - 2rem), 760px);
}

.budget-dialog {
  transition: background 160ms ease;
}

.budget-dialog:not(.is-income) form {
  background: linear-gradient(180deg, #fff8f2 0, #fff 190px);
}

.budget-dialog.is-income form {
  background: linear-gradient(180deg, #f1fbf5 0, #fff 190px);
}

.budget-form-note {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding: 0.7rem;
  color: var(--ink-500);
  font-size: 0.56rem;
  line-height: 1.55;
  background: var(--surface-soft);
  border-radius: 10px;
}

.budget-form-note span {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--teal-700);
  font-weight: 700;
  background: var(--teal-100);
  border-radius: 50%;
}

.confirmation-acknowledgement {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 0.8rem;
  padding: 0.75rem;
  color: var(--red-700);
  font-size: 0.58rem;
  font-weight: 600;
  background: var(--red-100);
  border: 1px solid rgba(177, 60, 75, 0.14);
  border-radius: 10px;
  cursor: pointer;
}

.confirmation-acknowledgement[hidden] {
  display: none;
}

.confirmation-acknowledgement input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: var(--red-700);
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 1.22rem;
  letter-spacing: -0.035em;
}

.dialog-heading p:not(.eyebrow) {
  margin: 0.35rem 0 0;
  color: var(--ink-500);
  font-size: 0.62rem;
}

.dialog-close {
  width: 35px;
  height: 35px;
  background: var(--surface-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 1.35rem;
}

.form-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.form-field[hidden] {
  display: none;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field > span,
.form-field legend {
  color: var(--ink-700);
  font-size: 0.6rem;
  font-weight: 600;
}

.form-field small {
  color: var(--ink-400);
  font-weight: 400;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  color: var(--ink-900);
  font-size: 0.7rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
}

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

.form-field textarea {
  min-height: 82px;
  padding: 0.7rem 0.75rem;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  background: #fff;
  border-color: rgba(22, 143, 145, 0.48);
  box-shadow: 0 0 0 3px rgba(22, 143, 145, 0.08);
}

.input-with-suffix {
  position: relative;
  display: block;
}

.input-with-suffix input {
  padding-right: 2rem;
}

.input-with-suffix em {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  color: var(--ink-400);
  font-size: 0.7rem;
  font-style: normal;
  transform: translateY(-50%);
}

.type-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.type-options label {
  position: relative;
}

.type-options input {
  position: absolute;
  opacity: 0;
}

.type-options span {
  display: flex;
  height: 41px;
  align-items: center;
  justify-content: center;
  color: var(--ink-500);
  font-size: 0.65rem;
  font-weight: 600;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.type-options input[value="expense"]:checked + span {
  color: var(--coral-700);
  background: var(--coral-100);
  border-color: rgba(186, 62, 86, 0.25);
}

.type-options input[value="income"]:checked + span {
  color: var(--green-700);
  background: var(--green-100);
  border-color: rgba(37, 122, 81, 0.24);
}

.form-field input:disabled,
.form-field select:disabled,
.form-field textarea:disabled {
  color: var(--ink-500);
  background: #edf1f3;
  cursor: not-allowed;
  opacity: 0.78;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.operation-dialog .dialog-actions [data-close-dialog],
.confirmation-dialog .dialog-actions #confirmationCancel {
  order: -1;
}

.unreconcile-button {
  margin-right: auto;
  color: var(--coral-700);
  background: var(--coral-100);
  border: 1px solid rgba(186, 62, 86, 0.18);
}

.unreconcile-button[hidden] {
  display: none;
}

.convert-button {
  margin-right: auto;
  color: var(--teal-700);
  background: var(--teal-100);
  border: 1px solid rgba(22, 143, 145, 0.18);
}

.convert-button[hidden],
.selection-button[hidden] {
  display: none;
}

.import-dropzone {
  display: grid;
  place-items: center;
  margin-top: 1.25rem;
  padding: 1.7rem 1rem;
  text-align: center;
  background: #f8fafb;
  border: 1.5px dashed #c8d2d8;
  border-radius: 16px;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.import-dropzone.is-dragover {
  background: var(--teal-100);
  border-color: var(--teal-600);
  box-shadow: inset 0 0 0 1px var(--teal-600);
}

.import-illustration {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 0.7rem;
  color: var(--teal-700);
  background: var(--teal-100);
  border-radius: 15px;
}

.import-dropzone strong {
  font-size: 0.78rem;
}

.import-dropzone p {
  margin: 0.2rem 0 0.8rem;
  color: var(--ink-400);
  font-size: 0.58rem;
}

.import-dropzone small {
  max-width: 100%;
  overflow: hidden;
  margin-top: 0.65rem;
  color: var(--ink-500);
  font-size: 0.54rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-preview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.import-preview div {
  display: grid;
  gap: 0.22rem;
  padding: 0.7rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.import-preview span {
  color: var(--ink-400);
  font-size: 0.49rem;
}

.import-preview strong {
  font-size: 0.63rem;
}

.import-preview .preview-ok {
  color: var(--green-700);
  background: var(--green-100);
  border-color: rgba(37, 122, 81, 0.13);
}

.import-preview .preview-error {
  color: var(--red-700);
  background: var(--red-100);
  border-color: rgba(177, 60, 75, 0.16);
}

.import-preview.is-empty div {
  color: var(--ink-400);
  background: var(--surface-soft);
  border-color: var(--line);
}

.import-preview.is-empty strong {
  color: var(--ink-400);
}

.import-analysis {
  margin-top: 0.8rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.import-analysis[hidden],
.import-error[hidden] {
  display: none;
}

.import-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  padding: 0.65rem 0.8rem;
  color: var(--ink-500);
  font-size: 0.55rem;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.import-counts strong {
  color: var(--ink-900);
  font-size: 0.65rem;
}

.import-operations {
  max-height: 210px;
  overflow: auto;
}

.import-operation {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) auto auto;
  gap: 0.6rem;
  align-items: center;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.import-operation:last-child {
  border-bottom: 0;
}

.import-operation time,
.import-operation em {
  color: var(--ink-500);
  font-size: 0.52rem;
  font-style: normal;
}

.import-operation span {
  min-width: 0;
  overflow: hidden;
  font-size: 0.58rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-operation b {
  font-size: 0.58rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.import-operation em {
  padding: 0.18rem 0.32rem;
  border-radius: 5px;
  white-space: nowrap;
}

.import-operation.is-new em {
  color: var(--green-700);
  background: var(--green-100);
}

.import-operation.is-existing {
  opacity: 0.68;
}

.import-operation.is-existing em {
  color: var(--ink-700);
  background: #edf1f3;
}

.import-operation.is-error em {
  color: var(--red-700);
  background: var(--red-100);
}

.import-error {
  margin: 0.8rem 0 0;
  padding: 0.7rem 0.8rem;
  color: var(--red-700);
  font-size: 0.58rem;
  line-height: 1.5;
  background: var(--red-100);
  border: 1px solid rgba(177, 60, 75, 0.16);
  border-radius: 10px;
}

.confirmation-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.15rem;
}

.confirmation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 1rem;
  align-items: center;
  padding: 0.78rem 0.85rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.confirmation-item strong {
  overflow: hidden;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confirmation-item .confirmation-amount {
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.confirmation-item small {
  grid-column: 1 / -1;
  color: var(--ink-500);
  font-size: 0.52rem;
}

.confirmation-item.is-protected {
  background: var(--blue-100);
  border-color: rgba(73, 106, 154, 0.16);
}

.confirmation-warning {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.8rem;
  padding: 0.8rem;
  color: var(--amber-700);
  background: var(--amber-100);
  border: 1px solid rgba(183, 110, 34, 0.16);
  border-radius: 11px;
}

.confirmation-warning[hidden] {
  display: none;
}

.confirmation-warning > span {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--amber-700);
  border-radius: 50%;
}

.confirmation-warning p {
  margin: 0;
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.55;
}

.privacy-callout {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.8rem;
  padding: 0.8rem;
  color: var(--navy-700);
  background: #edf3f6;
  border-radius: 11px;
}

.privacy-callout svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 0.1rem;
}

.privacy-callout p {
  margin: 0;
  font-size: 0.56rem;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 80;
  display: flex;
  min-width: 270px;
  max-width: min(420px, calc(100vw - 2rem));
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem;
  color: #fff;
  font-size: 0.65rem;
  background: var(--navy-900);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.toast-icon {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  color: #9ee3bd;
  background: rgba(64, 189, 123, 0.15);
  border-radius: 9px;
}

.toast-icon svg {
  width: 15px;
  height: 15px;
}

.toast > span:nth-child(2) {
  flex: 1;
}

.toast button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  color: rgba(255, 255, 255, 0.6);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.toast button svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 1220px) {
  :root {
    --sidebar-width: 218px;
  }

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

  .balance-card {
    grid-column: 1 / -1;
  }

  .ledger-row {
    grid-template-columns: 36px 72px minmax(180px, 1.2fr) 88px 88px minmax(120px, 0.8fr) minmax(130px, 1fr) 34px;
  }
}

@media (max-width: 980px) {
  :root {
    --sidebar-width: 82px;
  }

  .brand {
    justify-content: center;
    padding-inline: 0;
  }

  .brand-copy,
  .nav-label,
  .nav-item span,
  .local-status > span:last-child {
    display: none;
  }

  .main-nav,
  .sidebar-footer {
    padding-inline: 0.6rem;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .nav-item.is-active::before {
    left: -0.6rem;
  }

  .local-status {
    justify-content: center;
    padding: 0.45rem;
    background: transparent;
    border: 0;
  }

  .ledger-row {
    grid-template-columns: 36px 68px minmax(180px, 1.3fr) 82px 82px minmax(110px, 0.8fr) 34px;
  }

  .comment-column,
  #operationsList .comment-cell {
    display: none;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--canvas);
  }

  .sidebar {
    width: min(82vw, 285px);
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  body.menu-open {
    overflow: hidden;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .sidebar .brand {
    justify-content: flex-start;
    padding-inline: 1.2rem;
  }

  .sidebar .brand-copy,
  .sidebar .nav-label,
  .sidebar .nav-item span:not(.nav-badge, .nav-pill),
  .sidebar .local-status > span:last-child {
    display: grid;
  }

  .sidebar .main-nav,
  .sidebar .sidebar-footer {
    padding-inline: 0.8rem;
  }

  .sidebar .nav-item {
    justify-content: flex-start;
    padding: 0 0.85rem;
  }

  .sidebar .local-status {
    justify-content: flex-start;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 25;
    width: 100%;
    height: 100%;
    padding: 0;
    background: rgba(14, 27, 37, 0.48);
    border: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }

  body.menu-open .sidebar-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    height: 64px;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.9rem;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.85rem;
  }

  .mobile-header .icon-button {
    width: 37px;
    height: 37px;
  }

  .mobile-add {
    color: #fff;
    background: var(--coral-600);
    border-color: transparent;
  }

  .main-content {
    margin-left: 0;
    padding: 1.2rem 0.85rem 6.5rem;
  }

  .manager-heading {
    display: grid;
    gap: 1rem;
  }

  .manager-heading h1 {
    font-size: 1.55rem;
  }

  .manager-heading p:not(.eyebrow) {
    font-size: 0.7rem;
    line-height: 1.55;
  }

  .manager-heading .button {
    width: 100%;
  }

  .manager-summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-top: 1rem;
  }

  .manager-summary-card {
    min-height: 92px;
    gap: 0.6rem;
    padding: 0.75rem;
  }

  .manager-summary-icon {
    width: 36px;
    height: 36px;
  }

  .manager-summary-card small {
    font-size: 0.5rem;
  }

  .manager-summary-card strong {
    font-size: 0.83rem;
  }

  .manager-list-card {
    border-radius: 16px;
  }

  .manager-list-card > header {
    display: grid;
    min-height: 0;
    padding: 0.9rem;
  }

  .manager-list-count {
    width: fit-content;
  }

  .budget-list {
    padding: 0.65rem;
  }

  .budget-definition-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 0.6rem;
  }

  .budget-card-accent {
    padding-top: 0.75rem;
  }

  .budget-card-accent span {
    width: 30px;
    height: 30px;
  }

  .budget-card-main {
    padding: 0.75rem 0.7rem 0 0;
  }

  .budget-card-title {
    align-items: flex-start;
  }

  .budget-card-title h3 {
    white-space: normal;
  }

  .budget-card-meta {
    display: grid;
    gap: 0.15rem;
  }

  .budget-card-meta span + span::before {
    content: none;
  }

  .hidden-months ul {
    display: grid;
  }

  .hidden-months li {
    justify-content: space-between;
  }

  .budget-card-actions {
    grid-column: 2;
    justify-content: stretch;
    padding: 0 0.7rem 0.75rem 0;
  }

  .budget-card-actions .button {
    flex: 1;
  }

  .schedule-list {
    padding: 0.65rem;
  }

  .schedule-card-main {
    grid-template-columns: 1fr;
    padding: 0.8rem;
  }

  .schedule-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .schedule-card-actions .button {
    flex: 1;
  }

  .schedule-occurrence {
    grid-template-columns: 40px 78px minmax(58px, 1fr) 68px;
    gap: 0.35rem;
    padding: 0.55rem 0.7rem;
  }

  .schedule-occurrence-status {
    grid-column: 4;
    grid-row: 1;
  }

  .schedule-occurrence [data-edit-schedule-occurrence] {
    grid-column: 4;
    grid-row: 1;
    width: 100%;
    padding-inline: 0.25rem;
  }

  .page-heading {
    display: block;
  }

  .page-heading h1 {
    font-size: 1.55rem;
  }

  .page-intro {
    font-size: 0.7rem;
    line-height: 1.55;
  }

  .heading-actions {
    display: none;
  }

  .period-toolbar {
    min-height: 57px;
    margin-top: 1rem;
    padding: 0.4rem;
  }

  .month-control {
    flex: 1;
    justify-content: space-between;
  }

  .month-label {
    min-width: 118px;
  }

  .month-label span {
    font-size: 0.88rem;
  }

  .today-button {
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .today-button span,
  .period-note {
    display: none;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-top: 0.65rem;
  }

  .summary-card {
    min-height: 138px;
    padding: 0.9rem;
  }

  .balance-card {
    min-height: 165px;
    grid-column: 1 / -1;
  }

  .account-card {
    grid-column: 1 / -1;
    min-height: 112px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.8rem;
  }

  .metric-value {
    font-size: 0.95rem;
  }

  .metric-date {
    font-size: 0.74rem;
  }

  .ledger-card {
    margin-top: 0.7rem;
    border-radius: 17px;
  }

  .ledger-header {
    display: block;
    padding: 1rem;
  }

  .search-field {
    width: 100%;
    margin-top: 0.8rem;
  }

  .search-field kbd {
    display: none;
  }

  .ledger-toolbar {
    display: block;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .filter-tabs {
    width: 100%;
    min-height: 46px;
    gap: 1.05rem;
    overflow-x: auto;
    padding: 0 1rem;
    scrollbar-width: none;
  }

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

  .filter-tab {
    flex: 0 0 auto;
  }

  .compact-button {
    display: none;
  }

  .selection-bar {
    display: block;
    padding: 0.65rem 0.85rem;
  }

  .suggestions-heading {
    display: grid;
    padding: 0.8rem;
  }

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

  .suggestions-heading .button {
    width: 100%;
  }

  .suggestions-list {
    padding: 0.65rem;
  }

  .suggestion-card {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 0.35rem;
    padding: 0.65rem;
  }

  .suggestion-check {
    margin-left: 0;
  }

  .suggestion-operation {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    padding: 0.5rem;
  }

  .suggestion-actions {
    grid-column: 2;
    grid-template-columns: 1fr 1fr;
    padding: 0;
  }

  .suggestion-actions.is-rejected {
    grid-template-columns: 1fr;
  }

  .selection-actions {
    margin-top: 0.55rem;
  }

  .selection-button {
    flex: 1;
    justify-content: center;
  }

  .ledger-table-head {
    display: none;
  }

  #operationsList {
    display: grid;
    gap: 0.55rem;
    padding: 0.65rem;
    background: #f7f9f9;
  }

  #operationsList .ledger-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    grid-template-areas:
      "check operation amount"
      "check date amount"
      "check category menu";
    min-height: 0;
    gap: 0.2rem 0.45rem;
    padding: 0.75rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: 0 2px 8px rgba(20, 38, 52, 0.035);
  }

  #operationsList .ledger-row:hover,
  #operationsList .ledger-row.is-selected {
    background: #fff;
    box-shadow: inset 3px 0 0 var(--teal-600), 0 2px 8px rgba(20, 38, 52, 0.035);
  }

  #operationsList .ledger-row.row-imported {
    background: #c9f3d4;
  }

  #operationsList .ledger-row.row-budget {
    background: #fff7e8;
  }

  #operationsList .ledger-row.row-recurring {
    background: #eaf7f6;
  }

  #operationsList .ledger-row.row-schedule {
    background: #f5effc;
  }

  #operationsList .ledger-row.row-reconciled {
    background: #eef4fc;
  }

  #operationsList .ledger-row.row-budget .date-cell {
    display: none;
  }

  .cell {
    padding: 0;
  }

  .cell-check {
    align-self: start;
    grid-area: check;
    padding-top: 0.35rem;
  }

  .date-cell {
    grid-area: date;
    padding-left: 2.45rem;
  }

  .operation-cell {
    grid-area: operation;
  }

  .operation-name {
    font-size: 0.72rem;
  }

  .operation-indicator {
    width: 32px;
    height: 32px;
  }

  .debit-cell,
  .credit-cell {
    display: none;
  }

  .mobile-amount {
    display: block;
    grid-area: amount;
    align-self: center;
    padding-left: 0.5rem;
  }

  .category-cell {
    grid-area: category;
    padding-left: 2.45rem;
  }

  .category-chip {
    padding: 0.2rem 0.36rem;
    font-size: 0.52rem;
  }

  .row-menu-cell {
    grid-area: menu;
    justify-self: end;
  }

  .row-menu {
    width: 27px;
    height: 27px;
  }

  .ledger-footer {
    min-height: 42px;
    padding: 0 0.8rem;
  }

  .ledger-footer p {
    font-size: 0.56rem;
  }

  .ledger-footer button {
    display: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 22;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: 70px;
    padding: 0.35rem 0.35rem max(0.35rem, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 24px rgba(20, 38, 52, 0.08);
    backdrop-filter: blur(14px);
  }

  .mobile-bottom-nav > button {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
    padding: 0;
    color: var(--ink-400);
    font-size: 0.48rem;
    background: transparent;
    border: 0;
  }

  .mobile-bottom-nav > button svg {
    width: 20px;
    height: 20px;
  }

  .mobile-bottom-nav > button.is-active {
    color: var(--coral-600);
    font-weight: 600;
  }

  .mobile-bottom-nav .mobile-main-action span:first-child {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    margin-top: -25px;
    color: #fff;
    background: linear-gradient(145deg, var(--coral-500), var(--coral-700));
    border: 4px solid var(--canvas);
    border-radius: 50%;
    box-shadow: 0 7px 18px rgba(186, 62, 86, 0.28);
  }

  .mobile-bottom-nav .mobile-main-action svg {
    width: 20px;
    height: 20px;
  }

  .app-dialog {
    width: calc(100% - 1rem);
    max-height: calc(100vh - 1rem);
    border-radius: 18px;
  }

  .operation-dialog form,
  .budget-dialog form,
  .import-dialog,
  .confirmation-dialog {
    padding: 1.1rem;
  }

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

  .form-field-wide {
    grid-column: auto;
  }

  .import-preview {
    grid-template-columns: 1fr 1fr;
  }

  .import-operation {
    grid-template-columns: 54px minmax(0, 1fr) auto;
  }

  .import-operation b {
    grid-column: 2;
  }

  .import-operation em {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .toast {
    right: 0.65rem;
    bottom: 5rem;
    left: 0.65rem;
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 430px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .sync-card,
  .planned-card {
    min-height: 112px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.8rem;
  }

  .filter-tabs {
    gap: 0.85rem;
  }

  .selection-button {
    padding-inline: 0.45rem;
  }
}

.compact-dashboard {
  display: none;
}

@media (min-width: 761px) {
  .dashboard-sticky {
    width: min(100%, 1460px);
    margin-inline: auto;
  }

  .compact-dashboard {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    z-index: 24;
    display: block;
    padding: 0.4rem clamp(1.25rem, 3vw, 3rem) 0.55rem;
    visibility: hidden;
    background: rgba(242, 244, 245, 0.97);
    box-shadow: 0 12px 30px rgba(20, 38, 52, 0.12);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
    backdrop-filter: blur(14px);
  }

  .compact-dashboard.is-visible {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .compact-dashboard-inner {
    width: min(100%, 1460px);
    margin-inline: auto;
  }

  .compact-period-row {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 0.55rem;
    padding: 0.25rem 0.45rem;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid var(--line);
    border-radius: 13px;
  }

  .compact-period-row .month-label {
    min-width: 126px;
  }

  .compact-period-row .compact-sticky-actions {
    display: flex;
    margin-left: auto;
  }

  .compact-period-row .compact-sticky-actions[hidden] {
    display: none;
  }

  .compact-period-row .button {
    min-height: 36px;
    padding-inline: 0.72rem;
    font-size: 0.65rem;
  }

  .compact-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 0.4rem;
  }

  .compact-summary-card {
    display: grid;
    min-height: 68px;
    align-content: center;
    gap: 0.18rem;
    padding: 0.58rem 0.78rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
  }

  .compact-summary-card > span,
  .compact-summary-card > div > span {
    color: var(--ink-500);
    font-size: 0.57rem;
  }

  .compact-summary-card strong {
    display: block;
    margin-top: 0.12rem;
    font-size: 0.88rem;
  }

  .compact-balance-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    background: linear-gradient(145deg, #27475c, #173042 70%);
    border-color: transparent;
  }

  .compact-balance-card > div > span {
    color: rgba(255, 255, 255, 0.66);
  }
}

.button-primary.recurring-primary,
.button-primary.recurring-primary:hover {
  background: linear-gradient(135deg, #109b97, #087b78);
  box-shadow: 0 8px 18px rgba(8, 123, 120, 0.24);
}

.button-primary.schedule-primary,
.button-primary.schedule-primary:hover {
  background: linear-gradient(135deg, #8157ad, #67408f);
  box-shadow: 0 8px 18px rgba(112, 72, 160, 0.26);
}

.recurring-dialog:not(.is-income) form {
  background: linear-gradient(180deg, #effbf9 0, #fff 190px);
}

.schedule-dialog form {
  background: linear-gradient(180deg, #f8f4fc 0, #fff 210px);
}

.category-icon {
  color: #3f6f7d;
  background: #e7f2f4;
}

.category-alert-icon {
  color: #9b641f;
  font-weight: 700;
  background: #fff0d2;
}

.category-alert-summary strong,
.analysis-negative {
  color: var(--red-700);
}

.analysis-unrecognized-shortcut {
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.analysis-unrecognized-shortcut:hover,
.analysis-unrecognized-shortcut:focus-visible {
  border-color: #e7c27b;
  box-shadow: 0 8px 22px rgba(122, 76, 20, 0.12);
  outline: 0;
  transform: translateY(-1px);
}

.analysis-unrecognized-shortcut em {
  color: #8a5b22;
  font-size: 0.48rem;
  font-style: normal;
  font-weight: 700;
}

.analysis-positive {
  color: var(--green-700);
}

.category-manager-card {
  margin-top: 1.2rem;
}

.manager-tabs {
  display: flex;
  gap: 0.45rem;
  padding: 0.75rem 1rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

.manager-tabs button {
  min-height: 36px;
  padding: 0 0.75rem;
  color: var(--ink-500);
  font-size: 0.59rem;
  font-weight: 600;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
}

.manager-tabs button span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: 0.3rem;
  place-items: center;
  font-size: 0.5rem;
  background: #e8ecee;
  border-radius: 999px;
}

.manager-tabs button.is-active {
  color: #315e69;
  background: #e7f2f4;
  border-color: #cce1e5;
}

.category-panel[hidden] {
  display: none;
}

.category-overview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  background: #f5f7f8;
}

.category-overview-card {
  padding: 0.9rem;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--category-color);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
}

.category-overview-heading {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
}

.category-color-mark,
.analysis-legend-dot {
  display: block;
  width: 9px;
  height: 9px;
  background: var(--category-color);
  border-radius: 50%;
}

.category-overview-heading h3,
.category-overview-heading p {
  margin: 0;
}

.category-overview-heading h3 {
  font-size: 0.72rem;
}

.category-overview-heading p {
  margin-top: 0.12rem;
  color: var(--ink-500);
  font-size: 0.52rem;
}

.category-overview-heading > strong {
  font-size: 0.68rem;
}

.category-source-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.category-source-badges span {
  padding: 0.18rem 0.38rem;
  font-size: 0.45rem;
  font-weight: 700;
  border-radius: 999px;
}

.learned-source-badge {
  color: #315e69;
  background: #e1f0f2;
}

.manual-source-badge {
  color: #66508d;
  background: #eee8f7;
}

.category-subcategory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.category-subcategory-list span {
  display: grid;
  gap: 0.08rem;
  padding: 0.38rem 0.5rem;
  background: #f5f7f8;
  border-radius: 8px;
}

.category-subcategory-list b,
.category-subcategory-list small {
  font-size: 0.49rem;
}

.category-subcategory-list small {
  color: var(--ink-500);
}

.category-help-banner {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0.9rem 1rem 0;
  padding: 0.7rem;
  color: #315e69;
  font-size: 0.57rem;
  background: #edf7f8;
  border-radius: 10px;
}

.category-help-banner > span {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  font-weight: 700;
  background: #d8ecef;
  border-radius: 50%;
}

.category-help-banner p {
  margin: 0;
}

.unrecognized-list,
.category-rules-list {
  display: grid;
  gap: 0.55rem;
  padding: 1rem;
}

.unrecognized-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem;
  background: #fffaf1;
  border: 1px solid #efdfbe;
  border-radius: 11px;
  cursor: pointer;
}

.unrecognized-row:hover,
.unrecognized-row:focus-visible {
  background: #fff5e2;
  outline: 2px solid rgba(179, 116, 39, 0.18);
}

.unrecognized-copy {
  display: grid;
  min-width: 0;
  gap: 0.15rem;
}

.unrecognized-copy strong {
  overflow: hidden;
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unrecognized-copy small {
  color: var(--ink-500);
  font-size: 0.51rem;
}

.unrecognized-row > b,
.unrecognized-row .button {
  font-size: 0.59rem;
}

.category-rule-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1.2fr) minmax(150px, 0.8fr) auto 36px;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.category-rule-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #315e69;
  background: #e7f2f4;
  border-radius: 9px;
}

.category-rule-icon svg {
  width: 15px;
  height: 15px;
}

.category-rule-row > div,
.category-rule-target {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

.category-rule-row strong,
.category-rule-target b {
  overflow: hidden;
  font-size: 0.61rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-rule-row small,
.category-rule-row em {
  color: var(--ink-500);
  font-size: 0.49rem;
  font-style: normal;
}

.category-dialog {
  width: min(calc(100% - 2rem), 720px);
}

.category-dialog form {
  padding: 1.55rem;
  background: linear-gradient(180deg, #eff8f9 0, #fff 210px);
}

.category-operation-preview {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #cfe3e6;
  border-radius: 11px;
}

.category-operation-preview > div {
  display: grid;
  gap: 0.15rem;
}

.category-operation-preview strong,
.category-operation-preview b {
  font-size: 0.65rem;
}

.category-operation-preview small {
  color: var(--ink-500);
  font-size: 0.51rem;
}

.category-remember-field {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.8rem;
  color: #315e69;
  background: #edf7f8;
  border: 1px solid #cfe3e6;
  border-radius: 11px;
  cursor: pointer;
}

.category-remember-field input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: #3f7782;
}

.category-remember-field > span {
  display: grid;
  gap: 0.2rem;
}

.category-remember-field strong {
  font-size: 0.62rem;
}

.category-remember-field small {
  color: var(--ink-500);
  font-size: 0.52rem;
  line-height: 1.45;
}

.category-learning-warning {
  margin-top: 0.35rem;
  padding: 0.5rem 0.6rem;
  color: #82551e !important;
  background: #fff7e7;
  border: 1px solid #eed7a8;
  border-radius: 8px;
}

.category-learning-warning[hidden] {
  display: none;
}

.category-primary {
  background: linear-gradient(135deg, #477f89, #315e69);
}

.category-operation-button {
  color: #315e69;
  background: #e7f2f4;
}

.category-operation-button[hidden] {
  display: none;
}

.personal-category-mini,
.learned-category-mini {
  color: #315e69;
  font-weight: 700;
}

.learned-category-mini {
  padding: 0.1rem 0.3rem;
  background: #e1f0f2;
  border-radius: 999px;
}

.analysis-heading,
.category-heading {
  align-items: center;
}

.analysis-period {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem;
  background: #edf1f2;
  border-radius: 10px;
}

.analysis-period button {
  min-height: 34px;
  padding: 0 0.65rem;
  color: var(--ink-500);
  font-size: 0.55rem;
  font-weight: 600;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.analysis-period button.is-active {
  color: var(--ink-900);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 1rem;
  margin-top: 1.2rem;
}

.analysis-grid.is-long-period {
  grid-template-columns: minmax(300px, 0.7fr) minmax(600px, 1.3fr);
}

.analysis-breakdown-body {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 1.2rem;
  align-items: center;
  padding: 1rem;
}

.analysis-donut {
  position: relative;
  display: grid;
  width: 176px;
  height: 176px;
  place-items: center;
  border-radius: 50%;
}

.analysis-donut::after {
  position: absolute;
  width: 108px;
  height: 108px;
  background: #fff;
  border-radius: 50%;
  content: "";
}

.analysis-donut > span {
  position: relative;
  z-index: 1;
  display: grid;
  max-width: 92px;
  gap: 0.15rem;
  text-align: center;
}

.analysis-donut strong {
  font-size: 0.72rem;
}

.analysis-donut small {
  color: var(--ink-500);
  font-size: 0.5rem;
}

.analysis-category-list {
  display: grid;
  gap: 0.6rem;
}

.analysis-category-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.analysis-category-row > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 45px;
  gap: 0.45rem;
  align-items: center;
}

.analysis-category-row strong,
.analysis-category-row b {
  font-size: 0.55rem;
}

.analysis-category-row > small {
  grid-column: 3;
  color: var(--ink-500);
  font-size: 0.47rem;
  text-align: right;
}

.analysis-category-row div > span {
  height: 5px;
  overflow: hidden;
  background: #edf0f1;
  border-radius: 999px;
}

.analysis-category-row i {
  display: block;
  height: 100%;
  background: var(--category-color);
  border-radius: inherit;
}

.analysis-month-list {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.analysis-month-row {
  display: grid;
  gap: 0.45rem;
}

.analysis-month-row > strong {
  font-size: 0.61rem;
}

.analysis-month-bars {
  display: grid;
  gap: 0.35rem;
}

.analysis-month-bars > span {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.45rem;
  align-items: center;
  min-height: 24px;
  overflow: hidden;
  padding: 0 0.45rem;
  background: #f2f4f5;
  border-radius: 7px;
}

.analysis-month-bars i {
  position: absolute;
  inset: 0 auto 0 0;
  min-width: 3px;
  opacity: 0.22;
}

.analysis-month-bars .expense-bar {
  background: var(--coral-500);
}

.analysis-month-bars .income-bar {
  background: var(--green-700);
}

.analysis-month-bars small,
.analysis-month-bars b {
  position: relative;
  z-index: 1;
  font-size: 0.49rem;
}

.analysis-month-bars b {
  grid-column: 3;
}

.analysis-month-list.is-vertical {
  display: block;
  min-width: 0;
  overflow-x: auto;
  padding-top: 0.75rem;
}

.analysis-column-legend {
  display: flex;
  gap: 0.9rem;
  margin-bottom: 0.75rem;
  color: var(--ink-500);
  font-size: 0.49rem;
}

.analysis-column-legend span {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.analysis-column-legend span::before {
  width: 8px;
  height: 8px;
  background: var(--coral-500);
  border-radius: 2px;
  content: "";
}

.analysis-column-legend .income-key::before {
  background: var(--green-700);
}

.analysis-columns {
  display: flex;
  min-width: 560px;
  min-height: 225px;
  gap: 0.45rem;
  align-items: end;
  padding: 0 0.15rem 0.2rem;
  background: repeating-linear-gradient(to top, transparent 0, transparent 54px, #edf0f1 55px);
  border-bottom: 1px solid var(--line);
}

.analysis-month-column {
  display: grid;
  min-width: 38px;
  flex: 1 0 38px;
  grid-template-rows: 180px auto auto;
  gap: 0.2rem;
  align-items: end;
  text-align: center;
}

.analysis-column-bars {
  display: flex;
  height: 100%;
  gap: 3px;
  align-items: end;
  justify-content: center;
}

.analysis-column-bars i {
  width: min(14px, 42%);
  min-height: 1px;
  border-radius: 4px 4px 1px 1px;
}

.analysis-column-bars .expense-bar {
  background: var(--coral-500);
}

.analysis-column-bars .income-bar {
  background: var(--green-700);
}

.analysis-month-column strong {
  align-self: start;
  font-size: 0.49rem;
  text-transform: capitalize;
}

.analysis-month-column small {
  align-self: start;
  color: var(--ink-500);
  font-size: 0.42rem;
}

.mobile-main-action[hidden] {
  visibility: hidden;
}

.mobile-add[hidden],
.category-nav-badge[hidden] {
  display: none;
}

.settings-heading {
  align-items: center;
}

.environment-pill,
.connection-badge,
.planned-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: max-content;
  padding: 0.45rem 0.75rem;
  color: var(--green-700);
  background: var(--green-100);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 600;
}

.environment-pill > span {
  width: 8px;
  height: 8px;
  background: var(--green-700);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(37, 122, 81, 0.12);
}

.environment-pill em,
.settings-note em {
  font-style: normal;
}

.settings-summary-grid .manager-summary-card strong {
  font-size: 0.88rem;
}

.manager-summary-icon.storage-icon,
.settings-card-icon.storage-icon {
  color: var(--violet-700);
  background: var(--violet-100);
}

.manager-summary-icon.cloud-icon,
.settings-card-icon.cloud-icon {
  color: var(--teal-700);
  background: var(--teal-100);
}

.manager-summary-icon.security-icon,
.settings-card-icon.security-icon {
  color: var(--green-700);
  background: var(--green-100);
}

.settings-local-state.is-error {
  color: var(--red-700);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
}

.settings-card {
  overflow: hidden;
}

.settings-card > header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
}

.settings-card > header h2 {
  margin: 0;
}

.settings-card > header p {
  margin: 0.15rem 0 0;
}

.settings-card-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
}

.settings-card-icon.environment-icon {
  color: var(--amber-700);
  background: var(--amber-100);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.connection-badge {
  color: var(--ink-500);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.connection-badge.is-prepared {
  color: var(--teal-700);
  background: var(--teal-100);
  border-color: transparent;
}

.settings-card-body {
  display: grid;
  gap: 0.9rem;
  padding: 1.05rem 1.15rem 1.2rem;
}

.settings-detail {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.settings-detail span {
  color: var(--ink-500);
  font-size: 0.66rem;
}

.settings-detail strong {
  max-width: 62%;
  overflow: hidden;
  font-size: 0.7rem;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-note {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0;
  color: var(--ink-700);
  font-size: 0.62rem;
  line-height: 1.55;
}

.settings-note > span {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--teal-700);
  background: var(--teal-100);
  border-radius: 50%;
  font-size: 0.58rem;
  font-weight: 700;
}

.sync-primary {
  background: var(--teal-700);
  box-shadow: 0 8px 18px rgba(18, 123, 126, 0.2);
}

.sync-primary:hover {
  background: #0f696b;
}

.security-settings-card,
.environment-settings-card {
  min-height: 100%;
}

.security-settings-card .settings-card-body > p {
  margin: 0;
  color: var(--ink-700);
  font-size: 0.68rem;
  line-height: 1.65;
}

.security-flow {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: space-between;
}

.security-flow span {
  min-width: 0;
  padding: 0.5rem 0.6rem;
  color: var(--green-700);
  background: var(--green-100);
  border-radius: 9px;
  font-size: 0.58rem;
  font-weight: 600;
  text-align: center;
}

.security-flow b {
  color: var(--ink-400);
  font-size: 0.75rem;
}

.planned-badge {
  color: var(--violet-700);
  background: var(--violet-100);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.settings-actions .button {
  flex: 1 1 220px;
}

.settings-actions .button[hidden],
.settings-file-input {
  display: none;
}

.security-primary {
  background: var(--green-700);
  box-shadow: 0 8px 18px rgba(37, 122, 81, 0.18);
}

.security-primary:hover {
  background: #1e6744;
}

.security-warning > span {
  color: var(--coral-700);
  background: var(--coral-100);
}

#securityStatusBadge.is-configured {
  color: var(--green-700);
  background: var(--green-100);
  border-color: transparent;
}

.environment-list article {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 0.15rem 0.65rem;
  padding: 0.85rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.environment-list article > span {
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--teal-700);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
}

.environment-list strong {
  font-size: 0.68rem;
}

.environment-list small {
  color: var(--ink-500);
  font-size: 0.57rem;
}

.sync-setup-dialog {
  width: min(720px, calc(100vw - 2rem));
}

.sync-setup-dialog form {
  padding: 1.35rem;
}

.sync-setup-banner {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin: 1rem 0;
  padding: 0.8rem;
  color: var(--teal-700);
  background: var(--teal-100);
  border-radius: 12px;
}

.sync-setup-banner > span {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  background: #fff;
  border-radius: 10px;
}

.sync-setup-banner p {
  margin: 0;
  font-size: 0.64rem;
  font-weight: 600;
}

.form-field > small {
  color: var(--ink-500);
  font-size: 0.55rem;
}

.bootstrap-strategy-field {
  display: grid;
  gap: 0.6rem;
  padding: 0;
  border: 0;
}

.bootstrap-strategy-field legend {
  margin-bottom: 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
}

.strategy-option {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.75rem;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.strategy-option:has(input:checked) {
  background: var(--teal-100);
  border-color: rgba(18, 123, 126, 0.35);
}

.strategy-option input {
  margin-top: 0.25rem;
  accent-color: var(--teal-700);
}

.strategy-option span {
  display: grid;
  gap: 0.15rem;
}

.strategy-option strong {
  font-size: 0.68rem;
}

.strategy-option small {
  color: var(--ink-500);
  font-size: 0.57rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .category-overview-list,
  .analysis-grid,
  .analysis-breakdown-body {
    grid-template-columns: 1fr;
  }

  .manager-tabs {
    padding: 0.65rem;
  }

  .unrecognized-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }

  .unrecognized-row > .amount {
    grid-column: 2;
  }

  .unrecognized-row > .button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .category-rule-row {
    grid-template-columns: 32px minmax(0, 1fr) 36px;
  }

  .category-rule-target,
  .category-rule-row > em {
    grid-column: 2;
  }

  .category-rule-row > [data-delete-category-rule] {
    grid-column: 3;
    grid-row: 1 / span 3;
  }

  .analysis-heading,
  .category-heading {
    align-items: flex-start;
  }

  .analysis-period {
    width: 100%;
    overflow-x: auto;
  }

  .analysis-period button {
    flex: 1 0 auto;
  }

  .analysis-breakdown-body {
    justify-items: center;
  }

  .analysis-grid.is-long-period {
    grid-template-columns: 1fr;
  }

  .category-dialog form {
    padding: 1.15rem;
  }

  .analysis-category-list {
    width: 100%;
  }

  .settings-heading {
    align-items: flex-start;
  }

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

  .settings-card > header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .settings-card > header .connection-badge {
    grid-column: 2;
  }

  .security-flow {
    align-items: stretch;
  }

  .security-flow span {
    display: grid;
    flex: 1;
    place-items: center;
  }

  .sync-setup-dialog form {
    padding: 1.05rem;
  }
}

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