:root {
  color-scheme: light;
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: #1c2433;
  background: #f5f6f8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #828b9a;
  --line: #e9ebef;
  --green: #237a55;
  --deep-green: #174f3b;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 90% 5%, rgb(218 235 222 / 42%), transparent 28rem),
    #f5f6f8;
}

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

.app-shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 25px 0 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 42px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #202a38; font-family: Manrope, sans-serif; font-size: 1rem; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--deep-green); color: #fff; font-size: 1.25rem; }
.local-badge { display: inline-flex; align-items: center; gap: 8px; color: #697383; font-size: 0.78rem; }
.local-badge span { width: 7px; height: 7px; border-radius: 50%; background: #35a574; box-shadow: 0 0 0 4px #dff2e8; }

.welcome { position: relative; display: flex; min-height: 220px; align-items: center; justify-content: space-between; overflow: hidden; margin-top: 25px; padding: 28px 54px; border-radius: 22px; background: linear-gradient(110deg, #e3f0e8, #edf3ed 62%, #e8f0e9); }
.eyebrow { margin: 0 0 10px; color: #758479; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; color: #1b3c2e; font-family: Manrope, sans-serif; font-size: clamp(2rem, 4vw, 2.85rem); font-weight: 800; letter-spacing: -0.055em; line-height: 1.08; }
h1 span { color: #63816f; }
.welcome-copy { margin: 0; color: #63736a; font-size: 0.9rem; }
.welcome-art { position: absolute; top: 0; right: 3%; width: 345px; height: 100%; opacity: 0.92; }
.art-orbit { position: absolute; display: block; border: 1px solid rgb(83 136 101 / 18%); border-radius: 50%; }
.orbit-one { top: -94px; right: -28px; width: 330px; height: 330px; }
.orbit-two { top: -55px; right: 12px; width: 250px; height: 250px; }
.art-card { position: absolute; top: 46px; right: 82px; display: flex; width: 160px; height: 128px; flex-direction: column; padding: 14px 16px; transform: rotate(7deg); border: 1px solid rgb(255 255 255 / 75%); border-radius: 15px; background: rgb(255 255 255 / 85%); box-shadow: 0 18px 36px rgb(36 86 57 / 12%); }
.art-card span { color: #829184; font-size: 0.55rem; font-weight: 700; letter-spacing: 0.1em; }
.art-card strong { margin-top: 6px; color: #286348; font-family: Manrope, sans-serif; font-size: 2.15rem; line-height: 1; }
.art-card i { width: 74%; height: 5px; margin-top: 9px; border-radius: 10px; background: #e4eee6; }
.art-card i:last-child { width: 47%; margin-top: 5px; }
.art-dot { position: absolute; top: 43px; right: 72px; width: 15px; height: 15px; border-radius: 50%; background: #e5b45c; box-shadow: 0 0 0 7px rgb(229 180 92 / 15%); }

.overview-grid { display: grid; grid-template-columns: 1.22fr 1fr 1fr; gap: 14px; margin-top: 17px; }
.summary-card, .panel { border: 1px solid #ebedf0; border-radius: 17px; background: rgb(255 255 255 / 91%); box-shadow: 0 6px 22px rgb(37 48 62 / 3%); }
.summary-card { min-height: 132px; padding: 18px 20px; }
.summary-card.featured { border-color: #2b7655; background: #226648; color: #fff; }
.card-heading { display: flex; align-items: center; justify-content: space-between; color: #788291; font-size: 0.75rem; font-weight: 600; }
.featured .card-heading { color: #d0e5d8; }
.card-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 9px; background: #eff5f0; color: #438361; font-size: 1rem; }
.card-icon.soft-green { background: #e8f5ed; color: #32815c; }
.card-icon.soft-orange { background: #fff2df; color: #c0852c; }
.summary-value { display: block; overflow: hidden; margin-top: 12px; color: #222d3b; font-family: Manrope, sans-serif; font-size: clamp(1.35rem, 2.4vw, 1.75rem); font-weight: 800; letter-spacing: -0.045em; text-overflow: ellipsis; white-space: nowrap; }
.featured .summary-value { color: #fff; }
.summary-value.category-value { font-size: 1.35rem; }
.card-caption { display: block; margin-top: 4px; color: #929aa6; font-size: 0.7rem; }
.featured .card-caption { color: #c4ddce; }

.content-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; align-items: start; gap: 15px; margin-top: 15px; }
.panel { min-width: 0; padding: 21px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading .eyebrow { margin-bottom: 7px; }
h2 { margin-bottom: 0; color: #273243; font-family: Manrope, sans-serif; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.04em; }
.panel-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: #eaf3ed; color: #347553; font-size: 1.1rem; }
.category-icon { background: #f2efff; color: #7661b9; }
.panel-copy { max-width: 450px; margin: 11px 0 16px; color: #87909d; font-size: 0.8rem; line-height: 1.55; }
#expense-form label, .proposal-field label { display: block; margin-bottom: 7px; color: #586272; font-size: 0.76rem; font-weight: 700; }
textarea { display: block; width: 100%; min-height: 104px; resize: vertical; padding: 12px 13px; border: 1px solid #e4e8e4; border-radius: 11px; outline: none; background: #fbfcfb; color: #283244; font-size: 0.85rem; line-height: 1.5; transition: border-color 150ms, box-shadow 150ms; }
textarea::placeholder { color: #a9b0b9; }
textarea:focus, .proposal-field input:focus, .proposal-field select:focus { border-color: #5a9a75; box-shadow: 0 0 0 3px rgb(71 140 96 / 12%); }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 11px; }
.input-hint { color: #9aa1aa; font-size: 0.68rem; }
.primary-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 0; border-radius: 10px; background: #236b49; color: #fff; font-size: 0.78rem; font-weight: 700; cursor: pointer; transition: background 150ms, transform 150ms; }
.primary-button:hover { transform: translateY(-1px); background: #18573a; }
.primary-button:disabled { cursor: wait; opacity: 0.65; transform: none; }
.status-message { min-height: 0; margin: 0; color: #ad553e; font-size: 0.75rem; }
.status-message:not(:empty) { margin-top: 10px; }
[hidden] { display: none !important; }
h3 { margin: 0; color: #333d4c; font-size: 0.85rem; }
.text-button { padding: 4px 0; border: 0; background: none; color: #748074; font-size: 0.72rem; font-weight: 700; cursor: pointer; }
.proposal-item { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 12px; border: 1px solid #edf0ed; border-radius: 11px; background: #fbfcfb; }
.proposal-field { min-width: 0; }
.proposal-field.wide { grid-column: 1 / -1; }
.proposal-field input, .proposal-field select { width: 100%; min-height: 37px; padding: 0 9px; border: 1px solid #e2e7e2; border-radius: 8px; outline: none; background: #fff; color: #344052; font-size: 0.75rem; }
.proposal-field input[type="date"] { font-size: 0.7rem; }
.proposal-field label { margin-bottom: 5px; color: #87908a; font-size: 0.66rem; }

.category-list { display: grid; gap: 17px; margin-top: 21px; }
.category-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px 12px; align-items: center; }
.category-name { overflow: hidden; color: #5b6574; font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }
.category-amount { color: #303a48; font-size: 0.76rem; font-weight: 700; white-space: nowrap; }
.category-track { grid-column: 1 / -1; height: 6px; overflow: hidden; border-radius: 10px; background: #f0f2f0; }
.category-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #79aa86, #367856); }
.category-count { margin-left: 5px; color: #a1a8b1; font-size: 0.68rem; font-weight: 400; }

.history-panel { margin-top: 15px; padding: 19px 21px 5px; }
.history-heading { align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 12px; }
.history-heading > div:first-child { flex-shrink: 0; min-width: 0; }
.history-heading h2 { white-space: nowrap; }
.period-label { padding: 6px 10px; border-radius: 8px; background: #f0f4f0; color: #6c7e71; font-size: 0.68rem; font-weight: 600; }
.expense-table-wrap { overflow-x: hidden; width: 100%; }
.expense-table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; }
.expense-table th { padding: 10px 8px; border-bottom: 1px solid var(--line); color: #a0a7b0; font-size: 0.63rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.expense-table td { padding: 12px 8px; border-bottom: 1px solid #f0f1f3; color: #5f6978; font-size: 0.75rem; vertical-align: middle; }
.expense-table tbody tr:last-child td { border-bottom: 0; }
.expense-table th:first-child { width: auto; color: #a0a7b0; font-weight: 700; white-space: nowrap; }
.expense-table td.desc-cell,
.expense-table td:first-child:not(.empty-state) { width: auto; max-width: 0; color: #303a48; font-weight: 600; vertical-align: middle; }
.expense-table .desc-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
  max-height: 2.7em;
}
.expense-table th:nth-child(2),
.expense-table td.category-cell,
.expense-table td:nth-child(2):not(.empty-state) { width: 125px; white-space: nowrap; }
.expense-table th:nth-child(3),
.expense-table td.date-cell,
.expense-table td:nth-child(3):not(.empty-state) { width: 95px; white-space: nowrap; }
.expense-table th:last-child,
.expense-table td.amount-cell,
.expense-table td:last-child:not(.empty-state) { width: 115px; white-space: nowrap; text-align: right; }
.expense-table .amount-cell { color: #2d6047; font-weight: 700; text-align: right; white-space: nowrap; }
.expense-table th:last-child { text-align: right; }
.category-tag { display: inline-block; padding: 4px 8px; border-radius: 7px; background: #eff5f0; color: #5c8067; font-size: 0.66rem; white-space: nowrap; }
.empty-state { padding: 20px 8px !important; color: #9ba2ac !important; font-size: 0.76rem !important; text-align: center; }
.footer-note { padding: 16px 0 0; color: #a4aab2; font-size: 0.68rem; text-align: center; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 28px, 600px); padding-top: 16px; }
  .welcome { min-height: 205px; margin-top: 18px; padding: 24px 25px; }
  .welcome-art { right: -125px; opacity: 0.45; }
  .overview-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
  .summary-card { min-height: 118px; padding: 15px; }
  .summary-card.featured { grid-column: 1 / -1; }
  .content-grid { grid-template-columns: 1fr; gap: 12px; margin-top: 12px; }
  .panel { padding: 17px; }
  .category-list { grid-template-columns: 1fr 1fr; gap: 16px 18px; }
  .history-panel { margin-top: 12px; padding: 17px 13px 4px; }
  .history-heading { padding: 0 4px; }
  .expense-table th, .expense-table td { padding-right: 6px; padding-left: 6px; }
  .expense-table th { font-size: 0.57rem; }
  .expense-table td { font-size: 0.69rem; }
  .expense-table th:nth-child(2), .expense-table td.category-cell, .expense-table td:nth-child(2):not(.empty-state) { width: 110px; }
  .expense-table th:nth-child(3), .expense-table td.date-cell, .expense-table td:nth-child(3):not(.empty-state) { width: 85px; }
  .expense-table th:last-child, .expense-table td.amount-cell, .expense-table td:last-child:not(.empty-state) { width: 105px; }
}

@media (max-width: 600px) {
  .history-page .history-heading { flex-direction: column; align-items: stretch; gap: 12px; }
  .history-page .history-heading > div:first-child { width: 100%; }
  .history-page .filter-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .history-page .month-filter { display: block; width: 100%; min-width: 0; }
  .history-page .month-filter select { display: block; width: 100%; min-width: 0; }
}

@media (max-width: 500px) {
  .local-badge { font-size: 0.68rem; }
  .welcome { min-height: 190px; padding: 20px; }
  .welcome-copy { max-width: 245px; font-size: 0.82rem; }
  .category-list { grid-template-columns: 1fr; }
  .form-footer { align-items: flex-start; flex-direction: column; }
  .form-footer .primary-button { width: 100%; }
  .expense-table th:nth-child(2), .expense-table td.category-cell, .expense-table td:nth-child(2):not(.empty-state) { display: none; }
  .expense-table th:nth-child(3), .expense-table td.date-cell, .expense-table td:nth-child(3):not(.empty-state) { width: 82px; }
  .expense-table th:last-child, .expense-table td.amount-cell, .expense-table td:last-child:not(.empty-state) { width: 105px; }
  .proposal-item { grid-template-columns: 1fr; }
  .proposal-field.wide { grid-column: auto; }
}

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

.account { display: flex; align-items: center; gap: 12px; }
.account-email { max-width: 200px; overflow: hidden; color: #4e5b52; font-size: 0.8rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .account-email { max-width: 130px; font-size: 0.75rem; } .account { gap: 8px; } }

.key-dialog { width: min(92vw, 380px); padding: 24px; border: 0; border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.key-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.key-dialog h2 { margin: 0 0 8px; font-size: 1.1rem; }
.key-dialog p { margin: 0 0 12px; color: #4e5b52; font-size: 0.88rem; line-height: 1.4; }
.key-dialog input { width: 100%; margin-bottom: 8px; padding: 10px 12px; border: 1px solid #cfd8d1; border-radius: 10px; font: inherit; box-sizing: border-box; }
.key-dialog .key-error { min-height: 1.2em; color: #b3261e; }
.key-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }

.expense-table .amount-cell.income, .income-value { color: #1b7f4b; }
.category-tag.income { background: #e3f4ea; color: #1b7f4b; }

.settings-dock { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; gap: 6px; }
.settings-actions { display: flex; gap: 6px; width: 0; overflow: hidden; opacity: 0; transform: translateX(8px); visibility: hidden; transition: width 180ms ease, opacity 150ms ease, transform 180ms ease, visibility 0s linear 180ms; }
.settings-dock.is-open .settings-actions { width: 136px; opacity: 1; transform: translateX(0); visibility: visible; transition: width 180ms ease, opacity 150ms ease, transform 180ms ease, visibility 0s; }
.settings-button, .settings-toggle { display: grid; width: 40px; height: 40px; padding: 0; place-items: center; border: 1px solid #d6dcd7; border-radius: 50%; background: #fff; color: #5c6b60; box-shadow: 0 4px 16px rgb(28 36 51 / 14%); cursor: pointer; transition: background-color 150ms ease, color 150ms ease; }
.settings-button:hover, .settings-button:focus-visible, .settings-toggle:hover, .settings-toggle:focus-visible { background: var(--green); color: #fff; }
.settings-button:focus-visible, .settings-toggle:focus-visible { outline: 3px solid #b8e0cc; outline-offset: 3px; }
.settings-button svg, .settings-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.settings-toggle { order: 2; width: 28px; height: 32px; border-radius: 10px 0 0 10px; }
.settings-toggle svg { width: 16px; height: 16px; transform: rotate(180deg); transition: transform 180ms ease; }
.settings-dock.is-open .settings-toggle svg { transform: rotate(0); }
.settings-panel { margin-top: 24px; }
.settings-panel .account { margin: 12px 0; }
.settings-panel .account-email { max-width: none; font-size: 0.9rem; }
.settings-back { display: inline-block; margin-top: 20px; color: var(--green); font-size: 0.85rem; font-weight: 700; text-decoration: none; }
@media (prefers-reduced-motion: reduce) { .settings-actions, .settings-button, .settings-toggle, .settings-toggle svg { transition: none; } }

.passphrase-form { display: grid; gap: 8px; max-width: 360px; margin-top: 12px; }
.passphrase-form input { padding: 10px 12px; border: 1px solid #cfd8d1; border-radius: 10px; font: inherit; }
.passphrase-form .primary-button { justify-self: start; }

.welcome h1.balance { margin: 0 0 8px; color: #1d4d38; font-family: Manrope, sans-serif; font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.1; }
.welcome h1.balance.negative { color: #b3261e; }
.review-page { max-width: 640px; }
.review-panel { margin-top: 24px; }
.review-step { color: #58665b; font-size: 0.8rem; font-weight: 700; }
.review-cards-list { display: grid; gap: 14px; margin: 18px 0 12px; }
.review-card { padding: 16px; border: 1px solid #dbe2dd; border-radius: 14px; background: #fbfdfb; transition: border-color 150ms ease, box-shadow 150ms ease; }
.review-card:hover, .review-card:focus-within { border-color: #bcd1c1; background: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04); }
.review-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px dashed #e4ebe5; }
.review-card-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; margin-right: 8px; font-size: 0.85rem; font-weight: 700; color: #202a38; }
.review-card-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-card-badge { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 6px; background: #e1efe5; color: #174f3b; font-size: 0.72rem; font-weight: 800; }
.review-card-remove { padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: #ac6363; font-size: 0.75rem; font-weight: 700; cursor: pointer; transition: background-color 150ms; }
.review-card-remove:hover { background: #fde8e8; color: #b3261e; }
.review-card-body { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.review-card-body .proposal-field label { display: block; margin-bottom: 4px; color: #717d74; font-size: 0.72rem; font-weight: 600; }
.review-card-body .proposal-field input, .review-card-body .proposal-field select { width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid #cfd8d1; border-radius: 8px; background: #fff; color: #202a38; font-size: 0.85rem; outline: none; transition: border-color 150ms; }
.review-card-body .proposal-field input:focus, .review-card-body .proposal-field select:focus { border-color: var(--green); outline: 2px solid #b8e0cc; }
@media (max-width: 520px) { .review-card-body { grid-template-columns: 1fr; } .review-card-body .proposal-field.wide { grid-column: auto; } }
.review-add-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px dashed #a8c1af; border-radius: 9px; background: transparent; color: var(--green); font-size: 0.8rem; font-weight: 700; cursor: pointer; transition: background 150ms; }
.review-add-btn:hover { background: #eef5f0; }
.review-summary-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0; padding: 14px 18px; border-radius: 12px; background: #edf5ef; font-size: 0.82rem; color: #435147; }
.review-summary-stat { display: flex; align-items: center; gap: 6px; }
.review-summary-stat strong { font-weight: 800; color: #1b3c2e; }
.review-summary-stat strong.income { color: #1b7f4b; }
.review-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.text-button.danger { color: #ac6363; text-decoration: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.month-filter { display: inline-block; min-width: 0; }
.month-filter select { min-height: 36px; padding: 0 28px 0 12px; border: 1px solid #dfe5df; border-radius: 9px; background: #fff; color: #344052; font: inherit; font-size: 0.8rem; font-weight: 600; text-overflow: ellipsis; }
.history-page { margin-top: 24px; }
.history-summary { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 14px 0 6px; color: #697383; font-size: 0.78rem; }
.history-summary strong { margin-left: 4px; color: #303a48; }
.history-summary strong.income-value { color: #1b7f4b; }
.more-link { display: block; margin-top: 12px; text-align: center; color: #1b7f4b; font-size: 0.85rem; font-weight: 700; text-decoration: none; }
.hint-text { margin: 8px 0 0; color: #8a93a1; font-size: 0.74rem; }
#history-list tr[data-id] { cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: background-color 120ms; }
#history-list tr[data-id]:hover { background: #f7f9f7; }
#history-list tr.is-pressing { background: #e6ede7 !important; }
#action-title { margin: 0 0 14px; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #202a38; }
.action-list { display: grid; gap: 8px; }
.danger-button { background: #ac3b3b; }
.danger-button:hover { background: #943030; }

.detail-dialog { width: min(92vw, 400px); }
.detail-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #edf0ee; }
.detail-header-left { display: flex; align-items: center; gap: 8px; }
.favorite-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid #dfe5df;
  border-radius: 8px;
  background: #fff;
  color: #6c7e71;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
  user-select: none;
}
.favorite-toggle:hover {
  background: #fdfaf2;
  border-color: #f59e0b;
  color: #b45309;
}
.favorite-toggle svg {
  fill: none;
  stroke: currentColor;
  transition: transform 200ms ease, fill 200ms ease, stroke 200ms ease;
}
.favorite-toggle.is-favorite {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #b45309;
}
.favorite-toggle.is-favorite svg {
  fill: #f59e0b;
  stroke: #d97706;
  animation: star-pop 250ms ease;
}
@keyframes star-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1.1); }
}
.fav-star { color: #f59e0b; margin-right: 3px; font-size: 0.82rem; }
.detail-amount { font-size: 1.35rem; font-weight: 800; color: #2d6047; }
.detail-amount.income { color: #1b7f4b; }
.detail-body { display: grid; gap: 12px; margin-bottom: 18px; }
.detail-row { display: grid; gap: 4px; }
.detail-label { color: #8a93a1; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.detail-value { color: #303a48; font-size: 0.88rem; font-weight: 500; }
.detail-desc { line-height: 1.5; word-break: break-word; white-space: pre-wrap; font-size: 0.92rem; font-weight: 600; background: #f8faf8; padding: 10px 12px; border-radius: 10px; border: 1px solid #eef2ef; max-height: 180px; overflow-y: auto; }
.detail-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 14px; border-top: 1px solid #edf0ee; }
.detail-actions .text-button { padding: 6px 12px; font-size: 0.82rem; }
.detail-actions .text-button.danger { color: #ac3b3b; }
.detail-actions .text-button.danger:hover { color: #8a2a2a; }

#edit-focus-guard { width: 100%; padding: 0 0 8px; text-align: left; color: #303a48; font-size: 1.1rem; font-weight: 700; }
#edit-dialog .review-form { display: grid; gap: 12px; }
#history-list td { padding-top: 20px; padding-bottom: 20px; font-size: 0.82rem; }
#history-list tr[data-id] { -webkit-tap-highlight-color: rgba(27, 127, 75, 0.12); }
.filter-group { display: flex; gap: 8px; align-items: center; }
.category-group { margin: 16px 0; }
.category-group h3 { margin: 0 0 8px; font-size: 0.85rem; color: #303a48; }
.category-list { display: grid; gap: 8px; margin: 0 0 10px; padding: 0; list-style: none; }
.category-list li, .category-add { display: flex; gap: 8px; align-items: center; }
.category-list input, .category-add input { flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; border: 1px solid #dfe5df; border-radius: 9px; font: inherit; font-size: 0.85rem; }
.category-list button:disabled { opacity: 0.35; }
.settings-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: inherit; text-decoration: none; }
.settings-link strong { display: block; color: #303a48; font-size: 0.95rem; }
.settings-link small { color: #8a93a1; font-size: 0.78rem; }
.settings-link > span:last-child { color: #a0a7b0; font-size: 1.4rem; }
.settings-button[hidden] { display: none; }
.settings-dock.is-open .settings-actions:has(#logout-button:not([hidden])) { width: 182px; }
