:root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#172033;background:#f5f7fb;font-synthesis:none;text-rendering:optimizeLegibility;--muted:#6d7789;--line:#e3e8f0;--green:#16845b;--green-dark:#116847;--green-pale:#e8f7ef;--white:#fff;--shadow:0 8px 28px rgba(31,45,71,.045)}
*{box-sizing:border-box}body{margin:0;min-width:320px}.shell{max-width:1240px;margin:0 auto;padding:32px 24px 24px}.topbar{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:24px}.eyebrow{margin:0 0 7px;color:var(--green);font-size:.72rem;font-weight:800;letter-spacing:.14em}h1{margin:0;font-size:clamp(1.8rem,4vw,2.45rem);letter-spacing:-.045em}h2{font-size:1.08rem;margin:0;letter-spacing:-.02em}.subtitle,.section-heading p,.list-heading p{margin:6px 0 0;color:var(--muted);font-size:.9rem}.panel,.summary-card{background:var(--white);border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow)}.settings{display:flex;align-items:end;gap:14px;padding:18px;margin-bottom:16px}.field{display:flex;flex-direction:column;gap:7px;min-width:0}.field>span{font-size:.78rem;font-weight:700;color:#596477}.field input{width:100%;min-width:0;height:43px;border:1px solid #d8deea;border-radius:10px;padding:0 12px;background:#fff;color:#172033;font:inherit;outline:none}.field input:focus{border-color:#48a77f;box-shadow:0 0 0 3px rgba(22,132,91,.12)}.settings .field{width:180px}.button{border:0;border-radius:10px;min-height:42px;padding:0 16px;font:inherit;font-size:.88rem;font-weight:750;cursor:pointer;transition:transform .12s,background .12s}.button:active{transform:scale(.98)}.button-primary{background:var(--green);color:#fff}.button-primary:hover{background:var(--green-dark)}.button-quiet{background:#f0f3f8;color:#49566b}.button-quiet:hover{background:#e6ebf3}.save-settings{min-width:100px}.summary-grid{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:16px;margin-bottom:16px}.summary-card{padding:20px;display:flex;flex-direction:column;align-items:flex-start;min-height:140px}.budget-card{background:linear-gradient(135deg,#f0fbf5,#fff);border-color:#ccebd9}.summary-label{font-size:.82rem;font-weight:700;color:#626e80}.summary-value{font-size:clamp(1.6rem,3vw,2rem);line-height:1.3;letter-spacing:-.04em;margin:7px 0 5px;font-variant-numeric:tabular-nums}.summary-foot{font-size:.8rem;color:var(--muted)}.progress-track{height:6px;width:100%;border-radius:99px;background:#dcefe4;margin:7px 0 8px;overflow:hidden}.progress-fill{height:100%;width:0;background:var(--green);border-radius:99px;transition:width .2s}.progress-fill.over{background:#d44747}.add-panel,.list-panel{padding:22px;margin-bottom:16px}.section-heading,.list-heading{display:flex;justify-content:space-between;align-items:center;gap:14px}.add-form{display:grid;grid-template-columns:minmax(180px,1fr) 90px 160px auto;gap:12px;align-items:end;margin-top:20px}.add-button{white-space:nowrap}.add-button span{font-size:1.1rem;margin-right:4px}.message{min-height:0;margin:8px 0 0;color:#b42318;font-size:.83rem}.message:empty{display:none}.list-heading{margin-bottom:18px}.list-legend{font-size:.78rem;color:var(--muted);display:flex;align-items:center;gap:7px}.list-tools{display:flex;flex-direction:column;align-items:flex-end;gap:10px}.export-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:7px}.tool-button{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:0 11px;font-size:.78rem;text-decoration:none;white-space:nowrap}.check-sample{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:6px;background:var(--green-pale);color:var(--green);font-weight:900}.table-wrap{width:100%;overflow-x:auto}table{width:100%;border-collapse:collapse;text-align:left;white-space:nowrap}th{padding:12px 10px;background:#f7f9fc;color:#687487;font-size:.72rem;text-transform:uppercase;letter-spacing:.045em;font-weight:800;border-bottom:1px solid var(--line)}th:first-child{border-radius:9px 0 0 9px}th:last-child{border-radius:0 9px 9px 0}td{padding:13px 10px;border-bottom:1px solid #edf0f5;font-size:.87rem}tbody tr:last-child td{border-bottom:0}.check-col{width:75px}.number-col{text-align:right}.action-col{width:90px}.item-name{font-weight:700;white-space:normal;min-width:130px;max-width:270px}.item-name.purchased{text-decoration:line-through;color:#8b95a4}.item-sub{font-size:.73rem;color:var(--muted);margin-top:3px}.numeric{text-align:right;font-variant-numeric:tabular-nums}.purchased-row{background:#fbfdfc}.purchase-check{appearance:none;width:21px;height:21px;border:1.5px solid #cbd3df;border-radius:6px;display:inline-grid;place-items:center;vertical-align:middle;cursor:pointer;background:#fff}.purchase-check:checked{background:var(--green);border-color:var(--green)}.purchase-check:checked:after{content:"✓";font-size:14px;font-weight:900;color:#fff}.row-actions{display:flex;justify-content:flex-end;gap:5px}.icon-button{border:0;background:transparent;color:#647187;font-size:1.1rem;width:31px;height:31px;border-radius:8px;cursor:pointer}.icon-button:hover{background:#edf1f6;color:#26334a}.empty-state{text-align:center;padding:34px 12px;color:var(--muted);white-space:normal}.list-footer{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-top:18px;padding-top:18px;border-top:1px solid var(--line)}.list-footer div{display:flex;flex-direction:column;gap:5px}.list-footer span{font-size:.76rem;color:var(--muted)}.list-footer strong{font-size:1rem;font-variant-numeric:tabular-nums}footer{text-align:center;color:#8a94a5;font-size:.77rem;padding:8px}.edit-dialog{border:1px solid var(--line);border-radius:18px;padding:24px;width:min(440px,calc(100% - 28px));box-shadow:0 24px 80px #17203335}.edit-dialog::backdrop{background:#10182870;backdrop-filter:blur(3px)}.edit-dialog form{display:flex;flex-direction:column;gap:16px}.edit-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:4px}.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}
@media(max-width:760px){.list-heading{align-items:flex-start;flex-direction:column}.list-tools{align-items:flex-start;width:100%}.export-actions{justify-content:flex-start}.shell{padding:22px 13px}.topbar{align-items:flex-start}.topbar .button{padding:0 11px;font-size:.78rem}.settings{gap:10px;padding:14px}.settings .field{flex:1;width:auto}.save-settings{min-width:auto;padding:0 12px}.summary-grid{grid-template-columns:1fr 1fr;gap:10px}.budget-card{grid-column:1/-1}.summary-card{padding:16px;min-height:120px}.add-panel,.list-panel{padding:16px}.add-form{grid-template-columns:1fr 1fr}.item-field{grid-column:1/-1}.price-field{grid-column:1/2}.add-button{grid-column:2/3}.list-footer{grid-template-columns:1fr 1fr}.list-legend{font-size:.7rem}table{min-width:720px}td,th{padding:12px 8px}}
@media(max-width:400px){.subtitle{font-size:.8rem}.settings{flex-wrap:wrap}.settings .field{min-width:110px}.save-settings{width:100%}.summary-value{font-size:1.55rem}}

/* Burger menu and accidental-change protection */
.menu-wrap{position:relative;flex-shrink:0}.burger-button{min-width:96px;min-height:46px;font-weight:800}.burger-button span{margin-left:5px}.menu-panel{position:absolute;right:0;top:calc(100% + 9px);z-index:20;width:min(330px,calc(100vw - 28px));padding:14px;background:#fff;border:1px solid var(--line);border-radius:15px;box-shadow:0 16px 42px rgba(23,32,51,.16)}.menu-panel[hidden],.readonly-banner[hidden]{display:none}.menu-toggle-row{display:flex;align-items:center;gap:10px;padding:8px 4px;cursor:pointer}.menu-lock-icon{font-size:1.35rem}.menu-toggle-copy{display:flex;flex:1;flex-direction:column;gap:3px}.menu-toggle-copy strong{font-size:.93rem}.menu-toggle-copy small,.menu-note{color:var(--muted);font-size:.76rem;line-height:1.45}.menu-toggle-row input{width:23px;height:23px;accent-color:var(--green);cursor:pointer}.menu-note{margin:7px 4px 10px}.menu-action{display:block;width:100%;padding:11px 8px;border:0;border-top:1px solid var(--line);background:transparent;color:#344054;text-align:left;font:inherit;font-size:.88rem;font-weight:700;cursor:pointer;text-decoration:none}.menu-action:hover{background:#f6f8fb}.menu-link{box-sizing:border-box}.menu-danger{color:#b42318}.menu-divider{height:1px;background:var(--line);margin:8px 0}.menu-action:disabled{opacity:.42;cursor:not-allowed;background:transparent}.readonly-banner{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:7px;margin:-7px 0 18px;padding:12px 15px;border:1px solid #f0d59a;border-radius:12px;background:#fff8e8;color:#825b13;font-size:.86rem}.readonly-banner span{font-weight:500}.readonly-mode .settings .field input:disabled,.readonly-mode .add-form input:disabled{background:#f0f2f5;color:#8791a1;opacity:1}.readonly-mode .purchase-check:disabled,.readonly-mode .icon-button:disabled,.readonly-mode .button:disabled{cursor:not-allowed;opacity:.42}.readonly-mode .purchase-check:disabled{pointer-events:none}.readonly-mode .row-actions{opacity:.45}.readonly-mode .add-panel{opacity:.72}.readonly-mode .add-panel:after{content:"🔒 Editing is locked — open Menu to turn off Read-Only Mode";display:block;margin-top:12px;color:#825b13;font-size:.82rem}.readonly-mode .menu-toggle-copy strong{color:var(--green-dark)}button:disabled{cursor:not-allowed}
@media(max-width:520px){.topbar{gap:10px}.burger-button{min-width:48px;padding:0 12px;font-size:1.05rem}.burger-button span{display:none}.menu-panel{right:0}.readonly-banner{justify-content:flex-start;font-size:.8rem}.readonly-banner span{width:100%;padding-left:27px}.readonly-mode .add-panel{padding-bottom:14px}}


/* Mobile layout matching the compact store-shopping reference */
.mobile-budget-summary,.mobile-list-view{display:none}
@media(max-width:600px){
  body{padding-bottom:100px;background:#f3f6f8}
  .shell{padding:16px 12px 28px}
  .topbar{align-items:center;gap:10px;margin-bottom:14px}
  .eyebrow{font-size:.62rem;margin-bottom:4px}
  h1{font-size:1.7rem;letter-spacing:-.05em}
  .subtitle{display:none}
  .burger-button{width:46px;height:46px;min-width:46px;min-height:46px;padding:0;border-radius:14px;font-size:1.3rem;background:#e8f7ef;color:#116847}
  .burger-button span{display:none}
  .settings{display:none}
  .summary-grid{display:none}
  .mobile-budget-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:0 0 16px;padding:0}
  .mobile-metric{display:flex;flex-direction:column;gap:8px;min-width:0;padding:12px 11px;background:#edf3f8;border:1px solid #e0e8ef;border-radius:15px}
  .mobile-metric span{font-size:.78rem;color:#4f5d70}
  .mobile-metric strong{font-size:1.2rem;line-height:1.2;letter-spacing:-.035em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums}
  #mobileRemainingCard{color:#16845b}
  .mobile-progress{grid-column:1/-1;height:10px;background:#e2e9ec;border-radius:99px;overflow:hidden;margin-top:2px}
  .mobile-progress>div{height:100%;width:0;background:#31bd70;border-radius:99px;transition:width .2s}
  .mobile-progress>div.over{background:#d44747}
  .mobile-progress-caption{grid-column:1/-1;display:flex;justify-content:space-between;gap:8px;font-size:.78rem;color:#657185;margin-top:0}
  .mobile-progress-caption strong{font-weight:750}
  .add-panel{display:none}
  .list-panel{padding:0;border:0;background:transparent;box-shadow:none;margin-bottom:12px}
  .list-heading{display:none}
  .table-wrap{display:none}
  .mobile-list-view{display:block}
  .mobile-items-section{margin:0 0 14px;background:#eef3f7;border-radius:18px;padding:10px}
  .mobile-section-heading{display:flex;align-items:center;gap:7px;margin:0;padding:6px 4px 12px;font-size:1.05rem;font-weight:800;color:#182235}
  .mobile-section-heading span{font-weight:750}
  details.mobile-purchased-section summary{cursor:pointer;list-style:none}
  details.mobile-purchased-section summary::-webkit-details-marker{display:none}
  details.mobile-purchased-section summary::after{content:"⌄";margin-left:auto;font-size:1.35rem;line-height:1;transform:rotate(-90deg)}
  details.mobile-purchased-section[open] summary::after{transform:rotate(0)}
  .mobile-item-list{display:flex;flex-direction:column;gap:3px}
  .mobile-item-row{display:grid;grid-template-columns:42px minmax(0,1fr) auto 20px;grid-template-areas:"check main total chevron" "check main total delete";align-items:center;gap:0 8px;min-height:76px;padding:9px 7px;background:#fff;border-bottom:1px solid #edf1f5;border-radius:10px}
  .mobile-item-row.purchased-row{background:#f7fcf8}
  .mobile-item-check{grid-area:check;display:flex;align-items:center;justify-content:center}
  .mobile-item-check .purchase-check{width:28px;height:28px;border-radius:7px;border:2px solid #aeb9c4;margin:0}
  .mobile-item-main{grid-area:main;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;min-width:0;gap:4px;padding:0;border:0;background:transparent;text-align:left;color:inherit;font:inherit;cursor:pointer}
  .mobile-item-name{font-size:.98rem;line-height:1.2;overflow-wrap:anywhere}
  .mobile-item-name.purchased{text-decoration:line-through;color:#8b95a4}
  .mobile-item-sub{font-size:.8rem;color:#687487}
  .mobile-item-total{grid-area:total;font-size:.95rem;white-space:nowrap;font-variant-numeric:tabular-nums}
  .mobile-item-chevron{grid-area:chevron;border:0;background:transparent;color:#9aa5b1;font-size:1.7rem;line-height:1;cursor:pointer;padding:0}
  .mobile-item-delete{grid-area:delete;border:0;background:transparent;color:#9aa5b1;font-size:1rem;line-height:1;cursor:pointer;padding:0}
  .mobile-empty-state{margin:0;padding:18px 8px;text-align:center;color:#687487;font-size:.86rem}
  .list-footer{display:none}
  footer{font-size:.7rem;padding:12px 5px}
  .mobile-shopping-bar{position:fixed;z-index:30;left:0;right:0;bottom:0;display:grid;grid-template-columns:64px 1fr 1fr;gap:8px;align-items:center;padding:10px 12px calc(10px + env(safe-area-inset-bottom));background:rgba(255,255,255,.97);border-top:1px solid #dce5e7;box-shadow:0 -8px 28px rgba(20,38,50,.10);backdrop-filter:blur(16px)}
  .mobile-add-button{height:58px;width:64px;border-radius:50%;background:#159653;color:#fff;text-decoration:none;display:flex;flex-direction:column;align-items:center;justify-content:center;line-height:1;box-shadow:0 3px 9px #0002}
  .mobile-add-button span{font-size:2rem;font-weight:400}
  .mobile-add-button small{font-size:.58rem;font-weight:750;margin-top:1px}
  .mobile-sticky-total,.mobile-sticky-remaining{min-width:0;display:flex;flex-direction:column;gap:4px;padding:0 3px}
  .mobile-sticky-total small,.mobile-sticky-remaining small{font-size:.64rem;color:#697586;white-space:nowrap}
  .mobile-sticky-total strong,.mobile-sticky-remaining strong{font-size:1.02rem;letter-spacing:-.025em;font-variant-numeric:tabular-nums;white-space:nowrap}
  .mobile-sticky-total strong{color:#116847}
  .menu-panel{position:fixed;top:70px;right:12px;width:min(350px,calc(100vw - 24px));padding:14px;border-radius:18px;box-shadow:0 18px 55px rgba(23,32,51,.23)}
  .menu-action{min-height:48px;padding:14px 9px;font-size:.92rem}
  .menu-toggle-row{min-height:54px}
  .menu-toggle-row input{width:27px;height:27px}
  .readonly-banner{margin:0 0 12px;padding:12px;border-radius:14px}
  .readonly-mode .add-panel{display:none}
}
@media(max-width:360px){
  .mobile-metric{padding:10px 8px}
  .mobile-metric strong{font-size:1.04rem}
  .mobile-item-row{grid-template-columns:36px minmax(0,1fr) auto 16px;gap:0 6px;padding:8px 5px}
  .mobile-sticky-total small,.mobile-sticky-remaining small{font-size:.58rem}
  .mobile-sticky-total strong,.mobile-sticky-remaining strong{font-size:.91rem}
}

@media(max-width:600px){.settings{display:none}.mobile-settings-open .settings{display:flex;flex-wrap:wrap}.mobile-settings-open .settings .field{flex:1 1 42%;width:auto}.mobile-settings-open .settings .save-settings{flex:1 1 100%}}
