/* Briefsketch design system: components. Plain CSS classes over tokens.css, prefix bk-, no script. Copied from the
   Briefsketch (Design System) artifact (Spec G); class names stay as designed so the mocks and the code compare. */

body { margin: 0; font-family: var(--font-sans); background: var(--page); color: var(--ink); -webkit-font-smoothing: antialiased; }
.bk { font-family: var(--font-sans); color: var(--ink); font-size: 16px; line-height: 24px; }
.bk *, .bk *::before, .bk *::after { box-sizing: border-box; }
.bk svg.bk-i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bk-row-preview { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; padding: var(--space-5); }
.bk-stack-preview { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); max-width: 520px; }

/* Button */
.bk-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control); padding: 0 var(--space-5); border: 0; border-radius: var(--radius-md); background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); font: inherit; font-size: 16px; line-height: 20px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; transition: transform 80ms ease-out, box-shadow 80ms ease-out, background-color 120ms; }
.bk-btn:hover { background: var(--sunk); }
.bk-btn-primary { background: var(--brick); color: var(--on-brick); box-shadow: var(--shadow-press); }
.bk-btn-primary:hover { background: var(--brick-strong); }
.bk-btn-primary:active { transform: translateY(2px); box-shadow: none; }
.bk-btn-quiet { background: transparent; box-shadow: none; }
.bk-btn-quiet:hover { background: var(--sunk); }
.bk-btn-danger { color: var(--danger-text); box-shadow: inset 0 0 0 2px var(--danger); }
.bk-btn-danger-strong { background: var(--danger); color: var(--on-brick); box-shadow: var(--shadow-press); }
.bk-btn-danger-strong:hover { background: var(--danger-text); }
.bk-btn-danger-strong:active { transform: translateY(2px); box-shadow: none; }
.bk-btn-sm { height: var(--control-sm); padding: 0 var(--space-4); font-size: 15px; }
.bk-btn-block { display: flex; width: 100%; }
.bk-btn-icon { width: var(--control); padding: 0; }
.bk-btn-sm.bk-btn-icon { width: var(--control-sm); }
.bk-btn:focus-visible, .bk-ctl:focus-visible, .bk-floor:focus-visible, .bk-row:focus-visible, .bk-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bk-btn[disabled], .bk-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.bk-link { color: var(--brick-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }

/* Field */
.bk-field { display: flex; flex-direction: column; gap: var(--space-2); }
.bk-label { font-size: 14px; line-height: 18px; font-weight: 700; color: var(--ink); }
.bk-input { width: 100%; height: var(--control); padding: 0 var(--space-4); border: 2px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.bk-input::placeholder { color: var(--muted); }
.bk-input:focus { outline: none; border-color: var(--brick); box-shadow: 0 0 0 4px var(--brick-soft); }
.bk-hint { margin: 0; font-size: 14px; line-height: 20px; color: var(--muted); }
.bk-error { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--danger-text); }
.bk-field-invalid .bk-input { border-color: var(--danger); }
.bk-copy { display: flex; gap: var(--space-2); }
.bk-copy .bk-input { font-family: var(--font-mono); font-size: 14px; background: var(--sunk); border-color: var(--line); }

/* Card */
.bk-card { background: var(--surface); border-radius: var(--radius-lg); padding: var(--space-5) var(--space-6); box-shadow: var(--shadow-raised); display: flex; flex-direction: column; gap: var(--space-3); }
.bk-card-title { margin: 0; font-size: 18px; line-height: 24px; font-weight: 700; }
.bk-card-text { margin: 0; color: var(--muted); }
.bk-card-media { margin: calc(var(--space-5) * -1) calc(var(--space-6) * -1) 0; aspect-ratio: 16 / 10; background: var(--ground); border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; }
.bk-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
a.bk-card { color: inherit; text-decoration: none; transition: transform 120ms ease-out; }
a.bk-card:hover { transform: translateY(-2px); }

/* List row */
.bk-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-raised); overflow: hidden; }
.bk-list > li + li { border-top: 1px solid var(--line); }
.bk-row { display: flex; align-items: center; gap: var(--space-4); min-height: 72px; padding: var(--space-3) var(--space-5); color: inherit; text-decoration: none; }
a.bk-row:hover { background: var(--sunk); }
.bk-row-media { flex: none; width: 64px; height: 48px; border-radius: var(--radius-sm); background: var(--ground); overflow: hidden; }
.bk-row-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bk-row-title { font-size: 16px; line-height: 22px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-row-meta { font-size: 14px; line-height: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bk-row-trail { flex: none; display: flex; align-items: center; gap: var(--space-2); color: var(--muted); }

/* Notice */
.bk-notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-4) var(--space-5); border-radius: var(--radius-lg); background: var(--sunk); color: var(--ink); font-size: 15px; line-height: 22px; }
.bk-notice p { margin: 0; }
.bk-notice b { font-weight: 700; }
.bk-notice svg.bk-i { margin-top: 1px; }
.bk-notice-new { background: var(--mustard-soft); color: var(--ink); }
.bk-notice-new svg.bk-i { color: var(--mustard-text); }
.bk-notice-success { background: var(--sage-soft); color: var(--sage-text); }
.bk-notice-danger { background: var(--danger-soft); color: var(--danger-text); }
.bk-toast { display: inline-flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: var(--space-2) var(--space-5) var(--space-2) var(--space-3); border-radius: var(--radius-pill); background: var(--ink); color: var(--page); font-size: 16px; line-height: 20px; font-weight: 600; box-shadow: var(--shadow-float); }
.bk-toast-brick { flex: none; width: 26px; height: 14px; border-radius: 4px; background: var(--mustard); }
.bk-toast-action { color: var(--page); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* Panel */
.bk-panel { width: var(--panel-width); max-width: 100%; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-float); display: flex; flex-direction: column; overflow: hidden; }
.bk-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 64px; padding: var(--space-2) var(--space-3) var(--space-2) var(--space-6); border-bottom: 1px solid var(--line); }
.bk-panel-title { margin: 0; font-size: 18px; line-height: 24px; font-weight: 800; }
.bk-panel-body { padding: var(--space-5) var(--space-6) var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.bk-panel-sheet { width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
.bk-grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: var(--space-2) auto 0; }

/* Floating control group */
.bk-controls { display: inline-flex; align-items: center; gap: var(--space-1); padding: 6px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); }
.bk-ctl { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control); min-width: var(--control); padding: 0 var(--space-4); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink); font: inherit; font-size: 15px; line-height: 20px; font-weight: 700; cursor: pointer; }
.bk-ctl:hover { background: var(--sunk); }
.bk-ctl[aria-pressed="true"] { background: var(--ink); color: var(--page); }
.bk-ctl-icon { padding: 0; }
.bk-ctl-sep { width: 2px; height: 28px; margin: 0 var(--space-1); border-radius: 2px; background: var(--line); }
.bk-floors { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.bk-floor { position: relative; width: 132px; height: var(--control); border: 0; border-radius: var(--radius-md); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; line-height: 20px; font-weight: 700; box-shadow: var(--shadow-edge); cursor: pointer; transition: transform 80ms ease-out, box-shadow 80ms ease-out; }
.bk-floor-bond { margin-right: 14px; }
.bk-floor:hover { background: var(--sunk); }
.bk-floor[aria-pressed="true"] { background: var(--brick); color: var(--on-brick); box-shadow: var(--shadow-press); }
.bk-floor:active { transform: translateY(2px); box-shadow: none; }
.bk-floor-new::after { content: ""; position: absolute; top: -4px; right: -4px; width: 14px; height: 10px; border-radius: 3px; background: var(--mustard); box-shadow: 0 0 0 2px var(--surface); }
.bk-floor-all { width: 146px; margin-top: var(--space-2); background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
.bk-floor-all[aria-pressed="true"] { background: var(--ink); color: var(--page); box-shadow: none; }

/* Room label (viewer) */
.bk-room { display: inline-flex; align-items: center; height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); font-size: 14px; line-height: 18px; font-weight: 700; white-space: nowrap; box-shadow: 0 2px 8px rgba(120,60,30,0.18); }
.bk-room-sm { height: 24px; padding: 0 var(--space-2); font-size: 12px; line-height: 16px; }
.bk-room-new { background: var(--mustard); color: var(--on-mustard); box-shadow: 0 0 0 6px rgba(217,167,56,0.30), 0 2px 8px rgba(120,60,30,0.18); }

/* Status badge */
.bk-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--sunk); color: var(--ink); font-size: 13px; line-height: 16px; font-weight: 700; white-space: nowrap; }
.bk-badge::before { content: ""; width: 8px; height: 6px; border-radius: 2px; background: currentColor; }
.bk-badge-pending { background: var(--mustard-soft); color: var(--mustard-text); }
.bk-badge-approved { background: var(--sage-soft); color: var(--sage-text); }
.bk-badge-rejected { background: var(--danger-soft); color: var(--danger-text); }
.bk-badge-flagged { background: var(--brick-soft); color: var(--brick-soft-text); }
.bk-badge-new { background: var(--mustard); color: var(--on-mustard); }

/* Empty state */
.bk-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); max-width: 420px; margin: 0 auto; padding: var(--space-10) var(--space-6); }
.bk-empty-art { width: 112px; height: 80px; margin-bottom: var(--space-2); }
.bk-empty-title { margin: 0; font-size: 24px; line-height: 28px; font-weight: 800; letter-spacing: -0.01em; }
.bk-empty-text { margin: 0; color: var(--muted); }
.bk-prompt { display: flex; align-items: center; gap: var(--space-3); width: 100%; margin-top: var(--space-2); padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4); border: 2px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--surface); text-align: left; font-size: 15px; line-height: 22px; }
.bk-prompt q { flex: 1; quotes: "\201C" "\201D"; }

/* Text page template */
.bk-page { min-height: 100%; background: var(--page); }
.bk-page-main { max-width: var(--column); margin: 0 auto; padding: var(--space-12) var(--space-5) var(--space-16); display: flex; flex-direction: column; gap: var(--space-6); }
.bk-page-brand { display: inline-flex; align-self: flex-start; }
.bk-page-brand img { height: 28px; width: auto; display: block; }
.bk-page h1 { margin: var(--space-6) 0 0; font-size: 32px; line-height: 36px; font-weight: 800; letter-spacing: -0.02em; }
.bk-page-lede { margin: 0; font-size: 18px; line-height: 26px; color: var(--muted); }
.bk-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.bk-fine { margin: 0; font-size: 14px; line-height: 20px; color: var(--muted); }
.bk-page-foot { margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: 14px; color: var(--muted); }
.bk-page-foot a { color: var(--muted); }
@media (max-width: 600px) { .bk-page-main { padding-top: var(--space-8); } .bk-page h1 { font-size: 28px; line-height: 32px; } }

/* Theme helpers for the previews */
.bk-logo-dark { display: none; }
[data-theme="dark"] .bk-logo-light { display: none; }
[data-theme="dark"] .bk-logo-dark { display: block; }

/* Language switcher (bk-lang, Spec H1 and H8). One select-style control on every page: a trigger that names the
   language you are reading in, and a list of links, each language in its own name. Built on <details>, so the
   Worker's pages switch with no script; the viewer adds keys, outside taps and switching in place. */
.bk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bk-lang-wrap { position: relative; display: inline-flex; }
.bk-lang { display: inline-flex; align-items: center; gap: var(--space-2); height: var(--control-sm); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--ink); font: inherit; font-size: 15px; line-height: 20px; font-weight: 700; white-space: nowrap; cursor: pointer; text-decoration: none; }
.bk-lang:hover { background: var(--sunk); }
.bk-lang[aria-expanded="true"] { background: var(--sunk); box-shadow: inset 0 0 0 2px var(--line-strong); }
.bk-lang:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bk .bk-lang svg.bk-lang-chev { width: 16px; height: 16px; color: var(--muted); }
.bk-lang[aria-expanded="true"] .bk-lang-chev { transform: rotate(180deg); }
.bk-lang-ctl { height: var(--control); padding: 0 var(--space-4); }
details.bk-lang-wrap > summary { list-style: none; }
details.bk-lang-wrap > summary::-webkit-details-marker { display: none; }
/* A closed list is display: none, not just hidden, so an English page fetches no Vietnamese font file for the
   name of the other language. */
details.bk-lang-wrap:not([open]) > .bk-lang-menu { display: none; }
details.bk-lang-wrap[open] > .bk-lang { background: var(--sunk); box-shadow: inset 0 0 0 2px var(--line-strong); }
details.bk-lang-wrap[open] > .bk-lang .bk-lang-chev { transform: rotate(180deg); }
.bk-lang-code { display: none; letter-spacing: 0.04em; }
/* bk-lang-short: the full name from 760 px, the two-letter code below. The trigger's label always has the full name. */
@media (max-width: 760px) { .bk-lang-short .bk-lang-name { display: none; } .bk-lang-short .bk-lang-code { display: inline; } }
.bk-lang-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 10; min-width: 220px; max-height: 320px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-float); display: flex; flex-direction: column; gap: 2px; }
.bk-lang-menu-up { top: auto; bottom: calc(100% + 8px); }
.bk-lang-menu-start { right: auto; left: 0; }
.bk-lang-opt { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); height: var(--control); padding: 0 var(--space-3) 0 var(--space-4); border-radius: var(--radius-md); color: var(--ink); font-size: 16px; line-height: 20px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.bk-lang-opt:hover { background: var(--sunk); }
.bk-lang-opt:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.bk-lang-opt[aria-current="true"] { background: var(--brick-soft); color: var(--brick-soft-text); }
.bk .bk-lang-opt svg.bk-lang-check { visibility: hidden; }
.bk .bk-lang-opt[aria-current="true"] svg.bk-lang-check { visibility: visible; }
/* The text pages' top row: the lockup, and the switcher at the right. */
.bk-page-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }

/* Vietnamese fit (Spec H1). Stacked accents reach 0.99 em lowercase and 1.13 em on a capital, so two lines
   need at least 1.2 em and one-line text that is cut needs room above and below the clip. */
:lang(vi).bk-page h1, :lang(vi) .bk-page h1 { line-height: 40px; }
@media (max-width: 600px) { :lang(vi).bk-page h1, :lang(vi) .bk-page h1 { line-height: 34px; } }
.bk-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-block: 0.14em; margin-block: -0.14em; }
/* A typed floor name longer than its brick is cut, with the full name in the title. The cut is on an inner
   label, so the brick itself never clips the mustard corner that says it just changed. */
.bk-floor-fit { padding: 0 12px; }
.bk-floor-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-block: 0.14em; }
/* The toast wraps to two lines instead of running off a phone. */
.bk-toast-fit { max-width: min(640px, calc(100% - 24px)); }
.bk-toast-fit .bk-toast-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding-block: 0.1em; }
