:root {
  color-scheme: light;
  --primary: #4355b9; --on-primary: #fff; --primary-container: #dee0ff; --on-primary-container: #00105c;
  --secondary-container: #e1e0f9;
  --surface: #fbf8fd; --surface-1: #f1effa; --surface-2: #ebe9f5; --on-surface: #1b1b1f; --muted: #46464f;
  --outline: #777680; --outline-variant: #c7c5d0;
  --ok: #1b6d2f; --ok-bg: #b5f2bd; --bad: #ba1a1a; --bad-bg: #ffdad6; --warn-bg: #ffe08a;
  --e1: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15);
  --e2: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px 2px rgba(0,0,0,.15);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --primary: #bbc3ff; --on-primary: #08218a; --primary-container: #2a3ca0; --on-primary-container: #dee0ff;
    --secondary-container: #444559;
    --surface: #131316; --surface-1: #1b1b21; --surface-2: #22222a; --on-surface: #e4e1e6; --muted: #c7c5d0;
    --outline: #91909a; --outline-variant: #46464f;
    --ok: #9ad6a1; --ok-bg: #0c3a1a; --bad: #ffb4ab; --bad-bg: #5c1410; --warn-bg: #4d3a00;
  }
}
:root[data-mode="light"] { color-scheme: light; }
:root[data-mode="dark"] { color-scheme: dark; }
* { box-sizing: border-box; }
* { scrollbar-color: var(--primary) var(--surface-2); scrollbar-width: thin; }
*::-webkit-scrollbar { width: 12px; height: 12px; }
*::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 999px; }
*::-webkit-scrollbar-thumb { background: var(--primary); border: 3px solid var(--surface-2); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--primary-2, var(--primary)); }
body { margin: 0; font: 400 15px/1.5 Roboto, system-ui, sans-serif; background: var(--surface); color: var(--on-surface); }
.ms { font-family: 'Material Symbols Outlined'; font-size: 22px; line-height: 1; font-weight: normal; font-style: normal; display: inline-block; vertical-align: middle; -webkit-font-smoothing: antialiased; }

.appbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 10px 20px; overflow: hidden; color: var(--on-primary);
  background: linear-gradient(115deg, var(--primary) 0%, var(--primary-2, var(--primary)) 100%); box-shadow: var(--e2); }
.appbar::before, .appbar::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .08; }
.appbar::before { width: 220px; height: 220px; right: -50px; top: -120px; }
.appbar::after { width: 140px; height: 140px; right: 180px; bottom: -90px; opacity: .06; }
.appbar > * { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mark { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; font: 700 18px/1 Roboto; letter-spacing: .5px;
  background: rgba(255,255,255,.2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3), 0 2px 6px rgba(0,0,0,.18); backdrop-filter: blur(4px); }
.titles { display: flex; flex-direction: column; min-width: 0; }
.appbar h1 { font-size: 21px; font-weight: 700; letter-spacing: .2px; line-height: 1.2; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titles small { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; opacity: .8; font-weight: 500; }
.spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-radius: 28px; background: rgba(255,255,255,.16); }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font: 700 14px Roboto; background: rgba(255,255,255,.28); }
.uname { display: flex; flex-direction: column; line-height: 1.2; }
.uname b { font-size: 14px; font-weight: 500; }
.uname small { font-size: 11px; opacity: .8; }
.appbar .btn.tonal { background: rgba(255,255,255,.2); color: inherit; }

.tabs { position: relative; display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--surface-1); border-bottom: 1px solid var(--outline-variant); }
.tab { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: 12px; background: none; color: var(--muted); font: 500 13px Roboto; cursor: pointer; white-space: nowrap; }
.tab .ms { font-size: 18px; }
.tab.on { color: var(--on-primary-container); }
.tab.on .ms { font-variation-settings: 'FILL' 1; }
/* squircle pill behind the active tab, slides between tabs (position set by tabIndicator() in common.js) */
.tabs::after { content: ''; position: absolute; top: var(--iy, 8px); left: var(--ix, 0); width: var(--iw, 0); height: var(--ih, 34px); border-radius: 12px; background: var(--secondary-container);
  transition: left .4s var(--ease), width .4s var(--ease); }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 96px; }
h2 { font-size: 24px; font-weight: 400; margin: 8px 0 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.btn { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 24px; border: 0; border-radius: 20px; font: 500 14px/20px Roboto; letter-spacing: .1px; cursor: pointer; background: var(--primary); color: var(--on-primary); outline: none; transition: box-shadow .2s var(--ease); }
.btn:not(.text, .icon, .tonal, .danger):hover { box-shadow: var(--e1); }
.btn.tonal { background: var(--secondary-container); color: var(--on-primary-container); }
.btn.text { background: none; color: var(--primary); padding: 0 12px; box-shadow: none; }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; border-radius: 50%; height: 36px; background: none; color: var(--muted); box-shadow: none; }
.fab { position: fixed; right: 24px; bottom: 24px; height: 56px; padding: 0 20px; border-radius: 16px; box-shadow: var(--e2); z-index: 5; background: var(--primary-container); color: var(--on-primary-container); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { position: relative; outline: none; height: 28px; padding: 0 12px; border: 1px solid var(--outline); border-radius: 8px; background: none; color: var(--on-surface); font: 500 12.5px Roboto; cursor: pointer; }
.chip.on { background: var(--secondary-container); border-color: transparent; color: var(--on-primary-container); }
.status { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 8px; font-size: 12px; font-weight: 500; }
.status.paid { background: var(--ok-bg); color: var(--ok); }
.status.due { background: var(--bad-bg); color: var(--bad); }
.status.in { background: var(--warn-bg); }
.status .ms { font-size: 14px; }

.field { position: relative; display: block; margin: 0 0 16px; }
/* M3 filled text field: tinted container, active indicator line, label floats up when focused or filled */
.field input, .field select, .field textarea { width: 100%; padding: 24px 16px 8px; border: 0; border-radius: 4px 4px 0 0; background: var(--surface-2); color: inherit; font: 16px/24px Roboto;
  box-shadow: inset 0 -1px 0 var(--outline); transition: box-shadow .2s var(--ease), background-color .2s var(--ease); }
.field input:hover, .field select:hover, .field textarea:hover { box-shadow: inset 0 -1px 0 var(--on-surface); background: color-mix(in srgb, var(--surface-2), var(--on-surface) 6%); }
.field input::placeholder { color: var(--muted); opacity: .7; }
input[type="date"], input[type="time"], input[type="datetime-local"] { color-scheme: inherit; accent-color: var(--primary); }
/* Use the browser's customizable select picker so its open menu can follow the app theme. */
@supports (appearance: base-select) {
  .field select,
  .field select::picker(select) {
    appearance: base-select;
  }

  .field select {
    background-color: var(--surface-2);
    color: var(--on-surface);
  }

  .field select::picker(select) {
    background-color: var(--surface-1);
    color: var(--on-surface);
    border: 1px solid var(--outline);
    border-radius: 8px;
    padding: 4px;
    box-shadow: var(--e2);
  }

  .field select option {
    background-color: var(--surface-1);
    color: var(--on-surface);
    padding: 8px 12px;
  }

  .field select option:checked {
    background-color: var(--primary-container);
    color: var(--on-primary-container);
  }

  .field select option:hover,
  .field select option:focus {
    background-color: var(--surface-2);
    color: var(--on-surface);
  }
}
.field textarea { min-height: 70px; resize: vertical; }
.field > span { position: absolute; left: 16px; top: 8px; z-index: 1; font-size: 12px; line-height: 16px; color: var(--muted); pointer-events: none; transform-origin: left top;
  transition: top .2s var(--ease), font-size .2s var(--ease), color .2s var(--ease); }
.field:has(> input[placeholder=" "]:placeholder-shown:not(:focus)) > span { top: 18px; font-size: 16px; line-height: 20px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; box-shadow: inset 0 -2px 0 var(--primary); }
.field:focus-within > span { color: var(--primary); }
.field:has(:user-invalid) > span { color: var(--bad); }
.field :user-invalid { box-shadow: inset 0 -2px 0 var(--bad); }
.field.search { max-width: 360px; margin: 0 0 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.card { background: var(--surface-1); border-radius: 14px; padding: 14px; box-shadow: var(--e1); }
/* rows of small number tiles (summaries) sit side by side, even on phones */
.cards:has(> .stat:first-child) { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
.card.click { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.card.click:hover { box-shadow: var(--e2); transform: translateY(-1px); }
.card h3 { margin: 0; font-size: 20px; font-weight: 500; }
.card .sub { color: var(--muted); font-size: 13px; margin: 2px 0 10px; min-height: 20px; }
.stat { background: var(--surface-1); border-radius: 14px; padding: 12px 14px; box-shadow: var(--e1); }
.stat b { display: block; font-size: 22px; font-weight: 500; }
.stat small { color: var(--muted); }

.list { background: var(--surface-1); border-radius: 12px; overflow: hidden; box-shadow: var(--e1); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 12px 14px; background: var(--surface-2); }
td { padding: 10px 14px; border-top: 1px solid var(--outline-variant); vertical-align: middle; }
.tw { overflow-x: auto; }
.thumb { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--surface-2); cursor: zoom-in; display: block; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px 40px; }
.empty h3 { margin: 4px 0 4px; font-size: 18px; font-weight: 500; color: var(--on-surface); }
.empty p { margin: 0 auto; max-width: 420px; }
.cards > .empty, .chips > .empty { grid-column: 1 / -1; flex: 1 1 100%; }

/* illustrations (illo() in common.js): Material Symbols in themed shapes, gently animated */
.illo { position: relative; width: 180px; height: 150px; margin: 0 auto 8px; color: var(--primary); }
.illo.sm { width: 132px; height: 110px; margin-bottom: 4px; }
.illo .blob { position: absolute; inset: 14% 18%; background: var(--primary-container); border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%;
  animation: blob 9s ease-in-out infinite, illo-pop .6s var(--ease) backwards; }
.illo .blob::after { content: ''; position: absolute; inset: -10px; border-radius: inherit; border: 2px dashed color-mix(in srgb, var(--primary) 35%, transparent); animation: spin 40s linear infinite; }
.illo .main { position: absolute; left: 50%; top: 50%; translate: -50% -50%; font-size: 64px; color: var(--on-primary-container);
  font-variation-settings: 'FILL' 1, 'wght' 400; animation: bob 4s ease-in-out infinite, illo-pop .6s cubic-bezier(.34, 1.56, .64, 1) .1s backwards; }
.illo.sm .main { font-size: 46px; }
.illo .bit { position: absolute; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; box-shadow: var(--e1);
  animation: float 5s ease-in-out infinite, illo-pop .5s cubic-bezier(.34, 1.56, .64, 1) backwards; }
.illo .bit .ms { font-size: 22px; font-variation-settings: 'FILL' 1; }
.illo.sm .bit { width: 30px; height: 30px; border-radius: 10px; } .illo.sm .bit .ms { font-size: 17px; }
.illo .b0 { left: 2%; top: 14%; background: var(--secondary-container); color: var(--on-primary-container); animation-delay: -1s, .25s; rotate: -8deg; }
.illo .b1 { right: 0; top: 30%; background: var(--surface-1); color: var(--primary); animation-delay: -2.5s, .35s; rotate: 6deg; border-radius: 50%; }
.illo .b2 { left: 12%; bottom: 2%; background: var(--primary); color: var(--on-primary); animation-delay: -4s, .45s; rotate: 4deg; }
.illo .spark { position: absolute; width: 8px; height: 8px; background: var(--primary); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: twinkle 2.4s ease-in-out infinite; }
.illo .s0 { right: 16%; top: 4%; width: 12px; height: 12px; }
.illo .s1 { right: 10%; bottom: 14%; animation-delay: .8s; }
.illo .s2 { left: 30%; top: 0; width: 6px; height: 6px; animation-delay: 1.6s; }
td .empty { padding: 20px 8px 28px; }
@keyframes blob { 50% { border-radius: 55% 45% 40% 60% / 58% 52% 48% 42%; rotate: 8deg; } }
@keyframes bob { 50% { translate: -50% calc(-50% - 6px); } }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes twinkle { 0%, 100% { opacity: .2; scale: .6; } 50% { opacity: 1; scale: 1; } }
@keyframes illo-pop { from { opacity: 0; scale: .4; } }

dialog { border: 0; border-radius: 28px; padding: 24px; width: min(520px, calc(100vw - 32px)); background: var(--surface-1); color: var(--on-surface); box-shadow: var(--e2); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h3 { margin: 0 0 16px; font-size: 24px; font-weight: 400; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
dialog img.big { width: 100%; border-radius: 12px; }
dialog:has(.amenity-form) { width: min(760px, calc(100vw - 32px)); }
.amenity-form { min-width: 0; }
.amenity-form .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; align-items: start; }
.amenity-form .row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.amenity-form .row > .field { min-width: 0; }
.amenity-form .actions { display: flex; }
.snack { position: fixed; inset: auto; left: 50%; bottom: 24px; margin: 0; border: 1px solid var(--outline-variant); transform: translate(-50%, 100px); background: var(--surface-2); color: var(--on-surface); padding: 14px 20px; border-radius: 12px; box-shadow: var(--e2); transition: transform .25s; z-index: 50; max-width: 90vw; }
.snack.show { transform: translate(-50%, 0); }
.login { max-width: 400px; margin: 40px auto; background: var(--surface-1); padding: 28px; border-radius: 28px; box-shadow: var(--e1); }
.bar { height: 8px; border-radius: 4px; background: var(--primary-container); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } .btn .lbl, .uname { display: none; } .userchip { padding: 4px; } .appbar { gap: 10px; padding: 10px 14px; min-height: 68px; } .appbar h1 { font-size: 18px; } .mark { width: 40px; height: 40px; font-size: 16px; } }
@media (max-width: 560px) { .amenity-form .row, .amenity-form .row.three { grid-template-columns: 1fr; } }

/* ---- motion ---- */
:root { --ease: cubic-bezier(.2, 0, 0, 1); --ease-out: cubic-bezier(0, 0, 0, 1); }
.card.click, .stat.click, .feat, .cal .d, .cal-pick button, .cal-title { position: relative; }
.chip, .tab { transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease); }
/* Material Web ripple = M3 hover/pressed state layers in the element's own content color */
md-ripple { --md-ripple-hover-color: currentColor; --md-ripple-pressed-color: currentColor; --md-ripple-hover-opacity: .08; --md-ripple-pressed-opacity: .12; }
md-focus-ring { --md-focus-ring-color: var(--primary); --md-focus-ring-shape: 12px; }
.btn md-focus-ring, .dbtn md-focus-ring, .cal .d md-focus-ring, .swatch md-focus-ring { --md-focus-ring-shape: 999px; }
.chip md-focus-ring { --md-focus-ring-shape: 8px; }
.tab md-focus-ring { --md-focus-ring-shape: 12px; }
.appbar { animation: drop .4s var(--ease); }
@keyframes drop { from { transform: translateY(-100%); } }
main > * { animation: rise .4s var(--ease) backwards; }
main .cards > *, main .list tr, main .chips > * { animation: rise .45s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.fab { animation: pop .45s cubic-bezier(.34, 1.56, .64, 1) .25s backwards; }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
.fab:hover { box-shadow: 0 4px 12px rgba(0,0,0,.3); }
dialog[open] { animation: dlg .28s var(--ease); }
dialog[open]::backdrop { animation: fade .28s linear; }
@keyframes dlg { from { opacity: 0; transform: scale(.88) translateY(24px); } }
@keyframes fade { from { opacity: 0; } }
.bar > i { transform-origin: left; animation: grow .8s var(--ease) .2s backwards; }
@keyframes grow { from { transform: scaleX(0); } }
.status { transition: background-color .3s, color .3s; }
tr { transition: background-color .15s; }
.list tr:hover td { background: var(--surface-2); }
.login { animation: dlg .4s var(--ease); }
.stat b { animation: rise .6s var(--ease) .15s backwards; }

/* settings */
.swatches { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; display: grid; place-items: center; color: #fff; position: relative; transition: transform .2s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s; }
.swatch:hover { transform: scale(1.12); box-shadow: var(--e1); }
.swatch .ms { transform: scale(0); transition: transform .25s cubic-bezier(.34, 1.56, .64, 1); }
.swatch.on { outline: 3px solid var(--on-surface); outline-offset: 2px; }
.swatch.on .ms { transform: scale(1); }
.swatch.custom { background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red); overflow: hidden; }
.swatch.custom .ms { transform: none; text-shadow: 0 0 4px #000; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.noanim > * { animation: none !important; }

.bar.busy { margin-top: 16px; position: relative; }
.bar.busy > i { width: 40%; position: absolute; animation: indet 1.2s var(--ease) infinite; }
@keyframes indet { from { left: -40%; } to { left: 100%; } }
.btn:disabled { opacity: .5; pointer-events: none; }

/* tabs: never shrink, scroll sideways on narrow screens */
.tabs { scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; scroll-snap-align: center; }
@media (max-width: 600px) { .tab { padding: 0 10px; } }
/* bigger tabs on larger screens (phones keep the compact size) */
@media (min-width: 601px) {
  .tabs { padding: 10px 14px; gap: 5px; }
  .tab { height: 41px; padding: 0 15px; gap: 7px; border-radius: 14px; font-size: 15.5px; }
  .tab .ms { font-size: 22px; }
  .tabs::after { border-radius: 14px; }
}

.gfilters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 0 12px; align-items: start; margin-bottom: 16px; }
.gfilters > .row { grid-column: 1 / -1; }
.gfilters .field { margin-bottom: 12px; }
@media (max-width: 700px) { .gfilters { grid-template-columns: 1fr 1fr; } .gfilters .field:first-child { grid-column: 1 / -1; } }
td a[href^="tel"] { color: var(--primary); text-decoration: none; white-space: nowrap; }

/* date picker */
.datef .dtext { padding-right: 52px; }
.dbtn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; transition: background-color .2s; }
.dbtn:hover { color: var(--primary); }
.cal { inset: auto; margin: 0; width: 312px; max-width: calc(100vw - 16px); padding: 12px 12px 8px; border: 1px solid var(--outline-variant); border-radius: 28px; background: var(--surface-1); color: var(--on-surface); box-shadow: var(--e2); }
.cal:popover-open { animation: dlg .2s var(--ease); }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px; }
.cal-title { display: flex; align-items: center; gap: 2px; border: 0; background: none; color: inherit; font: 500 15px Roboto; padding: 8px 8px; border-radius: 16px; cursor: pointer; }
.cal-nav { display: flex; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); justify-items: center; row-gap: 2px; }
.cal-grid .wd { font-style: normal; font-size: 12px; color: var(--muted); width: 40px; height: 32px; display: grid; place-items: center; }
.cal .d { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: inherit; font: 14px Roboto; cursor: pointer; transition: background-color .15s, color .15s; }
.cal .d.out { color: var(--outline); }
.cal .d.today { box-shadow: inset 0 0 0 1px var(--primary); }
.cal .d.sel { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.cal-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 4px; padding: 8px 0; }
.cal-pick button { height: 44px; border: 0; border-radius: 22px; background: none; color: inherit; font: 14px Roboto; cursor: pointer; }
.cal-pick button.sel { background: var(--primary); color: var(--on-primary); }
.cal-foot { display: flex; align-items: center; gap: 4px; padding-top: 4px; }
.field.bad input.dtext { box-shadow: inset 0 -2px 0 var(--bad); }
.field.bad > span { color: var(--bad); }

/* the [hidden] attribute must always win over component display rules */
[hidden] { display: none !important; }

/* busy state: spinner on the active button, everything else locked while a save is in flight */
@keyframes spin { to { transform: rotate(360deg); } }
.btn.loading { opacity: .85; }
.btn.loading::before { content: ''; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
body.working .btn:not(.loading) { pointer-events: none; opacity: .55; transition: opacity .2s .25s; }
body.working { cursor: progress; }

/* upload progress */
.upload { margin: -4px 0 16px; }
.upload small { color: var(--muted); }
.upload .bar { margin-top: 6px; position: relative; }
.upload .bar > i { width: 0; transition: width .2s linear; animation: none; }
.upload .bar > i.indet { position: absolute; width: 40% !important; animation: indet 1.2s var(--ease) infinite; }

/* platform console */
.feats { display: grid; gap: 8px; margin-bottom: 8px; }
.feat { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--outline-variant); border-radius: 12px; cursor: pointer; transition: background-color .2s, border-color .2s; }
.feat input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.feat span { display: block; }
.feat small { display: block; color: var(--muted); }
.gh { margin: 8px 0 8px; font: 500 15px Roboto; }
form.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
form.two > .row { grid-column: 1 / -1; margin: 0 !important; }
.card.danger-zone { border: 1px solid var(--bad-bg); }

/* resident portal */
.status.muted { background: var(--surface-2); color: var(--muted); }
.tab .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.stat.click { cursor: pointer; transition: transform .15s var(--ease); }
.stat.click:hover { transform: translateY(-2px); }
.hello { background: var(--primary-container); color: var(--on-primary-container); }
.hello .sub { color: inherit; opacity: .8; }
.notice.new { border-left: 4px solid var(--primary); }
.notice.urgent { border-left: 4px solid var(--bad); }
.ms.pin { font-size: 16px; vertical-align: -3px; margin-right: 4px; color: var(--primary); }
.thread { margin: 16px 0; display: flex; flex-direction: column; gap: 8px; max-height: 40vh; overflow-y: auto; }
.thread .msg { background: var(--surface-2); border-radius: 12px; padding: 8px 12px; max-width: 85%; align-self: flex-start; }
.thread .msg.office { background: var(--primary-container); color: var(--on-primary-container); align-self: flex-end; }
.thread .msg small { opacity: .75; }

/* ---------- promotions ---------- */
.seg { display: inline-flex; gap: 6px; }
.promo-carousel { margin-top: 16px; }
.promo-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 16px; box-shadow: var(--e1); }
.promo-track::-webkit-scrollbar { display: none; }
.promo-track .promo { flex: 0 0 100%; scroll-snap-align: start; }
.promo-banners { display: grid; gap: 12px; margin-top: 16px; }
.promo-banners .promo { border-radius: 16px; overflow: hidden; box-shadow: var(--e1); }
.promo { position: relative; display: block; aspect-ratio: 12 / 5; max-height: 280px; width: 100%; background: var(--surface-2, var(--surface-1)); color: #fff; text-decoration: none; }
.promo[href] { cursor: pointer; }
.promo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.promo-title { position: absolute; inset: auto 0 0 0; padding: 28px 16px 12px; font-weight: 600; font-size: 16px;
  background: linear-gradient(transparent, rgb(0 0 0 / .65)); }
.promo-dots { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
.promo-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 4px; background: var(--outline, #999); opacity: .5; cursor: pointer; transition: width .25s var(--ease), opacity .25s; }
.promo-dots button.on { width: 22px; opacity: 1; background: var(--primary); }
.promo-admin img { width: 100%; aspect-ratio: 12 / 5; object-fit: cover; border-radius: 10px; display: block; cursor: zoom-in; }
.promo-admin.off img { opacity: .45; filter: grayscale(.6); }
.promo-clicks { display: flex; align-items: center; gap: 6px; margin: 10px 0 4px; color: var(--primary); }
.promo-clicks b { font-size: 20px; }
/* M3-style switch on a plain checkbox */
input.switch { appearance: none; position: relative; width: 52px; height: 32px; margin: 0; flex: none; cursor: pointer; border-radius: 16px;
  border: 2px solid var(--outline); background: var(--surface-2); transition: background .2s var(--ease), border-color .2s; }
input.switch::before { content: ''; position: absolute; top: 50%; left: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--outline);
  transform: translateY(-50%); transition: left .25s var(--ease), width .25s var(--ease), height .25s var(--ease), background .2s; }
input.switch:checked { background: var(--primary); border-color: var(--primary); }
input.switch:checked::before { left: 22px; width: 24px; height: 24px; background: var(--on-primary); }
input.switch:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.promo-tag { position: absolute; top: 10px; left: 10px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; letter-spacing: .4px;
  color: #fff; background: rgb(0 0 0 / .55); backdrop-filter: blur(4px); pointer-events: none; }

/* ---------- public flat board: one compact row per flat ---------- */
.list.board td { padding: 9px 14px; }
.list.board tr.click { cursor: pointer; }
.list.board td:first-child b { font-size: 15px; }
.list.board td:first-child small { color: var(--muted); margin-left: 4px; }
.list.board .bd { color: var(--muted); font-size: 13px; }
.list.board .bd b { color: var(--on-surface); font-weight: 500; }
.list.board .chev { width: 1%; text-align: right; color: var(--muted); }
.list.board .chev .ms { font-size: 20px; }
@media (max-width: 600px) {
  .list.board th, .list.board td { padding: 9px 10px; }
  .list.board .bd { font-size: 12px; }
}
/* payments list in the public flat dialog: amount + period on the left, receipt button on the right */
.pay-row { padding: 12px 14px; border-bottom: 1px solid var(--outline-variant); gap: 12px; flex-wrap: nowrap; }
.pay-row:last-child { border-bottom: 0; }
.pay-row > div { min-width: 0; line-height: 1.45; }
.pay-row > div b { font-size: 16px; }
.pay-row small { color: var(--muted); }
.pay-row .btn { flex: none; }
@media (max-width: 600px) { .pay-row { padding: 12px; } .pay-row .btn { width: 40px; padding: 0; justify-content: center; } .pay-row .btn .lbl { display: none; } }

/* ---------- search button + collapsible search/filter panel (searchBtn/searchPanel in common.js) ---------- */
.sp { display: grid; grid-template-rows: 0fr; opacity: 0; margin: 0; transition: grid-template-rows .35s var(--ease), opacity .25s var(--ease), margin .35s var(--ease); }
.sp.open { grid-template-rows: 1fr; opacity: 1; margin: 0 0 16px; }
.sp-in { overflow: hidden; min-height: 0; }
.sp-card { padding: 14px 14px 2px; border-radius: 16px; background: var(--surface-1); box-shadow: var(--e1); margin: 2px; }
.sp-card .field { margin-bottom: 12px; }
.sp-card .field.search { max-width: none; }
.btn.icon.sp-btn { position: relative; background: var(--surface-2); color: var(--on-surface); transition: background-color .2s var(--ease), transform .3s var(--ease); }
.btn.icon.sp-btn[aria-expanded="true"] { background: var(--secondary-container); color: var(--on-primary-container); transform: rotate(90deg); }
.sp-btn.on::after { content: ''; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--surface); }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.title-row h2 { margin: 8px 0 16px; }
.title-row .tools { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
@media (prefers-reduced-motion: reduce) { .sp, .sp-btn { transition: none; } }

/* maintenance list: on phones each row becomes a small card */
@media (max-width: 600px) {
  .list:has(> table.mcards) { background: none; box-shadow: none; overflow: visible; }
  table.mcards, table.mcards tbody { display: block; }
  table.mcards tr:first-child:has(th) { display: none; }
  table.mcards tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; margin-bottom: 8px; padding: 12px 14px;
    border-radius: 14px; background: var(--surface-1); box-shadow: var(--e1); }
  table.mcards td { display: block; padding: 0; border: 0; background: none !important; }
  table.mcards td:nth-child(1) { font-size: 16px; }
  table.mcards td:nth-child(2) { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 13px; }
  table.mcards td:nth-child(2):empty { display: none; }
  table.mcards td:nth-child(3) { grid-column: 2; grid-row: 1; justify-self: end; }
  table.mcards td:nth-child(4) { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
  table.mcards td:nth-child(4)::before { content: attr(data-l) ': '; }
  table.mcards td:nth-child(5) { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 8px; }
  table.mcards td:nth-child(5) .btn { flex: 1; justify-content: center; }
  table.mcards td[colspan] { grid-column: 1 / -1; }
}

/* credit line: last thing on the page, centred under the content; on short pages it sits at the bottom of the screen */
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
main { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
.credit { padding: 4px 16px 14px; text-align: center; font-size: 10.5px; letter-spacing: .3px; color: var(--muted); opacity: .55; user-select: none; }
/* pages with a floating button (bottom-right): keep the credit to the left so the button never covers it on phones */
@media (max-width: 600px) { body:has(.fab) .credit { text-align: left; } }

/* a status tile whose value is text (not a number): keep it to one short line */
.stat b.stat-line { font-size: 14px; line-height: 1.3; margin-top: 6px; }
.stat .status + b.stat-line { margin-top: 6px; }
@media (max-width: 600px) { .cards.home-stats:has(> .stat:first-child) { grid-template-columns: 1fr 1fr; } }

/* resident home: navigation blocks under the ads */
.home-nav { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 16px; }
.home-block { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 10px 4px; border: 0; border-radius: 16px;
  background: var(--secondary-container); color: var(--on-primary-container); font: 500 13px Roboto; cursor: pointer; }
.home-block .ms { font-size: 26px; }
.home-block .badge { position: absolute; top: 8px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
@media (max-width: 700px) { .home-nav { grid-template-columns: repeat(3, 1fr); } }

/* helpful contacts: name and type on the left, call button on the right, note underneath */
a.btn { text-decoration: none; }
.contact-top { display: flex; align-items: center; gap: 10px; }
.contact-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.contact-text b { font-size: 15px; overflow-wrap: anywhere; }
.contact-cat { padding: 1px 8px; border-radius: 6px; background: var(--secondary-container); color: var(--on-primary-container); font-size: 11px; font-weight: 500; }
.contact-call { flex: none; gap: 6px; padding: 0 14px; }
.contact-call .ms { font-size: 18px; }
.contact-note { display: block; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--outline-variant); color: var(--muted); line-height: 1.4; }

/* ---------- phone menu (hamburger) ---------- */
.menu-btn { display: none; }
@media (max-width: 600px) {
  /* only once signed in: the chip and Sign out move into the menu (unless the super admin chose tabs only) */
  :root:not([data-mobile-nav="tabs"]) .appbar:has(#who:not([hidden])) #who, :root:not([data-mobile-nav="tabs"]) .appbar:has(#who:not([hidden])) #auth-btn { display: none; }
  :root:not([data-mobile-nav="tabs"], [data-mobile-nav="both"]) .tabs { display: none; } /* the menu lists every tab */
  :root:not([data-mobile-nav="tabs"]) .appbar:has(#who:not([hidden])) .menu-btn { display: inline-flex; width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 14px; }
}
dialog.menu-sheet { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(300px, 84vw); height: 100dvh; max-height: 100dvh; padding: 0; border-radius: 24px 0 0 24px; }
dialog.menu-sheet[open] { display: flex; flex-direction: column; animation: menu-in .28s var(--ease); }
@keyframes menu-in { from { transform: translateX(100%); } to { transform: none; } }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 16px 12px 14px 16px; border-bottom: 1px solid var(--outline-variant); }
.menu-head .avatar { flex: none; background: var(--secondary-container); color: var(--on-primary-container); }
.menu-user { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.menu-user b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-user small { color: var(--muted); }
.menu-items { flex: 1; overflow-y: auto; padding: 8px; }
.menu-item { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; height: 48px; padding: 0 14px; border: 0; border-radius: 14px; background: none; color: var(--on-surface); font: 500 15px Roboto; text-align: left; cursor: pointer; }
.menu-item.on { background: var(--secondary-container); color: var(--on-primary-container); }
.menu-item .badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.menu-out { flex: none; width: auto; margin: 8px; color: var(--bad); }
@media (prefers-reduced-motion: reduce) { dialog.menu-sheet[open] { animation: none; } }
.appbar .brand { cursor: pointer; }
