: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; }
.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; }
.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); }
.entry-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.entry-actions .new-sheet { margin-left: auto; }
.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; align-items: center; justify-content: center; gap: 7px; padding: 23px 0 30px; color: var(--muted); font-size: .86rem; }
.site-footer .icon { width: 16px; height: 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; }
  .entry-actions .new-sheet { margin-left: 0; }
  .entry-actions .button { padding-inline: 10px; }
  .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, .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; }
}

.storage-notice { margin-top: 12px; }
#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: flex; flex-wrap: wrap; align-items: end; gap: 7px 12px; margin-bottom: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbf7; }
.voice-control { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
#voice-hint, #voice-privacy, #voice-status, #voice-transcript { flex-basis: 100%; 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 { padding-block: 3px 7px; }
.custom-actions .button { padding-inline: 7px; }
.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 (max-width: 490px) {
  .voice-control { margin-left: 0; }
  .voice-control .button { padding-inline: 10px; }
  .sheet-controls { align-items: start; }
}
@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-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#template-status { flex-basis: 100%; 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; }
}
