/* QLH-PMS app styles — design team skin over the screens' shared markup (core.js helpers).
   Tokens: web/tokens.css. Component classes for new markup: web/design/qlh.css. Keep selectors stable: tests and screens rely on them. */
* { box-sizing: border-box; }
html { --accent: var(--primary); }
body { margin: 0; font-family: var(--font-sans); font-size: 14px; line-height: 20px; color: var(--ink); background: var(--surface-0); -webkit-font-smoothing: antialiased; }
a { color: var(--link); }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--ink-inverse); padding: var(--space-2) var(--space-3); z-index: 100; border-radius: var(--radius-md); }
.skip:focus { left: var(--space-2); top: var(--space-2); }

/* ---- Shell ------------------------------------------------------------------------------------------------------ */
.top { display: flex; align-items: center; gap: var(--space-3); min-height: calc(var(--shell-bar) + var(--shell-band)); padding: var(--shell-band) var(--space-4) 0; background: var(--surface-1); color: var(--ink); border-bottom: 1px solid var(--line); box-shadow: inset 0 var(--shell-band) 0 var(--accent); flex-wrap: wrap; position: relative; z-index: var(--z-shell); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: 15px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand::before { content: "QLH" / ""; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--primary); color: var(--ink-inverse); font: 700 10px/1 var(--font-mono); letter-spacing: .02em; }
.brand:hover { color: var(--ink); }
#context { display: flex; align-items: center; gap: var(--space-3); min-width: 0; flex-wrap: wrap; }
#context:empty { display: none; }
.ctx-hotel { display: inline-flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-3) 0 var(--space-2); border: 1px solid var(--line-strong); border-radius: var(--radius-md); color: var(--ink); text-decoration: none; font-weight: 600; max-width: 280px; }
.ctx-hotel:hover { background: var(--surface-2); color: var(--ink); }
.ctx-dot { width: 22px; height: 22px; border-radius: var(--radius-pill); background: var(--accent); flex: none; }
.ctx-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-date { display: flex; flex-direction: column; line-height: 16px; padding-left: var(--space-3); border-left: 1px solid var(--line); white-space: nowrap; }
.ctx-date span:first-child { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-subtle); }
.ctx-date span:last-child { font-weight: 600; font-family: var(--font-mono); font-size: 13px; }
#account { margin-left: auto; display: flex; gap: var(--space-3); align-items: center; font-size: 13px; flex-wrap: wrap; }
#account .who { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; }
#account .who::before { content: attr(data-initials) / ""; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius-pill); background: var(--surface-3); font-size: 11px; font-weight: 600; }
.top a, .top button.link { color: var(--link); }
.top .muted { color: var(--ink-subtle); }

.layout { display: flex; min-height: calc(100vh - 59px); }
#side { width: var(--nav-width); flex: none; background: var(--surface-1); border-right: 1px solid var(--line); padding: var(--space-3) var(--space-2); }
#side:empty { display: none; }
#side p { margin: 0 var(--space-2) var(--space-2); }
#side p:first-child a { font-size: 13px; text-decoration: none; }
#side p strong { display: block; font-size: 15px; padding-top: var(--space-1); }
#side h2 { font-size: 11px; line-height: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-subtle); margin: var(--space-4) var(--space-3) var(--space-1); }
#side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
#side a { display: flex; align-items: center; min-height: 36px; padding: 0 var(--space-3); border-radius: var(--radius-md); text-decoration: none; color: var(--ink-muted); font-weight: 500; }
#side a:hover { background: var(--surface-2); color: var(--ink); }
#side a[aria-current="page"] { background: var(--primary-tint); color: var(--primary); font-weight: 600; }
main { flex: 1; padding: var(--space-5) var(--space-8) var(--space-8); min-width: 0; max-width: 1600px; }
main:focus { outline: none; }
main > * + * { margin-top: var(--space-4); }

/* ---- Type ------------------------------------------------------------------------------------------------------- */
h1 { font-size: 20px; line-height: 26px; font-weight: 600; margin: 0 0 var(--space-1); display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
h1 + p { margin-top: 0; }
h2 { font-size: 16px; line-height: 22px; font-weight: 600; margin: var(--space-6) 0 var(--space-2); }
h3 { font-size: 14px; line-height: 20px; font-weight: 600; margin: var(--space-4) 0 var(--space-2); }
p { margin: 0 0 var(--space-2); }
.muted { color: var(--ink-muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hint { font-weight: 400; color: var(--ink-subtle); font-size: 12px; line-height: 16px; }

/* ---- Panels, forms ---------------------------------------------------------------------------------------------- */
.card, form.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: var(--space-4); margin: var(--space-3) 0; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4) var(--space-4); min-width: 0; }
legend { font-size: 16px; line-height: 22px; font-weight: 600; margin-bottom: var(--space-3); padding: 0; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: var(--space-2); font-weight: 400; color: var(--ink); align-self: end; min-height: 36px; flex-wrap: wrap; }
label.check .hint { flex-basis: 100%; }
input, select, textarea { font: 400 14px/20px var(--font-sans); min-height: var(--control-md); padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); color: var(--ink); width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--primary); }
input[type="color"] { padding: 2px; width: 64px; }
input[type="file"] { padding: 6px var(--space-2); background: var(--surface-2); }
input[type="number"], input[type="date"], input[type="time"] { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
select[multiple] { padding: var(--space-1); min-height: 96px; }
textarea { min-height: 72px; padding: var(--space-2) var(--space-3); resize: vertical; grid-column: 1 / -1; }
label:has(textarea) { grid-column: 1 / -1; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
input[aria-invalid="true"] { border-color: var(--danger); }
input[readonly] { background: var(--surface-2); }

/* ---- Buttons ---------------------------------------------------------------------------------------------------- */
button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); font: 600 14px/20px var(--font-sans); min-height: var(--control-md); padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--primary); background: var(--primary); color: var(--ink-inverse); cursor: pointer; white-space: nowrap; }
button:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
button.secondary { background: var(--surface-1); color: var(--ink); border-color: var(--line-strong); }
button.secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-strong); }
button.danger { background: var(--danger); border-color: var(--danger); color: var(--ink-inverse); }
button.danger:hover:not(:disabled) { background: var(--danger-hover); border-color: var(--danger-hover); }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover:not(:disabled) { background: none; color: var(--primary-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
td button { min-height: var(--control-sm); padding: 0 var(--space-3); font-size: 13px; }
.actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; margin-top: var(--space-4); }
.card .actions { padding-top: var(--space-4); border-top: 1px solid var(--line); }

/* ---- Tables ----------------------------------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); margin: var(--space-2) 0; }
.card .table-wrap { box-shadow: none; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; margin: 0; }
caption { caption-side: top; text-align: left; padding: var(--space-3) var(--space-3) var(--space-2); font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-muted); }
th, td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { background: var(--surface-2); color: var(--ink-muted); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
tbody th { font-weight: 600; background: var(--surface-1); }
td { height: 44px; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover > td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
thead th.num { font-family: var(--font-sans); }
td a { font-weight: 600; }

/* ---- Feedback --------------------------------------------------------------------------------------------------- */
.alert { display: block; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); margin: var(--space-2) 0; border: 0; font-size: 14px; }
.alert ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); }
.alert.error { color: var(--danger); background: var(--danger-bg); font-weight: 600; }
.alert.error li { font-weight: 400; }
.alert.ok { color: var(--success-fg); background: var(--success-bg); }
.alert.warn { color: var(--warning-fg); background: var(--warning-bg); }
.toast { position: fixed; bottom: var(--space-6); right: var(--space-6); max-width: 440px; z-index: var(--z-toast); }
.toast:not(:empty) { background: var(--ink); color: var(--surface-1); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); box-shadow: var(--shadow-2); font-weight: 500; }

/* Status as chips: tinted fill + the word (never colour alone). */
.badge, [class^="st-"], [class*=" st-"] { display: inline-flex; align-items: center; height: 24px; padding: 0 var(--space-2); border-radius: var(--radius-sm); font-size: 12px; line-height: 16px; font-weight: 600; text-transform: capitalize; white-space: nowrap; border: 0; vertical-align: middle; }
h1 .badge { font-size: 12px; }
.badge.setup { background: var(--warning-bg); color: var(--warning-fg); }
.badge.live { background: var(--success-bg); color: var(--success-fg); }
.badge.retired { background: var(--surface-2); color: var(--ink-muted); }
.st-dirty { background: var(--hk-dirty-bg); color: var(--hk-dirty-fg); }
.st-clean { background: var(--hk-clean-bg); color: var(--hk-clean-fg); }
.st-inspected { background: var(--hk-inspected-bg); color: var(--hk-inspected-fg); }
.st-ooo { background: var(--hk-ooo-bg); color: var(--hk-ooo-fg); }

/* ---- Setup checklist -------------------------------------------------------------------------------------------- */
.progress { display: flex; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-2); }
.progress .bar { flex: 1; max-width: 360px; height: 8px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.progress .bar > span { display: block; height: 100%; background: var(--success-fg); border-radius: inherit; }
.progress .count { color: var(--ink-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.checklist { list-style: none; margin: 0; padding: 0; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); overflow: hidden; counter-reset: step; }
.checklist li { counter-increment: step; display: grid; grid-template-columns: 32px 1fr; column-gap: var(--space-3); align-items: center; margin: 0; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { content: counter(step); grid-row: span 2; width: 28px; height: 28px; border-radius: var(--radius-pill); display: grid; place-items: center; font: 600 12px/1 var(--font-mono); border: 2px solid var(--line-strong); color: var(--ink-muted); background: var(--surface-1); }
.checklist li.done::before { content: "✓"; background: var(--success-fg); border-color: var(--success-fg); color: var(--surface-1); }
.checklist li.next { background: var(--primary-tint); }
.checklist li.next::before { border-color: var(--primary); color: var(--primary); }
.checklist .step-title { font-weight: 600; }
.checklist .step-meta { font-size: 13px; color: var(--ink-subtle); }

/* ---- Page sections ---------------------------------------------------------------------------------------------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: var(--space-6); align-items: start; }
.split > * { margin-top: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); margin: var(--space-3) 0; padding: 0; list-style: none; }
.tile { display: flex; flex-direction: column; gap: var(--space-2); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.tile::before { content: ""; height: 6px; background: var(--tile-accent, var(--primary)); }
.tile > * { margin: 0 var(--space-4); }
.tile > :last-child { margin-bottom: var(--space-4); }
.tile h2 { margin-top: var(--space-1); font-size: 16px; display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }
.tile h2 a { color: var(--ink); text-decoration: none; }
.tile h2 a:hover { text-decoration: underline; }
.tile dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); margin-top: 0; }
.tile dt { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-subtle); }
.tile dd { margin: 0; font-weight: 600; }
.tile dl > div:nth-child(3) { grid-column: 1 / -1; }
.org-links { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.org-links a { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--space-3); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-1); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13px; }
.org-links a:hover { background: var(--surface-2); }
.logo { max-height: 60px; }

/* ---- Rate calendar grid ----------------------------------------------------------------------------------------- */
.grid td, .grid th { white-space: nowrap; }
.grid thead th { position: sticky; top: 0; z-index: var(--z-sticky); }
.grid tbody th { position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--line); }
.grid td { padding: var(--space-1) var(--space-2); height: 52px; }
.grid input.cell { width: 6.5rem; min-height: var(--control-sm); text-align: right; padding: 0 var(--space-2); }
.grid .hint { display: block; font-size: 11px; color: var(--warning-fg); font-weight: 600; }
.grid td.none { background: var(--danger-bg); color: var(--danger); font-weight: 600; }

/* ---- 0.3 operations --------------------------------------------------------------------------------------------- */
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-6); margin: 0 0 var(--space-4); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); }
dl.facts dt { font-weight: 600; color: var(--ink-muted); font-size: 13px; }
dl.facts dd { margin: 0; font-weight: 600; }
nav.filters { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0 0 var(--space-4); border-bottom: 1px solid var(--line); }
nav.filters a { display: inline-flex; align-items: center; height: 40px; padding: 0 var(--space-3); text-decoration: none; color: var(--ink-muted); font-weight: 600; position: relative; }
nav.filters a[aria-current="page"] { color: var(--ink); }
nav.filters a[aria-current="page"]::after { content: ""; position: absolute; left: var(--space-2); right: var(--space-2); bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
ul.hk-board { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: var(--space-3); }
li.hk { border: 0; border-radius: var(--radius-lg); padding: var(--space-3); background: var(--surface-1); box-shadow: inset 0 0 0 1px var(--line); }
li.hk.dirty { background: var(--hk-dirty-bg); color: var(--hk-dirty-fg); box-shadow: none; }
li.hk.clean { background: var(--hk-clean-bg); color: var(--hk-clean-fg); box-shadow: none; }
li.hk.inspected { background: var(--hk-inspected-bg); color: var(--hk-inspected-fg); box-shadow: none; }
li.hk h2 { margin: 0 0 var(--space-1); font: 600 20px/24px var(--font-mono); color: inherit; }
li.hk p { color: inherit; }
li.hk .actions { margin-top: var(--space-2); }
li.hk .actions button { min-height: var(--control-lg); }
.hk-board .card { margin: 0; }

/* ---- Responsive, print ------------------------------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  main { padding: var(--space-4); }
}
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  #side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: var(--space-1) var(--space-2); }
  #side > div { display: flex; align-items: center; gap: var(--space-1); overflow-x: auto; white-space: nowrap; }
  #side > div > p { margin: 0 var(--space-2) 0 0; flex: none; }
  #side > div > p:nth-of-type(2), #side h2 { display: none; }
  #side ul { flex-direction: row; flex: none; }
  .brand { font-size: 0; gap: 0; }
  .ctx-date { display: none; }
  #account .who span { display: none; }
  fieldset { grid-template-columns: 1fr; }
  main { padding: var(--space-4); }
  .toast { left: var(--space-3); right: var(--space-3); bottom: var(--space-3); max-width: none; }
}
@media print {
  .top, #side, .actions, .skip, .toast { display: none !important; }
  main { padding: 0; }
  body { background: #ffffff; }
}
