/* Income town portal · Blazor additions on top of app.css:
   forms, modal, toast, menu, loading/empty states, map, mobile shell. */
button { font-family: var(--font); }
button:disabled, .btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; pointer-events: none; }
a.btn, a.btn:hover { text-decoration: none; }
.btn-full { width: 100%; justify-content: center; }
.btn-link { border: 0; background: none; padding: 0; color: var(--brand); font: 500 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.seg button, .seg a { all: unset; height: 30px; padding: 0 13px; display: grid; place-items: center; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--g600); cursor: pointer; white-space: nowrap; }
.seg.sm button, .seg.sm a { height: 26px; padding: 0 10px; font-size: 12.5px; }
.seg button.on, .seg a.on { background: #fff; color: var(--g900); box-shadow: 0 1px 3px rgba(7,20,55,.1); }
.seg button:focus-visible { outline: 2px solid var(--brand-300); }
.seg button i, .seg a i { font-size: 15px; }
button.tab { background: none; border: 0; font-family: var(--font); padding: 0; }
.pg .pages button { all: unset; min-width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: var(--g700); font-weight: 500; cursor: pointer; }
.pg .pages button.on { background: var(--g150); color: var(--g900); border: 1px solid var(--g200); }
.pg .pages button:disabled { color: var(--g400); cursor: default; }
.pg .pages button:hover:not(:disabled):not(.on) { background: var(--g100); }
.tbl tbody tr.click { cursor: pointer; }
.tbl a:hover .n, a.who:hover .n, a.n:hover { color: var(--brand); }
.card-scroll { overflow-x: auto; }
button.more { border: 0; background: none; }
button.fbtn { cursor: pointer; font-family: var(--font); }

/* form fields */
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > label, .fld-l { font-size: 13px; font-weight: 500; color: var(--g800); }
.fld-h { font-size: 12px; color: var(--g600); }
.fgrid { display: grid; gap: 16px; }
.fgrid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.in, .fld input:not([type=checkbox]):not([type=radio]), .fld select, .fld textarea {
  height: 40px; width: 100%; border: 1px solid var(--g300); border-radius: 9px; background: #fff; padding: 0 12px;
  font: 400 14px var(--font); color: var(--g900); outline: none; box-shadow: 0 1px 2px rgba(7,20,55,.03); min-width: 0; }
.fld textarea, textarea.in { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.in:focus, .fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(59,63,216,.12); }
.in.sm { height: 34px; font-size: 13px; width: auto; }
.in::placeholder, .fld input::placeholder, .fld textarea::placeholder { color: var(--g500); }
.ltr-in, .fld input[type=email], .fld input[type=tel], .fld input.num { direction: ltr; text-align: right; }
.inp input { border: 0; outline: 0; background: transparent; height: 100%; flex: 1; min-width: 0; font: 400 13.5px var(--font); color: var(--g900); }
.inp input::placeholder { color: var(--g500); }
.inp:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 3px rgba(59,63,216,.12); }
.inp select { border: 0; outline: 0; background: transparent; height: 100%; font: 500 13px var(--font); color: var(--g800); cursor: pointer; max-width: 220px; }
.inp input[type=date] { font-size: 13px; color: var(--g800); flex: 0 1 auto; }
.in-group { display: flex; align-items: stretch; }
.in-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--g300); background: var(--g100); color: var(--g600); font-weight: 500; border-radius: 0 9px 9px 0; border-inline-end: 0; }
.fld .in-group input { border-radius: 9px 0 0 9px; }
.validation-message { color: var(--red-600); font-size: 12.5px; }
.fld input.invalid, .fld select.invalid, .fld textarea.invalid { border-color: var(--red); }
.chk { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--g800); cursor: pointer; user-select: none; }
.chk input { width: 17px; height: 17px; accent-color: var(--brand); }
button.sw { border: 0; padding: 0; cursor: pointer; }
button.sw:disabled { opacity: .5; cursor: default; }
.sw-row { display: flex; align-items: center; gap: 12px; }

/* alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; border: 1px solid; }
.alert i { font-size: 17px; margin-top: 1px; }
.alert-red { background: var(--red-50); border-color: #FFD3DE; color: var(--red-600); }
.alert-amber { background: var(--amber-50); border-color: #FBE8A6; color: #8A5F00; }
.alert-brand { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.alert-green { background: var(--green-50); border-color: #CDF5DB; color: var(--green-600); }

/* modal */
.mdl-bg { position: fixed; inset: 0; background: rgba(7,10,30,.48); backdrop-filter: blur(2px); z-index: 900; display: grid; place-items: center; padding: 20px; animation: fadeIn .15s ease-out; }
.mdl { width: 100%; max-width: 520px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: #fff; border-radius: 16px; box-shadow: 0 30px 70px -20px rgba(4,6,40,.5); animation: popIn .18s cubic-bezier(.2,.8,.3,1); }
.mdl.lg { max-width: 720px; }
.mdl.sm { max-width: 420px; }
.mdl-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--g200); }
.mdl-h .card-t { font-size: 16.5px; }
.mdl-b { padding: 20px 22px; overflow-y: auto; }
.mdl-f { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--g200); background: var(--g100); border-radius: 0 0 16px 16px; }
.mdl-f .sp { margin-inline-start: auto; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* search drawer */
.drw { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(460px, 100vw); background: #fff; z-index: 901; box-shadow: 20px 0 50px -20px rgba(4,6,40,.4); display: flex; flex-direction: column; animation: fadeIn .18s ease-out; }
.drw-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--g200); }
.drw-h .inp { flex: 1; height: 42px; }
.drw-b { flex: 1; overflow-y: auto; padding: 8px 10px 20px; }
.drw-g { font-size: 12px; font-weight: 500; color: var(--g500); padding: 12px 10px 6px; }
.drw-i { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px; color: var(--g800); }
.drw-i:hover, .drw-i.on { background: var(--brand-50); }

/* toast */
.toasts { position: fixed; bottom: 22px; left: 22px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; width: 340px; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 11px; align-items: center; background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: 0 20px 40px -14px rgba(4,6,40,.35), 0 0 0 1px var(--g200); animation: popIn .2s ease-out; }
.toast .card-ic { width: 34px; height: 34px; flex-basis: 34px; border-radius: 50%; font-size: 16px; }
.toast .x { margin-inline-start: auto; color: var(--g500); background: none; border: 0; cursor: pointer; font-size: 14px; }

/* dropdown menu */
.mnu-wrap { position: relative; display: inline-flex; }
.mnu-cover { position: fixed; inset: 0; z-index: 800; }
.mnu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 200px; background: #fff; border-radius: 12px; padding: 6px; z-index: 801; box-shadow: 0 18px 40px -12px rgba(4,6,40,.3), 0 0 0 1px var(--g200); animation: popIn .12s ease-out; }
.mnu.up { top: auto; bottom: calc(100% + 6px); }
.mnu.start { inset-inline-end: auto; inset-inline-start: 0; }
.mnu-i { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border-radius: 8px; border: 0; background: none; font: 500 13.5px var(--font); color: var(--g800); cursor: pointer; text-align: start; white-space: nowrap; }
.mnu-i i { font-size: 16px; color: var(--g500); }
.mnu-i:hover { background: var(--g100); }
.mnu-i.red { color: var(--red-600); } .mnu-i.red i { color: var(--red); }
.mnu-sep { height: 1px; background: var(--g200); margin: 5px 4px; }

/* states */
.loading { display: grid; place-items: center; min-height: 300px; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--brand-100); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.spin.sm { width: 16px; height: 16px; border-width: 2px; }
.spin.light { border-color: rgba(255,255,255,.25); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 34px 20px; }
.empty img { height: 120px; margin: 0 auto 12px; }
.empty .t { font-weight: 600; font-size: 15px; color: var(--g900); }
.empty .d { font-size: 13px; color: var(--g600); margin-top: 4px; }
.boot-loader { position: fixed; inset: 0; display: grid; place-items: center; background: var(--ink); }
.boot-loader .spin { border-color: rgba(255,255,255,.12); border-top-color: #7C7FFF; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; inset-inline: 0; z-index: 2000; padding: 12px 20px; background: var(--red); color: #fff; font-size: 14px; }
#blazor-error-ui .reload { color: #fff; text-decoration: underline; margin-inline-start: 10px; }
#blazor-error-ui .dismiss { cursor: pointer; float: left; }
h1:focus { outline: none; }

/* map */
.map { width: 100%; background: var(--g150); z-index: 0; }
.leaflet-container { font-family: var(--font) !important; }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; line-height: 1.45; }
.map-pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; box-shadow: 0 6px 14px -4px rgba(7,20,55,.5); border: 2px solid #fff; }
.map-pin i { transform: rotate(45deg); color: #fff; font-size: 14px; }
.map-dot { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(7,20,55,.35); display: grid; place-items: center; color: #fff; font: 600 11px var(--font); }

/* shell: mobile bar + off-canvas sidebar */
.mbar, .sb-cover, .sb-close { display: none; }
.sb a.ws { color: inherit; }
.sb-user .sb-ic, .sb-close { border: 0; background: none; cursor: pointer; }
.sb-user .av { --tc: #7C7FFF; background: rgba(124,127,255,.16); color: #C9CBFF; border: 2px solid var(--ink-4); }
.sb-user .grow { min-width: 0; }
.sb-user .r { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-status .gate { min-width: 0; }
.sb-status .gate span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1280px) {
  .frame-in { padding: 20px 22px 36px; }
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1100px) {
  .g-12 > [class*="s-"] { grid-column: span 12; }
  .g-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1023px) {
  html, body { overflow-x: hidden; }
  body { overflow-y: auto; background: #fff; }
  .frame-in { overflow-x: clip; }
  .app { display: block; height: auto; }
  .sb { position: fixed; top: 0; bottom: 0; right: 0; z-index: 950; transform: translateX(100%); transition: transform .22s ease; }
  .sb.open { transform: none; box-shadow: -20px 0 50px rgba(0,0,0,.35); }
  .sb-cover.open { display: block; position: fixed; inset: 0; background: rgba(7,10,30,.5); z-index: 940; }
  .sb-close { display: grid; place-items: center; width: 34px; height: 34px; color: #C9CBE0; font-size: 18px; }
  .frame { margin: 0; border-radius: 0; overflow: visible; min-height: 100vh; }
  .mbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 12px; background: var(--ink); color: #fff; }
  .mbar .logo-mark { width: 32px; height: 32px; flex-basis: 32px; border-radius: 9px; }
  .mbar .t { font-weight: 600; font-size: 15px; }
  .mbar button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--ink-4); background: var(--ink-2); color: #fff; display: grid; place-items: center; font-size: 18px; cursor: pointer; }
  .mbar .sp { margin-inline-start: auto; }
  .frame-in { padding: 16px 16px 32px; }
  .ph { flex-wrap: wrap; align-items: flex-start; }
  .ph-act { margin-inline-start: 0; width: 100%; flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .g-4, .g-3, .g-2, .fgrid.two { grid-template-columns: minmax(0,1fr); }
  .ph h1 { font-size: 21px; }
  .card-h { padding: 10px 16px; flex-wrap: wrap; }
  .card-b { padding: 16px; }
  .tb { padding: 12px 16px; }
  .tbl th:first-child, .tbl td:first-child { padding-inline-start: 16px; }
  .mdl-bg { padding: 0; align-items: end; }
  .mdl { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; }
  .mdl-f { border-radius: 0; }
  .toasts { left: 16px; bottom: 16px; }
}

/* print: only the frame's content */
@media print {
  body { background: #fff; overflow: visible; }
  .app { display: block; height: auto; }
  .sb, .sb-cover, .mbar, .toasts, .ph-act, .no-print { display: none !important; }
  .frame { margin: 0; border-radius: 0; overflow: visible; box-shadow: none; }
  .frame-in { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- date range picker (Components/DateRangePicker) ---------- */
.drp { position: relative; display: inline-flex; }
.drp-btn { gap: 8px; font-weight: 500; }
.drp-btn .num { font-variant-numeric: tabular-nums; }
.drp-btn .drp-p { color: var(--g900); font-weight: 600; }
.drp-btn .drp-sep { color: var(--g400); }
.drp-btn .chev { font-size: 11px; color: var(--g500); }
.drp-cover { position: fixed; inset: 0; z-index: 800; }
.drp-pop { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 801; display: flex; background: #fff; border-radius: 14px;
  box-shadow: 0 22px 48px -14px rgba(4,6,40,.32), 0 0 0 1px var(--g200); animation: popIn .12s ease-out; overflow: hidden; }
.drp-pop.start { inset-inline-end: auto; inset-inline-start: 0; }
.drp-presets { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-inline-end: 1px solid var(--g200); background: var(--g100); min-width: 150px; }
.drp-presets button { all: unset; box-sizing: border-box; height: 34px; padding: 0 12px; border-radius: 8px; font: 500 13px var(--font); color: var(--g700); cursor: pointer; white-space: nowrap; display: flex; align-items: center; }
.drp-presets button:hover { background: var(--g200); color: var(--g900); }
.drp-presets button.on { background: var(--brand); color: #fff; }
.drp-presets button:focus-visible { outline: 2px solid var(--brand-300); }
.drp-main { display: flex; flex-direction: column; }
.drp-cals { display: flex; gap: 22px; padding: 14px 16px 6px; }
.drp-cal { width: 252px; }
.drp-mh { display: flex; align-items: center; justify-content: space-between; height: 34px; margin-bottom: 6px; }
.drp-mh b { font-size: 14px; font-weight: 600; color: var(--g900); }
.drp-nav { all: unset; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--g700); }
.drp-nav:hover:not(:disabled) { background: var(--g150); }
.drp-nav:disabled { opacity: .3; cursor: default; }
.drp-nav i { font-size: 13px; }
.drp-nav-sp { width: 30px; }
.drp-nav.m-only { visibility: hidden; }
.drp-grid { display: grid; grid-template-columns: repeat(7, 36px); row-gap: 2px; }
.drp-dn { height: 28px; display: grid; place-items: center; font-size: 11.5px; font-weight: 500; color: var(--g500); }
.drp-d { all: unset; box-sizing: border-box; height: 34px; display: grid; place-items: center; font: 500 13px var(--font); color: var(--g800); cursor: pointer; position: relative; font-variant-numeric: tabular-nums; }
.drp-d:hover:not(:disabled) { background: var(--g150); border-radius: 8px; }
.drp-d:disabled { color: var(--g400); cursor: default; }
.drp-d.today { font-weight: 700; color: var(--brand); }
.drp-d.in, .drp-d.pv { background: var(--brand-50); border-radius: 0; }
.drp-d.s, .drp-d.e { background: var(--brand); color: #fff; border-radius: 8px; }
.drp-d.s:hover, .drp-d.e:hover { background: var(--brand-600); }
.drp-d:focus-visible { outline: 2px solid var(--brand-300); border-radius: 8px; }
.drp-f { display: flex; align-items: center; gap: 8px; padding: 10px 16px 12px; border-top: 1px solid var(--g200); }
.drp-sum { flex: 1; font-size: 13px; }
.drp-err { color: var(--red-600); font-size: 12px; margin-top: 2px; }
@media (max-width: 760px) {
  .drp-pop { position: fixed; inset: auto 8px 8px 8px; top: auto; flex-direction: column; max-height: calc(100dvh - 16px); overflow-y: auto; }
  .drp-pop.start { inset-inline-start: 8px; }
  .drp-presets { flex-direction: row; flex-wrap: wrap; border-inline-end: 0; border-bottom: 1px solid var(--g200); min-width: 0; }
  .drp-presets button { height: 30px; padding: 0 10px; background: #fff; box-shadow: 0 0 0 1px var(--g200); }
  .drp-cals { justify-content: center; }
  .drp-cal.earlier { display: none; }
  .drp-nav.m-only { visibility: visible; }
  .drp-cal { width: auto; }
  .drp-grid { grid-template-columns: repeat(7, minmax(38px, 1fr)); }
  .drp-btn .drp-p, .drp-btn .drp-sep { display: none; }
}
