/* Bekito UI — one look for every Bekito service.
   Source of truth: ~/Desktop/bekito/ui-kit (see README.md and guide.html).
   Paper background, navy ink, one copper action per screen, green "confirmed" stamp.
   No inline styles needed; works under a strict Content-Security-Policy. */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --bk-navy: #1E2A37;
  --bk-copper: #B5643A;
  --bk-copper-strong: #9A4E28;      /* button fill, links, accent badges: at least 4.5:1 on paper, on the soft copper tint and under white text */
  --bk-copper-soft: #F3E2D6;
  --bk-cream: #F3EEE6;
  --bk-paper: #FAF6F0;
  --bk-green: #2F7D4F;
  --bk-green-soft: #E3F0E7;
  --bk-amber: #875400;
  --bk-amber-soft: #F8ECD2;
  --bk-red: #B3362B;
  --bk-red-soft: #F8E2DF;
  --bk-blue: #2B5F8F;
  --bk-blue-soft: #E1ECF6;

  --bk-bg: var(--bk-paper);
  --bk-bg-sunken: #F1EBE1;
  --bk-surface: #FFFFFF;
  --bk-surface-2: #FBF8F3;
  --bk-fg: #1E2A37;
  --bk-fg-2: rgba(30, 42, 55, .76);
  --bk-fg-3: rgba(30, 42, 55, .68);
  --bk-line: rgba(30, 42, 55, .13);
  --bk-line-strong: rgba(30, 42, 55, .28);
  --bk-accent: var(--bk-copper-strong);
  --bk-accent-hover: #823F1E;
  --bk-accent-ink: #FFFFFF;
  --bk-accent-soft: var(--bk-copper-soft);
  --bk-ok: #296F46;                  --bk-ok-soft: var(--bk-green-soft);   /* text-safe green; --bk-green stays the brand stamp colour */
  --bk-warn: var(--bk-amber);        --bk-warn-soft: var(--bk-amber-soft);
  --bk-danger: var(--bk-red);        --bk-danger-soft: var(--bk-red-soft);
  --bk-info: var(--bk-blue);         --bk-info-soft: var(--bk-blue-soft);
  --bk-focus: #2B5F8F;
  --bk-shadow-1: 0 1px 2px rgba(30, 42, 55, .06), 0 1px 1px rgba(30, 42, 55, .04);
  --bk-shadow-2: 0 2px 6px rgba(30, 42, 55, .06), 0 12px 32px rgba(30, 42, 55, .08);
  --bk-shadow-3: 0 8px 20px rgba(30, 42, 55, .10), 0 28px 64px rgba(30, 42, 55, .16);
  --bk-hero-bg: #1E2A37;
  --bk-hero-fg: #F3EEE6;
  --bk-hero-accent: #E39A68;

  --bk-font: 'Bekito Latin', 'Zen Kaku Gothic New', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Noto Sans JP', Meiryo, sans-serif;
  --bk-font-latin: Inter, 'Zen Kaku Gothic New', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  --bk-font-mono: 'SFMono-Regular', Menlo, Consolas, 'Hiragino Sans', 'Zen Kaku Gothic New', 'Noto Sans JP', monospace;

  --bk-text-xs: .75rem;      /* 12 */
  --bk-text-sm: .8125rem;    /* 13 */
  --bk-text-md: .9375rem;    /* 15 — body */
  --bk-text-lg: 1.0625rem;   /* 17 */
  --bk-text-xl: 1.3125rem;   /* 21 */
  --bk-text-2xl: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  --bk-text-3xl: clamp(1.875rem, 1.3rem + 2.8vw, 3rem);

  --bk-r-sm: 8px;
  --bk-r-md: 12px;
  --bk-r-lg: 18px;
  --bk-r-pill: 999px;
  --bk-gutter: clamp(16px, 4vw, 40px);
  --bk-bar-h: 56px;
  --bk-ease: cubic-bezier(.2, .7, .2, 1);
  --bk-fast: 140ms;
  --bk-med: 240ms;
  /* layering: use these, never raw numbers */
  --bk-z-sticky: 10;
  --bk-z-bar: 40;
  --bk-z-overlay: 60;
  --bk-z-dialog: 80;
  --bk-z-toast: 90;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bk-bg: #121922;
  --bk-bg-sunken: #0D131A;
  --bk-surface: #1A232E;
  --bk-surface-2: #212C39;
  --bk-fg: #F3EEE6;
  --bk-fg-2: rgba(243, 238, 230, .78);
  --bk-fg-3: rgba(243, 238, 230, .58);
  --bk-line: rgba(243, 238, 230, .14);
  --bk-line-strong: rgba(243, 238, 230, .32);
  --bk-accent: #E39A68;
  --bk-accent-hover: #EDB088;
  --bk-accent-ink: #1A1410;
  --bk-accent-soft: rgba(227, 154, 104, .16);
  --bk-ok: #7CC79A;      --bk-ok-soft: rgba(124, 199, 154, .15);
  --bk-warn: #E6B85C;    --bk-warn-soft: rgba(230, 184, 92, .15);
  --bk-danger: #F0897E;  --bk-danger-soft: rgba(240, 137, 126, .16);
  --bk-info: #8DB9E2;    --bk-info-soft: rgba(141, 185, 226, .16);
  --bk-focus: #8DB9E2;
  --bk-shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --bk-shadow-2: 0 2px 6px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .35);
  --bk-shadow-3: 0 8px 20px rgba(0, 0, 0, .45), 0 28px 64px rgba(0, 0, 0, .5);
  --bk-hero-bg: #0D131A;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bk-bg: #121922; --bk-bg-sunken: #0D131A; --bk-surface: #1A232E; --bk-surface-2: #212C39;
    --bk-fg: #F3EEE6; --bk-fg-2: rgba(243, 238, 230, .78); --bk-fg-3: rgba(243, 238, 230, .58);
    --bk-line: rgba(243, 238, 230, .14); --bk-line-strong: rgba(243, 238, 230, .32);
    --bk-accent: #E39A68; --bk-accent-hover: #EDB088; --bk-accent-ink: #1A1410; --bk-accent-soft: rgba(227, 154, 104, .16);
    --bk-ok: #7CC79A; --bk-ok-soft: rgba(124, 199, 154, .15);
    --bk-warn: #E6B85C; --bk-warn-soft: rgba(230, 184, 92, .15);
    --bk-danger: #F0897E; --bk-danger-soft: rgba(240, 137, 126, .16);
    --bk-info: #8DB9E2; --bk-info-soft: rgba(141, 185, 226, .16);
    --bk-focus: #8DB9E2;
    --bk-shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --bk-shadow-2: 0 2px 6px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .35);
    --bk-shadow-3: 0 8px 20px rgba(0, 0, 0, .45), 0 28px 64px rgba(0, 0, 0, .5);
    --bk-hero-bg: #0D131A;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--bk-bar-h) + 16px); }
body {
  margin: 0;
  background: var(--bk-bg);
  color: var(--bk-fg);
  font-family: var(--bk-font);
  font-size: var(--bk-text-md);
  line-height: 1.75;
  font-feature-settings: "palt" 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-wrap: break-word;
  line-break: strict;
}
html[lang="en"] body { font-family: var(--bk-font-latin); line-height: 1.6; overflow-wrap: break-word; }
/* text marked as another Latin-script language (a caption in Vietnamese, Uzbek, French…) is set in Inter throughout */
:where([lang|="vi"], [lang|="uz"], [lang|="fr"], [lang|="de"], [lang|="es"], [lang|="pt"], [lang|="it"], [lang|="tr"], [lang|="pl"], [lang|="id"]) { font-family: var(--bk-font-latin); }
h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--bk-accent); text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { color: var(--bk-accent-hover); }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--bk-focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--bk-accent-soft); }
[hidden] { display: none !important; }
.bk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.bk-num { font-family: var(--bk-font-latin); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.bk-nowrap { white-space: nowrap; }
.bk-muted { color: var(--bk-fg-2); }
.bk-faint { color: var(--bk-fg-3); }

h1, .bk-h1 { font-size: var(--bk-text-3xl); line-height: 1.25; font-weight: 700; letter-spacing: .01em; text-wrap: balance; }
h2, .bk-h2 { font-size: var(--bk-text-2xl); line-height: 1.35; font-weight: 700; letter-spacing: .01em; text-wrap: balance; }
h3, .bk-h3 { font-size: var(--bk-text-lg); line-height: 1.5; font-weight: 700; }
h4, .bk-h4 { font-size: var(--bk-text-md); line-height: 1.5; font-weight: 700; }
html[lang="en"] h1, html[lang="en"] h2 { letter-spacing: -.02em; line-height: 1.15; }
.bk-lead { font-size: var(--bk-text-lg); line-height: 1.8; color: var(--bk-fg-2); text-wrap: pretty; max-width: 40em; }
.bk-eyebrow { font-family: var(--bk-font-latin); font-size: var(--bk-text-xs); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--bk-accent); }
html[lang="ja"] .bk-eyebrow { letter-spacing: .14em; }
.bk-small { font-size: var(--bk-text-sm); line-height: 1.65; }
.bk-xs { font-size: var(--bk-text-xs); line-height: 1.6; }

/* ---------- layout ---------- */
.bk-wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: var(--bk-gutter); }
.bk-wrap--narrow { max-width: 720px; }
.bk-wrap--wide { max-width: 1320px; }
.bk-main { padding-block: clamp(20px, 4vw, 40px) clamp(48px, 8vw, 96px); }
.bk-section { padding-block: clamp(36px, 7vw, 80px); }
.bk-stack { display: flex; flex-direction: column; gap: 16px; }
.bk-stack--sm { gap: 8px; } .bk-stack--lg { gap: 28px; } .bk-stack--xl { gap: 48px; }
.bk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.bk-row--between { justify-content: space-between; }
.bk-row--end { justify-content: flex-end; }
.bk-row--tight { gap: 6px; }
.bk-grow { flex: 1 1 14em; min-width: 0; }
.bk-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
.bk-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.bk-split { display: grid; gap: clamp(20px, 4vw, 48px); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .bk-split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } .bk-split--aside { grid-template-columns: minmax(0, 1fr) 340px; } }
.bk-divider { height: 1px; background: var(--bk-line); border: 0; margin: 0; }

/* ---------- top bar ---------- */
.bk-topbar { position: sticky; top: 0; z-index: var(--bk-z-bar); background: color-mix(in srgb, var(--bk-bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--bk-line); padding-top: env(safe-area-inset-top); }
.bk-topbar__in { height: var(--bk-bar-h); display: flex; align-items: center; gap: 12px; max-width: 1320px; margin-inline: auto; padding-inline: var(--bk-gutter); }
.bk-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--bk-fg); text-decoration: none; min-height: 44px; min-width: 44px; flex-shrink: 0; }
.bk-brand:hover { color: var(--bk-fg); }
.bk-brand__mark { width: 28px; height: 28px; flex-shrink: 0; }
.bk-brand__mark .logo-be { stroke: var(--bk-copper); }
:root[data-theme="dark"] .bk-brand__mark .logo-be { stroke: #CF7E52; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk-brand__mark .logo-be { stroke: #CF7E52; } }
.bk-brand__name { height: 15px; width: auto; flex-shrink: 0; }
.bk-brand__product { font-weight: 700; font-size: var(--bk-text-md); padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--bk-line-strong); line-height: 1.2; white-space: nowrap; }
@media (max-width: 420px) { .bk-brand__name { display: none; } .bk-brand__product { border-left: 0; padding-left: 0; } }
.bk-topbar__nav { display: flex; align-items: center; gap: 2px; margin-left: auto; min-width: 0; }
.bk-topbar__link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--bk-r-pill); color: var(--bk-fg-2); text-decoration: none; font-size: var(--bk-text-sm); font-weight: 500; white-space: nowrap; transition: background var(--bk-fast), color var(--bk-fast); }
.bk-topbar__link:hover { background: var(--bk-bg-sunken); color: var(--bk-fg); }
.bk-topbar__link[aria-current="page"] { color: var(--bk-fg); font-weight: 700; background: var(--bk-bg-sunken); }
/* on phones the header keeps only the logo, product name, language and theme; page links move into the page or a tab bar */
@media (max-width: 720px) { .bk-topbar__nav:not(.bk-topbar__nav--keep) .bk-topbar__link { display: none; } .bk-topbar__in { gap: 8px; } .bk-topbar .bk-seg__item { padding: 0 11px; min-height: 34px; } }

/* bottom tab bar for phone-first apps */
.bk-tabbar { position: fixed; inset: auto 0 0 0; z-index: var(--bk-z-bar); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: color-mix(in srgb, var(--bk-surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--bk-line); padding-bottom: env(safe-area-inset-bottom); }
.bk-tabbar__item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; color: var(--bk-fg-3); text-decoration: none; font-size: 12px; font-weight: 500; line-height: 1.2; border: 0; background: none; }
.bk-tabbar__item svg { width: 22px; height: 22px; }
.bk-tabbar__item[aria-current="page"] { color: var(--bk-accent); font-weight: 700; }
.bk-has-tabbar { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
/* the tab bar disappears where .bk-panes go side by side (1100 px) */
@media (min-width: 1100px) { .bk-tabbar { display: none; } .bk-has-tabbar { padding-bottom: 0; } }

/* ---------- buttons ---------- */
.bk-btn { --_bg: var(--bk-surface); --_fg: var(--bk-fg); --_bd: var(--bk-line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: var(--bk-r-pill); border: 1px solid var(--_bd); background: var(--_bg); color: var(--_fg); font-weight: 700; font-size: var(--bk-text-md); line-height: 1.2; text-decoration: none; white-space: nowrap; user-select: none; -webkit-tap-highlight-color: transparent; transition: background var(--bk-fast) var(--bk-ease), border-color var(--bk-fast), color var(--bk-fast), transform var(--bk-fast) var(--bk-ease), box-shadow var(--bk-fast); }
.bk-btn:hover { --_bg: var(--bk-surface-2); --_bd: var(--bk-fg-3); color: var(--_fg); }
.bk-btn:active { transform: scale(.975); }
.bk-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.bk-btn--primary { --_bg: var(--bk-accent); --_fg: var(--bk-accent-ink); --_bd: transparent; box-shadow: var(--bk-shadow-1); }
.bk-btn--primary:hover { --_bg: var(--bk-accent-hover); --_bd: transparent; }
.bk-btn--navy { --_bg: var(--bk-navy); --_fg: var(--bk-cream); --_bd: transparent; }
.bk-btn--navy:hover { --_bg: #2B3A4A; --_bd: transparent; }
:root[data-theme="dark"] .bk-btn--navy { --_bg: var(--bk-cream); --_fg: var(--bk-navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk-btn--navy { --_bg: var(--bk-cream); --_fg: var(--bk-navy); } }
.bk-btn--quiet { --_bg: transparent; --_bd: transparent; color: var(--bk-fg-2); font-weight: 500; }
.bk-btn--quiet:hover { --_bg: var(--bk-bg-sunken); --_bd: transparent; --_fg: var(--bk-fg); }
.bk-btn--danger { --_fg: var(--bk-danger); --_bd: color-mix(in srgb, var(--bk-danger) 45%, transparent); }
.bk-btn--danger:hover { --_bg: var(--bk-danger-soft); --_bd: var(--bk-danger); }
.bk-btn--ok { --_bg: var(--bk-ok); --_fg: #fff; --_bd: transparent; }
:root[data-theme="dark"] .bk-btn--ok { --_fg: #0F1A14; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk-btn--ok { --_fg: #0F1A14; } }
.bk-btn--sm { min-height: 36px; padding: 0 14px; font-size: var(--bk-text-sm); }
.bk-btn--lg { min-height: 54px; padding: 0 28px; font-size: var(--bk-text-lg); }
.bk-btn--block { width: 100%; }
.bk-btn--icon { width: 44px; padding: 0; }
.bk-btn--icon.bk-btn--sm { width: 36px; }
.bk-btn[disabled], .bk-btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.bk-btn[aria-busy="true"] { pointer-events: none; color: transparent; position: relative; }
.bk-btn[aria-busy="true"]::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--_fg); border-right-color: transparent; animation: bk-spin .7s linear infinite; }
.bk-link-btn { background: none; border: 0; padding: 0; color: var(--bk-accent); text-decoration: underline; text-underline-offset: .22em; font-weight: 500; }

/* ---------- cards & surfaces ---------- */
.bk-card { background: var(--bk-surface); border: 1px solid var(--bk-line); border-radius: var(--bk-r-lg); padding: clamp(16px, 3vw, 24px); box-shadow: var(--bk-shadow-1); }
.bk-card--flat { box-shadow: none; }
.bk-card--sunken { background: var(--bk-bg-sunken); box-shadow: none; border-color: transparent; }
.bk-card--raised { box-shadow: var(--bk-shadow-2); }
.bk-card--link { display: block; color: inherit; text-decoration: none; transition: transform var(--bk-med) var(--bk-ease), box-shadow var(--bk-med), border-color var(--bk-med); }
.bk-card--link:hover { transform: translateY(-2px); box-shadow: var(--bk-shadow-2); border-color: var(--bk-line-strong); color: inherit; }
.bk-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bk-card__title { font-size: var(--bk-text-lg); font-weight: 700; line-height: 1.45; }
.bk-card--accent { border-left: 4px solid var(--bk-accent); border-top-left-radius: 6px; border-bottom-left-radius: 6px; }

.bk-hero { background: var(--bk-hero-bg); color: var(--bk-hero-fg); position: relative; overflow: hidden; }
.bk-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 60% 70% at 85% 20%, rgba(227, 154, 104, .16), transparent 60%), radial-gradient(ellipse 50% 60% at 0% 100%, rgba(43, 95, 143, .22), transparent 60%); }
.bk-hero > * { position: relative; z-index: 1; }
.bk-hero__in { padding-block: clamp(40px, 8vw, 96px); }
.bk-hero h1 em, .bk-hero .bk-h1 em { font-style: normal; color: var(--bk-hero-accent); }
.bk-hero .bk-lead { color: rgba(243, 238, 230, .82); }
.bk-hero .bk-eyebrow { color: var(--bk-hero-accent); }
.bk-hero .bk-btn:not(.bk-btn--primary) { --_bg: transparent; --_fg: var(--bk-hero-fg); --_bd: rgba(243, 238, 230, .4); }
.bk-hero .bk-btn:not(.bk-btn--primary):hover { --_bg: rgba(243, 238, 230, .08); --_bd: rgba(243, 238, 230, .7); }
.bk-hero .bk-btn--primary { --_bg: #E39A68; --_fg: #1A1410; }
.bk-hero .bk-btn--primary:hover { --_bg: #EDB088; }
.bk-hero a:not(.bk-btn) { color: var(--bk-hero-accent); }

/* ---------- badges & chips ---------- */
.bk-badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: var(--bk-r-pill); font-size: var(--bk-text-xs); font-weight: 700; line-height: 1; white-space: nowrap; background: var(--bk-bg-sunken); color: var(--bk-fg-2); }
.bk-badge svg { width: 13px; height: 13px; }
.bk-badge--ok { background: var(--bk-ok-soft); color: var(--bk-ok); }
.bk-badge--warn { background: var(--bk-warn-soft); color: var(--bk-warn); }
.bk-badge--danger { background: var(--bk-danger-soft); color: var(--bk-danger); }
.bk-badge--info { background: var(--bk-info-soft); color: var(--bk-info); }
.bk-badge--accent { background: var(--bk-accent-soft); color: var(--bk-accent); }
.bk-badge--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--bk-line-strong); }
.bk-badge--dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bk-badge--live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: bk-pulse 1.6s ease-in-out infinite; }
.bk-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--bk-r-pill); border: 1px solid var(--bk-line-strong); background: var(--bk-surface); color: var(--bk-fg); font-size: var(--bk-text-sm); font-weight: 500; text-decoration: none; transition: background var(--bk-fast), border-color var(--bk-fast), color var(--bk-fast); }
.bk-chip:hover { border-color: var(--bk-fg-3); color: var(--bk-fg); }
.bk-chip[aria-pressed="true"], .bk-chip[aria-selected="true"], .bk-chip.is-on { background: var(--bk-fg); color: var(--bk-bg); border-color: var(--bk-fg); }
.bk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bk-chips--scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--bk-gutter) * -1); padding-inline: var(--bk-gutter); }
.bk-chips--scroll::-webkit-scrollbar { display: none; }
.bk-chips--scroll > * { flex-shrink: 0; }

/* ---------- forms ---------- */
.bk-field { display: flex; flex-direction: column; gap: 6px; }
.bk-label { font-size: var(--bk-text-sm); font-weight: 700; line-height: 1.4; }
.bk-label .bk-opt { font-weight: 400; color: var(--bk-fg-3); margin-left: 6px; }
.bk-hint { font-size: var(--bk-text-xs); color: var(--bk-fg-3); line-height: 1.6; }
.bk-error { font-size: var(--bk-text-xs); color: var(--bk-danger); line-height: 1.6; font-weight: 500; }
.bk-input, .bk-select, .bk-textarea { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--bk-r-md); border: 1px solid var(--bk-line-strong); background: var(--bk-surface); color: var(--bk-fg); font-size: 1rem; line-height: 1.5; transition: border-color var(--bk-fast), box-shadow var(--bk-fast); appearance: none; -webkit-appearance: none; }
.bk-textarea { min-height: 112px; resize: vertical; line-height: 1.7; }
.bk-input::placeholder, .bk-textarea::placeholder { color: var(--bk-fg-3); opacity: 1; }
.bk-input:hover, .bk-select:hover, .bk-textarea:hover { border-color: var(--bk-fg-3); }
.bk-input:focus-visible, .bk-select:focus-visible, .bk-textarea:focus-visible { outline: none; border-color: var(--bk-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bk-focus) 28%, transparent); border-radius: var(--bk-r-md); }
.bk-input[aria-invalid="true"], .bk-textarea[aria-invalid="true"], .bk-select[aria-invalid="true"] { border-color: var(--bk-danger); }
.bk-select { padding-right: 40px; background-image: url("../img/chevron-down.svg"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
.bk-input--lg { min-height: 54px; font-size: var(--bk-text-lg); padding-inline: 18px; }
.bk-check { display: inline-flex; align-items: flex-start; gap: 10px; min-height: 44px; padding-block: 10px; cursor: pointer; line-height: 1.5; }
.bk-check input { appearance: none; -webkit-appearance: none; flex-shrink: 0; width: 22px; height: 22px; margin: 1px 0 0; border: 1.5px solid var(--bk-line-strong); border-radius: 6px; background: var(--bk-surface); display: grid; place-content: center; transition: background var(--bk-fast), border-color var(--bk-fast); }
.bk-check input[type="radio"] { border-radius: 50%; }
.bk-check input::after { content: ""; width: 12px; height: 12px; transform: scale(0); transition: transform var(--bk-fast) var(--bk-ease); background: var(--bk-accent-ink); clip-path: polygon(14% 52%, 0 66%, 40% 100%, 100% 22%, 86% 10%, 39% 70%); }
.bk-check input[type="radio"]::after { clip-path: circle(42%); }
.bk-check input:checked { background: var(--bk-accent); border-color: var(--bk-accent); }
.bk-check input:checked::after { transform: scale(1); }
.bk-switch { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.bk-switch input { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 999px; background: var(--bk-line-strong); position: relative; flex-shrink: 0; margin: 0; transition: background var(--bk-med); }
.bk-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform var(--bk-med) var(--bk-ease); }
.bk-switch input:checked { background: var(--bk-ok); }
.bk-switch input:checked::after { transform: translateX(18px); }

.bk-seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: var(--bk-r-pill); background: var(--bk-bg-sunken); gap: 2px; max-width: 100%; }
.bk-seg__item { min-height: 38px; padding: 0 16px; border: 0; border-radius: var(--bk-r-pill); background: transparent; color: var(--bk-fg-2); font-size: var(--bk-text-sm); font-weight: 500; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background var(--bk-fast), color var(--bk-fast), box-shadow var(--bk-fast); }
.bk-seg__item[aria-selected="true"], .bk-seg__item[aria-pressed="true"], .bk-seg__item[aria-current="page"], .bk-seg__item.is-on { background: var(--bk-surface); color: var(--bk-fg); font-weight: 700; box-shadow: var(--bk-shadow-1); }

.bk-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: clamp(24px, 6vw, 48px) 20px; border-radius: var(--bk-r-lg); border: 2px dashed var(--bk-line-strong); background: var(--bk-surface-2); color: var(--bk-fg-2); cursor: pointer; transition: border-color var(--bk-fast), background var(--bk-fast), transform var(--bk-med) var(--bk-ease); }
.bk-drop:hover, .bk-drop.is-over { border-color: var(--bk-accent); background: var(--bk-accent-soft); color: var(--bk-fg); }
.bk-drop.is-over { transform: scale(1.01); }
.bk-drop svg { width: 36px; height: 36px; color: var(--bk-accent); }
.bk-drop strong { color: var(--bk-fg); font-size: var(--bk-text-lg); }

/* ---------- lists, tables, definition rows ---------- */
.bk-list { background: var(--bk-surface); border: 1px solid var(--bk-line); border-radius: var(--bk-r-lg); overflow: hidden; }
.bk-list__row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 56px; color: inherit; text-decoration: none; border-top: 1px solid var(--bk-line); transition: background var(--bk-fast); }
.bk-list__row:first-child { border-top: 0; }
a.bk-list__row:hover, button.bk-list__row:hover { background: var(--bk-surface-2); color: inherit; }
button.bk-list__row { width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; }
.bk-list__title { font-weight: 700; line-height: 1.45; }
.bk-list__meta { font-size: var(--bk-text-sm); color: var(--bk-fg-3); line-height: 1.5; }
.bk-chev { width: 18px; height: 18px; color: var(--bk-fg-3); flex-shrink: 0; }

.bk-table-wrap { overflow-x: auto; border: 1px solid var(--bk-line); border-radius: var(--bk-r-lg); background: var(--bk-surface); }
.bk-table { width: 100%; border-collapse: collapse; font-size: var(--bk-text-sm); line-height: 1.5; }
.bk-table th { text-align: left; font-weight: 700; font-size: var(--bk-text-xs); color: var(--bk-fg-3); padding: 12px 16px; background: var(--bk-surface-2); white-space: nowrap; border-bottom: 1px solid var(--bk-line); }
.bk-table td { padding: 13px 16px; border-top: 1px solid var(--bk-line); vertical-align: top; }
.bk-table tr:first-child td { border-top: 0; }
.bk-table tbody tr { transition: background var(--bk-fast); }
.bk-table tbody tr:hover { background: var(--bk-surface-2); }
.bk-table .is-num { text-align: right; font-family: var(--bk-font-latin); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .bk-table--cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bk-table--cards, .bk-table--cards tbody, .bk-table--cards tr, .bk-table--cards td { display: block; width: 100%; }
  .bk-table--cards tr { padding: 12px 16px; border-top: 1px solid var(--bk-line); }
  .bk-table--cards tr:first-child { border-top: 0; }
  .bk-table--cards td { border: 0; padding: 3px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  .bk-table--cards td::before { content: attr(data-label); color: var(--bk-fg-3); font-size: var(--bk-text-xs); text-align: left; flex-shrink: 0; padding-top: 2px; }
  .bk-table--cards td.is-title { font-weight: 700; font-size: var(--bk-text-md); text-align: left; justify-content: flex-start; }
  .bk-table--cards td.is-title::before { display: none; }
}
.bk-dl { display: grid; grid-template-columns: minmax(88px, max-content) 1fr; gap: 8px 16px; font-size: var(--bk-text-sm); line-height: 1.6; }
.bk-dl dt { color: var(--bk-fg-3); }
.bk-dl dd { font-weight: 500; min-width: 0; }

/* ---------- feedback ---------- */
.bk-note { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--bk-r-md); background: var(--bk-info-soft); color: var(--bk-fg); font-size: var(--bk-text-sm); line-height: 1.7; }
.bk-note > svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; color: var(--bk-info); }
.bk-note--warn { background: var(--bk-warn-soft); } .bk-note--warn > svg { color: var(--bk-warn); }
.bk-note--danger { background: var(--bk-danger-soft); } .bk-note--danger > svg { color: var(--bk-danger); }
.bk-note--ok { background: var(--bk-ok-soft); } .bk-note--ok > svg { color: var(--bk-ok); }
.bk-note--plain { background: var(--bk-bg-sunken); } .bk-note--plain > svg { color: var(--bk-fg-3); }
.bk-note strong { font-weight: 700; }

.bk-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: clamp(32px, 8vw, 64px) 20px; color: var(--bk-fg-2); }
.bk-empty svg { width: 44px; height: 44px; color: var(--bk-fg-3); margin-bottom: 4px; }
.bk-empty h3 { color: var(--bk-fg); }
.bk-empty p { max-width: 30em; font-size: var(--bk-text-sm); }

.bk-skel { display: block; border-radius: 8px; min-height: 1em; background: linear-gradient(90deg, var(--bk-bg-sunken) 25%, color-mix(in srgb, var(--bk-bg-sunken) 55%, var(--bk-surface)) 50%, var(--bk-bg-sunken) 75%); background-size: 200% 100%; animation: bk-shimmer 1.4s linear infinite; color: transparent; user-select: none; }
.bk-spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--bk-line-strong); border-top-color: var(--bk-accent); animation: bk-spin .7s linear infinite; flex-shrink: 0; }
.bk-progress { height: 6px; border-radius: 999px; background: var(--bk-bg-sunken); overflow: hidden; }
.bk-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--bk-accent); transition: width var(--bk-med) var(--bk-ease); }
.bk-dots { display: inline-flex; gap: 5px; align-items: center; }
.bk-dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .3; animation: bk-dot 1.2s ease-in-out infinite; }
.bk-dots i:nth-child(2) { animation-delay: .15s; } .bk-dots i:nth-child(3) { animation-delay: .3s; }

.bk-toasts { position: fixed; z-index: var(--bk-z-toast); inset: auto 0 calc(16px + env(safe-area-inset-bottom)) 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding-inline: 16px; }
.bk-has-tabbar .bk-toasts { bottom: calc(72px + env(safe-area-inset-bottom)); }
.bk-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(520px, 100%); padding: 12px 18px; border-radius: var(--bk-r-pill); background: var(--bk-navy); color: var(--bk-cream); font-size: var(--bk-text-sm); font-weight: 500; line-height: 1.5; box-shadow: var(--bk-shadow-3); animation: bk-rise var(--bk-med) var(--bk-ease); }
.bk-toast--ok svg { color: #7CC79A; } .bk-toast--danger svg { color: #F0897E; }
.bk-toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.bk-toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--bk-med), transform var(--bk-med); }
:root[data-theme="dark"] .bk-toast { background: var(--bk-cream); color: var(--bk-navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk-toast { background: var(--bk-cream); color: var(--bk-navy); } }

dialog.bk-dialog { border: 0; padding: 0; border-radius: var(--bk-r-lg); background: var(--bk-surface); color: var(--bk-fg); box-shadow: var(--bk-shadow-3); width: min(520px, calc(100vw - 32px)); max-height: min(86dvh, 720px); overflow: auto; }
dialog.bk-dialog::backdrop { background: rgba(13, 19, 26, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog.bk-dialog[open] { animation: bk-pop var(--bk-med) var(--bk-ease); }
.bk-dialog__body { padding: clamp(20px, 4vw, 28px); display: flex; flex-direction: column; gap: 14px; }
.bk-dialog__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px clamp(20px, 4vw, 28px); border-top: 1px solid var(--bk-line); background: var(--bk-surface-2); position: sticky; bottom: 0; }
@media (max-width: 560px) {
  dialog.bk-dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: var(--bk-r-lg) var(--bk-r-lg) 0 0; max-height: 92dvh; }
  dialog.bk-dialog[open] { animation: bk-sheet var(--bk-med) var(--bk-ease); }
  .bk-dialog__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .bk-dialog__foot .bk-btn { flex: 1 1 auto; }
}

/* ---------- steps ---------- */
.bk-steps { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); counter-reset: bk-step; }
.bk-step { position: relative; padding: 20px; border-radius: var(--bk-r-lg); background: var(--bk-surface); border: 1px solid var(--bk-line); counter-increment: bk-step; display: flex; flex-direction: column; gap: 6px; }
.bk-step::before { content: counter(bk-step, decimal-leading-zero); font-family: var(--bk-font-latin); font-size: var(--bk-text-xs); font-weight: 700; letter-spacing: .1em; color: var(--bk-accent); }
.bk-step h3 { font-size: var(--bk-text-lg); }
.bk-step p { font-size: var(--bk-text-sm); color: var(--bk-fg-2); line-height: 1.7; }
.bk-stepper { display: flex; align-items: center; gap: 8px; font-size: var(--bk-text-xs); color: var(--bk-fg-3); font-weight: 500; }
.bk-stepper__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bk-line-strong); transition: background var(--bk-med), transform var(--bk-med) var(--bk-ease); }
.bk-stepper__dot.is-done { background: var(--bk-ok); }
.bk-stepper__dot.is-now { background: var(--bk-accent); transform: scale(1.35); }

/* ---------- stat tiles ---------- */
.bk-stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: var(--bk-r-lg); background: var(--bk-surface); border: 1px solid var(--bk-line); }
.bk-stat__label { font-size: var(--bk-text-xs); color: var(--bk-fg-3); font-weight: 500; }
.bk-stat__value { font-family: var(--bk-font-latin); font-variant-numeric: tabular-nums; font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.bk-stat__value small { font-family: var(--bk-font); font-size: var(--bk-text-sm); font-weight: 500; color: var(--bk-fg-2); margin-left: 3px; letter-spacing: 0; }
.bk-stat__sub { font-size: var(--bk-text-xs); color: var(--bk-fg-3); }

/* ---------- the "confirmed" stamp (Bekito's signature moment) ---------- */
.bk-stamp { --_c: var(--bk-green); display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; border: 3px solid var(--_c); color: var(--_c); transform: rotate(-12deg); position: relative; flex-shrink: 0; }
.bk-stamp svg { width: 55%; height: 55%; stroke-width: 3; }
.bk-stamp--sm { width: 28px; height: 28px; border-width: 2px; }
.bk-stamp--lg { width: 88px; height: 88px; border-width: 4px; }
.bk-stamp--copper { --_c: var(--bk-accent); }
.bk-stamp.is-stamping { animation: bk-stamp 420ms var(--bk-ease) both; }
.bk-stamp.is-stamping::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--_c); animation: bk-ring 620ms var(--bk-ease) 120ms both; }

/* ---------- audio row ---------- */
.bk-audio { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border-radius: var(--bk-r-pill); background: var(--bk-bg-sunken); }
.bk-audio__btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--bk-fg); color: var(--bk-bg); display: grid; place-items: center; flex-shrink: 0; transition: transform var(--bk-fast) var(--bk-ease); }
.bk-audio__btn:active { transform: scale(.94); }
.bk-audio__btn svg { width: 16px; height: 16px; }
.bk-audio__bar { flex: 1 1 0; min-width: 40px; height: 4px; border-radius: 999px; background: var(--bk-line-strong); overflow: hidden; }
.bk-audio__bar > span { display: block; height: 100%; width: 0; background: var(--bk-accent); border-radius: inherit; }
.bk-audio__time { font-family: var(--bk-font-latin); font-variant-numeric: tabular-nums; font-size: var(--bk-text-xs); color: var(--bk-fg-3); }

/* ---------- quote ---------- */
.bk-quote { position: relative; padding: 4px 0 4px 18px; border-left: 3px solid var(--bk-accent); font-size: var(--bk-text-lg); line-height: 1.85; font-weight: 500; }
.bk-quote cite { display: block; margin-top: 8px; font-style: normal; font-size: var(--bk-text-sm); font-weight: 400; color: var(--bk-fg-3); }

/* ---------- code ---------- */
.bk-code { font-family: var(--bk-font-mono); font-size: var(--bk-text-sm); line-height: 1.7; background: var(--bk-navy); color: #E8E2D8; border-radius: var(--bk-r-md); padding: 14px 16px; overflow-x: auto; white-space: pre; tab-size: 2; }
.bk-kbd { font-family: var(--bk-font-mono); font-size: .8em; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--bk-line-strong); background: var(--bk-surface-2); }

/* ---------- footer ---------- */
.bk-footer { border-top: 1px solid var(--bk-line); padding-block: 28px calc(28px + env(safe-area-inset-bottom)); font-size: var(--bk-text-sm); color: var(--bk-fg-3); }
.bk-footer__in { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.bk-footer a { color: var(--bk-fg-2); text-decoration: none; }
.bk-footer a:hover { color: var(--bk-fg); text-decoration: underline; }
.bk-footer__links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.bk-has-tabbar .bk-footer { padding-bottom: 28px; }

/* ---------- motion ---------- */
.bk-fade-in { animation: bk-rise var(--bk-med) var(--bk-ease) both; }
.bk-stagger > * { animation: bk-rise 360ms var(--bk-ease) both; }
.bk-stagger > *:nth-child(2) { animation-delay: 50ms; } .bk-stagger > *:nth-child(3) { animation-delay: 100ms; }
.bk-stagger > *:nth-child(4) { animation-delay: 150ms; } .bk-stagger > *:nth-child(5) { animation-delay: 200ms; }
.bk-stagger > *:nth-child(n+6) { animation-delay: 250ms; }
@keyframes bk-spin { to { transform: rotate(360deg); } }
@keyframes bk-shimmer { to { background-position: -200% 0; } }
@keyframes bk-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
@keyframes bk-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes bk-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bk-pop { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes bk-sheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes bk-stamp { 0% { opacity: 0; transform: rotate(-12deg) scale(2.1); } 55% { opacity: 1; transform: rotate(-12deg) scale(.9); } 100% { opacity: 1; transform: rotate(-12deg) scale(1); } }
@keyframes bk-ring { from { opacity: .6; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- print ---------- */
@media print {
  .bk-topbar, .bk-tabbar, .bk-toasts, .bk-footer, .bk-no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .bk-card, .bk-list, .bk-table-wrap { box-shadow: none; border-color: #bbb; break-inside: avoid; }
}

/* ---------- inline icons (<i data-bk-icon="check"></i>, filled by bekito-ui.js) ---------- */
.bk-ico { display: inline-flex; line-height: 0; flex-shrink: 0; font-style: normal; }
.bk-ico > svg { width: 1.3em; height: 1.3em; }
.bk-btn .bk-ico > svg { width: 18px; height: 18px; }
.bk-ico--lg > svg { width: 28px; height: 28px; }
.bk-ico--xl > svg { width: 40px; height: 40px; }
.bk-ico-tile { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--bk-accent-soft); color: var(--bk-accent); flex-shrink: 0; }
.bk-ico-tile > svg, .bk-ico-tile .bk-ico > svg { width: 22px; height: 22px; }

/* icon sizing inside components that set their own icon size */
.bk-stamp .bk-ico { width: 56%; height: 56%; }
.bk-stamp .bk-ico > svg { width: 100%; height: 100%; stroke-width: 3; }
.bk-drop .bk-ico > svg { width: 36px; height: 36px; }
.bk-drop .bk-ico { color: var(--bk-accent); }
.bk-empty .bk-ico > svg { width: 44px; height: 44px; }
.bk-empty .bk-ico { color: var(--bk-fg-3); margin-bottom: 4px; }
.bk-note > .bk-ico { margin-top: 2px; color: var(--bk-info); }
.bk-note > .bk-ico > svg { width: 20px; height: 20px; }
.bk-note--warn > .bk-ico { color: var(--bk-warn); } .bk-note--danger > .bk-ico { color: var(--bk-danger); }
.bk-note--ok > .bk-ico { color: var(--bk-ok); } .bk-note--plain > .bk-ico { color: var(--bk-fg-3); }
.bk-audio__btn .bk-ico > svg { width: 16px; height: 16px; }
.bk-toast .bk-ico > svg, .bk-badge .bk-ico > svg { width: 14px; height: 14px; }
.bk-tabbar__item .bk-ico > svg { width: 22px; height: 22px; }
.bk-list__row > .bk-ico.bk-chev > svg { width: 18px; height: 18px; }

/* Japanese line breaking: break between phrases, not inside words (Chromium; others fall back) */
html[lang="ja"] body { word-break: auto-phrase; }
html[lang="ja"] h1, html[lang="ja"] h2, html[lang="ja"] h3, html[lang="ja"] .bk-lead { word-break: auto-phrase; overflow-wrap: normal; }


/* =====================================================================
   v2 (2026-11-21): data-heavy screens. Read SERVICE-STANDARD.md section 2b.
   ===================================================================== */

/* ---------- scrollbars: thin, quiet, themed (light and dark) ---------- */
html { scrollbar-color: var(--bk-line-strong) transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--bk-line-strong) transparent; }
@supports not (scrollbar-color: auto) {
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb { background-color: var(--bk-line-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
  *::-webkit-scrollbar-thumb:hover { background-color: var(--bk-fg-3); }
}

/* The ONE scrolling box of a region. Never nest one inside another. */
.bk-scroll { overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; -webkit-overflow-scrolling: touch; min-height: 0; min-width: 0; }

/* ---------- panes (app screens with two or three working areas) ----------
   Wide AND tall window: panes sit side by side and each pane's body scrolls by itself.
   Wide but short window: panes sit side by side at their natural height and the PAGE scrolls.
   Narrow window: panes stack (or use a .bk-tabbar to show one at a time) and the PAGE scrolls. */
.bk-panes { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.bk-pane { display: flex; flex-direction: column; min-width: 0; background: var(--bk-surface); border: 1px solid var(--bk-line); border-radius: var(--bk-r-lg); box-shadow: var(--bk-shadow-1); }
.bk-pane__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 10px 16px; border-bottom: 1px solid var(--bk-line); }
.bk-pane__title { font-size: var(--bk-text-md); font-weight: 700; line-height: 1.3; white-space: nowrap; }
.bk-pane__body { padding: 16px; min-width: 0; }
.bk-pane__body--flush { padding: 0; }
.bk-pane__foot { padding: 12px 16px; border-top: 1px solid var(--bk-line); }
@media (min-width: 1100px) {
  .bk-panes--2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bk-panes--3 { grid-template-columns: minmax(300px, 1fr) minmax(280px, .9fr) minmax(380px, 1.25fr); }
  .bk-panes--aside { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (min-width: 1100px) and (min-height: 760px) {
  /* Exactly fills the window under the top bar: bar height + its 1 px border + safe area + the page's own gap
     (set --bk-fill-gap to the vertical margin/padding your page puts around the panes; default 32px).
     Rounded down so the page never ends up 1 px taller than the window (which shows an extra scrollbar). */
  .bk-panes--fill { height: calc(100dvh - var(--bk-bar-h) - 1px - env(safe-area-inset-top, 0px) - var(--bk-fill-gap, 32px) - 1px); align-items: stretch; }
  body:has(.bk-panes--fill) { overflow-y: hidden; }  /* belt and braces: the panes scroll, the page never does */
  .bk-panes--fill > .bk-pane { min-height: 0; overflow: hidden; }
  .bk-panes--fill > .bk-pane > .bk-pane__body { flex: 1 1 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
}

/* ---------- message box (text + optional mic + send): grows with the text, never scrolls for two lines ---------- */
.bk-composer { display: flex; align-items: flex-end; gap: 6px; padding: 6px; border-radius: 24px; border: 1px solid var(--bk-line-strong); background: var(--bk-surface); transition: border-color var(--bk-fast), box-shadow var(--bk-fast); }
.bk-composer:focus-within { border-color: var(--bk-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bk-focus) 28%, transparent); }
.bk-composer__input { flex: 1 1 12em; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--bk-fg); resize: none; padding: 9px 10px; min-height: 42px; max-height: 10.5em; font-size: 1rem; line-height: 1.55; overflow-y: auto; field-sizing: content; }
.bk-composer__input::placeholder { color: var(--bk-fg-3); opacity: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-composer__input:focus-visible { outline: none; }
.bk-composer > .bk-btn { flex-shrink: 0; min-height: 42px; }
.bk-composer > .bk-btn--icon { width: 42px; }
@media (max-width: 480px) { .bk-composer__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .bk-composer > .bk-btn--primary { width: 42px; padding: 0; } }

/* ---------- text that must not break, and text that must be cut ---------- */
.bk-truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-clamp-2, .bk-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.bk-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.bk-clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }
.bk-break { overflow-wrap: anywhere; }                 /* emails, URLs, long codes inside a cell that may wrap */
.bk-mono { font-family: var(--bk-font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.bk-btn, .bk-badge, .bk-chip, .bk-seg__item, .bk-topbar__link, .bk-label, .bk-stat__label, th { word-break: keep-all; }  /* never split a label mid-word */

/* ---------- dense tables: sticky header, two-line cells, badges with their own room ---------- */
.bk-table-wrap--fit { max-height: min(70dvh, 640px); overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.bk-table-wrap--fit .bk-table thead th { position: sticky; top: 0; z-index: var(--bk-z-sticky); box-shadow: 0 1px 0 var(--bk-line); }
.bk-table--dense th { padding: 9px 12px; }
.bk-table--dense td { padding: 9px 12px; }
.bk-table td { overflow-wrap: break-word; }
.bk-table td.bk-break, .bk-table td .bk-break { overflow-wrap: anywhere; }
.bk-table .is-num { white-space: nowrap; }
.bk-table .is-fit { width: 1%; white-space: nowrap; }  /* a column exactly as wide as its content (status, actions, numbers) */
.bk-cell__main { display: block; font-weight: 700; line-height: 1.4; }
.bk-cell__sub { display: block; font-size: var(--bk-text-xs); color: var(--bk-fg-3); line-height: 1.5; }
.bk-table td > .bk-badge { vertical-align: middle; }
.bk-table tr.is-flash td { animation: bk-flash 1.6s var(--bk-ease); }
@keyframes bk-flash { 0%, 30% { background: var(--bk-accent-soft); } 100% { background: transparent; } }
.bk-list__row > .bk-grow { flex: 1 1 0; }               /* list rows keep one line of layout; text inside wraps or truncates */
.bk-list__title, .bk-list__meta { overflow-wrap: break-word; }
.bk-more { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--bk-line); }

/* ---------- search / filter bar above long lists ---------- */
.bk-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bk-toolbar .bk-input { min-height: 40px; }
.bk-search { position: relative; flex: 1 1 220px; min-width: 0; }
.bk-search > .bk-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--bk-fg-3); pointer-events: none; }
.bk-search > .bk-input { padding-left: 38px; }


/* ---------- v3: touch screens get full-size targets; contrast fixes are in the tokens above ---------- */
@media (pointer: coarse) {
  .bk-btn--sm, .bk-chip, .bk-seg__item, .bk-topbar__link { min-height: 44px; }
  .bk-btn--icon.bk-btn--sm { width: 44px; }
  .bk-topbar .bk-seg__item { min-height: 44px; }
  .bk-footer__links a, .bk-footer a { display: inline-flex; align-items: center; min-height: 44px; }
  .bk-brand, .bk-brand__product { min-height: 44px; display: inline-flex; align-items: center; }
  .bk-composer > .bk-btn { min-height: 44px; }
  .bk-composer > .bk-btn--icon, .bk-composer > .bk-btn--primary.bk-btn--icon { width: 44px; }
}
:root[data-theme="dark"] .bk-stamp { --_c: #7CC79A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk-stamp { --_c: #7CC79A; } }

/* v8: the theme button is filled by bekito-ui.js; without JavaScript it would be an empty box, so hide it */
[data-bk-theme-toggle]:empty { visibility: hidden; }

/* v9: every filled button keeps its fill on hover/press (the generic .bk-btn:hover would turn it paper with white text) */
.bk-btn--ok:hover, .bk-btn--ok:active { --_bg: #24603D; --_bd: transparent; --_fg: #fff; }
:root[data-theme="dark"] .bk-btn--ok:hover, :root[data-theme="dark"] .bk-btn--ok:active { --_bg: #93D3AC; --_fg: #0F1A14; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk-btn--ok:hover, :root:not([data-theme="light"]) .bk-btn--ok:active { --_bg: #93D3AC; --_fg: #0F1A14; } }
:root[data-theme="dark"] .bk-btn--ok { --_bg: #7CC79A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bk-btn--ok { --_bg: #7CC79A; } }
.bk-btn--primary:active { --_bg: var(--bk-accent-hover); --_bd: transparent; }
.bk-btn--navy:active { --_bd: transparent; }
/* on touch screens :hover sticks after a tap; filled buttons must look the same before and after */
@media (hover: none) {
  .bk-btn--primary:hover { --_bg: var(--bk-accent); }
  .bk-btn--ok:hover { --_bg: var(--bk-ok); }
}
