/* i-mobel tickets. Layout from docs/wireframe-v6.html: one phone-width column (max 760px), sticky top bar,
   bottom tab bar on phones. Root 110 %, body 17 px (owner 1091). Colours: the IM app's own, read from its
   stylesheet (docs/im-reference/app.css, docs/spec-im-exact.md 2), dark on every phone (owner Telegram 1354 D1 A). */
:root {
  --bg: #0E1310; --surface: #14241E; --sunk: #223A33; --header: #24504B; --nav: #2A443B;
  --fg: #E6F4EF; --muted: #ABC1BA; --line: #456459;
  --accent: #8ADDC2; --accent-fg: #102B24; --accent-soft: rgba(138,221,194,.15);
  --open: #8fb0ee; --open-bg: #1e2b44; --pend: #e7b35c; --pend-bg: #3a2c14; --res: #7fcf93; --res-bg: #1b3524;
  --closed: #a9b1af; --closed-bg: #2a302f; --warn: #f08a72; --warn-bg: #3f1f18;
  color-scheme: dark;
  --f-head: "Anuphan", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box }
html { font-size: 110% }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 17px; line-height: 1.6 }
h1, h2, h3 { font-family: var(--f-head); margin: 0; line-height: 1.25 }
h1 { font-size: 1.3rem } h2 { font-size: 1.1rem } h3 { font-size: .95rem }
#ticket-title h1 { font-size: 18px }
.ticket-sections, .ticket-notes, .ticket-note-form { display: grid; gap: 10px; min-width: 0 }
.ticket-section { min-inline-size: 0; margin: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px }
.ticket-section > legend { padding: 0 4px; font-size: 14px; font-weight: 600 }
.ticket-section > :is(select, textarea) { display: block; width: 100%; min-width: 0; min-height: 44px;
  padding: 6px 8px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 16px }
.ticket-section > select { text-overflow: ellipsis }
.ticket-section > textarea { max-height: 180px; field-sizing: content; resize: vertical }
.ticket-skip-link { display: block; width: fit-content; margin: 6px 0 0 auto; font-size: 13px }
.ticket-job-summary { font-size: 16px; display: flex; justify-content: space-between; align-items: center; min-height: 44px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); list-style: none; cursor: pointer }
.ticket-job-summary::-webkit-details-marker { display: none }
.ticket-job-summary::after { content: "▾"; color: var(--muted) }
#job-info[open] .ticket-job-summary::after { content: "▴" }
#job-info:not([open]) .when-open, #job-info[open] .when-closed { display: none }
.post-stage-options { display: flex; flex-wrap: wrap; gap: 4px }
.post-stage-option { flex: 1 0 auto; cursor: pointer }
.post-stage-option span { display: flex; justify-content: center; align-items: center; min-height: 44px;
  padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font-size: .8125rem; white-space: nowrap }
.post-stage-option input:checked + span { color: var(--accent); border-color: var(--accent); background: var(--accent-soft) }
.post-stage-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px }
.ticket-photo-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 6px 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line) }
.ticket-photo-actions { flex-wrap: nowrap; gap: 4px; justify-content: flex-end; margin-inline-start: auto }
.ticket-photo-actions > .btn { padding-inline: 8px; white-space: nowrap }
#ticket-photo-sort { gap: 1px; color: var(--muted) }
#ticket-photo-sort:not(.oldest-first) .photo-sort-down, #ticket-photo-sort.oldest-first .photo-sort-up {
  color: var(--accent); font-weight: 600 }
#ticket-photo-list { display: grid; gap: 8px }
#ticket-photo-list:not(:empty) { margin-top: 8px }
#ticket-photo-list a { display: block }
#ticket-photo-list img { display: block; width: 100%; max-height: 280px; object-fit: contain;
  border-radius: 8px; background: var(--surface) }
#ticket-photo-pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px }
#ticket-photo-pages button { padding: 4px; border: 0; color: var(--muted); background: transparent }
#ticket-photo-pages button[aria-current="page"] { color: var(--accent); text-decoration: underline; text-underline-offset: 4px }
a { color: var(--accent) }
button, input, select, textarea { font: inherit; color: inherit }
button { cursor: pointer }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
/* the header is Ticket Codex's (docs/spec-im-header-row.md 2.1): no line under it, 5px 12px */
header.top { position: sticky; top: 0; z-index: 5; background: var(--header); border-bottom: 0;
  padding: 5px max(12px, env(safe-area-inset-right, 0px)) 5px max(12px, env(safe-area-inset-left, 0px)) }
.top-in { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap }
.brand { font-family: var(--f-head); font-weight: 700; font-size: 1.05rem; margin-right: auto; text-decoration: none; color: var(--fg) }
/* left: brand line over ☰ + page title; right: name over today's date. The left block takes the room (basis 0, so the
   two never wrap apart); a long title or name is cut with an ellipsis */
.hd-left { flex: 1 1 0; min-width: 0 }
.hd-brand { display: block; font-size: 12px; line-height: 1.4; color: var(--muted) }
.hd-row { display: flex; align-items: center; min-width: 0 }
.hd-title { font-family: var(--f-head); font-weight: 400; font-size: .85rem; color: var(--fg); text-decoration: none;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.hd-me { flex: 0 1 auto; max-width: 45%; min-width: 0; text-align: right; font-size: .8rem; line-height: 1.4 }
.hd-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.hd-today { display: block; font-size: 12px; color: var(--muted) }
/* the ☰ menu: a <details>, no JavaScript (the .svc pattern). Its panel hangs under the whole header (header.top is the
   containing block), 12px in from the content column's left edge (Ticket Codex #navigation) */
.menu { position: static; flex: none }
.menu > summary { list-style: none; cursor: pointer; font-size: 29px; line-height: 1; padding: 0 8px; min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center }
.menu > summary::-webkit-details-marker { display: none }
.menu > summary::marker { content: "" }
.menu-list { position: absolute; top: 100%; left: calc(12px + max(0px, (100% - 24px - 760px) / 2)); z-index: 2;
  width: max-content; max-width: calc(100vw - 24px); max-height: calc(100svh - 100%); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 2px; display: flex; flex-direction: column }
.menu-list a, .menu-list button { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 8px; border: 0;
  border-radius: 6px; background: transparent; color: var(--fg); text-align: left; text-decoration: none; font-size: .85rem; font-weight: 400 }
.menu-list a:hover, .menu-list button:hover { background: var(--sunk) }
.menu-list a[aria-current="page"] { color: var(--accent); background: var(--sunk) }
.menu-list form { margin: 0 }
.menu-sep { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 2px 0 }
/* desktop keeps its tab row, on its own line under the header row */
.tabs-desk { display: flex; gap: 4px; flex-wrap: wrap; flex: 1 0 100% }
.tabs-desk a, .tabbar a { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: var(--muted); font-weight: 600 }
/* IM #bottom button[aria-pressed=true] */
.tabs-desk a[aria-current="page"], .tabbar a[aria-current="page"] { color: var(--accent); background: var(--sunk) }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font-size: .8rem }
main { max-width: 760px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 96px max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px; background: var(--bg) }
/* the content column is IM's #app: --bg down to the bottom of the screen even on a short page, with no extra
   scroll. body is a flex column one small viewport high (svh: the iOS toolbars shown; no vh / dvh layout, owner 1126)
   and main takes the rest under the header */
body { display: flex; flex-direction: column; min-height: 100svh }
main { flex: 1 0 auto; width: 100% }
.note { font-size: .8rem; color: var(--muted); background: var(--sunk); border-radius: 8px; padding: 8px 10px }
.chips { display: flex; gap: 6px; flex-wrap: wrap }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 12px; font-size: .85rem; font-weight: 600; text-decoration: none; color: var(--fg) }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); border-color: var(--accent) }
.chip .n { font-family: var(--f-mono); font-size: .75rem; margin-left: 4px; opacity: .75 }
.search { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface) }
/* a .list holds row cards (or one empty-state note): they sit edge to edge, like IM's .ticket rows */
.list { display: flex; flex-direction: column; gap: 10px }
/* a queue card is an IM row (.ticket): no box, a line under it */
.card { background: var(--surface); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 9px 0; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px; text-align: left; width: 100%; color: var(--fg); text-decoration: none }
.card:hover { background: var(--sunk) }
/* the last row of a list inside a section leaves the line to the section (no double line) */

.card .name { font-weight: 600; min-width: 0; overflow-wrap: anywhere }
.card .meta { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); display: flex; gap: 4px 12px; flex-wrap: wrap; min-width: 0; overflow-wrap: anywhere }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; white-space: nowrap; align-self: start; justify-self: end }
/* status labels are coloured text, IM color-1..8 by the status number (main.py STATUS_CLASS, spec-im-exact 2.4) */
.st { display: inline-flex; align-items: center; white-space: nowrap; align-self: start; justify-self: end;
  background: transparent; padding: 0; font-weight: 600; font-size: .85rem; color: var(--fg) }
:is(.st, .status-text, .chip.status).n1 { color: #8FD1FF }
:is(.st, .status-text, .chip.status):is(.n2, .n4) { color: #FFDC87 }
:is(.st, .status-text, .chip.status).n3 { color: #FFC184 }
:is(.st, .status-text, .chip.status):is(.n5, .n9) { color: #83EDB3 }
:is(.st, .status-text, .chip.status).n8 { color: #FF9EAA }
:is(.st, .status-text, .chip.status).n6 { color: #FFFFFF }
:is(.st, .status-text, .chip.status).n7 { color: #FFA5A1 }
.g-open { color: var(--open); background: var(--open-bg) } .g-pend { color: var(--pend); background: var(--pend-bg) }
.g-res { color: var(--res); background: var(--res-bg) } .g-closed { color: var(--closed); background: var(--closed-bg) }
/* a section is an IM .section: no box, a line under it */
.panel { background: var(--surface); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 0; display: flex; flex-direction: column; gap: 10px; min-width: 0 }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
.spread { justify-content: space-between }
.fold > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; min-height: 44px }
.fold > summary::-webkit-details-marker { display: none }
.fold > summary h2::after { content: " ▸"; color: var(--muted) } .fold[open] > summary h2::after { content: " ▾" }
.fold .when-open { display: none } .fold[open] .when-open { display: inline } .fold[open] .when-closed { display: none }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 600; color: var(--fg); text-decoration: none }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent) }
.btn.next { background: var(--accent-soft); border-color: transparent }
.btn.cancel { color: var(--warn); border-color: var(--warn) }
.btn:disabled { opacity: .45; cursor: not-allowed }
.why { font-size: .78rem; color: var(--muted); display: block }
.move { display: flex; flex-direction: column; gap: 2px }
.lock { display: flex; gap: 8px; align-items: center; color: var(--pend); background: var(--pend-bg); border-radius: 10px; padding: 8px 10px; font-size: .85rem; font-weight: 600 }
.warnbox { color: var(--warn); background: var(--warn-bg); border-radius: 10px; padding: 8px 10px; font-size: .85rem; font-weight: 600 }
.flow { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; max-width: 100% }
.flow > span { font-size: .72rem; padding: 3px 8px; border-radius: 6px; background: var(--sunk); color: var(--muted); white-space: nowrap }
.flow > span.done { background: var(--accent-soft); color: var(--fg) }
.flow > span.now { background: var(--header); box-shadow: inset 0 -2px var(--accent) }
.service-detail-intro, .card.service-detail-parent { border: 1px solid var(--line); border-radius: 8px; background: var(--surface) }
.service-detail-intro { padding: 0 10px 10px; min-width: 0 }
.service-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px }
.service-detail-top a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none }
.service-detail-intro #ticket-title { align-items: baseline; gap: 4px 8px }
.service-detail-intro #ticket-title h1 { min-width: 0; overflow-wrap: anywhere }
.card.service-detail-parent { padding: 8px 10px; gap: 3px 8px }
.service-detail-flow { min-width: 0 }
.service-detail-flow > h2 { margin: 0 0 4px; font-size: 13px }
.service-detail-sections .ticket-section { padding: 8px 10px 10px }
.service-detail-sections .ticket-section > legend { color: var(--fg); font-size: 15px }
.flow.flow-install { gap: 0; scrollbar-width: thin; overscroll-behavior-inline: contain }
.flow-install > span { position: relative; flex: none; padding: 4px 8px 14px; background: transparent;
  border-radius: 0; font-size: .8125rem }
.flow-install > span:is(.done, .now) { background: transparent; box-shadow: none }
.flow-install > span::before { content: ""; position: absolute; inset: auto 0 4px; height: 2px; background: var(--line) }
.flow-install > span:is(.done, .now)::before { background: var(--accent) }
.flow-install > span.now::after { content: ""; position: absolute; bottom: 1px; left: 50%; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); transform: translateX(-50%) }
.flow-install > span.now { font-weight: 600 }
dl.fields { display: grid; grid-template-columns: minmax(120px, 38%) minmax(0, 1fr); gap: 6px 12px; margin: 0; font-size: .9rem }
dl.fields dt { color: var(--muted) } dl.fields dd { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap }
dl.fields dd.empty { color: var(--muted); opacity: .6 }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums }
.thread { display: flex; flex-direction: column; gap: 10px }
.post { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0 }
.post.sys { border-left-color: var(--accent) }
.post .who { font-size: .78rem; color: var(--muted) } .post .who b { color: var(--fg) }
.post .body { white-space: pre-wrap; overflow-wrap: anywhere }
.files { display: flex; gap: 6px; flex-wrap: wrap }
.thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--sunk) }
.pdf { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: .8rem; background: var(--sunk); overflow-wrap: anywhere }
.fsize { font-family: var(--f-mono); font-size: .7rem; color: var(--muted) }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; min-width: 0 }
label.f .req { color: var(--warn) }
label.f input, label.f select, label.f textarea { font-weight: 400; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); width: 100%; min-width: 0 }
label.f.bad input, label.f.bad select, label.f.bad textarea { border-color: var(--warn); background: var(--warn-bg) }
fieldset.f { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin: 0; min-width: 0; font-size: .85rem; font-weight: 600 }
fieldset.f.bad { border-color: var(--warn) }
fieldset.f label { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; margin: 4px 10px 4px 0 }
.err { color: var(--warn); font-size: .8rem; font-weight: 600 }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 10px }
.cal-day { display: flex; flex-direction: column; gap: 0 }
.cal-day h3 { font-size: .85rem; color: var(--muted); margin-bottom: 6px }
.appt { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px; align-items: center; color: var(--fg); text-decoration: none }
.appt .k { font-size: .75rem; font-weight: 700; border-radius: 6px; padding: 2px 8px }
.k-survey { background: var(--open-bg); color: var(--open) } .k-install { background: var(--res-bg); color: var(--res) }
.k-service { background: var(--pend-bg); color: var(--pend) }
.small { font-size: .8rem; color: var(--muted) }
table.users { width: 100%; border-collapse: collapse; font-size: .85rem }
table.users td, table.users th { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; vertical-align: top }
/* reports: wide tables scroll inside their own frame, never the page */
.tscroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch }
table.report { border-collapse: collapse; font-size: .82rem; min-width: 100% }
table.report th, table.report td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: right; white-space: nowrap }
table.report th[scope="row"], table.report thead th:first-child { text-align: left; position: sticky; left: 0; background: var(--surface) }
table.report thead th { font-size: .75rem; color: var(--muted); vertical-align: bottom; white-space: normal; min-width: 52px }
table.report tr.total th, table.report tr.total td { font-weight: 700 }
table.report a.cnt { display: inline-flex; align-items: center; justify-content: flex-end; min-width: 44px; min-height: 44px; font-weight: 700 }
.c-green { background: var(--res-bg); color: var(--res) } .c-yellow { background: var(--pend-bg); color: var(--pend) }
.c-red { background: var(--warn-bg); color: var(--warn) }
.c-green a, .c-yellow a, .c-red a { color: inherit }
.bars { display: flex; flex-direction: column; gap: 4px }
.bar { display: grid; grid-template-columns: minmax(0, 7em) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: .8rem }
.bar progress { width: 100%; height: 14px; accent-color: var(--accent) }
.card .why { color: var(--fg) }
body { container: app-layout / inline-size }
/* Set mobile_preview to false in base.html to restore the full-width layout. */
body.mobile-preview { --preview-width: 390px; max-width: var(--preview-width); margin-inline: auto }
body.mobile-preview .tabbar { max-width: var(--preview-width); margin-inline: auto }
.tabbar { display: none }
@container app-layout (max-width: 640px) {
  header.top:has(.hd-left) { padding-top: max(2px, env(safe-area-inset-top, 0px)); padding-bottom: 2px }
  .hd-left { display: grid; grid-template-columns: 44px minmax(0, 1fr); column-gap: 4px }
  .hd-row { display: contents }
  .hd-brand { grid-area: 1 / 2; align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
  .hd-title { grid-area: 2 / 2; align-self: start; font-size: 18px; line-height: 1.4 }
  .hd-left .menu { grid-area: 1 / 1 / 3 / 2 }
  .tabs-desk, .menu-list .also-in-tabbar { display: none }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--nav); border-top: 1px solid var(--line); justify-content: space-around;
    padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)) }
  .tabbar a { flex: 1; font-size: .85rem; text-align: center }
  dl.fields { grid-template-columns: minmax(0, 1fr) } dl.fields dd { margin-bottom: 6px }
  table.users, table.users tbody, table.users tr, table.users td { display: block; width: 100% }
  table.users thead { display: none }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important } }
.visually-hidden { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden }
.mt6 { margin-top: 6px } .mt8 { margin-top: 8px } .mt10 { margin-top: 10px } .mt12 { margin-top: 12px }
.grow { flex: 1 } .align-top { align-items: flex-start } .selfstart { align-self: flex-start }
label.f.inline { flex-direction: row; align-items: center } input.autow, label.f input.autow { width: auto }
[hidden] { display: none !important }
.pick { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; background: var(--sunk); max-width: 100%; overflow-wrap: anywhere; font-size: .8rem }
.pick .thumb { width: 72px; height: 72px }
/* the "ลบ" button sits on the pick's --sunk, where --line gives under 3:1 */
.pick .btn { border-color: var(--muted) }
.small-btn { padding: 2px 10px; font-size: .8rem }
/* the file inputs are visually hidden; their label buttons show the keyboard focus instead */
.visually-hidden:focus-visible + label.btn { outline: 2px solid var(--accent); outline-offset: 2px }
/* Owner 1126 (iOS and Android). Form text at least 16 px, or iOS zooms into every field;
   44x44 px touch targets for every button; the notch and the home bar keep their distance. */
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { font-size: max(16px, 1rem) }
button, .btn, label.btn, .linkbtn { min-height: 44px; min-width: 44px }
.btn, label.btn { display: inline-flex; align-items: center; justify-content: center }
.linkbtn { display: inline-flex; align-items: center }
.small-btn { min-height: 44px; min-width: 44px; padding: 2px 12px }
.tabbar a { min-height: 44px; min-width: 44px; display: flex; align-items: center; justify-content: center }
/* every other thing a finger presses: filter chips, the map link, cards */
a.chip, a.maplink { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center }
a.card { min-height: 44px }
header.top { padding-top: max(5px, env(safe-area-inset-top, 0px)) }
main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) }
/* the queue (owner Telegram 1281 D4 C, D6 B: the reference's behaviour in this site's look) */
.qsearch { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap }
.qsearch label.f.days { flex: 0 1 9.5em; min-width: 0 }
.qsearch label.f.grow { flex: 1 1 12em }
#design-search { display: grid; grid-template-columns: minmax(0, 1fr) minmax(76px, .55fr) auto }
#design-search > button { padding-inline: 8px; white-space: nowrap }
.qsec { display: flex; flex-direction: column; gap: 8px; min-width: 0 }
.qhead { font-size: 1rem }
.install-results .qhead, .service-results .qhead, #design-count { font-size: 15px }
.service-filters { display: flex; flex-wrap: nowrap; gap: 2px; width: 100% }
.service-filters > .chip { flex: 1 1 auto; justify-content: center; min-width: 0; padding-inline: 2px; font-size: 13px; white-space: nowrap }
.list > .card { gap: 3px 8px; align-items: baseline; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface) }
.list > .card:hover { background: var(--sunk) }
.service-card > .name, .service-card .service-ref { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.service-card .service-meta { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 6px; min-width: 0;
  color: var(--muted); font-size: .8rem }
.service-card .service-tech { flex: 0 1 auto; min-width: 0; max-width: 32%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.service-card .service-date { flex: none; margin-inline-start: auto; white-space: nowrap }
.qsearch:has(input[name="kind"][value="service"]) #q { width: 100%; min-width: 0 }
.report-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid #456459; margin-bottom: 10px }
.report-tabs > a { display: grid; place-items: center; min-height: 44px; text-align: center; white-space: nowrap; border-bottom: 2px solid transparent }
.report-tabs > a[aria-current="page"] { color: #8addc2; border-bottom-color: currentColor }
.qhead-with-status { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px }
.qhead-with-status > .status-text { margin-inline-start: auto; text-align: end }
.card .when { grid-column: 1 / -1; font-size: .85rem; font-weight: 600 }
/* a queue row (the qcard macro, the only .card with a .tel-r cell) is Ticket Codex's .ticket (docs/spec-im-header-row.md
   2.2): customer | appointment on line 1, created · number · status | phone on line 2. The other .card rows keep their
   layout. */
.card:has(> .tel-r), .dcard { gap: 3px 8px }
.card:has(> .tel-r) > .when { grid-column: auto; justify-self: end; text-align: right; white-space: nowrap; color: var(--muted) }
.card:has(> .tel-r) > .meta { grid-column: auto; display: block }
.card > .tel-r { justify-self: end; text-align: right; max-width: 11em; min-width: 0; overflow-wrap: anywhere; font-size: .8rem; color: var(--fg) }
.card > .extra { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); display: flex; gap: 4px 12px; flex-wrap: wrap; min-width: 0;
  overflow-wrap: anywhere }
.dcard .dcard-info { grid-column: 1 }
.dcard .dcard-install { grid-column: 2; justify-self: end; text-align: right }
/* Equal-width mobile tabs, including when permissions hide an item. */
@container app-layout (max-width: 640px) {
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; background: #15231b; border-top: 0; border-bottom: 2px solid #70957a; padding-top: 4px; padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
    padding-left: max(6px, env(safe-area-inset-left, 0px)); padding-right: max(6px, env(safe-area-inset-right, 0px)) }
  .tabbar a { flex-direction: column; gap: 2px; padding: 2px; font-size: 13px; line-height: 16px; min-width: 0;
    white-space: nowrap; overflow: hidden; color: #d5e4da; border: 1px solid transparent; border-bottom: 0; border-radius: 9px 9px 0 0; }
  .tabbar a[aria-current="page"] { background: #34503f; color: #f0fff4; border-color: #70957a; }
  .bottom-menu-icon { flex: none; }
  .tabbar a { font-family: system-ui, sans-serif; font-size: 13px; font-weight: 500; }
}
/* service tickets of a main ticket: one 🛠 button at the right end of the top row, its list opens under it
   (owner Telegram 1315/1317 B). No JavaScript: a <details>; the list overlays the content below it. */
.svc { position: relative; margin-left: auto }
.svc > summary { list-style: none; cursor: pointer; white-space: nowrap }
.svc > summary::-webkit-details-marker { display: none }
.svc > summary::marker { content: "" }
.svc-arrow::after { content: "▾" } .svc[open] .svc-arrow::after { content: "▴" }
.svc-pop { position: absolute; top: calc(100% + 4px); right: 0; z-index: 4; width: max-content;
  max-width: min(320px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5); padding: 6px; display: flex; flex-direction: column; gap: 4px }
.svc-row { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; border-radius: 8px;
  color: var(--fg); text-decoration: none; min-width: 0 }
.svc-row:hover { background: var(--sunk) }
.svc-txt { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.svc-row .st { align-self: center; flex: none }
/* IM theme (docs/spec-im-theme.md 3.4): readable placeholders and input borders, a mint focus ring.
   The status chips show the number only, in its colour (spec-im-exact 2.6, IM .bar .status) */
::placeholder { color: var(--muted); opacity: 1 }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0 }
/* one row of equal chips like IM's .bar; at 360 px a chip is under 44 px wide (the one owner-1126 exception), never
   under 44 px high */
.install-filter-label { font-size: 12px; line-height: 1.4; color: var(--muted); margin-bottom: 4px }
.chips.install-teams { flex-wrap: nowrap; gap: clamp(4px, 1.5cqi, 6px) }
.install-teams > a.chip { flex: 1 0 auto; min-width: 0; justify-content: center; padding: 4px;
  border-radius: 10px; white-space: nowrap; font-size: .8125rem; font-weight: 500; line-height: 1.2 }
.install-teams > a.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent) }
@container app-layout (max-width: 344px) {
  .chips.install-teams { gap: 4px }
  .install-teams > a.chip { padding-inline: 1px }
}
.chips.nums { display: flex; flex-wrap: nowrap; gap: 4px }
.chip.status { flex: 1; min-width: 0; justify-content: center; padding: 0 2px }
.chip.status[aria-pressed="true"] { background: var(--sunk); border-color: currentColor }
.service-results :is(.status-text, .chip.status).n8 { color: #83EDB3 }
:where(input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea) { border: 1px solid var(--line); background-color: var(--surface);
  border-radius: 8px }


.service-report-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px }
.service-report-totals > div { display: grid; gap: 4px; place-items: center; text-align: center; min-width: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 6px 2px; font-size: 13px }
.service-report-directions { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0 }
.service-report-directions > a { text-decoration: none }
.service-report-period { align-items: end }
.service-report-period .f { min-width: 0 }

.service-payroll { display: grid; gap: 10px; min-width: 0; width: 100%; font-size: 14px }
.service-report-period { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px }
.service-report-period :is(select, input) { width: 100%; min-width: 0; min-height: 44px; padding: 4px 8px; border-radius: 8px }
.service-report-period .service-report-month { grid-column: 1 / -1; grid-row: 2 }
.service-report-period:not(:has(option[value="month"]:checked)) .service-report-month { display: none }
.service-report-period .btn { padding-inline: 8px }
.service-report-totals-tech { grid-template-columns: repeat(3, minmax(0, 1fr)) }
.service-report-crew, .service-report-list { border: 1px solid var(--line); border-radius: 8px; padding: 8px }
.service-report-crew { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px }
.service-report-crew-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; width: 100%; font-size: 13px }
.service-report-crew-line + .service-report-crew-line { padding-top: 4px; border-top: 1px solid var(--line) }
.service-report-tech-card { margin-top: 10px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px }
.service-report-list h2, .service-report-list h3 { font-size: 15px }
.service-report-list h3 { text-align: center; padding: 6px 0 }
.service-report-list p { margin: 4px 0 }
.service-report-job, .cal-day .appt { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 10px }
.service-report-job + .service-report-job, .cal-day .appt + .appt { margin-top: 10px }
.service-report-job summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer }
.service-report-job summary span:first-child { min-width: 0; overflow-wrap: anywhere }
.service-report-job[open] summary { color: var(--accent) }
.service-report-job > a { display: inline-flex; align-items: center; min-height: 44px }

.service-report-period { grid-template-columns: auto minmax(0, 1fr) auto auto }
.service-report-range, .service-report-period > label, .service-report-totals span { color: #abc1ba }
.service-report-range { white-space: nowrap; font-size: 13px }
.service-report-totals > div { min-width: 0; align-content: space-between; background: var(--surface); border-color: #456459; padding: 7px 2px }
.service-report-totals:not(.service-report-totals-tech) > div:nth-child(3) strong,
.service-report-totals-tech > div:nth-child(2) strong { color: #ff9eaa }
.service-report-totals:not(.service-report-totals-tech) > div:last-child strong { color: #ffdc87 }
.service-report-totals-tech > div:last-child strong, .service-report-crew-line > :last-child { color: #8addc2 }
.service-report-crew, .service-report-list, .service-report-tech-card { border-color: #456459 }
.service-report-tech-card { background: var(--surface) }
.service-report-directions > a { color: #abc1ba; border-radius: 0 }
.service-report-directions > a[aria-current="page"] { color: #8addc2 }
.service-report-job .num { color: #8addc2 }
@media (max-width: 360px) { .service-report-range { grid-column: 1 / -1; justify-self: end } }


.service-report-period :is(select, .btn),
#service-payroll-preview .service-round select {
  box-sizing: border-box;
  height: 44px;
  min-height: 44px;
  margin-block: 0;
  padding-block: 0;
}
#service-payroll-preview .service-round select[hidden] { display: none; }
.ticket-section, fieldset.f, .service-report-crew, .service-report-list, .note, .pdf, .pick, .thumb { background-color: var(--surface) }
.panel:has(> .list) { background-color: var(--bg) }

.design-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; border-bottom: 1px solid var(--line) }
.design-tabs button { min-height: 44px; padding: 4px; font: inherit; color: var(--muted); background: transparent; border: 0; border-radius: 0; border-bottom: 2px solid transparent; cursor: pointer }
.design-tabs button[aria-pressed="true"] { color: var(--accent); border-bottom-color: currentColor; font-weight: 600 }
.install-round { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 14px }
.install-round select { width: auto; height: 44px; padding: 0 8px; font-size: 16px; border-radius: 8px }
.install-round span { margin-inline-start: auto; white-space: nowrap }
.install-job-cols, .install-job summary.install-job-cols { display: grid; grid-template-columns: .75fr .95fr .75fr 1fr .7fr .95fr; gap: 4px; align-items: center }
.install-job-cols > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.install-job-cols > * { text-align: center }
.install-job-cols.small { padding: 0 6px }
.install-job { padding: 3px 6px; font-size: 16px }
.approval-dot { display:inline-block; width:10px; height:10px; border-radius:50%; background:#9ca3af }
.approval-dot[aria-label="อนุมัติ"] { background:#4ade80 }
.approval-dot[aria-label="ไม่อนุมัติ"] { background:#f87171 }
.install-job .approved, .install-job button[aria-pressed="true"] { color: var(--accent) }
a.approval-ticket-link, .service-report-job > a.approval-ticket-link { display: flex; width: fit-content; margin: 6px 0 0 auto; align-items: center; min-height: 44px; color: var(--accent) }
.approval-actions, #service-payroll-preview .approval-actions { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px }
.approval-actions > a.approval-ticket-link { margin: 0 0 0 auto; min-width: 44px; justify-content: center }
.install-dot {display:inline-block;width:10px;height:10px;border-radius:50%;background:#9ca3af}
.install-dot.paid {background:#4ade80}
.install-dot.unpaid {background:#fb923c}
.install-account-meta {display:flex;align-items:center;gap:6px}

.service-payroll .service-report-crew-line, .service-payroll .service-report-job { text-align: center }
.service-payroll .service-report-job:not(.install-job) summary > span { flex: 1; text-align: center }

.payroll-crew-summary .service-report-crew-line { grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); }
.payroll-crew-summary .service-report-crew-line > :first-child { text-align: left; }
.payroll-crew-summary .service-report-crew-line > :last-child { text-align: right; }

.install-crew-group { min-inline-size:0; margin:10px 0; padding:4px 6px 8px; border:1px solid #456459; border-radius:8px; }
.install-crew-group > legend { margin-inline:auto; padding:0 8px; font-size:15px; font-weight:600; }

.new-ticket h1 { margin:0; font-size:18px }
.new-ticket > p { margin:2px 0 6px }
.new-ticket .panel { padding:8px }
.new-ticket .grid2 { grid-template-columns: repeat(2,minmax(0,1fr)); gap:6px 8px }
.new-ticket label.f { display:block; line-height:1.35 }
.new-ticket label.f :is(input,select,textarea) { display:block; margin-top:2px; min-height:42px; padding:6px 8px }
.new-ticket label:is([for="f_address"],[for="f_maps"],[for="f_survey_date"]) { grid-column:1/-1 }
.new-ticket label[for="f_estimate"] { grid-column:1/-1 }
.new-ticket .mt12 { margin-top:8px }
@media (min-width:480px) { .new-ticket label[for="f_estimate"],.new-ticket label[for="f_survey_date"] { grid-column:auto } }
@media (max-width:319px) { .new-ticket .grid2 { grid-template-columns:minmax(0,1fr) } }

.new-ticket .initial-note-card { margin-top:8px; padding:8px; background:var(--surface); border:1px solid var(--line); border-radius:8px }

#initial-note-dialog { box-sizing:border-box; width:min(96vw,560px); max-height:95dvh; padding:10px; border:1px solid var(--line); border-radius:10px; background:var(--surface); color:var(--fg); overflow:auto }
#initial-note-dialog::backdrop { background:rgb(0 0 0 / 65%) }
.initial-note-head { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:6px }
.initial-note-head h2 { font-size:18px; margin:0 }
#initial-note-editor { box-sizing:content-box; display:block; width:calc(100% - 18px); height:21em; min-height:21em; padding:8px; font-size:16px; line-height:1.4; border:1px solid var(--line); border-radius:6px; background:var(--bg); }

.new-map-field{grid-column:1/-1;min-width:0;font-size:.85rem}.new-map-row{display:flex;gap:6px;align-items:stretch}.new-map-row input{min-width:0;flex:1;padding:6px 8px;border-radius:8px}.new-map-field .req{color:var(--warn)}

.new-ticket .postcode-field{grid-column:1/-1;display:grid;grid-template-columns:minmax(90px,1fr) minmax(0,2fr);gap:2px 6px}.new-ticket #postcode-choice[hidden]{display:none}.postcode-field small{grid-column:1/-1}.postcode-field small:empty{display:none}

#postcode-area{display:block;width:100%;min-height:42px;margin-top:2px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#postcode-dialog{width:min(94vw,430px);max-height:78dvh;overflow:auto;padding:12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--fg)}#postcode-dialog::backdrop{background:#0009}#postcode-options{display:grid;gap:5px}#postcode-options button{min-height:44px;text-align:left}

.new-ticket .new-address-card{grid-column:1/-1;min-width:0;margin:2px 0;padding:4px 8px 8px;border:1px solid var(--line);border-radius:8px;background:var(--surface)}.new-address-card legend{padding:0 5px;font-weight:600}.new-address-card .postcode-field{margin-bottom:6px}

.service-create { max-width:600px; margin-inline:auto }
.service-create-head,.service-source summary { display:flex; justify-content:space-between; align-items:center; gap:10px }
.service-create-head h1 { font-size:18px; margin:0 }
.service-create-head a,.service-source summary span { font-size:13px }
.service-source,.service-create fieldset { margin:10px 0; min-width:0; padding:8px 10px; border:1px solid #385046; border-radius:9px; background:#14241e }
.service-source summary { cursor:pointer; min-height:32px }
.service-source summary strong { overflow-wrap:anywhere }
.service-source summary span { white-space:nowrap; color:var(--accent) }
.service-source[open] summary { margin-bottom:6px }
.service-source > div { overflow-wrap:anywhere; white-space:pre-line }
.service-create legend { padding:0 5px; font-size:15px; font-weight:600 }
.service-create-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px 8px }
.service-create-grid label.f { display:block }
.service-create-grid label.f :is(input,select,textarea) { display:block; min-height:44px; margin-top:3px; padding:6px 8px }
.service-create-grid label:is([for=f_svc_problem],[for=f_svc_date],[for=f_svc_warranty]) { grid-column:1/-1 }
.service-create-actions { display:grid; grid-template-columns:1fr 2fr; gap:8px; margin-block:10px }
.service-create-actions > * { justify-content:center; text-align:center; min-height:44px }
@media(max-width:330px){.service-create-grid{grid-template-columns:minmax(0,1fr)}}

.service-create .warranty-grid{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}.service-create .warranty-grid label[for=f_svc_warranty]{grid-column:auto}.warranty-value{display:grid;gap:4px;font-size:15px}.warranty-value small{color:var(--muted);font-size:13px}

#warranty-hint {font-size:13px;white-space:nowrap}#warranty-hint.warranty-active {color:#4ade80}#warranty-hint.warranty-expired {color:#f87171}

.install-team-picker {grid-column:1/-1;min-width:0;margin:4px 0;padding:8px 12px 12px;border:1px solid var(--line);border-radius:10px;background:#14241e}
.install-team-picker legend {padding:0 5px;font-weight:600}
.team-count {display:grid;grid-template-columns:repeat(4,1fr);background:#0e1310;border-radius:8px;padding:3px;gap:3px}
.team-count label {position:relative;cursor:pointer}
.team-count input {position:absolute;opacity:0;width:1px;height:1px}
.team-count span {display:grid;place-items:center;min-height:36px;font-size:14px;border-radius:6px}
.team-count input:checked + span {background:#a3ddba;color:#12251a;font-weight:600}
.team-count input:focus-visible + span {outline:2px solid currentColor;outline-offset:-3px}
.team-choice {display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:12px;margin-top:8px;font-size:14px}
.team-choice[hidden] {display:none}
.team-choice select {width:100%;min-height:40px}

.inline-team-approval{display:grid;width:100%;min-width:0;gap:6px;margin-bottom:8px}.inline-team-approval .btn{justify-self:end}

#payroll .install-pay-decision{display:flex;flex-wrap:nowrap;align-items:center;gap:6px}#payroll .install-pay-decision .btn{white-space:nowrap}#payroll .decision-result{margin-inline-start:auto;align-self:flex-end;text-align:right;font-size:13px;line-height:1.25}

#change-team .team-options,#change-team .change-team-details{border:0;margin:0;padding:0;min-width:0}
#change-team .team-options{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}
#change-team .team-options legend{padding:0;margin-bottom:4px;font-size:14px}
#change-team .team-chip{position:relative;cursor:pointer}
#change-team .team-chip input{position:absolute;opacity:0;width:1px;height:1px}
#change-team .team-chip span{display:grid;place-items:center;min-height:38px;padding:0 12px;border:1px solid var(--line);border-radius:7px;background:#0e1310;font-size:14px}
#change-team .team-chip input:checked+span{background:#a3ddba;color:#12251a;border-color:#a3ddba;font-weight:600}
#change-team .team-chip input:focus-visible+span{outline:2px solid currentColor;outline-offset:2px}
#change-team [hidden]{display:none}
.service-team-assignment > .install-team-picker, .inline-team-approval > .install-team-picker, #change-team.ticket-section, #payroll.ticket-section { border-color: #A493B8 }
.install-preview-nav > :is(.small, a) { color: #A493B8 }
#payroll .company-share { font-size: 13px }
.service-team-assignment .install-team-picker > button[type="submit"] { margin-block: 10px 2px; }
#payroll #ticket-labor-fee + .install-pay-decision { margin-block-start: 10px; }
#payroll .deduction-heading { margin-block: 12px 8px; }
#payroll .service-fee-field { display: inline-flex; align-items: center; gap: 12px; }
#payroll .service-fee-field input { box-sizing: border-box; width: 8ch; min-width: 0; }
#payroll .decision-positive { color: #86d9aa; }
#payroll .decision-negative { color: #ff7878; }
#payroll .decision-pending { color: var(--muted); }
.card.standalone-service-card, .service-detail-intro.standalone-service-card, .btn.primary.standalone-service-link { background-color: #182A36; border: 1px solid #436176; }
.btn.primary.standalone-service-link { color: #edf4ef; border-color: #83aac0; box-shadow: 0 0 4px #8dcdf32b; }
.btn.standalone-service-link { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.svc > .svc-btn { border: 1px solid #86D9AA; box-shadow: 0 0 4px #86D9AA40; }
.list > .card.standalone-service-card:hover { background-color: #223847; }
.btn.primary.standalone-service-link:hover, .btn.primary.standalone-service-link:active { background-color: #223847; }
.svc > .svc-btn:hover, .svc > .svc-btn:active { background-color: var(--sunk); }
.install-preview-nav { display:flex; align-items:baseline; gap:8px; margin-inline-start:8px; white-space:nowrap; font-size:14px; }
@container app-layout (max-width:640px) { .hd-left:has(.install-preview-nav) { grid-template-columns:44px auto minmax(0,1fr); } .hd-left:has(.install-preview-nav) .hd-brand { grid-column:2 / 4; } .install-preview-nav { grid-area:2 / 3; align-self:center; margin-inline-start:2px; } }
.hd-row > .install-preview-nav { flex: 1; justify-content: center; margin-inline-start: 0; }
main:has(.install-results) {
  background-image: url("install-diagonal.svg");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% 100%;
  background-attachment: scroll;
}

.install-payroll .service-report-totals span { font-size: 14px }
.install-payroll .service-report-totals strong,
.install-payroll .service-report-crew-line { font-size: 15px }
.install-payroll .install-job,
.install-payroll .install-round select { font-size: 16px }
