:root {
  color-scheme: light;
  --background: #f5f6f0;
  --white: #ffffff;
  --ink: #1c3027;
  --muted: #516359;
  --green: #1c513e;
  --deep: #15392e;
  --line: #dfe6dc;
  --tint: #edf4ed;
  --rust: #99402e;
  --radius: 20px;
  font: 100%/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--background); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #527f6b; outline-offset: 3px; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: min(1160px, calc(100% - 72px)); margin-inline: auto; }
.skip { position: fixed; top: 8px; left: 8px; z-index: 10; background: white; padding: 12px; transform: translateY(-160%); }
.skip:focus { transform: translateY(0); }
.site-header { border-bottom: 1px solid var(--line); background: #fafbf7; }
.header-content { display: flex; align-items: center; justify-content: space-between; min-height: 74px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 750; text-decoration: none; letter-spacing: -.025em; line-height: 1.22; }
.brand-secondary { font-weight: 540; }
.brand-icon { display: grid; width: 40px; height: 40px; place-items: center; flex: none; color: #f9fff9; background: var(--green); border-radius: 12px; }
.brand-icon .icon { width: 23px; height: 23px; }
nav, .nav-button { display: flex; align-items: center; }
nav { gap: 7px; }
.language-picker select { min-width: 94px; font-weight: 640; }
.app-shell .language-picker select, .landing .language-picker select {
  color: #f2f7f3;
  border-color: #476959;
  background-color: #111b16;
  color-scheme: dark;
}
.language-picker select:focus-visible { outline-color: #a0f4bd; }
[lang="en"] #nav-sheet .wide-label { display: none; }
[lang="en"] #nav-sheet .en-sheet-full { display: none; }
@media (min-width: 761px) {
  [lang="en"] #nav-sheet .en-sheet-full { display: inline; }
  [lang="en"] #nav-sheet .en-sheet-short { display: none; }
}
.nav-button { min-height: 44px; padding: 0 13px; gap: 7px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: .9rem; font-weight: 650; white-space: nowrap; }
.wide-label { margin-left: -4px; }
.nav-button .icon { width: 17px; height: 17px; }
.nav-button:hover, .nav-button.active { color: var(--green); background: #e6eee3; }
.count { padding: 0 7px; border-radius: 20px; background: #d8e6d8; font-size: .8rem; }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 46px 0 33px; }
h1 { font: 400 clamp(2.8rem, 5vw, 4.3rem)/1.03 Georgia, "Times New Roman", serif; letter-spacing: -.055em; }
h1 em { color: #2d624c; font-weight: inherit; }
.intro p { color: var(--muted); margin-top: 13px; font-size: 1.04rem; }
.intro .button { flex: none; margin-bottom: 2px; }
.archive-links { display: flex; flex-wrap: wrap; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 15px; min-height: 44px; border: 1px solid transparent; border-radius: 10px; font-weight: 680; font-size: .91rem; background: transparent; text-decoration: none; line-height: 1.2; }
.button .icon { width: 18px; height: 18px; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--deep); }
.button.outline { border-color: #b9ccbc; color: var(--green); background: #fbfcf9; }
.button.outline:hover, .button.quiet:hover { background: var(--tint); }
.button.quiet { color: var(--green); }
.notice { margin: 0 0 15px; padding: 11px 15px; border: 1px solid #d6e5d2; border-radius: 10px; background: #eaf2e7; color: var(--green); }
.notice.warning { background: #fdf1db; border-color: #ead7af; color: #714d18; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.48fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); box-shadow: 0 4px 14px #29342a08; }
.entry { padding: 23px 25px 16px; }
.entry-top { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin-bottom: 23px; }
h2 { font-size: 1.24rem; line-height: 1.25; letter-spacing: -.028em; }
.muted { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.entry-top .muted { margin-top: 5px; }
.period { flex: none; }
.period label, .simulate-field label, .month-choice label { display: block; margin-bottom: 4px; font-size: .87rem; font-weight: 680; }
.period-controls { display: flex; gap: 6px; }
select { min-height: 44px; max-width: 100%; padding: 7px 30px 7px 10px; appearance: none; border: 1px solid #cedad0; border-radius: 8px; background: linear-gradient(45deg, transparent 50%, #456453 50%) right 15px center / 5px 5px no-repeat, linear-gradient(135deg, #456453 50%, transparent 50%) right 10px center / 5px 5px no-repeat, #f9fbf8; font-size: .92rem; }
.expense-group + .expense-group { margin-top: 12px; }
.group-title { padding: 7px 12px; background: #f0f4ee; border-radius: 7px; color: #395a47; font-size: .86rem; font-weight: 750; }
.expense { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(104px, 140px); gap: 13px; align-items: start; padding: 11px 0; }
.expense + .expense { border-top: 1px solid #edf0eb; }
.expense-icon, .section-icon { display: grid; place-items: center; border-radius: 10px; }
.expense-icon { width: 37px; height: 37px; margin-top: 2px; color: var(--category-ink); background: var(--category-light); }
.expense-icon .icon { width: 19px; height: 19px; }
.expense label { font-weight: 730; display: block; line-height: 1.27; }
.expense-help { color: var(--muted); font-size: .85rem; line-height: 1.33; margin-top: 3px; }
.bill-link { display: inline; padding: 0; text-align: left; border: 0; background: transparent; color: var(--green); font-size: .84rem; line-height: 1.6; text-decoration: underline; text-underline-offset: 2px; }
.currency-wrap { position: relative; }
.currency-wrap input { width: 100%; min-height: 44px; padding: 8px 30px 8px 11px; border: 1px solid #cbd8cb; border-radius: 8px; background: #fafbf9; font-size: 1rem; font-variant-numeric: tabular-nums; }
.currency-wrap input::placeholder { color: #627168; opacity: 1; }
.currency-wrap input:focus { background: white; }
.currency-wrap input[aria-invalid="true"] { border-color: var(--rust); }
.currency-wrap span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #516359; pointer-events: none; }
.field-error { margin-top: 5px; color: var(--rust); font-size: .82rem; line-height: 1.3; }
.entry-footer { padding-top: 12px; border-top: 1px solid var(--line); container-type: inline-size; }
.entry-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 7px; }
.entry-actions .button { min-width: 0; padding-inline: 8px; text-align: center; overflow-wrap: anywhere; }
@container (width < 35rem) {
  .entry-actions:has(#retry-example[hidden]) #save { grid-column: 1 / -1; }
}
@container (min-width: 35rem) {
  .entry-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .entry-actions .button { grid-column: span 2; }
  .entry-actions:has(#retry-example[hidden]) :is(#reset-amounts, #clear) { grid-column: span 3; }
}
.feedback { margin-top: 8px; color: var(--green); font-size: .88rem; min-height: 2px; }
.feedback:empty { margin: 0; }
.mobile-total { display: none; }
.summary-column { display: grid; gap: 15px; }
.total-card { background: #173f32; border-radius: var(--radius); color: #f6faf3; padding: 23px 24px 17px; }
.total-top, .total-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.total-top h2 { font-size: 1.015rem; letter-spacing: 0; }
#summary-period { padding: 4px 10px; border: 1px solid #82a6937a; color: #e1eee0; background: #355849; border-radius: 30px; font-size: .83rem; font-weight: 650; }
#total { display: block; margin: 9px 0 2px; font: 400 clamp(2.5rem, 4.45vw, 4rem)/1.1 Georgia, "Times New Roman", serif; letter-spacing: -.055em; overflow-wrap: anywhere; }
#total-context { color: #d6e8d9; font-size: .9rem; }
.total-footer { margin-top: 17px; padding-top: 13px; border-top: 1px solid #ffffff35; color: #e0eee1; font-size: .86rem; }
.segments { display: flex; gap: 4px; }
.segments i { width: 14px; height: 6px; border-radius: 4px; background: #ffffff31; }
.segments .filled { background: #acd6a9; }
.breakdown { padding: 21px 23px 22px; }
.section-title { display: flex; align-items: center; gap: 10px; }
.section-icon { width: 34px; height: 34px; color: var(--green); background: #ecf3e9; flex: none; }
.section-icon .icon { width: 18px; height: 18px; }
#largest { margin: 9px 0 14px; }
.breakdown-item { display: grid; margin-top: 9px; grid-template-columns: minmax(82px, 1fr) minmax(22px, .88fr) minmax(58px, auto) 46px; align-items: center; gap: 10px; font-size: .88rem; }
.breakdown-label { display: flex; min-width: 0; align-items: center; gap: 7px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--category-color); flex: none; }
.breakdown-track { height: 6px; overflow: hidden; border-radius: 6px; background: #edf1eb; }
.breakdown-track span { display: block; width: var(--share); height: 100%; border-radius: inherit; background: var(--category-color); }
.breakdown-value { text-align: right; color: #354b3e; font-weight: 660; font-variant-numeric: tabular-nums; }
.breakdown-share { text-align: right; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.compare-card { margin-top: 22px; padding: 22px 24px; }
.compare-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.view-switch { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: #ecf1eb; }
.view-switch button { border: 0; border-radius: 7px; min-height: 38px; padding: 6px 11px; color: #4a5e52; background: transparent; font-size: .89rem; font-weight: 680; white-space: nowrap; }
.view-switch .selected { background: white; color: var(--green); box-shadow: 0 1px 3px #25332b19; }
.compare-intro { margin-top: 12px; }
.comparison-layout { display: grid; grid-template-columns: minmax(200px, .66fr) minmax(0, 1.5fr); align-items: start; gap: 16px; margin-top: 15px; }
.compare-result { background: #edf4ec; border-radius: 10px; padding: 12px 14px; color: #264c38; min-height: 44px; font-size: .93rem; overflow-wrap: anywhere; }
.compare-result strong { font-size: 1.05rem; }
.compare-result p + p { margin-top: 4px; }
.compare-result .more { color: #8c3d2b; }
.compare-result .less { color: #21563b; }
.month-choice select, .simulate-field select { width: 100%; }
.compare-details { margin-top: 12px; }
.compare-details summary { cursor: pointer; width: fit-content; min-height: 34px; padding-top: 4px; color: var(--green); font-weight: 680; }
.compare-details table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.compare-details th, .compare-details td { border-bottom: 1px solid var(--line); text-align: right; padding: 7px 8px; }
.compare-details th:first-child, .compare-details td:first-child { text-align: left; padding-left: 0; }
.compare-details thead th { color: var(--muted); font-weight: 650; }
.simulate-layout { display: grid; grid-template-columns: minmax(140px, .85fr) minmax(150px, .85fr) minmax(0, 1.4fr); gap: 15px; align-items: start; margin-top: 13px; }
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 16px; padding: 23px 0 30px; color: var(--muted); font-size: .86rem; }
.site-footer span { display: inline-flex; align-items: center; gap: 7px; }
.site-footer a { color: var(--green); text-underline-offset: 3px; }
.site-footer .icon { width: 16px; height: 16px; }
.legal-links { flex-basis: 100%; flex-wrap: wrap; justify-content: center; gap: 6px 16px; }
.archive-card { padding: 20px 24px; min-height: 95px; }
.archive-row + .archive-row { border-top: 1px solid var(--line); }
.archive-row h2 { font-size: 1rem; }
.archive-row strong { font-variant-numeric: tabular-nums; }
dialog { width: min(440px, calc(100% - 30px)); padding: 22px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--white); }
dialog::backdrop { background: #10251c78; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.button.close { font-size: 1.45rem; min-width: 44px; padding: 0; }
.bill-fields { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; margin: 13px 0; }
.bill-result { margin-bottom: 12px; color: var(--green); font-weight: 670; }
@media (max-width: 1020px) {
  .entry-top { flex-wrap: wrap; }
  .workspace { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 15px; }
  .entry { padding-inline: 19px; }
  .expense { gap: 10px; }
}
@media (max-width: 760px) {
  .wrap { width: calc(100% - 36px); }
  .header-content { min-height: 64px; }
  .wide-label { display: none; }
  .intro { padding: 29px 0 22px; flex-direction: column; align-items: start; gap: 14px; }
  .intro p { margin-top: 9px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .entry-top { flex-wrap: nowrap; }
  .mobile-total { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; padding: 6px 13px; border-radius: 10px; background: var(--deep); color: #f7f9f2; font-size: .88rem; box-shadow: 0 5px 15px #24352b25; }
  .mobile-total strong { margin-left: 4px; font-variant-numeric: tabular-nums; }
  .mobile-total a { display: flex; align-items: center; min-height: 38px; text-underline-offset: 3px; }
  #total-title { scroll-margin-top: 62px; }
  .simulate-layout, .comparison-layout { grid-template-columns: 1fr 1fr; }
  .simulate-layout .compare-result, .comparison-layout > * { grid-column: 1 / -1; }
}
@media (max-width: 490px) {
  .wrap { width: calc(100% - 26px); }
  .brand { gap: 7px; font-size: .9rem; }
  .brand-secondary { display: block; }
  .brand-icon { width: 34px; height: 34px; border-radius: 9px; }
  nav { gap: 2px; }
  .nav-button { padding: 0 7px; gap: 4px; font-size: .84rem; }
  .nav-button .icon { width: 15px; }
  .count { padding-inline: 4px; }
  h1 { font-size: clamp(2.43rem, 10vw, 3.3rem); }
  .entry, .breakdown, .compare-card, .archive-card { padding-inline: 14px; }
  .entry-top { flex-wrap: wrap; margin-bottom: 14px; }
  .expense { grid-template-columns: 32px minmax(0, 1fr) minmax(82px, 100px); gap: 8px; }
  .expense-icon { width: 32px; height: 32px; border-radius: 8px; }
  .expense-help { font-size: .82rem; }
  .currency-wrap input { padding-left: 7px; padding-right: 22px; }
  .currency-wrap span { right: 7px; }
  .compare-header { flex-wrap: wrap; }
  .view-switch { width: 100%; }
  .view-switch button { flex: 1; }
  .compare-details th, .compare-details td { padding-inline: 3px; font-size: .81rem; }
}
@media (max-width: 360px) {
  .nav-button .icon, .nav-button .count { display: none; }
  .brand-icon { width: 30px; height: 30px; }
  .header-content { gap: 6px; }
}
@media print {
  :root, body { color: black; background: white; }
  .wrap { width: 100%; }
  .site-header, .site-footer, .intro button, .categories-link, .mobile-total, .entry-footer, .compare-card, .bill-link, dialog, .skip { display: none !important; }
  .intro { padding: 0 0 17px; }
  h1 { font-size: 35px; }
  .workspace { grid-template-columns: 1.35fr 1fr; gap: 12px; }
  .card, .total-card { box-shadow: none; border: 1px solid #c4c4c4; color: black; background: white; break-inside: avoid; }
  .total-card *, #summary-period, #total-context, .total-footer { color: black; background: white; }
  .entry, .breakdown, .total-card { padding: 12px; }
  .entry-top { flex-wrap: wrap; margin-bottom: 8px; }
  .expense { grid-template-columns: minmax(0, 1fr) 100px; gap: 8px; padding-block: 6px; }
  .expense-icon { display: none; }
  .expense-help { display: none; }
  .currency-wrap input, select { min-height: 29px; background: white; }
  .currency-wrap input::placeholder { color: transparent; }
  #main::after { display: block; content: "Creato con CrispRow · Le tue schede, in chiaro"; margin-top: 12px; color: #454545; font-size: 11px; }
  [lang="en"] #main::after { content: "Created with CrispRow · Your sheets, made clear"; }
}

.storage-notice { margin-top: 12px; }
#storage-backup { margin-top: 8px; }
#storage-backup-status { font-size: .87rem; }
#storage-backup-status:not(:empty) { margin-top: 6px; }
#editing-name { color: var(--green); font-weight: 680; overflow-wrap: anywhere; }
.archive-tools { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 14px; }
.archive-tools .simulate-field { width: min(320px, 100%); }
#archive-feedback:not(:empty) { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--tint); overflow-wrap: anywhere; }
.archive-row { display: block; padding: 13px 0; }
.archive-row:first-child { padding-top: 3px; }
.record-header { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.record-header h2 { overflow-wrap: anywhere; }
.record-header strong { white-space: nowrap; }
.record-meta { margin-top: 3px; overflow-wrap: anywhere; }
.record-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.record-actions .button { padding-inline: 11px; }
.button.danger { color: var(--rust); }
.button.danger:hover { background: #faeee9; }
.button.primary.danger { color: white; background: var(--rust); }
.button.primary.danger:hover { background: #753023; }
.dialog-field { margin-top: 12px; }
.dialog-field input, .dialog-field textarea {
  width: 100%; padding: 9px 10px; min-height: 44px; color: var(--ink); background: #f9fbf8;
  border: 1px solid #cedad0; border-radius: 8px; font: inherit;
}
.dialog-field textarea { resize: vertical; font-size: .9rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; margin-top: 15px; }
.share-actions { justify-content: start; }
.dialog-folder { margin-top: 5px; padding-inline: 7px; }
#manage-summary { overflow-wrap: anywhere; }
.print-record { display: none; }
@media (max-width: 490px) {
  .record-actions .button { padding-inline: 9px; }
}
@media print {
  body.printing-record > :not(.print-record) { display: none !important; }
  body.printing-record .print-record { display: block; max-width: 165mm; margin: 0 auto; }
  .print-record h1 { margin: 10px 0; overflow-wrap: anywhere; }
  .print-record .print-month { margin-block: 8px 15px; }
  .print-record table { width: 100%; border-collapse: collapse; margin: 12px 0; }
  .print-record th, .print-record td { padding: 7px 0; border-bottom: 1px solid #ccc; }
  .print-record th { text-align: left; font-weight: 550; }
  .print-record td { text-align: right; }
  .print-record .print-total { font-size: 1.15rem; font-weight: 750; }
  .print-record .print-credit { margin-top: 15px; font-size: .85rem; }
}

.control-label { display: block; margin-bottom: 4px; font-size: .87rem; font-weight: 680; }
.period-controls { flex-wrap: wrap; }
.sheet-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; margin-bottom: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbf7; }
.sheet-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas: "create manage" "dictate edit";
  grid-auto-rows: 1fr;
  gap: 7px;
}
.sheet-actions .button { padding-inline: 8px; text-align: center; }
#create-template { grid-area: create; }
#manage-templates { grid-area: manage; }
#dictate { grid-area: dictate; }
#edit-amount { grid-area: edit; }
#voice-hint, #voice-privacy, #voice-status, #voice-transcript { margin: 0; font-size: .82rem; }
#voice-transcript, #edit-amount-transcript { overflow-wrap: anywhere; }
#edit-amount-current { margin-top: 4px; }
#voice-status:empty { display: none; }
#voice-status.warning { color: var(--rust); }
.custom-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; padding-block: 12px; }
.add-catalog-form { display: flex; flex: 1 1 300px; flex-wrap: wrap; align-items: end; gap: 8px; }
.add-catalog-form .simulate-field { flex: 1 1 120px; min-width: 0; }
.custom-actions .button { padding-inline: 10px; }
.expense-row-actions { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.expense-row-actions .button, .expense-row-actions .bill-link { min-height: 32px; }
.remove-row { color: var(--rust); }
.expense .quick-add { display: block; margin-inline-start: auto; padding: 3px 4px; min-height: 27px; }
.expense label { overflow-wrap: anywhere; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
@media print {
  .sheet-controls, .custom-actions, .quick-add { display: none !important; }
}

.folder-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 215px), 1fr)); gap: 10px; padding: 0; margin: 10px 0 0; list-style: none; }
.folder-list:empty { display: none; }
#archive-folders-empty { margin-top: 8px; }
.folder-card { width: 100%; min-height: 64px; height: 100%; display: flex; align-items: center; gap: 10px; padding: 11px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #f9fbf8; }
.folder-card:hover { background: var(--tint); border-color: #b9ccbc; }
.folder-card-text { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.folder-card-text > span { color: var(--muted); font-size: .85rem; }
.archive-record-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.archive-record-header h2 { overflow-wrap: anywhere; min-width: 0; }

#template-status { margin: 0; overflow-wrap: anywhere; }
#template-status:empty { display: none; }
#heading-subject { overflow-wrap: anywhere; }
.comparison-structure { margin-top: 9px; overflow-wrap: anywhere; }
#template-editor { width: min(690px, calc(100% - 24px)); max-height: calc(100% - 24px); max-height: calc(100dvh - 24px); padding: 16px; }
#template-editor-form { display: flex; flex-direction: column; max-height: calc(100vh - 68px); max-height: calc(100dvh - 68px); }
.template-editor-body { overflow-y: auto; min-height: 0; padding: 0 5px 8px; }
#template-editor .dialog-actions { margin-top: 9px; }
.brick-area, .fixed-entry { min-width: 0; margin: 16px 0 0; padding: 0; border: 0; }
.brick-area legend, .fixed-entry legend { font-weight: 700; }
.brick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 252px), 1fr)); gap: 8px; margin-top: 6px; }
.brick-card, .fixed-entry { border: 1px solid var(--line); border-radius: 9px; background: #fafbf7; padding: 8px 10px; }
.brick-label { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 8px; align-items: start; cursor: pointer; }
.brick-label small { display: block; color: var(--muted); line-height: 1.3; }
.brick-label .expense-icon { width: 29px; height: 29px; }
.brick-label input, .brick-monthly input, .check-label input { accent-color: var(--green); }
.brick-monthly, .check-label { display: flex; align-items: center; gap: 5px; min-height: 34px; font-size: .88rem; }
.brick-monthly { margin-top: 3px; }
.brick-monthly:has(input:disabled) { color: var(--muted); }
.fixed-entries { margin-top: 17px; }
.fixed-entry-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 195px), 1fr)); gap: 8px; }
.fixed-entry-fields label { font-size: .87rem; font-weight: 650; }
.fixed-entry-fields input { display: block; width: 100%; min-height: 42px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.fixed-entry-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.fixed-entry-buttons { display: flex; flex-wrap: wrap; gap: 4px; }
.fixed-entry-caption { min-width: 0; overflow-wrap: anywhere; }
.fixed-entry-caption span:not(:empty) { display: block; }
.fixed-entries > .muted { margin-top: 4px; }
#add-fixed-entry { margin-top: 8px; }
@media (max-width: 360px) {
  .brand-secondary { font-size: .73rem; }
  #template-editor { padding: 12px; }
}
.install-button { background: #e6eee3; color: #1c513e; }
.install-button:hover { background: #d8e7d7; color: #153e2f; }
.install-steps { margin: 12px 0 0; padding-inline-start: 1.55rem; }
.install-steps li + li { margin-top: 7px; }
.project-expense { grid-template-columns: auto minmax(0, 1fr); }
.project-amounts {
  grid-column: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.project-amounts label { color: var(--muted); font-size: .82rem; margin-bottom: 4px; }
.budget-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0 10px; }
.budget-totals span { display: block; font-size: .85rem; color: #daecde; }
.budget-totals strong { display: block; font-variant-numeric: tabular-nums; font-size: 1.3rem; overflow-wrap: anywhere; }
.budget-variance { grid-column: 1 / -1; border-top: 1px solid #82a6937a; padding-top: 8px; }
.budget-variance strong { font-size: 1rem; }
.total-card .budget-variance strong.less { color: #c5f2ca; }
.total-card .budget-variance strong.more { color: #ffc7bb; }
.record-total { text-align: right; }
.record-total small { display: block; color: var(--muted); }
.project-compare-row td span { display: block; white-space: nowrap; }
.project-compare-row td small { display: block; color: var(--muted); white-space: normal; }
.project-compare-row td span + span { margin-top: 5px; }
.attachment { border-top: 1px solid var(--line); padding: 10px 0; }
.attachment-preview { display: flex; align-items: center; gap: 12px; }
.photo-thumbnail { padding: 0; background: #edf1ed; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.photo-thumbnail img { display: block; width: 72px; height: 72px; object-fit: cover; }
#photo-view[open] {
  display: grid; grid-template-rows: auto minmax(0, 1fr); width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none; padding: 12px; border: 0; border-radius: 0;
}
#photo-full { display: block; width: 100%; height: 100%; object-fit: contain; }
@media (max-width: 600px) {
  .header-content { flex-wrap: wrap; padding-block: 6px; }
  .header-content nav { flex-wrap: wrap; max-width: 100%; }
  .nav-home .icon { display: block; }
  .project-expense { grid-template-columns: 32px minmax(0, 1fr); }
  .project-amounts { grid-column: 1 / -1; }
}
@media print {
  .attachment { display: none !important; }
  .print-record thead th:not(:first-child) { text-align: right; }
}

.home-view {
  display: grid;
  place-items: center;
  min-block-size: calc(100svh - 155px);
  padding: clamp(34px, 8vh, 76px) 0 26px;
}
.home-view:has(:is(.home-catalog, .home-results):not([hidden])) { align-items: start; }
.home-panel { inline-size: min(100%, 760px); text-align: center; }
.home-mark { display: block; margin: 0 auto 14px; border-radius: 14px; }
.home-brand h1 { font-size: clamp(3rem, 10vw, 5.25rem); color: var(--green); }
.home-brand p { margin-top: 12px; color: var(--muted); font-size: clamp(1rem, 2.5vw, 1.18rem); }
.home-search-form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px auto 16px;
  padding: 0 18px;
  border: 1px solid #ccd9cc;
  border-radius: 32px;
  background: var(--white);
  box-shadow: 0 5px 18px #1c513e10;
  color: var(--green);
}
.home-search-form input {
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.home-search-form input::placeholder { color: var(--muted); opacity: 1; }
.home-search-form:focus-within { outline: 3px solid #527f6b; outline-offset: 3px; }
.home-search-form input:focus { outline: 0; }
.home-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.home-pill { border-radius: 24px; }
.home-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.home-results { margin-top: 24px; text-align: left; }
.home-result-list { display: grid; gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }
.home-result {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px;
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); text-align: left; color: var(--green);
}
.home-result:hover { background: var(--tint); }
.home-result strong, .home-result small { display: block; overflow-wrap: anywhere; }
.home-result small { color: var(--muted); }
#home-empty-action { margin-top: 6px; text-align: left; overflow-wrap: anywhere; }
#home-categories { margin-top: 20px; }
.home-category-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 225px), 1fr));
  gap: 10px; margin-top: 6px; text-align: left;
}
.home-category { min-width: 0; padding: 13px 16px; }
.home-category h3 { font-size: 1rem; }
.home-subcategory { width: 100%; margin-top: 5px; justify-content: flex-start; padding-inline: 8px; text-align: left; }
.home-catalog { inline-size: min(100%, 760px); }
.home-catalog h2 { margin: 10px 0 20px; font-size: clamp(1.9rem, 6.5vw, 3.2rem); overflow-wrap: anywhere; }
.category-directory { min-block-size: calc(100svh - 155px); margin-inline: auto; padding: clamp(34px, 8vh, 76px) 0 26px; }
.calculator-directory { margin-top: 28px; }
.calculator-directory h3 { margin-bottom: 10px; }
.calculator-folders {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 10px; margin: 0; padding: 0; list-style: none;
}
.calculator-folders .home-result { height: 100%; }
a.home-result { text-decoration: none; }
.calculator-page .category-directory { inline-size: min(100%, 960px); }
.calculator-page h1 { margin: 16px 0; font-size: clamp(2rem, 5.5vw, 3.6rem); overflow-wrap: anywhere; }
.calculator-page p { margin: 14px 0; }
.calculator-page .catalog-tool { grid-template-columns: minmax(0, 1fr) auto; }
.calculator-page .catalog-action { grid-column: auto; }
.calculator-frame { display: block; width: 100%; min-height: 320px; margin-top: 18px; border: 0; border-radius: 16px; background: transparent; }
.distance-converter { margin: 14px 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; }
.distance-converter summary { width: fit-content; min-height: 44px; padding-block: 10px; cursor: pointer; font-weight: 700; }
.distance-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 174px), 1fr)); align-items: end; gap: 10px; padding-bottom: 14px; }
.distance-form label { display: block; font-size: .9rem; }
.distance-form :is(input, select, output) { display: block; width: 100%; min-height: 44px; margin-top: 4px; }
.distance-form input { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; }
.distance-form output { padding: 8px 10px; overflow-wrap: anywhere; font-weight: 700; }
.distance-cost { border-top: 1px solid var(--line); }
.distance-cost-result { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.distance-cost-result output { width: auto; margin-top: 0; padding-inline: 0; }
.distance-cost-result .feedback { flex-basis: 100%; margin: 0; }
.distance-cost-result .feedback:empty { display: none; }
#sheet-categories { margin-bottom: 12px; }
.home-catalog .home-result-list { gap: 12px; }
.catalog-tool {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 16px;
}
.catalog-tool strong { font-size: 1.07rem; }
.catalog-tool small { margin-top: 4px; font-size: .9rem; }
.catalog-action { padding: 5px 9px; border: 1px solid currentColor; border-radius: 8px; font-size: .85rem; font-weight: 680; }
@media (max-width: 490px) {
  .home-view { min-block-size: calc(100svh - 180px); }
  .home-search-form { gap: 8px; padding-inline: 13px; }
  .home-actions { gap: 6px; }
  .home-pill { padding-inline: 11px; }
  .catalog-tool { grid-template-columns: auto minmax(0, 1fr); }
  .catalog-action { grid-column: 2; justify-self: start; }
}

@media screen {
  .app-shell {
    --shell-bg: #090d0b;
    --shell-surface: #111b16;
    --shell-text: #f2f7f3;
    --shell-muted: #aebdb2;
    --shell-accent: #a0f4bd;
    --shell-line: #476959;
    --shell-hover: #1c3226;
    min-height: 100vh;
    background: radial-gradient(ellipse 52rem 33rem at 55% 235px, #153529 0%, transparent 77%) var(--shell-bg);
  }

  .app-shell .site-header {
    color: var(--shell-text);
    background: #0a100d;
    border-color: #293b31;
  }
  .app-shell .brand-secondary { color: var(--shell-muted); }
  .app-shell .brand:hover, .app-shell .brand:hover .brand-secondary { color: var(--shell-accent); }
  .app-shell .nav-button { color: var(--shell-muted); }
  .app-shell .nav-button:hover { color: var(--shell-accent); background: var(--shell-hover); }
  .app-shell .nav-button.active { color: var(--shell-accent); background: #1d382a; }
  .app-shell .count { color: var(--shell-accent); background: #284838; }
  .app-shell .install-button { color: var(--shell-accent); background: #142219; box-shadow: inset 0 0 0 1px var(--shell-line); }

  .app-shell :is(.home-view, .category-directory) { color-scheme: dark; color: var(--shell-text); }
  .app-shell .home-panel { inline-size: min(100%, 880px); }
  .app-shell :is(.home-search-form, .home-results) { max-inline-size: 760px; margin-inline: auto; }
  .app-shell .home-brand h1 { color: var(--shell-text); }
  .app-shell .home-brand p { color: var(--shell-muted); }
  .app-shell .home-search-form {
    color: var(--shell-accent);
    background: #192a21;
    border-color: #638c75;
    box-shadow: 0 6px 24px #0005;
  }
  .app-shell .home-search-form input { color: var(--shell-text); }
  .app-shell .home-search-form input::placeholder { color: #bdcec1; }
  .app-shell .home-search-form:focus-within { outline-color: var(--shell-accent); }
  .app-shell :is(.home-pill.outline, .home-result, .home-category, .intro .button.outline, .categories-link) {
    color: var(--shell-text);
    background: var(--shell-surface);
    border-color: var(--shell-line);
    box-shadow: none;
  }
  .app-shell :is(.home-pill.outline, .home-result, .intro .button.outline, .categories-link):hover {
    color: var(--shell-accent);
    background: var(--shell-hover);
  }
  .app-shell .home-pill.primary { color: #0c2015; background: var(--shell-accent); }
  .app-shell .home-pill.primary:hover:not(:disabled) { background: #c2ffd5; }
  .app-shell .home-result small { color: var(--shell-muted); }
  .app-shell :is(#home-categories, .home-subcategory, .catalog-action, #home-template-status) { color: var(--shell-accent); }
  .app-shell :is(#home-categories, .home-subcategory):hover { background: var(--shell-hover); }

  .app-shell .intro { color: var(--shell-text); }
  .app-shell .intro h1 em, .app-shell .site-footer a { color: var(--shell-accent); }
  .app-shell :is(.intro p, .site-footer) { color: var(--shell-muted); }
  .app-shell .skip { color: var(--shell-text); background: var(--shell-surface); }
  .app-shell :is(.site-header, .home-view, .category-directory, .intro, .site-footer) :focus-visible,
  .app-shell .skip:focus-visible { outline-color: var(--shell-accent); }
  .app-shell .calculator-page p { color: var(--shell-muted); }
  .app-shell .distance-converter { background: var(--shell-surface); border-color: var(--shell-line); }
  .app-shell .distance-cost { border-color: var(--shell-line); }
  .app-shell .distance-cost-result .button.outline { background: var(--shell-hover); color: var(--shell-accent); border-color: var(--shell-line); }
  .app-shell .distance-cost-result .button.outline:hover { border-color: var(--shell-accent); }
  .app-shell .distance-converter summary, .app-shell .distance-form output { color: var(--shell-accent); }
  .app-shell .distance-form :is(input, select) { color-scheme: light; color: var(--ink); background-color: #f0f2ef; }

  .app-shell :is(#sheet-view .card, .archive-card) {
    background: #e9ece8;
    border-color: #ccd5cd;
    box-shadow: none;
  }
  #sheet-view .sheet-controls { background: #e1e6e1; border-color: #ccd5cd; }
  #sheet-view :is(.currency-wrap input, select, .card .button.outline) { background-color: #f0f2ef; }
  #sheet-view .currency-wrap input:focus { background-color: #f3f5f2; }
  #sheet-view .card .button.outline:hover { background-color: #dfe9df; }
  #sheet-view .view-switch { background: #dfe5df; }
  #sheet-view .view-switch .selected { background: #f0f2ef; }
}
