/* Advent door app. Brand tokens from advent-lighting/design-system.md (light only, like the website). */
:root {
  --violet: #38182F; --charcoal: #2F394D; --vanilla: #EEE1B3; --linen: #EFE5DC; --porcelain: #FBFEFB;
  --muted: #6B7180; --faint: #A3A7B0; --line: rgba(47, 57, 77, 0.12); --error: #8C1D2C; --ok: #2E9B57; --warn: #9A6A00;
  --display: "Outfit", "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --top-h: 56px; --tab-h: 64px; --r: 14px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--porcelain); color: var(--charcoal); font: 400 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--display); color: var(--violet); margin: 0; letter-spacing: -0.02em; }
.t-h1 { font-size: 30px; font-weight: 600; }
.t-h2 { font-size: 24px; font-weight: 600; }
.t-h3 { font-size: 20px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.num, .tot b, output { font-variant-numeric: tabular-nums lining-nums; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }

/* Buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 22px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--porcelain); color: var(--violet); font-weight: 600;
}
.btn-primary { background: var(--violet); border-color: var(--violet); color: var(--porcelain); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; }
.link-btn { background: none; border: 0; padding: 10px 0; color: var(--violet); text-decoration: underline; font-weight: 500; }
.link-btn.danger { color: var(--error); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--linen); color: var(--violet); font-size: 26px; line-height: 1; }
.icon-btn.light { background: rgba(251, 254, 251, 0.14); color: var(--porcelain); }
.fld { display: grid; gap: 6px; margin: 0 0 14px; font-weight: 500; }
.fld > span { font-size: 15px; }
.fld input, .fld select, .fld textarea, .input, .search {
  width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--porcelain);
  font-size: 17px; font-weight: 400;
}
.fld textarea, textarea.input { min-height: 0; resize: vertical; }
.fld-inline { grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.err { color: var(--error); min-height: 1.5em; margin: 4px 0 10px; font-size: 15px; }
.warn { color: var(--warn); font-weight: 600; margin: 8px 0 0; }
.lbl { margin: 14px 0 8px; font-weight: 600; }

/* Sign in */
.login { min-height: 100%; display: grid; place-items: center; padding: calc(24px + var(--sat)) 16px 24px; background: var(--violet); }
.login-card { width: min(440px, 100%); background: var(--porcelain); border-radius: 22px; padding: 28px 24px; }
.login-mark { display: block; width: 200px; margin: -8px auto 18px; padding: 14px 18px; background: var(--violet); border-radius: 14px; }
.login-card h1 { margin-bottom: 16px; }

/* Shell */
.app { position: fixed; inset: 0; display: grid; grid-template-rows: calc(var(--top-h) + var(--sat)) 1fr calc(var(--tab-h) + var(--sab)); }
.top { background: var(--violet); color: var(--porcelain); display: flex; align-items: center; justify-content: space-between; padding: var(--sat) 16px 0; }
.top-mark { height: 30px; width: auto; }
.sync-chip { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 6px 12px; background: rgba(251, 254, 251, 0.12); color: var(--porcelain); font-size: 14px; font-weight: 500; }
.sync-chip .dot { width: 9px; height: 9px; border-radius: 50%; background: #6BD49A; }
.sync-chip.wait .dot { background: var(--vanilla); }
.sync-chip.off .dot { background: #E07A7A; }
.views { position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; }
.view-pad { overflow-y: auto; padding: 18px 16px 32px; -webkit-overflow-scrolling: touch; }
.pad-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--porcelain); border-top: 1px solid var(--line); padding-bottom: var(--sab); }
.tabs button { border: 0; background: none; display: grid; justify-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.tabs svg { width: 26px; height: 26px; }
.tabs button.on { color: var(--violet); }

/* Map */
.map { position: absolute; inset: 0; background: #1c2245; }
.map-note { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); background: rgba(20, 16, 36, 0.8); color: var(--porcelain); padding: 6px 12px; border-radius: 999px; font-size: 13px; z-index: 500; white-space: nowrap; }
.map-tools { position: absolute; right: 14px; top: 50px; display: grid; gap: 10px; z-index: 500; }
@media (min-width: 900px) { .map-tools { right: auto; left: 14px; } }   /* clear of the side panel */
.fab { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--porcelain); color: var(--violet); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28); display: grid; place-items: center; }
.map-hint { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); background: rgba(20, 16, 36, 0.78); color: var(--porcelain); padding: 8px 14px; border-radius: 999px; font-size: 14px; z-index: 500; pointer-events: none; transition: opacity .3s; }
.today-bar { position: absolute; left: 12px; top: 12px; max-width: calc(100% - 90px); z-index: 500; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
@media (min-width: 900px) { .today-bar { left: 80px; } }
.today-bar .tb { display: inline-flex; align-items: center; gap: 5px; background: rgba(251, 254, 251, 0.94); border-radius: 999px; padding: 4px 10px 4px 5px; font-weight: 600; font-size: 14px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
.pin-ico { background: none; border: 0; }
.leaflet-container { font: inherit; }

/* Panels: a bottom sheet on phones, a side panel on wide screens */
.panel {
  position: fixed; z-index: 1000; left: 0; right: 0; bottom: 0; max-height: 82%; overflow-y: auto; background: var(--porcelain);
  border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25); padding: 8px 16px calc(18px + var(--sab));
  -webkit-overflow-scrolling: touch;
}
.panel-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.panel-actions .btn { flex: 1 1 160px; }
@media (min-width: 900px) {
  .panel { left: auto; top: calc(var(--top-h) + var(--sat) + 12px); right: 12px; bottom: auto; width: 420px; max-height: calc(100% - var(--top-h) - var(--sat) - var(--tab-h) - var(--sab) - 24px); border-radius: 20px; }
  .panel-grip { display: none; }
}
.outcomes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.oc { display: grid; justify-items: center; gap: 6px; padding: 12px 6px; min-height: 84px; border: 2px solid var(--line); border-radius: var(--r); background: var(--porcelain); font-weight: 600; font-size: 14px; text-align: center; line-height: 1.2; }
.oc.on { border-color: var(--violet); background: var(--linen); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--porcelain); font-weight: 500; }
.chip.on { background: var(--violet); border-color: var(--violet); color: var(--porcelain); }
#pp-obj-other { margin-top: 10px; }
.hist { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.hist h3 { font-size: 16px; margin-bottom: 8px; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; }
.hist-row .when { color: var(--muted); margin-left: auto; font-size: 14px; }
.type-list { display: grid; gap: 6px; margin-top: 14px; }
.type-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; font-weight: 500; }
.type-row input { width: 24px; height: 24px; accent-color: var(--violet); }

/* Segmented control */
.seg { display: inline-flex; background: var(--linen); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; border-radius: 999px; min-height: 40px; padding: 8px 14px; font-weight: 600; color: var(--charcoal); }
.seg button.on { background: var(--violet); color: var(--porcelain); }

/* Customers */
.search { margin-bottom: 14px; }
.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card { text-align: left; border: 1px solid var(--line); border-radius: var(--r); background: var(--porcelain); padding: 14px 16px; display: grid; gap: 4px; }
.card .nm { font-family: var(--display); font-weight: 600; font-size: 18px; color: var(--violet); }
.card .sub { color: var(--muted); font-size: 15px; }
.card .row { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: 4px; }
.tag { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--linen); }
.tag.ok { background: #DDF1E5; color: #1F6B3D; }
.tag.wait { background: #FBF1CF; color: #7A5600; }
.tag.bad { background: #F7DDE0; color: var(--error); }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

/* Stats */
#st-period { margin-bottom: 14px; }
#st-rep-wrap { max-width: 340px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 22px; }
.kpi { background: var(--linen); border-radius: var(--r); padding: 14px; }
.kpi .v { font-family: var(--display); font-size: 30px; font-weight: 600; color: var(--violet); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .k { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi.big { background: var(--violet); }
.kpi.big .v { color: var(--porcelain); }
.kpi.big .k { color: rgba(251, 254, 251, 0.82); }
.bars { display: grid; gap: 8px; margin: 8px 0 24px; max-width: 640px; }
.bar { display: grid; grid-template-columns: 170px 1fr 44px; align-items: center; gap: 10px; font-size: 15px; }
.bar .track { height: 12px; background: var(--linen); border-radius: 6px; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--violet); border-radius: 6px; }
.bar b { text-align: right; font-variant-numeric: tabular-nums; }
.st-h { font-size: 18px; margin-top: 6px; }
.st-note { font-size: 14px; color: var(--muted); max-width: 640px; }

/* Settings */
.set-sec { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; max-width: 760px; }
.set-sec h2 { font-size: 19px; margin-bottom: 10px; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 14px; }
.price-grid .fld input { min-height: 44px; }
.rep-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rep-row .nm { font-weight: 600; flex: 1; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* Quote */
.quote { position: fixed; inset: 0; z-index: 2000; background: var(--porcelain); display: grid; grid-template-rows: auto auto 1fr; }
.q-top { background: var(--violet); color: var(--porcelain); display: flex; align-items: center; gap: 12px; padding: calc(8px + var(--sat)) 12px 8px; }
.q-title { color: var(--porcelain); font-size: 19px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-saved { font-size: 13px; color: rgba(251, 254, 251, 0.8); }
.q-steps { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); background: var(--porcelain); }
.q-steps button { border: 0; background: none; padding: 12px 4px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; font-size: 15px; }
.q-steps button b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--linen); color: var(--violet); font-size: 13px; margin-right: 4px; }
.q-steps button.on { color: var(--violet); border-bottom-color: var(--violet); }
.q-steps button.on b { background: var(--violet); color: var(--porcelain); }
.q-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 16px calc(28px + var(--sab)); }
.q-grid { display: grid; gap: 8px 32px; max-width: 1100px; margin: 0 auto; }
@media (min-width: 760px) { .q-grid { grid-template-columns: 1fr 1fr; } }
.q-col h3 { margin-bottom: 12px; }
.grp { font-size: 16px; margin: 18px 0 8px; }
.toggles { display: flex; gap: 10px; flex-wrap: wrap; }
.tgl { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; min-height: 48px; font-weight: 500; }
.tgl input { width: 22px; height: 22px; accent-color: var(--violet); }
.meas { display: grid; gap: 8px; }
.m-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 6px 0; }
.m-row .nm { font-weight: 500; }
.m-row .unit { color: var(--muted); font-size: 14px; }
.stepper { display: inline-grid; grid-template-columns: 48px 76px 48px; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { height: 48px; border: 0; background: var(--linen); color: var(--violet); font-size: 24px; font-weight: 600; }
.stepper input { height: 48px; border: 0; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; width: 100%; background: var(--porcelain); }
.q-foot { margin-top: 22px; display: flex; justify-content: flex-end; }
.q-step[data-step="house"] .q-foot { max-width: 1100px; margin-left: auto; margin-right: auto; }

.menu { display: grid; gap: 16px; max-width: 1200px; margin: 0 auto; }
@media (min-width: 1100px) { .menu { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.menu-pic { margin: 0; }
.menu-pic img { display: block; width: 100%; aspect-ratio: 1600 / 896; object-fit: cover; border-radius: 16px; background: #1c2245; }
.disc { font-size: 12px; color: var(--muted); margin-top: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.sw { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--porcelain); box-shadow: 0 0 0 1px rgba(47, 57, 77, 0.25); }
.sw.on { box-shadow: 0 0 0 3px var(--violet); }
.sw-warm-white { background: radial-gradient(circle at 40% 35%, #fff4dc, #f6cf8a); }
.sw-cool-white { background: radial-gradient(circle at 40% 35%, #ffffff, #dfe9f7); }
.sw-classic-multicolor { background: conic-gradient(#d8262f 0 20%, #2b9a4a 0 40%, #2d5fd8 0 60%, #f0a020 0 80%, #fff6e2 0); }
.sw-blue { background: radial-gradient(circle at 40% 35%, #6f9bff, #1f45c8); }
.sw-candy-cane { background: repeating-linear-gradient(45deg, #d8262f 0 7px, #fff6e2 7px 14px); }
.sw-winter-blue { background: repeating-linear-gradient(45deg, #2d5fd8 0 7px, #f3f7ff 7px 14px); }
.sw-red-green { background: repeating-linear-gradient(45deg, #d8262f 0 7px, #2b9a4a 7px 14px); }
.pkgs { display: grid; gap: 10px; margin-bottom: 14px; }
.pkg { text-align: left; border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; background: var(--porcelain); display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; }
.pkg .pn { font-family: var(--display); font-weight: 600; font-size: 21px; color: var(--violet); }
.pkg .pl { grid-column: 1; color: var(--muted); font-size: 15px; }
.pkg .pp { grid-row: 1 / span 2; grid-column: 2; font-family: var(--display); font-weight: 600; font-size: 24px; color: var(--violet); font-variant-numeric: tabular-nums; }
.pkg.on { border-color: var(--violet); background: var(--violet); }
.pkg.on .pn, .pkg.on .pp { color: var(--porcelain); }
.pkg.on .pl { color: rgba(251, 254, 251, 0.82); }

.rate { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; background: var(--linen); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; font-weight: 600; }
.rate output { font-family: var(--display); font-size: 22px; color: var(--violet); }
.rate input { grid-column: 1 / -1; width: 100%; accent-color: var(--violet); height: 32px; }
.items { display: grid; }
.it { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.it input { width: 24px; height: 24px; accent-color: var(--violet); }
.it .q { color: var(--muted); font-size: 14px; display: block; }
.it b { font-variant-numeric: tabular-nums; }
.it.off { opacity: 0.5; }
.tot { background: var(--linen); border-radius: 16px; padding: 8px 16px; }
.tot-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tot-row:last-of-type { border-bottom: 0; }
.tot-big b { font-family: var(--display); font-size: 26px; color: var(--violet); }
.money-in { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.money-in input { width: 120px; min-height: 46px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--porcelain); text-align: right; font-size: 18px; font-variant-numeric: tabular-nums; }
#c-tax { width: 70px; }

.consent { background: var(--linen); border-radius: 16px; padding: 16px; margin-top: 4px; }
.chk { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; font-weight: 500; cursor: pointer; }
.chk input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chk .box { width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--violet); background: var(--porcelain); display: grid; place-items: center; }
.chk input:checked + .box { background: var(--violet); }
.chk input:checked + .box::after { content: ""; width: 7px; height: 13px; border: solid var(--porcelain); border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.chk input:focus-visible + .box { outline: 3px solid var(--violet); outline-offset: 2px; }
.q-fine { font-size: 13px; color: var(--muted); margin: 10px 0 0 38px; }
.q-fine a { color: var(--violet); }

.done { max-width: 560px; margin: 20px auto; text-align: center; }
.done-check { width: 72px; height: 72px; border-radius: 50%; background: var(--violet); color: var(--porcelain); font-size: 40px; display: grid; place-items: center; margin: 0 auto 14px; }
.done-sum { text-align: left; background: var(--linen); border-radius: 16px; padding: 8px 16px; margin: 18px 0; }
.done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--sab) + 16px); transform: translateX(-50%) translateY(20px); background: var(--charcoal); color: var(--porcelain); padding: 10px 18px; border-radius: 999px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 3000; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 420px) {
  .bar { grid-template-columns: 120px 1fr 36px; font-size: 14px; }
  .q-steps button { font-size: 13px; }
  .q-steps button b { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
