@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');
:root{--ink:#18251f;--muted:#78847e;--line:#e7ece8;--paper:#f5f7f5;--green:#173b30;--green2:#245b48;--mint:#e7f1eb;--white:#fff;--red:#b84c4c;--shadow:0 12px 32px rgba(25,52,40,.055)}
*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font-family:"DM Sans",Arial,sans-serif;font-size:14px}.app-shell{max-width:1440px;margin:auto;padding:0 42px 36px}.topbar{height:86px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.brand{display:flex;align-items:center;gap:12px}.brand-icon{width:42px;height:42px;border-radius:11px;flex:none;display:block}.brand-name{font:800 16px Manrope;letter-spacing:-.35px}.brand-subtitle{font-size:11px;color:var(--muted);margin-top:3px}.header-actions{display:flex;align-items:center;gap:12px}.status-pill{font-size:11px;color:var(--muted);display:flex;align-items:center;gap:7px}.status-pill i,.legend i{width:7px;height:7px;background:#d9a441;border-radius:50%;display:inline-block}.status-pill.online i{background:#29966d}.status-pill.error i{background:#c75b5b}main{padding-top:28px}.hero{background:linear-gradient(115deg,#142e26,#214c3c);border-radius:18px;padding:28px 32px;color:white;display:flex;align-items:center;justify-content:space-between;min-height:166px;box-shadow:var(--shadow)}.eyebrow{font-size:9px;letter-spacing:1.5px;font-weight:700;color:#8b9991;margin:0 0 9px}.hero .eyebrow{color:#a6b9ae}.hero-total{font:800 clamp(30px,4vw,42px) Manrope;letter-spacing:-1.7px}.hero-caption{font-size:12px;color:#b7c8bf;margin-top:6px}.month-control{display:flex;align-items:center;gap:16px}.month-control strong{font:700 13px Manrope;min-width:118px;text-align:center}.icon-button{border:1px solid rgba(255,255,255,.2);background:transparent;color:inherit;width:32px;height:32px;border-radius:9px;font-size:22px;line-height:1;cursor:pointer}.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:15px;margin:17px 0}.stat-card,.panel{background:var(--white);border:1px solid var(--line);border-radius:15px;box-shadow:var(--shadow)}.stat-card{padding:17px 19px}.stat-label{font-size:11px;color:var(--muted);font-weight:600}.stat-value{font:800 20px Manrope;letter-spacing:-.5px;margin-top:7px}.stat-note{font-size:10px;color:#98a29c;margin-top:4px}.content-grid{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(330px,.85fr);gap:16px}.panel{padding:21px}.panel-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.panel-heading h2,.modal h2{font:800 16px Manrope;letter-spacing:-.35px;margin:0}.panel-heading .eyebrow{margin-bottom:5px}.legend{font-size:10px;color:var(--muted);display:flex;align-items:center;gap:6px}.legend i{background:#7fb89b}.calendar-weekdays,.calendar-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:7px}.calendar-weekdays{margin-bottom:7px}.calendar-weekdays span{text-align:center;font-size:10px;color:#9aa49e;font-weight:600;padding:6px 0}.day-cell{border:1px solid #edf0ed;border-radius:10px;min-height:73px;background:#fff;padding:8px 7px;text-align:left;cursor:pointer;display:flex;flex-direction:column;align-items:flex-start;justify-content:space-between;transition:.15s}.day-cell:hover{border-color:#8ab49d;background:#f8fbf8}.day-cell.outside{visibility:hidden}.day-cell.selected{background:var(--green);border-color:var(--green);color:white}.day-number{font-size:11px;font-weight:700}.day-amount{font-size:9px;font-weight:700;color:#448466;white-space:nowrap}.day-cell.selected .day-amount{color:#c4e3d0}.day-cell.today:not(.selected){outline:1px solid #83a991;outline-offset:-2px}.day-dot{width:5px;height:5px;border-radius:50%;background:#75a98b;margin-top:2px}.calendar-foot{display:flex;justify-content:space-between;gap:10px;color:#9aa49e;font-size:10px;margin-top:13px}.analysis-panel{display:flex;flex-direction:column}.weekly-list{display:flex;flex-direction:column;gap:13px}.week-row{display:grid;grid-template-columns:72px 1fr auto;align-items:center;gap:9px}.week-label{font-size:10px;color:#7f8b84}.bar-track{height:7px;background:#eef2ef;border-radius:20px;overflow:hidden}.bar-fill{height:100%;background:#7daf91;border-radius:20px;min-width:0}.week-value{font-size:10px;font-weight:700;min-width:76px;text-align:right}.analysis-divider{height:1px;background:var(--line);margin:22px 0 18px}.compact-heading{margin-bottom:10px}.count-chip{font-size:9px;background:#f0f4f1;color:#718078;border-radius:20px;padding:5px 8px}.entry-list{display:flex;flex-direction:column;gap:0;min-height:76px}.entry-row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid #f0f2f0}.entry-description{font-size:11px;font-weight:600;overflow-wrap:anywhere}.entry-time{font-size:9px;color:#9aa49e;margin-top:3px}.entry-amount{font-size:11px;font-weight:700;white-space:nowrap}.entry-actions{display:flex;gap:5px;margin-left:6px}.mini-button{border:0;background:#f1f4f2;color:#6f7c74;border-radius:6px;padding:5px 7px;font-size:10px;cursor:pointer}.empty-state{font-size:11px;color:#9aa49e;padding:20px 0;text-align:center}.selected-total-row{display:flex;justify-content:space-between;border-top:1px solid var(--line);padding-top:13px;margin-top:auto;font-size:11px;color:var(--muted)}.selected-total-row strong{font:800 14px Manrope;color:var(--ink)}.add-panel{margin-top:16px}.small-hint{font-size:10px;color:#9aa49e}.purchase-form{display:grid;grid-template-columns:2fr 1fr 1fr auto;gap:12px;align-items:end}.field{display:flex;flex-direction:column;gap:7px}.field span{font-size:10px;color:#78847e;font-weight:700}.field input{height:42px;border:1px solid #e4eae5;border-radius:9px;padding:0 12px;background:#fbfcfb;color:var(--ink);font:500 12px "DM Sans";outline:none;width:100%}.field input:focus{border-color:#7ca58c;box-shadow:0 0 0 3px #e8f1eb}.button{border:0;border-radius:9px;padding:0 16px;height:42px;font:700 11px "DM Sans";cursor:pointer;transition:.15s}.button:disabled{opacity:.55;cursor:wait}.button-primary{background:var(--green);color:white}.button-primary:hover{background:#245b48}.button-quiet{height:34px;background:#edf2ee;color:#43584b}.button-danger{background:#fff0ef;color:#a94343}.add-button{white-space:nowrap}.add-button span{font-size:16px;vertical-align:-1px;margin-right:4px}.form-message{min-height:15px;margin:8px 0 0;font-size:10px;color:#39815e}.form-message.error{color:#b84c4c}.footer{display:flex;justify-content:space-between;color:#a0aaa4;font-size:10px;padding:18px 3px}.modal-backdrop{position:fixed;inset:0;background:rgba(16,31,24,.38);display:grid;place-items:center;padding:18px;z-index:10}.modal-backdrop[hidden]{display:none}.modal{background:white;border-radius:16px;padding:23px;width:min(420px,100%);display:flex;flex-direction:column;gap:15px;box-shadow:0 25px 80px #10251c40}.modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}.modal-head .icon-button{color:#53645a;border-color:#e5ebe6}.modal-actions{display:flex;justify-content:space-between;margin-top:5px}.toast{position:fixed;bottom:22px;left:50%;transform:translate(-50%,20px);opacity:0;pointer-events:none;background:#173b30;color:white;border-radius:9px;padding:11px 16px;font-size:11px;box-shadow:var(--shadow);transition:.2s;z-index:20}.toast.show{opacity:1;transform:translate(-50%,0)}.toast.error{background:#a83232;color:#fff;max-width:min(560px,calc(100vw - 32px));white-space:normal;text-align:center;line-height:1.45}.toast.success{background:#173b30}
@media(max-width:900px){.app-shell{padding:0 22px 28px}.content-grid{grid-template-columns:1fr}.analysis-panel{min-height:0}.purchase-form{grid-template-columns:1fr 1fr}.description-field{grid-column:span 2}.add-button{grid-column:span 2}.day-cell{min-height:65px}}
@media(max-width:560px){.app-shell{padding:0 13px 22px}.topbar{height:72px}.brand-name{font-size:14px}.brand-subtitle{font-size:10px}.status-pill{font-size:0}.status-pill i{width:8px;height:8px}.hero{padding:21px 17px;min-height:145px;align-items:flex-start;flex-direction:column;gap:16px}.hero-total{font-size:34px}.month-control{align-self:flex-end;margin-top:-4px}.stat-grid{gap:8px}.stat-card{padding:13px 11px}.stat-label{font-size:9px}.stat-value{font-size:15px}.stat-note{font-size:9px}.panel{padding:15px}.panel-heading h2{font-size:14px}.calendar-weekdays,.calendar-grid{gap:4px}.day-cell{min-height:53px;padding:6px 4px;border-radius:7px}.day-number{font-size:10px}.day-amount{font-size:8px}.calendar-weekdays span{font-size:9px}.calendar-foot{font-size:9px}.purchase-form{grid-template-columns:1fr 1fr;gap:10px}.description-field{grid-column:span 2}.date-field{grid-column:span 2}.add-button{grid-column:span 2}.small-hint{display:none}.footer{font-size:9px;gap:12px}.week-row{grid-template-columns:62px 1fr auto;gap:6px}.week-value{min-width:65px;font-size:9px}}

/* ---- Mobile / touch optimisation ---- */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
html,body{overflow-x:hidden;overflow-x:clip;max-width:100%}
body{-webkit-tap-highlight-color:transparent}
button,input,.day-cell{touch-action:manipulation}
.app-shell{padding-left:max(42px,env(safe-area-inset-left));padding-right:max(42px,env(safe-area-inset-right))}
.field{min-width:0}
.field input{min-width:0;max-width:100%;-webkit-appearance:none;appearance:none}
.field input[type=date]{display:block;line-height:42px}
.field input[type=date]::-webkit-date-and-time-value{text-align:left}
.day-cell{min-width:0;overflow:hidden}
.day-amount{max-width:100%;overflow:hidden;text-overflow:clip}
.modal-backdrop{overflow-y:auto;overscroll-behavior:contain}
.modal{max-height:calc(100dvh - 36px);overflow-y:auto}
.toast{bottom:calc(22px + env(safe-area-inset-bottom))}
@media(max-width:900px){.app-shell{padding-left:max(22px,env(safe-area-inset-left));padding-right:max(22px,env(safe-area-inset-right))}}
/* iOS zooms into any input under 16px - keep inputs at 16px on phones/tablets */
@media(max-width:900px),(pointer:coarse){
  .field input{font-size:16px;height:48px}
  .field span{font-size:12px}
  .button{height:48px;font-size:14px}
  .button-quiet{height:38px;font-size:12px}
  .icon-button{width:40px;height:40px}
  .mini-button{padding:8px 12px;font-size:12px}
}
@media(max-width:560px){
  .app-shell{padding-left:max(13px,env(safe-area-inset-left));padding-right:max(13px,env(safe-area-inset-right));padding-bottom:calc(22px + env(safe-area-inset-bottom))}
  .topbar{padding-top:env(safe-area-inset-top);height:calc(72px + env(safe-area-inset-top))}
  .brand-icon{width:38px;height:38px;border-radius:10px}
  main{padding-top:16px}
  .eyebrow{font-size:10px}
  .hero-caption{font-size:13px}
  .stat-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .stat-label{font-size:11px}
  .stat-value{font-size:15px;overflow-wrap:anywhere}
  .stat-note{font-size:10px}
  .day-amount{font-size:8px;letter-spacing:-.2px}
  .calendar-foot{font-size:11px;flex-wrap:wrap}
  .week-label,.week-value{font-size:11px}
  .count-chip{font-size:11px}
  .entry-description,.entry-amount{font-size:13px}
  .entry-time{font-size:11px}
  .empty-state{font-size:13px}
  .selected-total-row{font-size:13px}
  .form-message{font-size:12px}
  .footer{font-size:11px;flex-wrap:wrap}
  .toast{font-size:13px;max-width:calc(100vw - 32px)}
  .modal{padding:18px}
  /* put the main action near the top on phones */
  main{display:flex;flex-direction:column}
  .hero{order:0}.add-panel{order:1;margin-top:12px}.stat-grid{order:2;margin:12px 0}.content-grid{order:3}.footer{order:4}
  .date-field{grid-column:auto}
  .add-panel .panel-heading{margin-bottom:12px}
}
.field input[type=number]{-moz-appearance:textfield}
.field input[type=number]::-webkit-inner-spin-button,.field input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
