:root{--green:#06C755;--green-dark:#06C755;--soft:#FFFFFF;--ink:#000000;--muted:#000000;--line:#000000;--bg:#FFFFFF;--red:#000000;--blue:#06C755;font-family:-apple-system,BlinkMacSystemFont,'Hiragino Kaku Gothic ProN','Noto Sans JP',Meiryo,sans-serif;color:var(--ink);background:var(--bg);font-size:16px}*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}button,.button{min-height:44px;padding:10px 16px;border:1px solid var(--line);border-radius:9px;background:white;color:var(--ink);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;font-weight:600;font-size:.875rem}button:hover,.button:hover{background:#FFFFFF}button:disabled{opacity:.5;cursor:wait}button:focus-visible,a:focus-visible{outline:3px solid #06C755;outline-offset:3px}.primary{background:var(--green);border-color:var(--green);color:white}.primary:hover{background:var(--green-dark)}.quiet{background:transparent;border-color:transparent;color:var(--muted)}.danger{color:var(--red)}h1,h2,h3,p{margin:0}h1{font-size:1.75rem;letter-spacing:.035em;font-weight:700}h2{font-size:1.05rem}p{line-height:1.8}.muted{color:var(--muted)}.small{font-size:.8125rem}.eyebrow{font-size:.6875rem;font-weight:700;letter-spacing:.15em;color:var(--green);margin-bottom:8px}.topbar{height:88px;background:#FFFFFF;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 5%;gap:10px}.brand{display:flex;align-items:center;gap:12px;font-size:1.2rem;font-weight:700;text-decoration:none;color:var(--ink)}.brand small{display:block;font-size:.6875rem;letter-spacing:.08em;color:var(--muted);font-weight:400;margin-top:4px}.brandmark{width:40px;height:40px;border-radius:12px;background:var(--green);display:inline-flex;align-items:center;justify-content:center;color:white;font-size:1.5rem}.layout{max-width:1440px;margin:auto;display:grid;grid-template-columns:228px minmax(0,1fr);gap:42px;padding:38px 4% 0}aside{display:flex;flex-direction:column;justify-content:space-between;max-height:640px}nav{display:flex;flex-direction:column;gap:9px}nav button{justify-content:flex-start;gap:14px;border:0;background:transparent;color:#000000;font-weight:500;padding:14px 18px}nav button span{font-size:1.3rem}nav button.active{background:var(--soft);color:var(--green);font-weight:700}.aside-note{padding:22px 16px;color:#000000}.aside-note .eyebrow{font-size:.6rem;color:#000000}.aside-note p{font-size:.875rem;margin:12px 0}.aside-note small{font-size:.75rem}main{min-width:0}.page-head{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:28px}.page-head p.muted{font-size:.875rem;margin-top:8px}.card{background:white;border:1px solid var(--line);border-radius:14px;box-shadow:0 3px 8px #000000}.monthbar{padding:14px 20px;display:flex;align-items:center;gap:8px;margin-bottom:20px}.monthnav{display:flex;align-items:center;gap:10px}.monthnav>button{width:44px;padding:0;font-size:1.6rem;font-weight:400}.month-label{position:relative;text-align:center;margin:0;min-width:164px;font-weight:700;font-size:1.125rem;cursor:pointer}.month-label input{position:absolute;inset:0;opacity:0;width:100%;cursor:pointer}.save-state{margin-left:auto;color:var(--muted);font-size:.75rem}.summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin-bottom:24px}.stat{padding:22px 24px;position:relative}.stat label,.stat .label{font-size:.8125rem;color:var(--muted);display:block;margin:0 0 10px}.stat strong{font-size:1.65rem;letter-spacing:-.03em;font-variant-numeric:tabular-nums;white-space:nowrap}.stat strong small{font-size:.8rem;margin-left:4px;font-weight:500}.stat.featured{background:var(--green);border-color:var(--green);color:white}.stat.featured .label{color:#FFFFFF}.stat.forecast{background:#FFFFFF}.stat .mini{padding:0;min-height:32px;font-size:.75rem;border:0;color:var(--green);background:transparent;float:right;margin-top:-5px}.negative{color:var(--red)!important}.featured strong.negative{color:#FFFFFF!important}.section-head{padding:22px 24px;display:flex;justify-content:space-between;align-items:center;gap:12px;border-bottom:1px solid var(--line)}.section-head p{margin-top:6px}.progress{height:4px;background:#FFFFFF;border-radius:9px;overflow:hidden;margin-top:14px}.progress progress{appearance:none;width:100%;height:4px;border:0;display:block}.progress progress::-webkit-progress-bar{background:#FFFFFF}.progress progress::-webkit-progress-value{background:#06C755}.day{display:grid;grid-template-columns:112px minmax(0,1fr);border-bottom:1px solid #FFFFFF;padding:16px 24px;gap:16px}.day:last-child{border:0}.day.empty{padding-top:9px;padding-bottom:9px;min-height:48px}.date{font-size:.8125rem;font-weight:600;padding-top:8px}.date b{font-size:1.25rem;display:inline-block;min-width:27px}.date small{font-size:.75rem;margin-left:6px;font-weight:400}.date .holiday-name{display:block;font-size:.6875rem;margin:5px 0;line-height:1.4}.sat .date{color:var(--blue)}.sun .date,.holiday .date{color:var(--red)}.today{background:#FFFFFF;border-left:3px solid var(--green);padding-left:21px}.today-badge{display:inline-block;background:var(--green);color:white;font-size:.625rem;padding:2px 6px;border-radius:4px;margin-top:5px}.empty-text{color:#000000;font-size:.75rem;align-self:center}.payment{display:flex;align-items:center;border-radius:9px;gap:8px;padding:2px 8px;margin:2px 0;min-height:54px}.payment.paid{background:#FFFFFF}.payment .toggle{flex:0 0 44px;width:44px;height:44px;min-height:44px;padding:0;border:0;background:transparent}.check-icon{width:21px;height:21px;border:1.5px solid #000000;border-radius:6px;color:transparent;display:flex;align-items:center;justify-content:center;font-size:14px}.paid .check-icon{border-color:#06C755;background:#06C755;color:white}.payment-edit{flex:1;min-width:0;display:flex;justify-content:space-between;gap:12px;border:0;background:transparent;padding:8px 0;text-align:left;font-weight:500}.payment-edit:hover{background:transparent}.pay-title{min-width:0;overflow-wrap:anywhere}.pay-title small{display:block;font-size:.6875rem;font-weight:400;color:#000000;margin-top:4px}.pay-amount{white-space:nowrap;font-variant-numeric:tabular-nums;font-weight:700;font-size:1rem;align-self:center}.paid .pay-title,.paid .pay-amount{color:#000000}.overdue{font-size:.625rem;color:var(--red);background:#FFFFFF;padding:2px 5px;border-radius:4px;margin-left:6px}.day-total{text-align:right;font-size:.6875rem;color:var(--muted);margin-top:6px}.searchbar{display:flex;gap:12px;padding:20px 24px}.searchbar input{flex:1;min-width:0}.master-row{display:flex;align-items:center;gap:16px;padding:20px 24px;border-top:1px solid var(--line)}.master-day{width:56px;flex-shrink:0;text-align:center;color:var(--green);font-size:.8rem;background:var(--soft);border-radius:9px;padding:10px 0}.master-day b{font-size:1.3rem}.master-info{flex:1;min-width:0;overflow-wrap:anywhere}.master-info p{font-weight:600}.master-info small{color:var(--muted);font-size:.75rem}.master-actions{display:flex;gap:5px}.status-pill{font-size:.7rem;padding:4px 8px;border-radius:20px;background:var(--soft);color:var(--green);white-space:nowrap}.status-pill.off{background:#FFFFFF;color:var(--muted)}.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}.settings-grid article{padding:28px}.settings-grid p{font-size:.875rem;margin:12px 0 20px}.settings-grid .button{display:flex;margin-top:10px}.tile-icon{display:inline-flex;width:40px;height:40px;border-radius:10px;background:var(--soft);align-items:center;justify-content:center;color:var(--green);font-size:1.4rem;margin-bottom:20px}.file-label{border:1px dashed #000000;padding:12px;border-radius:9px;margin:12px 0}.file-label input{font-size:.75rem;margin-top:10px;border:0;padding:0;width:100%}footer{color:#000000;display:flex;justify-content:space-between;font-size:.6875rem;padding:35px 0}.error{background:#FFFFFF;color:var(--red);padding:12px;border-radius:8px;font-size:.875rem;margin:12px 0;overflow-wrap:anywhere}#notice{background:var(--soft);color:var(--green);padding:12px 16px;border-radius:9px;margin-bottom:16px;font-size:.875rem}#notice.error{background:#FFFFFF;color:var(--red)}dialog{width:min(540px,calc(100% - 28px));max-height:calc(100dvh - 40px);border:0;border-radius:18px;box-shadow:0 24px 80px #000000;padding:26px;color:var(--ink)}dialog::backdrop{background:#000000;backdrop-filter:blur(3px)}.dialog-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:20px}.dialog-head button{font-size:1.4rem;border:0;width:44px;padding:0}.dialog-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:24px;flex-wrap:wrap}label{display:block;font-size:.875rem;margin:16px 0 8px;font-weight:500}input,select,textarea{border:1px solid #000000;border-radius:8px;min-height:44px;padding:11px 12px;background:white;color:var(--ink);max-width:100%}label input,label select,label textarea{display:block;width:100%;margin-top:8px}input:focus,textarea:focus,select:focus{outline:2px solid #06C755;outline-offset:1px}input[type=checkbox]{width:20px;min-height:20px;display:inline-block;vertical-align:middle;margin:0 10px 0 0;accent-color:var(--green)}textarea{resize:vertical;min-height:80px}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.form-note{font-size:.75rem;color:var(--muted);margin-top:12px;line-height:1.7}.confirm-symbol{width:44px;height:44px;border-radius:50%;background:var(--soft);color:var(--green);display:flex;align-items:center;justify-content:center;margin-bottom:18px}#confirm-body{color:var(--muted);font-size:.875rem;margin-top:14px;white-space:pre-wrap;overflow-wrap:anywhere}.empty-state{padding:36px 24px;text-align:center;color:var(--muted);font-size:.875rem;line-height:1.9}.preview-row{display:flex;justify-content:space-between;border-bottom:1px solid var(--line);padding:12px 0;gap:15px;font-size:.875rem}.preview-row span{overflow-wrap:anywhere}.preview-row b{white-space:nowrap}.preview-list{max-height:280px;overflow:auto}.login{max-width:420px;margin:8vh auto;padding:24px;text-align:center}.login>.brandmark{width:58px;height:58px;border-radius:18px;font-size:2rem;margin-bottom:22px}.login-card{text-align:left;padding:30px;margin:30px 0 22px}.login-card h2{font-size:1.2rem}.login-card p{font-size:.8125rem;margin-top:8px}.login-card button{margin-top:24px}.wide{width:100%}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}[hidden]{display:none!important}select{appearance:none;padding-right:32px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m2 2 4 4 4-4' fill='none' stroke='%23000000' stroke-width='1.5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center}
@media(max-width:1100px){.layout{grid-template-columns:180px minmax(0,1fr);gap:24px;padding:30px 3% 0}.stat{padding:18px}.stat strong{font-size:1.4rem}nav button{padding:12px}.master-row{flex-wrap:wrap}.master-actions{margin-left:auto}}
@media(max-width:760px){.topbar{height:74px;padding:0 18px}.brand{font-size:1.05rem}.layout{display:block;padding:24px 16px 82px}aside{display:block}nav{position:fixed;bottom:0;left:0;right:0;background:white;border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(3,1fr);gap:0;padding:7px 8px max(7px,env(safe-area-inset-bottom));z-index:10;box-shadow:0 -3px 12px #000000}nav button{flex-direction:column;gap:3px;font-size:.6875rem;border-radius:9px;padding:5px 2px;min-height:52px}nav button span{font-size:1.25rem}.aside-note{display:none}h1{font-size:1.375rem}.page-head{align-items:flex-start;margin-bottom:20px;gap:8px}.page-head>.primary{font-size:.75rem;padding:10px;white-space:nowrap}.page-head .eyebrow{font-size:.625rem}.page-head p.muted{font-size:.75rem;max-width:210px}.monthbar{padding:12px;gap:2px;flex-wrap:wrap}.monthnav{gap:5px}.month-label{min-width:142px;font-size:1.05rem}.save-state{font-size:.625rem}.monthbar>.quiet{padding:8px}.summary{grid-template-columns:1fr 1fr;gap:10px;margin-bottom:18px}.stat{padding:16px}.stat strong{font-size:1.3rem}.stat label,.stat .label{font-size:.75rem}.stat .mini{font-size:.6875rem}.section-head{padding:18px 14px;gap:8px}.section-head select{font-size:.75rem;padding-left:8px}.section-head p{font-size:.6875rem}.day{padding:12px 10px;grid-template-columns:62px minmax(0,1fr);gap:4px}.today{padding-left:7px}.day.empty{padding:6px 10px}.day.empty.today{padding-left:7px}.date{font-size:.75rem}.date b{font-size:1.1rem;min-width:22px}.date small{font-size:.6875rem;margin-left:2px}.payment{padding:1px 0;gap:0}.payment .toggle{flex-basis:40px;width:40px}.payment-edit{gap:6px;font-size:.8125rem}.pay-amount{font-size:.875rem}.pay-title small{font-size:.625rem}.day-total{font-size:.625rem}.settings-grid{grid-template-columns:1fr}.settings-grid article{padding:22px}.searchbar{padding:16px;gap:8px}.searchbar input{width:60%;font-size:.875rem}.searchbar select{width:40%;font-size:.75rem}.master-row{padding:16px;gap:12px}.master-info p{font-size:.875rem}.master-actions{width:100%;justify-content:flex-end}.section-head>.primary{font-size:.75rem;padding:8px;flex-shrink:0}.overdue{display:block;width:fit-content;margin:4px 0 0}dialog{padding:22px}.form-grid{gap:10px}.login{margin-top:3vh}.login-card{padding:24px}.progress{margin-top:10px}footer{padding:26px 0}.stat strong{font-size:clamp(.9rem,4vw,1.3rem)}}

/* Keep focused form controls at least 16px to prevent mobile Safari auto-zoom. */
@media (max-width: 760px), (pointer: coarse) {
  input, select, textarea { font-size: max(16px, 1rem) !important; }
  .searchbar { flex-wrap: wrap; }
  .searchbar input { min-width: 0; }
  .searchbar select { width: auto; max-width: 100%; }
}

/* Native date controls must shrink inside the dialog's grid. */
#edit-fields, #edit-fields label, #edit-fields .form-grid { min-width: 0; }
#editor input[type="month"], #editor input[type="date"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-inline-size: 0;
  box-sizing: border-box;
}
#editor input::-webkit-date-and-time-value { min-width: 0; text-align: left; }
#editor input::-webkit-datetime-edit { min-width: 0; padding: 0; }


/* Fixed visual shell: iOS's native month picker cannot enlarge the grid. */
#editor .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.month-control {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: 46px;
  margin-top: 8px;
  padding: 0 8px;
  border: 1px solid #000000;
  border-radius: 8px;
  background: #FFFFFF;
  color: #000000;
  overflow: hidden;
  contain: inline-size;
}
.month-value { font-size: 16px; line-height: 1.5; white-space: nowrap; pointer-events: none; }
#editor .month-control input[type="month"] {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  -webkit-appearance: none;
  appearance: none;
  font-size: 16px !important;
  cursor: pointer;
}
.month-control:focus-within { border-color: #06C755; outline: 2px solid #06C755; outline-offset: 1px; }
.month-control input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; margin: 0; padding: 0; cursor: pointer; }

/* LINE-inspired: white surfaces, light gray structure, green accents. */
:root {
  --green: #06C755;
  --green-dark: #05b34c;
  --soft: #eaf8ef;
  --ink: #161a18;
  --muted: #56605a;
  --line: #dce2de;
  --bg: #f5f6f7;
  --red: #161a18;
  --blue: #161a18;
}
.card { border-color: var(--line); box-shadow: 0 2px 6px #00000004; }
.topbar { border-color: var(--line); }
.primary, .primary:hover { color: #FFFFFF; }
.primary:hover { background: var(--green-dark); }
.brandmark { color: #FFFFFF; }
button:hover, .button:hover { border-color: #b9c4bd; background: #f2f5f3; }
.primary:hover { border-color: var(--green-dark); background: var(--green-dark); }
button:disabled { opacity: .55; }
nav button { color: #49544d; }
nav button.active { background: var(--soft); color: #075d2c; }
.aside-note, .aside-note .eyebrow, footer { color: #606b64; }
.eyebrow { color: #075d2c; }
.stat .label { color: #4e5952; font-weight: 600; }
.stat.featured { background: #06C755; border-color: #06C755; color: #FFFFFF; }
.stat.featured .label { color: #FFFFFF; }
.stat.forecast { background: #eef8f1; border-color: #cce7d5; }
.stat .mini { color: #075d2c; }
.stat:nth-child(5) strong { color: #075d2c; }
.negative, .featured strong.negative { color: #161a18 !important; text-decoration: underline; text-decoration-thickness: 2px; }
.day { border-bottom-color: #e9edea; }
.today { background: #f0faf4; border-left-color: #06C755; }
.today-badge { background: #06C755; color: #FFFFFF; }
.empty-text { color: #69756d; }
.payment.paid { background: #edf7f0; }
.check-icon { border-color: #819389; }
.paid .check-icon { background: #06C755; border-color: #06C755; color: #FFFFFF; }
.pay-title small { color: #5d6961; }
.paid .pay-title, .paid .pay-amount { color: #4b6052; }
.overdue { background: #e8ece9; color: #161a18; font-weight: 700; }
.master-day, .tile-icon, .confirm-symbol, .status-pill, #notice {
  background: #eaf8ef; color: #075d2c;
}
.status-pill { font-weight: 700; }
.status-pill.off { background: #eef0ef; color: #515b55; }
.error, #notice.error { background: #f0f2f1; color: #161a18; border: 1px solid #819389; }
.danger { color: #161a18; text-decoration: underline; }
.progress, .progress progress::-webkit-progress-bar { background: #e5ebe7; }
.progress progress::-webkit-progress-value { background: #06C755; }
.progress progress::-moz-progress-bar { background: #06C755; }
input, select, textarea, .month-control { border-color: #aab7ae; background-color: #FFFFFF; color: #161a18; }
input::placeholder, textarea::placeholder { color: #637068; opacity: 1; }
input:focus, select:focus, textarea:focus, .month-control:focus-within { border-color: #06C755; outline-color: #06C755; }
input[type=checkbox] { accent-color: #06C755; }
.file-label { border-color: #aab7ae; }
dialog { border: 1px solid #dce2de; background: #FFFFFF; box-shadow: 0 16px 64px #00000026; }
dialog::backdrop { background: #00000066; backdrop-filter: blur(2px); }
@media(max-width:760px) {
  nav { border-color: #dce2de; box-shadow: 0 -2px 10px #00000008; }
}

/* Weekend and holiday dates remain distinct from the green app accents. */
.sat .date { color: #1755b5; }
.sun .date, .holiday .date { color: #c62828; }

/* Compact phone layout, retaining readable inputs and 44px tap targets. */
@media (max-width: 760px) {
  .topbar { height: 62px; padding: 0 12px; }
  .brand { gap: 9px; font-size: 1rem; }
  .brandmark { width: 34px; height: 34px; border-radius: 10px; font-size: 1.3rem; }
  .brand small { margin-top: 2px; }
  .layout { padding: 16px 12px 76px; }
  .page-head { margin-bottom: 14px; }
  .page-head .eyebrow { margin-bottom: 5px; }
  .page-head p.muted { margin-top: 5px; }
  .monthbar { padding: 8px 10px; margin-bottom: 12px; }
  .save-state { line-height: 1.4; }
  .summary { gap: 8px; margin-bottom: 14px; }
  .stat { padding: 12px; }
  .stat .label, .stat label { margin-bottom: 6px; }
  .stat strong { line-height: 1.3; }
  .stat .mini { min-height: 44px; margin-top: -12px; margin-bottom: -8px; padding: 0 4px; }
  .card { border-radius: 11px; }
  .section-head { padding: 12px; }
  .section-head p { margin-top: 4px; }
  .day { padding: 8px; grid-template-columns: 58px minmax(0, 1fr); }
  .today { padding-left: 5px; }
  .day.empty { padding: 3px 8px; min-height: 36px; }
  .day.empty.today { padding-left: 5px; }
  .date { padding-top: 5px; }
  .date .holiday-name { margin: 3px 0; }
  .payment { min-height: 48px; margin: 1px 0; }
  .payment .toggle { flex-basis: 44px; width: 44px; height: 44px; }
  .payment-edit { min-height: 44px; padding: 5px 0; }
  .pay-title small { margin-top: 2px; }
  .day-total { margin-top: 2px; }
  .progress { margin-top: 6px; }
  .empty-state { padding: 22px 12px; }
  .searchbar { padding: 12px; }
  .master-row { padding: 12px; gap: 10px; }
  .master-day { padding: 7px 0; }
  .settings-grid { gap: 12px; }
  .settings-grid article { padding: 18px; }
  .settings-grid p { margin: 8px 0 14px; }
  .tile-icon { margin-bottom: 12px; }
  nav { padding-top: 5px; }
  nav button { min-height: 48px; }
  footer { padding: 20px 0; }
  #notice { padding: 9px 12px; margin-bottom: 12px; }
  dialog { padding: 18px; }
  .dialog-head { margin-bottom: 10px; }
  dialog label { margin-top: 12px; margin-bottom: 6px; }
  dialog label input, dialog label select, dialog label textarea,
  .month-control { margin-top: 6px; }
  dialog textarea { min-height: 72px; }
  .dialog-actions { margin-top: 16px; gap: 8px; }
  .form-note { margin-top: 8px; }
}

.stat.forecast strong { text-decoration: none; }

/* Keep negative balances white inside the solid green balance card. */
.stat.featured strong.negative { color: #FFFFFF !important; }

/* Shared dialog system: fixed heading/actions, only the form body scrolls. */
dialog {
  width: min(560px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  border: 1px solid #e0e6e2;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 72px #00000026;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #17251c66; backdrop-filter: blur(3px); }
.dialog-head {
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 20px 24px;
  border-bottom: 1px solid #e7ece9;
  background: #FFFFFF;
}
.dialog-heading { min-width: 0; }
.dialog-kicker { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 600; color: #5d6962; letter-spacing: .04em; }
dialog h2 { font-size: 19px; line-height: 1.5; font-weight: 700; letter-spacing: .015em; overflow-wrap: anywhere; }
.dialog-head .dialog-close {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #e5ebe7;
  border-radius: 50%;
  background: #f5f7f6;
  color: #4b5750;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
}
.dialog-head .dialog-close:hover { background: #eaf8ef; border-color: #c8e9d4; color: #075d2c; }
#edit-form { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px; scrollbar-width: thin; scrollbar-color: #c4cec7 transparent; }
#edit-fields, #new-payment-fields { display: grid; gap: 18px; min-width: 0; }
#edit-fields label { display: block; margin: 0; font-size: 14px; font-weight: 600; line-height: 1.5; }
#edit-fields .form-grid { gap: 12px; align-items: start; }
#edit-fields input:not([type=checkbox]), #edit-fields select, #edit-fields textarea {
  width: 100%; min-width: 0; box-sizing: border-box;
  margin-top: 7px; min-height: 46px;
  padding: 11px 12px; border: 1px solid #c5d0c9;
  border-radius: 10px; background: #fafcfb; color: #161a18;
  font-size: 16px; font-weight: 400; line-height: 1.4;
}
#edit-fields select { padding-right: 30px; }
#edit-fields textarea { min-height: 88px; max-height: 200px; resize: vertical; }
#edit-fields input:focus, #edit-fields select:focus, #edit-fields textarea:focus {
  border-color: #06C755; outline: 2px solid #06c75533; outline-offset: 1px; background-color: #FFFFFF;
}
#edit-fields .month-control { margin-top: 7px; height: 46px; border: 1px solid #c5d0c9; border-radius: 10px; background: #fafcfb; padding: 0 10px; }
#edit-fields .month-value { font-weight: 400; font-variant-numeric: tabular-nums; }
#edit-fields .month-control input[type=month] { position: absolute; inset: 0; margin: 0; padding: 0; border: 0; height: 100%; min-height: 0; opacity: 0; }
#edit-fields .month-control:focus-within { border-color: #06C755; outline: 2px solid #06c75533; outline-offset: 1px; background: #FFFFFF; }
#edit-fields .enabled-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid #e2eae5; border-radius: 12px; background: #f5f9f6; cursor: pointer; min-height: 68px; }
.enabled-title { display: block; color: #243a2d; }
.enabled-row small { display: block; margin-top: 3px; font-size: 12px; font-weight: 400; color: #56655c; }
#edit-fields .enabled-row input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 24px; height: 24px; min-height: 24px; flex: 0 0 24px;
  padding: 0; margin: 0; border: 1.5px solid #9caea2; border-radius: 7px; background: #FFFFFF; cursor: pointer;
}
#edit-fields .enabled-row input:checked {
  border-color: #06C755; background-color: #06C755;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12 4 4 8-9' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
dialog .form-note { margin: 0; padding: 12px 14px; border-radius: 10px; background: #f5f7f6; color: #56635b; font-size: 12px; font-weight: 400; line-height: 1.8; }
dialog .error { margin: 16px 0 0; font-size: 14px; border-radius: 10px; }
.dialog-actions {
  flex-shrink: 0; display: flex; align-items: center; justify-content: flex-end;
  flex-wrap: wrap; gap: 10px; margin: 0; padding: 16px 24px;
  border-top: 1px solid #e7ece9; background: #FFFFFF;
}
.dialog-actions button { min-height: 46px; min-width: 112px; padding: 11px 18px; border-radius: 10px; font-size: 14px; line-height: 1.5; }
.dialog-actions .primary { color: #FFFFFF; border-color: #06C755; background: #06C755; }
.dialog-actions .primary:hover { background: #05b34c; border-color: #05b34c; }
#delete-payment { margin-right: auto; min-width: 0; padding-left: 12px; padding-right: 12px; color: #5e6962; text-decoration: none; background: #f5f7f6; }
#confirm { width: min(440px, calc(100% - 32px)); }
#confirm .dialog-body { padding: 28px 24px; }
#confirm .confirm-symbol { width: 48px; height: 48px; margin: 0 0 18px; border-radius: 15px; background: #eaf8ef; color: #075d2c; font-size: 24px; }
#confirm-title { font-size: 19px; }
#confirm-body { margin: 12px 0 0; font-size: 14px; line-height: 1.9; color: #526058; }
#import-preview { display: grid; gap: 16px; min-width: 0; font-size: 14px; }
#import-preview > p { margin: 0; }
.preview-list { max-height: none; overflow: visible; border: 1px solid #e2e9e5; border-radius: 12px; }
.preview-row { padding: 12px 14px; font-size: 14px; align-items: center; }
.preview-row:last-child { border-bottom: 0; }
.preview-row:nth-child(even) { background: #f7f9f8; }
@media(max-width:760px) {
  dialog, #confirm { width: calc(100% - 24px); max-width: calc(100% - 24px); max-height: calc(100dvh - 24px); border-radius: 18px; }
  .dialog-head { padding: 14px 16px; gap: 8px; }
  dialog h2, #confirm-title { font-size: 18px; }
  .dialog-kicker { font-size: 11px; margin-bottom: 3px; }
  .dialog-body { padding: 18px 16px; }
  #edit-fields, #new-payment-fields { gap: 15px; }
  #edit-fields .form-grid { gap: 10px; }
  #edit-fields .month-control { padding: 0 8px; }
  #edit-fields textarea { min-height: 76px; }
  .dialog-actions { padding: 12px 16px max(12px, env(safe-area-inset-bottom)); gap: 8px; }
  .dialog-actions button { flex: 1 1 0; min-width: 0; padding: 11px 10px; }
  #delete-payment:not([hidden]) { flex: 0 0 100%; margin: 0; min-height: 44px; background: transparent; }
  #confirm .dialog-body { padding: 24px 20px; }
  #confirm .confirm-symbol { margin-bottom: 16px; }
}
.dialog-actions { align-items: stretch; }
body:has(dialog[open]) { overflow: hidden; }
