/* Happy LLC staff / portal UI. Tokens first; light and dark are both chosen, not flipped.
   The accent is the logo's red (#e41e26, img/mark-*.png); dark mode lifts it a little so text in it stays readable. */
:root {
  color-scheme: light;
  --page: #f4f4f1; --surface: #fcfcfb; --surface-2: #f0efec; --hover: #eceae4;
  --text: #0b0b0b; --text-2: #52514e; --muted: #6b6a65;               /* muted: 4.5:1 or more on page, surface-2 and hover */
  --line: #e1e0d9; --line-2: #c3c2b7; --ring: rgba(11,11,11,0.10);
  --accent: #e41e26; --accent-2: #c0161d; --accent-soft: #fde4e4; --on-accent: #fff;
  /* fill: behind white text (primary buttons, badges); 4.5:1 or more with --on-accent in both themes */
  --fill: #e41e26; --fill-2: #c0161d;
  --good: #0ca30c; --good-text: #006300; --warning: #fab219; --warning-text: #8a5a00; --serious: #ec835a; --critical: #d03b3b;
  --series: #2a78d6; --series-soft: #cde2fb; --grid: #e1e0d9; --axis: #c3c2b7;
  --div-hi: var(--series); --div-lo: #c47217;
  --nav: #141413; --nav-text: #c3c2b7; --nav-muted: #6f6e69; --nav-active: #2a2a27;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 2px 8px rgba(0,0,0,.04);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --hover: #262624;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
    --line: #2c2c2a; --line-2: #383835; --ring: rgba(255,255,255,0.10);
    --accent: #ef4248; --accent-2: #f5686d; --accent-soft: #3b1719; --on-accent: #fff;
    --fill: #d12027; --fill-2: #c0161d;
    --good-text: #0ca30c; --warning-text: #fab219;
    --series: #3987e5; --series-soft: #1c3352; --grid: #2c2c2a; --axis: #383835; --div-lo: #d98c3a;
    --nav: #0b0b0a; --nav-active: #1f1f1d;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --hover: #262624;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #898781;
  --line: #2c2c2a; --line-2: #383835; --ring: rgba(255,255,255,0.10);
  --accent: #ef4248; --accent-2: #f5686d; --accent-soft: #3b1719; --on-accent: #fff;
  --fill: #d12027; --fill-2: #c0161d;
  --good-text: #0ca30c; --warning-text: #fab219;
  --series: #3987e5; --series-soft: #1c3352; --grid: #2c2c2a; --axis: #383835; --div-lo: #d98c3a;
  --nav: #0b0b0a; --nav-active: #1f1f1d;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--page); color: var(--text); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
svg.i.sm { width: 14px; height: 14px; vertical-align: -2px; }

/* controls */
button, input, select, textarea { font: inherit; color: inherit; }
button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); padding: 7px 13px; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
button:hover { background: var(--hover); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--fill); color: var(--on-accent); border-color: var(--fill); font-weight: 550; }
button.primary:hover { background: var(--fill-2); border-color: var(--fill-2); }
button.danger { color: var(--critical); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--hover); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { border: 1px solid var(--line-2); background: var(--surface); padding: 7px 10px; border-radius: 8px; width: 100%; min-height: 36px; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--text-2); font-weight: 500; }
label > input, label > select, label > textarea { margin-top: 4px; font-size: 14px; color: var(--text); font-weight: 400; }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--text); }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card > h3:first-child { margin-top: 0; }
.err { color: var(--critical); min-height: 1em; }
.muted { color: var(--muted); }
.sub { color: var(--text-2); font-size: 13px; }
h3 { margin: 0 0 12px; font-size: 15px; font-weight: 650; }
h4 { margin: 0 0 8px; font-size: 13px; font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 -4px; }
.section-title h3 { margin: 0; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--page); }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 14px; padding: 28px; }
.login-card h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.login-card h1 .wordmark { height: 48px; width: auto; }
.nav .brand .wordmark { height: 36px; width: auto; display: block; }
.login-links { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }

/* home: greeting, first-steps checklist */
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.hello h2 { margin: 0 0 2px; font-size: 22px; letter-spacing: -.01em; }
.hello .actions { margin: 0; }
.onboard ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.onboard li { display: flex; align-items: center; gap: 14px; padding: 10px 4px; border-top: 1px solid var(--line); }
.onboard li:first-child { border-top: 0; }
.onboard li > div { flex: 1; }
.onboard .n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; border: 2px solid var(--accent); color: var(--accent); }
.onboard li.done .n { background: var(--good); border-color: var(--good); color: #fff; }
.onboard li.done b { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--muted); }
.chip-sep { width: 1px; align-self: stretch; background: var(--line-2); margin: 2px 4px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px; flex: none; }

/* shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.nav { background: var(--nav); color: var(--nav-text); padding: 14px 10px; display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav .brand { color: #fff; font-weight: 700; padding: 4px 8px 16px; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.nav a { color: var(--nav-text); padding: 8px 10px; border-radius: 8px; display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav a:hover { background: var(--nav-active); color: #fff; }
.nav a.active { background: var(--nav-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .badge { margin-left: auto; background: var(--critical); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--nav-muted); padding: 14px 10px 4px; }
.nav .foot { margin-top: auto; padding: 12px 10px 2px; font-size: 12px; color: var(--nav-muted); }
main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; min-height: 58px; }
.top h2 { margin: 0; font-size: 17px; font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.top h2 .back { color: var(--muted); }
.top .lang { font-size: 13px; font-weight: 650; letter-spacing: .04em; padding: 6px 9px; }
.search { position: relative; width: 280px; }
.search input { padding-left: 34px; padding-right: 30px; text-overflow: ellipsis; background: var(--surface-2); border-color: transparent; }
.search svg { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.search kbd { position: absolute; right: 8px; top: 8px; font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }
.me { display: flex; align-items: center; gap: 6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 650; font-size: 13px; color: var(--text-2); }
.menu { display: none; }
.view { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; max-width: 1480px; width: 100%; }
.backdrop { display: none; }

/* layout helpers */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.row > button, .row > .fit { flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: end; }
.actions.left { justify-content: flex-start; }
.spacer { flex: 1; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); color: inherit; display: block; position: relative; }
a.tile:hover { text-decoration: none; border-color: var(--line-2); }
.tile .k { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.tile .v { font-size: 28px; font-weight: 650; margin-top: 4px; letter-spacing: -.01em; }
.tile .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.good .v { color: var(--good-text); }
.tile.bad .v { color: var(--critical); }
.tile.warn .v { color: var(--warning-text); }

/* an order's video and banner in a list */
.cthumbs { display: flex; gap: 6px; align-items: center; }
.cthumbs .thumb { padding: 0; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; background: #000; display: grid; place-items: center; color: #fff; }
.cthumbs .thumb.video { width: 64px; height: 36px; }
.cthumbs .thumb.banner { width: 48px; height: 36px; background: var(--surface-2); color: var(--muted); }
.cthumbs .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cthumbs .thumb.banner img { object-fit: contain; }
.cthumbs .thumb:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
/* "add video / banner by hand": select-like dropdowns with a list of pictures or a calendar */
/* minmax(0, 1fr) and min-width 0: a long file name is cut or wrapped inside the modal, it does not widen it */
.dd-host { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-width: 0; }
.dd-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
.dd-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; font-size: 12px; color: var(--text-2); font-weight: 500; }
.dd-host > .sub:empty, .dd-host > .err:empty { display: none; }
.dd-slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.dd-slot { display: grid; gap: 2px; justify-items: center; padding: 8px 4px; border-radius: 10px; background: var(--surface); text-align: center; font-weight: 400; }
.dd-slot b { font-size: 13px; font-weight: 600; }
.dd-slot span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dd-slot.on { background: var(--text); border-color: var(--text); color: var(--surface); }
.dd-slot.on span { color: inherit; opacity: .8; }
@media (max-width: 560px) { .dd-slots { grid-template-columns: minmax(0, 1fr); } }
.dd { position: relative; }
.dd-btn { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; font-weight: 400; background: var(--surface); }
.dd-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn svg { flex: none; transform: rotate(90deg); transition: transform .12s; color: var(--muted); }
.dd.open .dd-btn { border-color: var(--accent); }
.dd.open .dd-btn svg { transform: rotate(-90deg); }
.dd-panel { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; right: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.dd-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; max-height: 260px; overflow: auto; }
.dd-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.dd-row:hover { background: var(--hover); }
.dd-row.on { background: var(--accent-soft); }
.dd-row.off { opacity: .55; cursor: not-allowed; }
.dd-row.off:hover { background: none; }
.dd-row input { flex: none; }
.dd-name { flex: 1; min-width: 0; }
.dd-name b { overflow-wrap: anywhere; font-size: 13px; }
.dd-none { padding: 10px; text-align: center; }
.dd-thumb { flex: none; width: 64px; height: 36px; object-fit: cover; border-radius: 5px; background: #000; display: grid; place-items: center; color: #fff; }
.dd-thumb.banner { object-fit: contain; background: var(--surface-2); color: var(--muted); }
.dd-thumb.banner.v { width: 16px; height: 44px; }
.dd-prev { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.dd-prev .row { min-width: 0; flex-wrap: nowrap; }
.dd-prev video, .dd-prev img { width: 100%; height: 200px; object-fit: contain; border-radius: 8px; background: #000; display: block; }
.dd-prev-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.dd-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dd-tags:empty { display: none; }
/* while the list is open the tags wait: a tick must not grow the modal and move the list under the cursor */
.dd.open ~ .dd-tags { display: none; }
.dd-tag { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 3px 3px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12px; }
.dd-tag .dd-thumb { width: 32px; height: 18px; border-radius: 3px; }
.dd-tag .dd-thumb.banner.v { width: 8px; height: 22px; }
.dd-tag-name { min-width: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-tag button { padding: 2px; flex: none; }
.dd-all { font-size: 13px; padding: 5px 8px; color: var(--text-2); }
.dd-panel .rcal-day { height: 34px; }
.modal-card .err { white-space: pre-line; }
/* a channel's playlist row: picture + name; a long file name wraps so the delete button stays inside the table */
.item-cell { min-width: 240px; max-width: 340px; }
.item-cell .title-cell { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.item-cell.done .title-cell b { color: var(--muted); font-weight: 500; }

/* tables */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; min-width: 180px; }
td.num, th.num, .r { text-align: right; font-variant-numeric: tabular-nums; }
th { font-size: 12px; color: var(--text-2); font-weight: 600; background: var(--surface); position: sticky; top: 0; user-select: none; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }
th .arrow { color: var(--accent); font-size: 10px; margin-left: 3px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty > svg.i { width: 28px; height: 28px; color: var(--line-2); }
/* one long name must not make every other column of a list scroll away */
.title-cell b { display: block; font-weight: 600; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.title-cell span { display: block; color: var(--muted); font-size: 12px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.title-cell .err { color: var(--critical); min-height: 0; }

/* chips, status */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 550; line-height: 18px; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.chip.plain::before { display: none; }
.chip.ok { color: var(--good-text); } .chip.ok::before { background: var(--good); }
.chip.warn { color: var(--warning-text); } .chip.warn::before { background: var(--warning); }
.chip.serious::before { background: var(--serious); }
.chip.bad { color: var(--critical); } .chip.bad::before { background: var(--critical); }
.chip.info { color: var(--series); } .chip.info::before { background: var(--series); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { border-radius: 99px; padding: 5px 12px; font-size: 13px; background: var(--surface); }
.filter-chip.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.filter-chip .n { opacity: .65; font-variant-numeric: tabular-nums; }
.lvl { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 550; }
.lvl.ok { color: var(--good-text); } .lvl.warning { color: var(--warning-text); } .lvl.critical { color: var(--critical); }
.metric { font-variant-numeric: tabular-nums; }
.metric.warning { color: var(--warning-text); font-weight: 600; }
.metric.critical { color: var(--critical); font-weight: 600; }

/* issues list */
.issues { display: grid; gap: 8px; }
.issue { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--warning); }
.issue.critical { border-left-color: var(--critical); }
.issue.ok { border-left-color: var(--good); }
/* only the line's own icon takes its tone: a button inside the line keeps its own colours */
.issue > svg.i { margin-top: 1px; }
.issue.warning > svg.i { color: var(--warning-text); } .issue.critical > svg.i { color: var(--critical); } .issue.ok > svg.i { color: var(--good-text); }

/* key-value */
.kv { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 7px 16px; align-items: baseline; }
.kv > div:nth-child(odd) { color: var(--text-2); font-size: 13px; }
.kv > div:nth-child(even) { min-width: 0; overflow-wrap: anywhere; }

/* health cards */
.hcard { display: grid; gap: 10px; align-content: start; }
.hcard .head { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.hcard .head .lvl { margin-left: auto; }
.big { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.big small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter > div { height: 100%; border-radius: 3px; background: var(--good); }
.meter.warning > div { background: var(--warning); } .meter.critical > div { background: var(--critical); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; border-radius: 0; background: transparent; padding: 10px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); background: transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .n { background: var(--surface-2); border-radius: 99px; padding: 0 7px; font-size: 11px; }

/* stepper */
.stepper { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 4px 0; scrollbar-width: none; }
.step { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.step .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--surface); }
.step.done { color: var(--text-2); } .step.done .dot { background: var(--good); border-color: var(--good); color: #fff; }
.step.now { color: var(--text); font-weight: 650; } .step.now .dot { border-color: var(--accent); color: var(--accent); }
.step.stop .dot { background: var(--critical); border-color: var(--critical); color: #fff; }
.step-line { width: 36px; height: 2px; background: var(--line-2); margin: 0 8px; flex: none; }
.step-line.done { background: var(--good); }

/* charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--series); }
.chart .bar:hover, .chart .bar.hl { fill: color-mix(in srgb, var(--series) 75%, var(--text)); }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-soft); opacity: .55; }
.chart .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.chart .thr { stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .thr.warning { stroke: var(--warning); } .chart .thr.critical { stroke: var(--critical); }
.chart .thr-label { font-size: 11px; fill: var(--muted); }
.chart .hit { fill: transparent; }
.chart .cross { stroke: var(--line-2); stroke-width: 1; }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); padding: 6px 9px; border-radius: 6px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 3; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.tip b { font-variant-numeric: tabular-nums; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.chart-head h3 { margin: 0; }
.chart-head .now { font-size: 13px; color: var(--text-2); }
/* a signed contract: its first page, all its pages */
.contract-now { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; align-items: start; }
.pdf-thumb { width: 100%; aspect-ratio: 1 / 1.414; padding: 0; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: #fff; color: #667; display: grid; place-items: center; }
.pdf-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.pdf-thumb:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.pdf-thumb.small { width: 44px; }
.pdf-pages { display: grid; gap: 10px; }
.pdf-pages img { width: 100%; display: block; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.modal-card.wide { max-width: 980px; }
/* paying an invoice: the account and the payment reference with copy buttons, the printable invoice under them */
.pay-box { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.pay-box h3 { margin: 0; }
.pay-rows { display: grid; gap: 2px; }
.pay-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 36px; }
.pay-row .k { color: var(--text-2); font-size: 13px; }
.pay-row .v { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; font-size: 15px; }
.pay-row button { padding: 4px 10px; font-size: 13px; }
.pay-acts { display: grid; gap: 8px; justify-items: start; }
.inv-frame { width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.issue > button { flex: none; align-self: center; }
.step.link { cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.step.link:hover, .step.link:focus-visible { color: var(--accent); }
@media (max-width: 560px) {
  .pay-row { grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; }
  .pay-row .k { grid-column: 1 / -1; }
  .issue { flex-wrap: wrap; }
}
@media (max-width: 640px) { .contract-now { grid-template-columns: 1fr; } .contract-now > .pdf-thumb { max-width: 200px; margin: 0 auto; } }
/* the QR report */
.qr-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.qr-dates { display: inline-flex; align-items: center; gap: 6px; }
.qr-dates input { width: auto; min-height: 34px; padding: 4px 8px; font-size: 13px; }
.tile .qr-v { font-size: 22px; font-variant-numeric: tabular-nums; }
.qr-share { display: grid; gap: 3px; min-width: 76px; }
.qr-share-n { font-variant-numeric: tabular-nums; }
.qr-share i { display: block; height: 4px; border-radius: 2px; background: var(--series); }
.qr-phone { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 10px; font-size: 14px; }

/* toast, modal */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; z-index: 40; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.2); animation: rise .18s ease-out; }
.toast.bad { background: var(--critical); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
.modal { position: fixed; inset: 0; background: rgba(10,10,10,.5); display: grid; place-items: center; padding: 16px; z-index: 30; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 620px; max-height: calc(100vh - 32px); overflow: auto; display: grid; gap: 14px; }
.modal-card > h3 { font-size: 17px; margin: 0; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
video { max-width: 100%; border-radius: 8px; background: #000; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px; max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 13px; font-weight: 400; }
.checks input { width: auto; margin: 0; min-height: 0; }
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--hover), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; height: 90px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.drop { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--text-2); cursor: pointer; transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { color: var(--text); }
pre.raw { white-space: pre-wrap; font-size: 12px; margin: 0; max-height: 480px; overflow: auto; background: var(--surface-2); padding: 12px; border-radius: 8px; }
.chat { display: grid; gap: 12px; }
.bubble { max-width: 820px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; }
.bubble.me { display: block; justify-self: end; background: var(--accent-soft); border-color: transparent; }   /* not the top bar's flex .me */
.bubble .who { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* upload cards side by side: the drop zones line up at the bottom */
.upload-card { display: flex; flex-direction: column; gap: 12px; }
.upload-card > h3 { margin: 0; }
.upload-card > .drop { margin-top: auto; }

/* toast action (undo) */
.toast button { background: transparent; color: inherit; border-color: color-mix(in oklab, currentColor 40%, transparent); padding: 3px 10px; margin-left: 6px; font-weight: 600; }
.toast button:hover { background: color-mix(in oklab, currentColor 14%, transparent); }

.icon-btn { padding: 7px 8px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.link-card { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none; transition: border-color .12s; }
.link-card:hover { border-color: var(--line-2); }
.link-card > div { flex: 1; }
.link-card h3 { margin: 0 0 2px; }
.link-card > svg.i:first-child { color: var(--accent); width: 26px; height: 26px; }

/* day-coefficient calendar: diverging around 1 (below warm, above blue), selection = ink ring */
.cal-top { display: grid; gap: 12px; }
.cal-toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; }
.cal-nav { display: flex; gap: 6px; }
.cal-range { font-weight: 650; font-size: 17px; margin-right: auto; align-self: center; font-variant-numeric: tabular-nums; }
.cal-loc { min-width: 220px; }
.cal-legend { display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--text-2); }
.cal-legend > span:first-child { margin-right: -10px; }
.cal-ramp { display: inline-block; width: 150px; height: 10px; border-radius: 5px; border: 1px solid var(--line);
  background: linear-gradient(90deg, color-mix(in oklab, var(--div-lo) 60%, var(--surface)), var(--surface-2) 50%, color-mix(in oklab, var(--div-hi) 60%, var(--surface))); }
.cal-ramp + span { margin-left: -10px; }
.cal-key { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line-2); background: var(--surface-2); flex: none; }
.sw.hi { background: color-mix(in oklab, var(--div-hi) var(--mix, 30%), var(--surface)); border-color: transparent; }
.sw.lo { background: color-mix(in oklab, var(--div-lo) var(--mix, 30%), var(--surface)); border-color: transparent; }

.cal-months { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.cal-months.editable { user-select: none; -webkit-user-select: none; }
.cal-month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 16px; box-shadow: var(--shadow); }
.cal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-title { border: 0; background: none; padding: 4px 8px; margin-left: -8px; font-weight: 650; font-size: 15px; }
.cal-title:disabled, .cal-wd:disabled { opacity: 1; cursor: default; }
.cal-title:disabled:hover, .cal-wd:disabled:hover { background: none; }
.cal-avg { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-avg b { color: var(--text-2); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { border: 0; background: none; justify-content: center; padding: 4px 0; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 6px; }
.cal-wd.we { color: var(--text-2); }
.cal-wd:hover { color: var(--text); }
.cal-day { position: relative; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 0;
  min-height: 52px; padding: 5px 6px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text);
  white-space: normal; text-align: left; touch-action: manipulation; transition: box-shadow .1s, border-color .1s, background .12s; }
.cal-day:hover { background: var(--hover); border-color: var(--line-2); }
.cal-day.one { background: var(--surface-2); }
.cal-day.hi { background: color-mix(in oklab, var(--div-hi) var(--mix), var(--surface)); border-color: color-mix(in oklab, var(--div-hi) calc(var(--mix) + 12%), var(--surface)); }
.cal-day.lo { background: color-mix(in oklab, var(--div-lo) var(--mix), var(--surface)); border-color: color-mix(in oklab, var(--div-lo) calc(var(--mix) + 12%), var(--surface)); }
.cal-day.hi:hover, .cal-day.lo:hover { filter: brightness(.97); }
.cal-day.past { opacity: .55; }
.cal-day.past:hover { opacity: .85; }
.cal-n { font-size: 12.5px; font-weight: 600; line-height: 18px; color: var(--text-2); }
.cal-day.we .cal-n { color: var(--text); }
.cal-day.today .cal-n { align-self: flex-start; background: var(--text); color: var(--surface); border-radius: 99px; padding: 0 6px; }
.cal-v { align-self: flex-end; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 16px; }
.cal-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px var(--surface); }
.cal-dot.alt { background: var(--muted); }
.cal-dot.static { position: static; display: inline-block; }
.cal-day.hol::before, .hol-mark { content: ''; position: absolute; left: 8px; right: 8px; top: -1px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.hol-mark { position: static; display: inline-block; width: 16px; border-radius: 2px; }
.cal-day.sel { border-color: var(--text); box-shadow: inset 0 0 0 1.5px var(--text); }
.cal-day.sel::after { content: '✓'; position: absolute; top: -6px; left: -6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); color: var(--surface); font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.cal-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.cal-bar { display: grid; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.cal-bar.active { position: sticky; bottom: 12px; z-index: 6; border-style: solid; box-shadow: 0 10px 30px rgba(0,0,0,.14); animation: rise .15s ease-out; }
.cal-hint { display: flex; gap: 8px; align-items: center; color: var(--text-2); font-size: 13px; }
.cal-picked { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.cal-picked > div:first-child { flex: 1 1 260px; }
.cal-picked .presets { display: flex; gap: 4px; flex-wrap: wrap; }
.preset { padding: 5px 9px; font-variant-numeric: tabular-nums; font-size: 13px; }
.cal-custom { display: flex; gap: 6px; align-items: center; }
.cal-input { width: 92px; }
.cal-list summary { cursor: pointer; font-weight: 600; }
.cal-list[open] summary { margin-bottom: 12px; }

/* phone: nav as a drawer, tables as cards */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 25; transform: translateX(-100%); transition: transform .2s; }
  .nav.open { transform: none; }
  .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 24; }
  .menu { display: inline-flex; }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
  .top { padding: 8px 16px; }
  .top h2 { display: none; }
  .view { padding: 16px; gap: 14px; }
  .me .name { display: none; }
}
@media (max-width: 640px) {
  .tablewrap.cards { background: transparent; border: 0; box-shadow: none; }
  .tablewrap.cards table, .tablewrap.cards tbody, .tablewrap.cards tr, .tablewrap.cards td { display: block; width: 100%; }
  .tablewrap.cards thead { display: none; }
  .tablewrap.cards tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 8px 4px; }
  .tablewrap.cards td { border: 0; padding: 4px 12px; display: flex; justify-content: space-between; gap: 12px; white-space: normal; text-align: right; }
  .tablewrap.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; }
  .tablewrap.cards td.first { font-weight: 600; text-align: left; display: block; }
  .tablewrap.cards td.first::before { display: none; }
  .tablewrap.cards td:empty { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tile .v { font-size: 22px; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv > div:nth-child(even) { margin-bottom: 8px; }
  .cal-months { grid-template-columns: 1fr; }
  .cal-top .filter-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 0 18px; }
  .cal-top .filter-chips > * { flex: none; }
  .cal-range { font-size: 15px; }
  .cal-legend .cal-key.muted { display: none; }
  .cal-month { padding: 10px; }
  .cal-grid { gap: 3px; }
  .cal-day { min-height: 46px; padding: 3px 4px; }
  .cal-v { font-size: 11.5px; }
  .cal-loc { min-width: 0; flex: 1 1 100%; }
  .cal-bar { bottom: 8px; padding: 10px; }
  .cal-picked > div:first-child { flex-basis: 100%; }
}
@media print { .nav, .top { display: none; } .shell { display: block; } }

/* ---------------------------------------------------------------- v17: order wizard, content preview, pickers */
.issue.info { border-left-color: var(--series); } .issue.info > svg.i { color: var(--series); }
.warn-text { color: var(--warning-text); }
button.tile { text-align: left; font: inherit; cursor: pointer; width: 100%; }
button.tile:hover { border-color: var(--line-2); }

/* the base price on hover / focus / tap */
.pinfo { position: relative; display: inline-flex; align-items: center; gap: 4px; cursor: help; border-bottom: 1px dotted var(--line-2); outline: none; }
.pinfo > svg.i { width: 14px; height: 14px; color: var(--muted); }
/* fixed, placed by priceInfo(): a table's scroll box would otherwise clip it */
.pinfo .pop { display: none; position: fixed; z-index: 60; width: 420px; max-width: 80vw; text-align: left; white-space: normal;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.3); gap: 6px; font-weight: 400; }
.pinfo:hover .pop, .pinfo:focus .pop, .pinfo:focus-within .pop { display: grid; }
.pinfo .pop table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pinfo .pop td { padding: 4px 2px; border-top: 1px solid var(--line); vertical-align: top; }
.pinfo .pop td.num { text-align: right; white-space: nowrap; font-weight: 600; }

/* wizard shell */
.wiz { display: grid; gap: 16px; }
.wiz-steps { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.wiz-step { display: inline-flex; align-items: center; gap: 8px; border-radius: 99px; padding: 6px 14px 6px 6px; background: var(--surface); white-space: nowrap; font-size: 14px; }
.wiz-step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.wiz-step.now { border-color: var(--text); font-weight: 650; } .wiz-step.now .n { background: var(--text); color: var(--surface); }
.wiz-step.done .n { background: var(--good); color: #fff; }
.wiz-step:disabled { opacity: .5; cursor: not-allowed; }
.wiz-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.wiz-main { display: grid; gap: 16px; min-width: 0; }
.wiz-head h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
/* taller than a small window: it scrolls by itself, and its last button stays clear of the chat bubble */
.wiz-side { position: sticky; top: 76px; display: grid; gap: 10px; max-height: calc(100vh - 92px); overflow-y: auto; padding-bottom: 64px; }
.wiz-side h3 { margin: 0 0 2px; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; } .sum-row > span:first-child { color: var(--text-2); }
.sum-row b { text-align: right; font-weight: 600; }
.sum-row.big { font-size: 18px; } .sum-row.big b { font-size: 22px; font-weight: 700; }
.sum-tags { display: flex; flex-wrap: wrap; gap: 4px; } .sum-tags .chip::before { display: none; }
.sum-list { display: grid; gap: 4px; font-size: 13px; } .sum-list div { display: flex; justify-content: space-between; gap: 8px; }
.sum-total { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
.wiz-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.wiz-send { display: grid; gap: 8px; } .wiz-send button { justify-content: center; } button.big { padding: 12px; font-size: 15px; }

/* packages */
.pk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pk-card { position: relative; display: grid; gap: 4px; align-content: start; text-align: left; padding: 14px 14px 12px 44px; border-radius: var(--radius); background: var(--surface); min-height: 96px; font: inherit; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.pk-card:hover { border-color: var(--line-2); }
.pk-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.pk-card:disabled { opacity: .5; }
.pk-check { position: absolute; left: 14px; top: 14px; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line-2); display: grid; place-items: center; background: var(--surface); }
.on > .pk-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.pk-check svg.i { width: 14px; height: 14px; stroke-width: 3; }
.pk-meta { font-size: 13px; color: var(--text-2); }
.pk-price { margin-top: 4px; font-size: 13px; }
.pk-price .pop { left: 0; right: auto; }

/* time slots */
/* the time slots fill the wizard's column, never an empty column beside them (auto-fill kept a fourth one on a wide
   screen): three side by side from 690 px, two from 460 px with a last odd one across the row, else one under the other */
.wiz-main { container: wiz / inline-size; }
.slot-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@container wiz (min-width: 460px) {
  .slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slot-grid > .slot-card:nth-child(odd):last-child { grid-column: 1 / -1; }
}
@container wiz (min-width: 690px) {
  .slot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .slot-grid > .slot-card:nth-child(odd):last-child { grid-column: auto; }
}
/* minmax(0,1fr) + min-width 0: a long price line wraps inside the card instead of pushing the options out of it */
.slot-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; min-width: 0; }
.slot-top > div { min-width: 0; }
.slot-top > .chip { flex-shrink: 0; white-space: nowrap; }
.slot-card.on { border-color: var(--accent); }
.slot-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.slot-time { font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
/* a slot card is a head and a body; the cards of one row share the head's height, so their choices start on one line */
.slot-grid > .slot-card { grid-row: span 2; grid-template-rows: subgrid; }
.slot-head { display: grid; gap: 6px; align-content: start; min-width: 0; }
.slot-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; min-width: 0; }
/* Оргил цаг: its two windows, one row each: the short name (1 · өглөө) in a column, the hours beside it */
.slot-wins { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: baseline; margin-top: 2px; }
.slot-wins > .n { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.slot-wins > .t { font-size: 18px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.3; }
/* one box per product: the choice (a button) and under it what it has on these days (.slot-foot), one frame */
.slot-box { border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); min-width: 0; }
/* picked: as a picked package card (a 2 px accent edge, the soft accent ground, a filled red check) */
.slot-box.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.slot-box.on .pk-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.slot-box.bad { border-color: var(--critical); box-shadow: 0 0 0 1px var(--critical) inset; }
/* nothing of it on these days: still read (dimmed, not faded away), not picked */
.slot-box.full { background: var(--surface-2); } .slot-box.full .slot-opt b, .slot-box.full .slot-opt .sub { color: var(--muted); }
.slot-opt { position: relative; display: block; text-align: left; padding: 10px 12px 6px 42px; border: 0; border-radius: 10px 10px 0 0; background: transparent; font: inherit; width: 100%; min-width: 0; white-space: normal; }
.slot-opt > span:last-child { display: grid; gap: 2px; }
.slot-opt .pk-check { left: 12px; top: 12px; }
.slot-opt:disabled { opacity: 1; cursor: not-allowed; }
/* the whole box answers the pointer as a package card does (shaded), not only its button's half */
.slot-box > .slot-opt:hover { background: transparent; }
.slot-box:not(.full):not(.on):hover { background: var(--hover); }
.slot-foot { display: grid; gap: 4px; justify-items: start; padding: 0 12px 10px 42px; min-width: 0; }
/* a product's state on these days: the video's free slots with a small meter, a banner place free, or full / held */
.slot-room { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.slot-room .meter { flex: 0 0 56px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.slot-room .meter > i { display: block; height: 100%; background: var(--good); }
.slot-room.low { color: var(--warning-text); } .slot-room.low .meter > i { background: var(--warning); }
.slot-room.good { color: var(--good-text); gap: 6px; }
.slot-room.full { color: var(--critical); font-weight: 600; gap: 6px; }
.slot-room svg.i { flex: none; width: 14px; height: 14px; }
.slot-room.sub-row { font-weight: 500; padding-left: 20px; }
.slot-remove { margin-top: 2px; padding: 4px 10px; font-size: 12px; }

/* date range calendar */
.rcal { display: grid; gap: 12px; }
.rcal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rcal-months { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.rcal-title { font-weight: 650; margin-bottom: 8px; }
.rcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.rcal-wd { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0; }
.rcal-day { height: 40px; padding: 0; justify-content: center; border-radius: 8px; font-variant-numeric: tabular-nums; background: var(--surface); }
.rcal-day.in { background: var(--accent-soft); border-color: transparent; }
.rcal-day.edge { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.rcal-day.today { box-shadow: 0 0 0 2px var(--text) inset; }
.rcal-day:disabled { opacity: .35; }
.rcal-sum { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: end; }
.rcal-sum > div { display: grid; } .rcal-sum b { font-size: 18px; }

/* the lift screen mock-up: 4:3 panel = 16:9 video (720) over the banner strip (240) */
.content-step { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.mock-col { display: grid; gap: 8px; }
.up-col { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.up-col .picked, .up-col .picked b { min-width: 0; overflow-wrap: anywhere; }
/* a screen drawn from its zones (zoneMock): the bezel, then each zone placed by its x,y,w,h */
.mock-col.two { gap: 14px; }
.mock-one { display: grid; gap: 6px; }
.zmock { border-radius: 14px; padding: 12px; background: linear-gradient(160deg, #3a3a37, #1c1c1a); box-shadow: 0 16px 40px -18px rgba(0,0,0,.45); }
.zm-in { position: relative; width: 100%; border-radius: 6px; overflow: hidden; background: #000; }
.zm-z { position: absolute; overflow: hidden; display: grid; place-items: center; background: #000; color: #8f8e88; font-size: 13px; box-shadow: inset 0 0 0 1px #262624; text-align: center; }
.zm-z.empty { background: repeating-linear-gradient(135deg, #1a1a19 0 10px, #222220 10px 20px); }
.zm-z.banner.none { background: #11110f; }
.zm-z video, .zm-z img { width: 100%; height: 100%; object-fit: contain; display: block; }
.zm-z span { display: inline-flex; align-items: center; gap: 6px; padding: 2px; }
.zmock.mini { padding: 5px; border-radius: 8px; box-shadow: none; }
.zmock.mini .zm-in { border-radius: 3px; }
.zmock.mini .zm-z { font-size: 10px; line-height: 1.15; }
.zmock.mini .zm-z.video { background: #2b2b28; color: #d6d4cc; }
.zmock.mini .zm-z.banner { background: var(--accent); color: #fff; opacity: .9; }
/* the channel form's split picker */
.lay-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lay-opt { display: grid; gap: 8px; align-content: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-align: left; font-size: 12.5px; line-height: 1.35; white-space: normal; height: auto; }
.lay-opt.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.lay-opt .lay-px { display: grid; place-items: center; aspect-ratio: 16 / 9; border: 1px dashed var(--line-2); border-radius: 8px; color: var(--muted); font-size: 12px; }
.chan-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 260px); gap: 16px; align-items: start; }
@media (max-width: 640px) { .chan-head { grid-template-columns: 1fr; } }
.up-box { display: grid; gap: 10px; min-width: 0; }
.up-box h3 { margin: 0; }
.picked { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.picked .fit { display: flex; gap: 6px; }
.prev-pick h4 { margin: 4px 0 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.thumb { display: grid; gap: 6px; padding: 6px; border-radius: 10px; background: var(--surface); text-align: left; font-size: 12px; font: inherit; }
.thumb video, .thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #000; }
.thumb.banner video, .thumb.banner img { aspect-ratio: 16 / 3; }
.thumb span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
/* Happy shop product pictures: square, a remove button on each, an add tile */
.modal-card .thumbs .thumb { position: relative; border: 1px solid var(--line); }
.modal-card .thumbs .thumb img { aspect-ratio: 1 / 1; background: var(--surface-2); }
.modal-card .thumbs .thumb > button.danger { position: absolute; top: 8px; right: 8px; background: var(--surface); padding: 4px; }
.thumb.add { place-items: center; align-content: center; min-height: 120px; border: 1px dashed var(--line-2); color: var(--muted); cursor: pointer; }

/* order detail */
.content-card { display: grid; gap: 14px; } .content-card h3 { margin: 0; }
.c-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.c-item .fit { display: flex; gap: 6px; align-items: center; }
.review-box { display: grid; gap: 10px; border-color: var(--warning); } .review-box h3 { margin: 0; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; }
.checklist li.ok svg.i { color: var(--good-text); } .checklist li.warn svg.i { color: var(--critical); } .checklist li.eye svg.i { color: var(--series); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 0 10px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); }
.timeline li:first-child::before { border-color: var(--accent); background: var(--accent); }
.timeline .when { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline li > div { display: grid; gap: 2px; } .timeline b { font-weight: 550; }

/* pick lists (channel for a screen, screens for a channel) */
.pick-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; padding-right: 2px; }
.pick { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.pick > span { display: grid; gap: 2px; } .pick.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.pick input { margin-top: 3px; width: auto; flex: none; accent-color: var(--accent); }
.move-rows { display: grid; gap: 8px; } .move-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }

/* beside the side menu and the summary the mock-up and the upload boxes do not fit side by side */
@media (max-width: 1320px) { .content-step { grid-template-columns: minmax(0, 1fr); } .mock-col { max-width: 420px; } }
@media (max-width: 1000px) {
  .wiz-body { grid-template-columns: minmax(0, 1fr); }
  .wiz-side { position: static; order: 2; max-height: none; overflow: visible; padding-bottom: 0; }
}
@media (max-width: 640px) {
  .rcal-months { grid-template-columns: 1fr; }
  .rcal-months .rcal-month:nth-child(2) { display: none; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .pinfo .pop { position: fixed; left: 16px; right: 16px; top: auto; bottom: 16px; width: auto; max-width: none; }
}

/* ---------------------------------------------------------------- v18: AI model switch, ITA jobs, Excel */
.seg-sw { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.seg-sw button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-weight: 550; color: var(--text-2); }
.seg-sw button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg-sw button .sub { font-weight: 400; }
.seg-sw.small button { padding: 6px 10px; font-size: 13px; }
.model-tag { margin-left: 8px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
#title .btn.xls { margin-left: 12px; font-size: 13px; padding: 4px 10px; vertical-align: middle; font-weight: 500; }

.tk-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tk-tab { display: grid; justify-items: start; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); text-align: left; font: inherit; }
.tk-tab .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tk-tab.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tk-groups { display: grid; gap: 12px; }
.tk-group summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; }
.tk-group summary::-webkit-details-marker { display: none; }
.tk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 12px; }
.tk-card { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; color: inherit; background: var(--surface); }
.tk-card:hover { border-color: var(--line-2); }
.tk-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pick.busy { opacity: .6; cursor: not-allowed; }
.job-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.accent-card { border-color: var(--accent); }
.accent-card h3, .job-layout .card h3 { margin: 0; }
.result-box { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; border-radius: 10px; background: var(--surface-2); }
.result-box > div { display: grid; gap: 2px; }
.hist { display: grid; gap: 8px; margin-top: 10px; }
.hist-item { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: inherit; }
.optlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow: auto; }
.optlist li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 900px) { .job-layout { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .tk-tabs { gap: 6px; } .tk-tab { padding: 10px; } .tk-tab .n { font-size: 20px; } .result-box { grid-template-columns: 1fr; } #title .btn.xls { display: none; } }
a.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 500; text-decoration: none; white-space: nowrap; }
a.btn:hover { border-color: var(--line-2); background: var(--hover); }
a.btn.primary { background: var(--fill); border-color: var(--fill); color: var(--on-accent); }
/* settings: the landing page's photos */
.site-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.site-photo { display: grid; gap: 8px; padding: 10px; }
.site-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
label:has(> .seg-sw) { display: grid; gap: 6px; justify-items: start; }

.view > .seg-sw { justify-self: start; }
a.filter-chip { color: var(--text); text-decoration: none; }

/* v20: assistant conversation list */
.chat-wrap { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.conv-list { display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; position: sticky; top: 72px; max-height: calc(100vh - 100px); overflow-y: auto; }
.conv-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.conv { display: flex; align-items: center; border-radius: 8px; }
.conv:hover, .conv.on { background: var(--ring); }
.conv-open { flex: 1; min-width: 0; display: grid; gap: 1px; text-align: left; border: 0; background: none; padding: 7px 8px; white-space: normal; }
.conv-open span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-open small { color: var(--muted); font-size: 11px; }
.conv-del { opacity: 0; padding: 2px 8px; }
.conv:hover .conv-del, .conv.on .conv-del, .conv-del:focus-visible { opacity: 1; }
@media (max-width: 760px) { .chat-wrap { grid-template-columns: 1fr; } .conv-list { position: static; max-height: 220px; } .conv-del { opacity: 1; } }
.bubble .md { white-space: normal; display: grid; gap: 8px; }
.md-p { margin: 0; white-space: pre-wrap; }
.md-list { margin: 0; padding-left: 20px; display: grid; gap: 2px; }
.md-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.md-table table { width: auto; min-width: 100%; }
.md-table td, .md-table th { padding: 6px 10px; white-space: normal; }
.md-table tr:last-child td { border-bottom: 0; }
/* power cuts list in the health card */
.cuts { display: grid; gap: 4px; margin-top: 8px; font-size: 13px; }
.cut { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding-top: 4px; }
.cut span { color: var(--text-2); font-variant-numeric: tabular-nums; }

/* media lists: a preview beside the title */
.media-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mthumb { flex-shrink: 0; display: grid; place-items: center; width: 88px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #000; border: 1px solid var(--line); color: var(--text-2); }
.mthumb.banner.h { width: 128px; aspect-ratio: 1280 / 240; }
.mthumb.banner.v { width: 34px; aspect-ratio: 342 / 768; }
.mthumb.empty { background: var(--surface-2, var(--surface)); }

/* map page (map.js): the map fills the view, glass panels float on it */
.view.full { padding: 0; max-width: none; gap: 0; }
.mp-page { position: relative; height: calc(100vh - 58px); height: calc(100dvh - 58px); min-height: 480px; overflow: hidden; background: #05070d; isolation: isolate; }
.mp-page > .mp-cv { position: absolute; inset: 0; width: 100%; height: 100%; }       /* over maplibre-gl.css (.maplibregl-map: relative) */
.glass { background: color-mix(in srgb, var(--surface) 82%, transparent); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--line-2) 55%, transparent); box-shadow: 0 12px 40px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.08); }
.mp-panel { position: absolute; top: 16px; left: 16px; width: 344px; max-height: calc(100% - 32px); overflow: hidden auto; border-radius: 16px; padding: 14px; display: grid; gap: 12px; align-content: start; z-index: 3; scrollbar-width: thin; }
.mp-panel.min { overflow: hidden; }
.mp-panel.min > :not(.mp-head) { display: none; }
.mp-panel h4, .mp-drawer-body h4 { margin: 4px 0 -4px; }
.mp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.mp-head h3 { margin: 0; font-size: 16px; }
.mp-collapse { padding: 6px; }
.mp-mode { justify-self: stretch; display: grid !important; grid-template-columns: 1fr 1fr; }
.mp-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 10px; padding: 0 10px; color: var(--muted); }
.mp-search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.mp-search input { border: 0; background: transparent; padding: 8px 0; min-height: 0; color: var(--text); }
.mp-search input:focus-visible { outline: none; }
.mp-results { display: grid; gap: 2px; margin-top: -6px; }
.mp-results:empty { display: none; }
.mp-res { justify-content: flex-start; border: 0; background: transparent; padding: 6px 8px; gap: 8px; }
.mp-res span:not(.chip) { color: var(--muted); font-size: 12px; }
.mp-zones { display: flex; flex-wrap: wrap; gap: 6px; }
.mp-zone { padding: 4px 10px; border-radius: 99px; font-size: 12.5px; gap: 6px; background: var(--surface); }
.mp-zone i { width: 8px; height: 8px; border-radius: 50%; background: var(--zc, var(--text-2)); }
.mp-zone span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.mp-zone.on { background: var(--zc, var(--text)); border-color: transparent; color: #fff; }
.mp-zone.on:not([style]) { color: var(--page); }
.mp-zone.on i { background: currentColor; }
.mp-zone.on span { color: inherit; opacity: .8; }
.mp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mp-stat { display: grid; justify-items: center; gap: 0; padding: 8px 4px; border-radius: 10px; background: color-mix(in srgb, var(--surface-2) 85%, transparent); border: 1px solid transparent; text-align: center; white-space: normal; }
button.mp-stat:hover { border-color: var(--line-2); }
.mp-stat.on { border-color: var(--text); background: var(--surface); }
.mp-stat b { font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.3; }
.mp-stat span { font-size: 11px; color: var(--text-2); }
.mp-stat .mp-dot { margin-bottom: 3px; }
.mp-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mp-dot.big { width: 11px; height: 11px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--surface) 70%, transparent); }
.mp-order { justify-content: center; }
.mp-list { display: grid; gap: 2px; max-height: 36vh; overflow: auto; margin: 0 -6px; padding: 0 2px; scrollbar-width: thin; }
.mp-row, .mp-eng { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 7px 8px; border-radius: 10px; text-align: left; white-space: normal; }
.mp-row:hover, .mp-eng:hover { background: var(--hover); }
.mp-row.on, .mp-eng.on { background: var(--accent-soft); }
.mp-row-main { display: grid; flex: 1; min-width: 0; }
.mp-row-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-row-main span { font-size: 12px; color: var(--text-2); }
.mp-row-n { display: grid; justify-items: end; font-size: 12px; font-variant-numeric: tabular-nums; grid-auto-flow: row; }
.mp-row-n span { color: var(--muted); font-size: 11px; }
.mp-thumb { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; flex: none; }
.mp-thumb.ph { display: grid; place-items: center; color: var(--zc); background: linear-gradient(135deg, color-mix(in srgb, var(--zc) 30%, transparent), color-mix(in srgb, var(--zc) 8%, transparent)); }
.mp-sec { display: flex; align-items: center; justify-content: space-between; gap: 4px 8px; flex-wrap: wrap; margin-top: 2px; }
.mp-sec button { white-space: normal; text-align: left; }
.mp-sec h4 { margin: 0; }
.mp-note { font-size: 11.5px; }
.mp-nocoord summary { cursor: pointer; display: flex; gap: 6px; align-items: center; color: var(--warning-text); font-size: 13px; }
.mp-nocoord .mp-list { margin-top: 6px; }

.mp-drawer { position: absolute; top: 16px; right: 16px; bottom: 16px; width: 400px; border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; z-index: 3; animation: mp-in .5s cubic-bezier(.2,.8,.2,1); }
@keyframes mp-in { from { opacity: 0; transform: translateX(28px) scale(.98); } }
.mp-hero { position: relative; height: 250px; flex: none; overflow: hidden; background: #111; }
.mp-hero img { width: 100%; height: 100%; object-fit: cover; display: block; animation: mp-kb 16s ease-out both; }
@keyframes mp-kb { from { transform: scale(1.14); } to { transform: scale(1); } }
.mp-hero.ph { background: radial-gradient(90% 80% at 15% 0%, color-mix(in srgb, var(--zc) 75%, transparent), transparent 62%), linear-gradient(160deg, color-mix(in srgb, var(--zc) 45%, #0d0d0d), #0a0a0a 75%); }
.mp-hero-ph { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; color: rgba(255,255,255,.7); font-size: 13px; padding-bottom: 40px; }
.mp-hero-ph svg { width: 64px; height: 64px; stroke-width: 1.1; }
.mp-hero-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, transparent 30%, transparent 45%, rgba(0,0,0,.8) 100%); }
.mp-x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 50%; border-color: transparent; background: rgba(0,0,0,.45); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.mp-x:hover { background: rgba(0,0,0,.7); }
.mp-hero-title { position: absolute; left: 18px; right: 18px; bottom: 14px; color: #fff; }
.mp-hero-title h2 { margin: 6px 0 0; font-size: 23px; line-height: 1.2; letter-spacing: -.01em; text-shadow: 0 2px 14px rgba(0,0,0,.5); }
.mp-hero-title div { font-size: 12.5px; opacity: .85; }
.mp-zone-tag { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--zc); color: #fff; }
.mp-hero-nav { position: absolute; top: 10px; left: 10px; display: flex; align-items: center; gap: 2px; color: #fff; font-size: 12px; background: rgba(0,0,0,.45); border-radius: 99px; padding: 2px; }
.mp-hero-nav button { border: 0; background: transparent; color: #fff; padding: 4px 6px; border-radius: 99px; }
.mp-hero-nav button:hover { background: rgba(255,255,255,.15); }
.mp-hero-tools { position: absolute; top: 52px; right: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.mp-hero-tools button { font-size: 12.5px; padding: 5px 10px; color: #fff; background: rgba(0,0,0,.45); border-color: rgba(255,255,255,.22); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.mp-hero-tools button:hover { background: rgba(0,0,0,.7); }
.mp-hero-tools button.danger { color: #ffb4b4; }
.mp-drawer-body { padding: 16px; overflow: auto; display: grid; gap: 12px; align-content: start; flex: 1; }
.mp-pkgs, .mp-devs { display: grid; gap: 8px; }
.mp-pkg { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.mp-dev { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.mp-dev.st-critical { border-left-color: #e5484d; }
.mp-dev.st-warning { border-left-color: #f2b01e; }
.mp-dev.st-ok { border-left-color: #1fae51; }
.mp-dev.st-office { border-left-color: #6f8fe0; }
.mp-dev-top, .mp-tk { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mp-dev-top .spacer, .mp-tk .spacer { flex: 1; }
.mp-probs { display: flex; flex-wrap: wrap; gap: 4px; }
.mp-probs span { font-size: 11.5px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); }
.mp-tk { font-size: 12.5px; color: var(--text); padding-top: 6px; border-top: 1px dashed var(--line); }
.mp-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.mp-tools button { font-size: 13px; }
.mp-notes { white-space: pre-wrap; }

.mp-ctrls { position: absolute; right: 16px; bottom: 30px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 2; transition: right .35s; }
.mp-drawer:not(.hidden) ~ .mp-ctrls { right: 432px; }
.mp-drawer:not(.hidden) ~ .mp-bar { left: calc(50% - 208px); max-width: calc(100% - 464px); }
.mp-ctl-group { display: flex; gap: 2px; padding: 3px; border-radius: 12px; }
.mp-ctl { width: 36px; height: 36px; padding: 0; justify-content: center; border: 0; border-radius: 9px; background: transparent; font-weight: 700; font-size: 12px; }
.mp-sun { padding: 7px 12px; border-radius: 12px; }
.mp-sun-label { display: flex; align-items: baseline; gap: 10px; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mp-sun-label span { color: var(--text-2); }
.mp-bar { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: calc(100% - 32px); padding: 10px 12px 10px 16px; border-radius: 14px; z-index: 4; animation: mp-up .35s cubic-bezier(.2,.8,.2,1); }
@keyframes mp-up { from { opacity: 0; transform: translate(-50%, 14px); } }
.mp-bar-txt { display: grid; gap: 2px; flex: 1; min-width: 200px; }
.mp-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.mp-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); }
.mp-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mp-inline input { width: 70px; margin: 0; }
.mp-bar input[type=text] { width: 160px; }
.mp-tip { position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, calc(-100% - 16px)); display: grid; gap: 2px; min-width: 170px; padding: 8px 12px; border-radius: 12px; font-size: 13px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.22); }
.mp-tip-st { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--text-2); }
.mp-tip-st i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.mp-loading { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; align-content: center; gap: 16px; color: #c3c2b7; font-size: 13px; pointer-events: none;
  background: radial-gradient(55% 55% at 50% 50%, #13254a, #05070d); transition: opacity .9s; }
.mp-loading.gone { opacity: 0; }
.mp-orb { width: 86px; height: 86px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #9cc4ff, #2a5fb8 42%, #081a3d 72%); box-shadow: 0 0 70px rgba(42,120,214,.6), inset -14px -10px 30px rgba(0,0,0,.6); animation: mp-breathe 2.4s ease-in-out infinite; }
@keyframes mp-breathe { 50% { transform: scale(1.06); box-shadow: 0 0 100px rgba(42,120,214,.8), inset -14px -10px 30px rgba(0,0,0,.6); } }
.mp-page .maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 70%, transparent) !important; color: var(--text-2); }
.mp-page .maplibregl-ctrl-attrib a { color: var(--text-2); }
.mp-page .maplibregl-ctrl-attrib-button { filter: var(--attrib-filter, none); }
@media (max-width: 900px) {
  .mp-panel { width: 300px; }
}
@media (max-width: 760px) {
  .mp-panel { left: 8px; right: 8px; top: 8px; width: auto; max-height: 46%; padding: 12px; }
  .mp-drawer { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 60%; border-radius: 18px 18px 0 0; }
  .mp-hero { height: 150px; }
  .mp-panel.min { padding: 10px 12px; }
  .mp-drawer:not(.hidden) ~ .mp-ctrls { display: none; }
  .mp-ctrls { right: 8px; bottom: 26px; }
  .mp-sun-label span { display: none; }
  .mp-bar { bottom: 12px; }
  .mp-drawer:not(.hidden) ~ .mp-bar { left: 50%; top: 8px; bottom: auto; max-width: calc(100% - 16px); }
}
@media (prefers-reduced-motion: reduce) {
  .mp-hero img, .mp-drawer, .mp-bar, .mp-orb { animation: none; }
}

/* header photo, profile photo card */
.avatar { cursor: pointer; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.me-photo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.me-photo > img, .me-photo > span { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center; font-size: 28px; font-weight: 700; background: var(--surface-2); color: var(--text-2); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--line); }
.me-photo-act { display: grid; gap: 6px; flex: 1; min-width: 200px; }

/* chat (chat.js): a bubble at the bottom right, the panel over the page */
.view { padding-bottom: 96px; }                   /* the last rows of a page scroll clear of the bubble */
.view.full { padding-bottom: 0; }
.mp-ctrls { bottom: 92px; }                       /* the map's controls sit over the bubble */
.ch-bubble { position: fixed; right: 20px; bottom: 20px; z-index: 20; width: 56px; height: 56px; padding: 0; border-radius: 50%; justify-content: center;
  background: var(--accent); color: #fff; border: 0; box-shadow: 0 8px 24px rgba(228,30,38,.35), 0 2px 6px rgba(0,0,0,.15); transition: transform .18s, background .18s; }
.ch-bubble:hover { background: var(--accent-2); transform: translateY(-2px); }
.ch-bubble svg.i { width: 26px; height: 26px; }
.ch-bubble.on { transform: scale(.92); }
.ch-badge { position: absolute; top: -2px; right: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--critical); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--page); }
.ch-peek { position: fixed; right: 86px; bottom: 26px; z-index: 20; max-width: 300px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; text-align: left; white-space: normal;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.18); animation: mp-in .35s cubic-bezier(.2,.8,.2,1); }
.ch-peek > span:last-child { display: grid; min-width: 0; }
.ch-peek b { font-size: 13px; }
.ch-peek span span { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ch-panel { position: fixed; right: 20px; bottom: 88px; z-index: 21; width: 384px; height: min(640px, calc(100vh - 120px)); display: flex; flex-direction: column; overflow: hidden;
  border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,0,0,.25); animation: ch-up .25s cubic-bezier(.2,.8,.2,1); transform-origin: bottom right; }
@keyframes ch-up { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.ch-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); min-height: 58px; }
.ch-head > button { padding: 6px; }
.ch-head .ch-mini { padding: 5px 9px; }
.ch-head-t { flex: 1; min-width: 0; display: grid; font-weight: 650; }
.ch-head-name { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-head-t { overflow: hidden; }
.ch-head-t span { font-weight: 400; font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-head-t .ch-av { font-size: 13px; }
.ch-x { margin-left: 2px; }
.ch-search { display: flex; align-items: center; gap: 8px; margin: 10px 12px 4px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--muted); }
.ch-search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.ch-search input { border: 0; padding: 7px 0; min-height: 0; background: transparent; color: var(--text); }
.ch-search input:focus-visible { outline: none; }
.ch-list { flex: 1; overflow: auto; padding: 4px 6px 10px; }
.ch-sec { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.ch-mini { font-size: 12px; padding: 3px 8px; text-transform: none; letter-spacing: 0; gap: 4px; }
.ch-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 12px; background: transparent; text-align: left; white-space: normal; }
.ch-row:hover { background: var(--hover); }
.ch-row-m { display: grid; flex: 1; min-width: 0; }
.ch-row-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ch-row-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-row-time { margin-left: auto; font-size: 11.5px; color: var(--muted); flex: none; }
.ch-row-last { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-row.unread .ch-row-last { color: var(--text); font-weight: 550; }
.ch-row-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.ch-tag { font-size: 10.5px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); flex: none; font-weight: 500; text-transform: none; letter-spacing: 0; }
.ch-tag.new { background: var(--accent-soft); color: var(--accent-2); font-weight: 650; }
.ch-av { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; display: inline-grid; place-items: center; color: #fff; font-weight: 650; background: var(--muted); }
.ch-av.team { background: linear-gradient(135deg, #2a78d6, #8b5cf6); }
.ch-av.brand { width: 32px; height: 32px; background: transparent; border-radius: 0; object-fit: contain; }
.ch-av.brand.big { width: 56px; height: 56px; font-size: 24px; }
.ch-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px; }
.ch-msgs { flex: 1; overflow: auto; padding: 12px 12px 6px; display: flex; flex-direction: column; gap: 3px; background: var(--page); }
.ch-welcome { margin: auto; display: grid; justify-items: center; gap: 8px; text-align: center; max-width: 260px; color: var(--text-2); font-size: 13.5px; }
.ch-welcome b { color: var(--text); font-size: 16px; }
.ch-day { text-align: center; margin: 10px 0 6px; }
.ch-day span { font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 2px 10px; border-radius: 99px; }
.ch-sys { align-self: center; display: flex; align-items: center; gap: 6px; max-width: 90%; margin: 6px 0; padding: 6px 12px; border-radius: 12px; font-size: 12.5px; text-align: center;
  background: var(--accent-soft); color: var(--accent-2); }
.ch-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 86%; margin-top: 6px; }
.ch-msg.cont { margin-top: 0; }
.ch-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.ch-av-gap { width: 30px; flex: none; }
.ch-bub { position: relative; padding: 7px 11px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.ch-msg:not(.mine):not(.cont) .ch-bub { border-bottom-left-radius: 6px; }
.ch-msg.mine .ch-bub { background: var(--accent); border-color: var(--accent); color: #fff; }
.ch-msg.mine:not(.cont) .ch-bub { border-bottom-right-radius: 6px; }
.ch-msg.mine .ch-bub a { color: #fff; text-decoration: underline; }
.ch-bub.pic { padding: 3px; }
.ch-name { font-size: 11.5px; font-weight: 650; color: var(--accent-2); margin-bottom: 1px; }
.ch-txt { white-space: pre-wrap; font-size: 14px; line-height: 1.42; }
.ch-time { display: block; text-align: right; font-size: 10.5px; opacity: .6; margin-top: 1px; }
.ch-bub.pic .ch-time { position: absolute; right: 10px; bottom: 8px; color: #fff; opacity: .9; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.ch-img { display: block; max-width: 240px; max-height: 260px; border-radius: 13px; object-fit: cover; }
.ch-file { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; padding: 4px 2px; }
.ch-file:hover { text-decoration: none; opacity: .85; }
.ch-file svg { width: 28px; height: 28px; flex: none; }
.ch-file span { display: grid; min-width: 0; }
.ch-file b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.ch-file span span { font-size: 11.5px; opacity: .75; }
.ch-older { align-self: center; font-size: 12.5px; margin-bottom: 6px; }
.ch-compose { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.ch-compose textarea { min-height: 40px; max-height: 132px; resize: none; border-radius: 20px; padding: 9px 14px; line-height: 1.4; }
.ch-attach { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; flex: none; color: var(--text-2); }
.ch-send { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; flex: none; background: var(--accent); border-color: var(--accent); color: #fff; }
.ch-send:hover { background: var(--accent-2); }
@media (max-width: 640px) {
  .ch-bubble { right: 14px; bottom: 14px; width: 52px; height: 52px; }
  .ch-peek { right: 76px; bottom: 18px; max-width: calc(100vw - 96px); }
  .ch-panel { inset: 0; width: auto; height: auto; border-radius: 0; border: 0; animation-name: fade; }
  .ch-panel:not(.hidden) ~ .ch-bubble, body.ch-lock .ch-bubble { display: none; }
  body.ch-lock { overflow: hidden; }
  .ch-msg { max-width: 92%; }
  .mp-ctrls { bottom: 80px; }
}
@media (prefers-reduced-motion: reduce) { .ch-panel, .ch-peek { animation: none; } }

/* map: registered buildings, entrances (map.js drawBuilding, bldList) */
.mp-tip-hint { font-size: 11px; color: var(--muted); }
.mp-add { justify-content: center; border-style: dashed; color: var(--text-2); }
.mp-blist { display: grid; gap: 4px; }
.mp-brow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left; white-space: normal; }
.mp-brow:hover { border-color: var(--line-2); background: var(--hover); }
.mp-brow > svg:last-child { color: var(--muted); }
.mp-bsq { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; box-shadow: inset 0 -8px 12px rgba(0,0,0,.18); }
.mp-bhead { position: relative; flex: none; padding: 12px 14px 16px; color: #fff; background: linear-gradient(150deg, color-mix(in srgb, var(--bc) 88%, #000), color-mix(in srgb, var(--bc) 55%, #0c0c0c)); }
.mp-bhead-row { display: flex; align-items: center; justify-content: space-between; }
.mp-bhead .mp-x { position: static; }
.mp-back { color: #fff; padding: 4px 8px 4px 4px; font-size: 13px; opacity: .9; }
.mp-back:hover { background: rgba(255,255,255,.14); }
.mp-bhead-t { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.mp-bhead-t h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.mp-bhead-t div div { font-size: 12.5px; opacity: .85; }
.mp-bicon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.16); flex: none; }
.mp-bicon svg { width: 26px; height: 26px; }
.mp-ents { display: grid; gap: 8px; }
.mp-ent { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.mp-ent.st-critical { border-left-color: #e5484d; background: color-mix(in srgb, #e5484d 5%, var(--surface)); }
.mp-ent.st-warning { border-left-color: #f2b01e; }
.mp-ent.st-ok { border-left-color: #1fae51; }
.mp-ent-top { display: flex; align-items: center; gap: 8px; }
.mp-ent-top .spacer { flex: 1; }
.mp-code { font-size: 12.5px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.mp-code.none { font-weight: 400; color: var(--muted); }
.mp-mini { padding: 3px 8px; font-size: 12px; gap: 4px; }
.mp-ent-devs { display: grid; gap: 4px; }
.mp-ent-dev { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.mp-ent-st { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* job: where exactly (building, entrance, door code, screen) */
.where { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.where > div { display: grid; gap: 1px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); min-width: 92px; }
.where > div span { font-size: 11.5px; color: var(--text-2); }
.where > div b { font-size: 14.5px; }
.where > a.btn { align-self: center; }
.mp-stat b { white-space: nowrap; font-size: clamp(13px, 1.1vw + 6px, 17px); }
/* phones: long words / chips never widen the page */
.chat-wrap > * { min-width: 0; }
.chips .filter-chip, .chat .filter-chip { white-space: normal; text-align: left; }
@media (max-width: 640px) {
  .tablewrap.cards td { overflow-wrap: anywhere; }
  /* a card's label keeps its words and its room, the value takes the rest and wraps in it: a wide value (a video's
     picture and long name) broke the label itself, "Бич / лэг" (2026-11-06) */
  .tablewrap.cards td::before { flex: 0 0 auto; max-width: 42%; overflow-wrap: normal; word-break: normal; }
  .tablewrap.cards td > * { min-width: 0; }
  /* a video or banner cell: the label above, its picture and name under it on the whole width */
  .tablewrap.cards td:has(> .media-cell) { display: block; text-align: left; }
  .tablewrap.cards td:has(> .media-cell)::before { display: block; max-width: none; margin-bottom: 6px; }
  .tablewrap.cards .item-cell { min-width: 0; max-width: none; }
  .tablewrap.cards .title-cell b, .tablewrap.cards .title-cell span { max-width: none; }
  .tablewrap.cards .title-cell b { font-size: 14px; line-height: 1.35; }
  .seg-sw button { white-space: normal; text-align: left; }
}
@media (max-width: 640px) { .mp-drawer-body { padding-bottom: 84px; } }   /* the last button clear of the chat bubble */
