/* Bekito 承認ゲート — the demo screen.
   Built from the Bekito UI kit (panes, composer, dense tables). Only kit tokens are used here.

   Two layouts (service standard 2b):
     window at least 1280 wide AND 760 tall   three full-height panes side by side (the kit's .bk-panes --3 --fill);
                                             below 1280 px the three columns are too narrow for the examples and
                                             the company data, so the one-column layout takes over earlier than
                                             the kit's 1100 px minimum
                                             each pane body scrolls by itself, the page never scrolls
     anything smaller                        ONE column and ONE page scrollbar; tabs choose 会話 / AIの動き /
                                             会社のデータ / 記録 (at the top on desktop sizes, at the bottom on
                                             phones). The approval card also sits in 会話 under its request,
                                             so a decision never needs another tab.
   There is never a scrolling box inside another one. */

/* ---------- frame ---------- */
.g-app { --g-stick: calc(var(--bk-bar-h) + 1px + env(safe-area-inset-top, 0px)); --bk-fill-gap: 32px; }
.g-main { padding-block: 16px; }
.g-linkbtn { border: 0; background: none; }
.g-noscript { padding: 24px 16px; text-align: center; }
.g-pane--log { display: none; }
.g-main[data-view="log"] .g-panes { display: none; }
.g-main[data-view="log"] .g-pane--log { display: flex; }
.g-viewtabs-wrap { display: none; }
.g-pane > .bk-pane__head { flex-shrink: 0; min-height: 56px; }
.g-pane--chat > .g-foot { padding-block: 10px; }

/* three panes, big windows only */
@media (min-width: 1280px) and (min-height: 760px) {
  .g-only-single { display: none !important; }
  .g-app .g-data .bk-table thead th { top: 0; }
  .g-app .g-log .bk-table thead th { top: var(--g-stick); }
}

/* one column: everything smaller than 1280×760 */
@media (max-width: 1279.98px), (max-height: 759.98px) {
  .g-only-panes { display: none !important; }
  .bk-panes.g-panes { grid-template-columns: minmax(0, 1fr); }
  .g-panes > .g-pane { display: none; }
  .g-main[data-view="chat"] .g-pane--chat,
  .g-main[data-view="steps"] .g-pane--steps,
  .g-main[data-view="data"] .g-pane--data { display: flex; }
  .g-app .g-data .bk-table thead th, .g-app .g-log .bk-table thead th { top: var(--g-stick); }  /* .g-app: must beat the plain rule further down */
  /* before the first request the tab already says 会話 and there is nothing to start over, so the pane's
     heading row is left out: the examples and the message box get its height */
  .g-pane--chat:not(.is-started) > .bk-pane__head { display: none; }
  /* the message box always stays at the bottom of the window, above the phone tab bar: on a phone the
     examples are taller than the screen, and before this the box opened half hidden under the tab bar */
  .g-pane--chat > .g-foot { position: sticky; bottom: var(--g-foot-bottom, 0px); box-shadow: 0 -8px 20px -14px rgba(0, 0, 0, .45); }
}
/* the kit fills the window from 1100 px; this screen starts filling at 1280 px, so undo the fill in between
   (the script also removes the class there; this covers the moment before it runs) */
@media (min-width: 1100px) and (max-width: 1279.98px) {
  .g-panes.bk-panes--fill { height: auto; }
  .g-panes.bk-panes--fill > .bk-pane { overflow: visible; min-height: auto; }
  .g-panes.bk-panes--fill > .bk-pane > .bk-pane__body { overflow: visible; flex: 0 1 auto; }
}
/* desktop sizes in one column: tabs at the top, a readable column width */
@media (min-width: 900px) and (max-width: 1279.98px), (min-width: 1280px) and (max-height: 759.98px) {
  .g-app { --g-tabs-h: 60px; --g-stick: calc(var(--bk-bar-h) + 1px + env(safe-area-inset-top, 0px) + var(--g-tabs-h)); }
  .g-main.bk-wrap { max-width: calc(860px + 2 * var(--bk-gutter)); padding-top: 0; padding-bottom: 12px; }
  .g-viewtabs-wrap { display: block; position: sticky; top: calc(var(--bk-bar-h) + 1px + env(safe-area-inset-top, 0px)); z-index: var(--bk-z-sticky); height: var(--g-tabs-h); padding-block: 8px; background: var(--bk-bg); }
  .g-app .bk-tabbar { display: none; }
  body.g-app.bk-has-tabbar { padding-bottom: 0; }
}
@media (pointer: coarse) and (min-width: 900px) and (max-width: 1279.98px), (pointer: coarse) and (min-width: 1280px) and (max-height: 759.98px) {
  .g-app { --g-tabs-h: 66px; }
}
/* phones and small tablets: the kit's bottom tab bar */
@media (max-width: 899.98px) {
  .g-app { --g-foot-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .g-main { padding-block: 12px; }
}
.g-viewtabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
.g-viewtabs .bk-seg__item { gap: 8px; min-width: 0; }
.g-segbadge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--bk-r-pill); background: var(--bk-accent); color: var(--bk-accent-ink); font-size: var(--bk-text-xs); font-weight: 700; line-height: 20px; text-align: center; }
.g-segbadge[hidden] { display: none; }

/* phone tab bar extras: a count on "AIの動き", a dot on "データ" */
.g-app .bk-tabbar__item { font-size: var(--bk-text-xs); }
.g-tabicon { position: relative; display: inline-flex; }
.g-tabbadge { position: absolute; top: -6px; left: 14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--bk-r-pill); background: var(--bk-accent); color: var(--bk-accent-ink); font-size: var(--bk-text-xs); font-weight: 700; line-height: 18px; text-align: center; }
.g-tabdot { position: absolute; top: -2px; right: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--bk-ok); box-shadow: 0 0 0 2px var(--bk-surface); }
.bk-tabbar__item.is-nudged .g-tabicon, .g-viewtabs .is-nudged .g-segbadge { animation: g-nudge 480ms var(--bk-ease); }

/* ---------- conversation ---------- */
.g-chat { display: flex; flex-direction: column; gap: 14px; }
.g-hello { display: flex; flex-direction: column; gap: 8px; line-height: 1.7; }
.g-hello[hidden] { display: none; }
.g-msgs { display: flex; flex-direction: column; gap: 12px; }
.g-msgs:empty { display: none; }
.g-pane--chat.is-started .g-msgs { margin-top: auto; }  /* in a tall pane the newest message sits just above the message box */
.g-msg { display: flex; flex-direction: column; gap: 3px; max-width: 92%; align-self: flex-start; min-width: 0; animation: bk-rise var(--bk-med) var(--bk-ease) both; }
.g-msg__who { font-size: var(--bk-text-xs); color: var(--bk-fg-3); font-weight: 500; padding-inline: 4px; }
.g-msg__body { padding: 10px 14px; border-radius: 16px 16px 16px 6px; background: var(--bk-surface-2); border: 1px solid var(--bk-line); white-space: pre-wrap; line-height: 1.7; overflow-wrap: break-word; }
.g-msg--you { align-self: flex-end; align-items: flex-end; }
.g-msg--you .g-msg__body { background: var(--bk-fg); color: var(--bk-bg); border-color: transparent; border-radius: 16px 16px 6px 16px; }
/* while the AI works: three dots and what it is doing now (its plan, or the tool it called) */
.g-live { display: flex; align-items: flex-start; gap: 10px; align-self: stretch; color: var(--bk-fg-2); font-size: var(--bk-text-sm); line-height: 1.6; padding: 4px 4px 4px 2px; min-width: 0; }
.g-live .bk-dots { flex-shrink: 0; margin-top: 8px; color: var(--bk-fg-3); }
.g-live__text { flex: 1 1 0; min-width: 0; }

/* what the gate did, said in the conversation too */
.g-gateline { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--bk-r-md); background: var(--bk-surface); border: 1px solid var(--bk-line); border-left: 4px solid var(--_c, var(--bk-line-strong)); font-size: var(--bk-text-sm); line-height: 1.6; min-width: 0; animation: bk-rise var(--bk-med) var(--bk-ease) both; }
.g-gateline > .bk-ico { color: var(--_c, var(--bk-fg-3)); align-self: flex-start; margin-top: 2px; }
.g-gateline__text { flex: 1 1 0; min-width: 0; }
.g-gateline__text strong { display: block; }
.g-gateline--waiting { --_c: var(--bk-warn); }
.g-gateline--stopped { --_c: var(--bk-danger); }
.g-gateline--ok { --_c: var(--bk-ok); }
.g-gateline--read { --_c: var(--bk-info); }
.g-gateline .bk-btn, .g-gateline .bk-link-btn { flex-shrink: 0; }
.g-gateline.is-bounce, .g-call.is-bounce { animation: g-bounce 420ms var(--bk-ease) both; }
.g-msgs > .g-approval { animation: bk-rise var(--bk-med) var(--bk-ease) both; }
/* once a person decides, the AI's earlier reply is greyed and a line under it says what happened */
.g-msg--ai.is-outdated .g-msg__body { color: var(--bk-fg-2); background: transparent; border-style: dashed; }
.g-msg__when { font-weight: 400; }
.g-outcome { display: flex; flex-direction: column; gap: 4px; align-self: flex-start; max-width: 92%; margin-top: -4px; animation: bk-rise var(--bk-med) var(--bk-ease) both; }
.g-outcome__line { display: flex; align-items: flex-start; gap: 8px; padding: 8px 12px; border-radius: var(--bk-r-md); background: var(--bk-surface-2); font-size: var(--bk-text-sm); font-weight: 600; line-height: 1.6; color: var(--bk-fg); }
.g-outcome__line > .bk-ico { flex-shrink: 0; margin-top: 3px; color: var(--bk-fg-3); }
.g-outcome__line.is-approved > .bk-ico { color: var(--bk-ok); }
.g-outcome__line > span { min-width: 0; overflow-wrap: break-word; }

/* example requests: a list at the start, a fold-out panel above the message box afterwards */
.g-examples { display: flex; flex-direction: column; gap: 6px; }
.g-examples[hidden] { display: none; }
.g-examples__label { font-size: var(--bk-text-xs); font-weight: 700; color: var(--bk-fg-3); letter-spacing: .04em; margin-top: 2px; }
.g-examples__list { display: flex; flex-direction: column; gap: 6px; }
.g-examples--menu { padding: 10px; margin-bottom: 4px; border: 1px solid var(--bk-line-strong); border-radius: var(--bk-r-lg); background: var(--bk-surface); box-shadow: var(--bk-shadow-3); }
.g-chip { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 12px; border-radius: var(--bk-r-md); border: 1px solid var(--bk-line-strong); background: var(--bk-surface); color: var(--bk-fg); font-size: var(--bk-text-sm); font-weight: 500; line-height: 1.5; text-align: left; text-decoration: none; transition: border-color var(--bk-fast), background var(--bk-fast), transform var(--bk-fast) var(--bk-ease); }
.g-chip:hover { border-color: var(--bk-fg-3); background: var(--bk-surface-2); color: var(--bk-fg); }
.g-chip:active { transform: scale(.985); }
.g-chip > span { flex: 1 1 0; min-width: 0; }
.g-chip .bk-ico { color: var(--bk-accent); flex-shrink: 0; }
.g-chip--break .bk-ico { color: var(--bk-danger); }
.g-chip[disabled] { opacity: .5; pointer-events: none; }
/* on wide columns the examples sit two to a row, so all five fit above the message box */
@container chatpane (min-width: 620px) {
  .g-examples__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-examples__list > .g-chip:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.g-pane--chat { container: chatpane / inline-size; }

/* the message box: the text gets the whole width; examples, microphone and send sit under it */
.g-foot { background: var(--bk-surface); border-radius: 0 0 var(--bk-r-lg) var(--bk-r-lg); z-index: var(--bk-z-sticky); display: flex; flex-direction: column; gap: 6px; }
.g-pane--chat.is-started > .g-foot { box-shadow: 0 -8px 20px -14px rgba(0, 0, 0, .45); }
.bk-composer.g-composer { flex-wrap: wrap; align-items: center; border-radius: var(--bk-r-lg); padding: 4px 6px 6px; gap: 2px 6px; }
.g-composer > .bk-composer__input { flex: 1 1 100%; min-height: 44px; max-height: 8.5em; }  /* about five lines, then it scrolls */
.g-composer__bar { display: flex; align-items: center; gap: 6px; flex: 1 1 100%; min-width: 0; }
.g-composer__bar .bk-btn { min-height: 40px; }
.g-composer__bar .bk-btn--icon { width: 40px; }
.g-send { padding-inline: 16px; }
.g-examples-toggle { padding-inline: 10px; }
.g-examples-toggle[hidden] { display: none; }
.g-examples-toggle[aria-expanded="true"] .bk-ico { transform: rotate(180deg); }
@media (pointer: coarse) { .g-composer__bar .bk-btn { min-height: 44px; } .g-composer__bar .bk-btn--icon { width: 44px; } }
.g-status { font-size: var(--bk-text-xs); line-height: 1.6; color: var(--bk-fg-2); padding-inline: 4px; }
.g-status:empty { display: none; }
.g-status.is-error { color: var(--bk-danger); font-weight: 500; }
.g-datanote { font-size: var(--bk-text-xs); line-height: 1.6; color: var(--bk-fg-3); padding-inline: 4px; }
.g-datanote .bk-link-btn { font-size: inherit; white-space: nowrap; }
#mic[aria-pressed="true"] { --_bg: var(--bk-danger-soft); --_fg: var(--bk-danger); }
.g-notelist { display: flex; flex-direction: column; gap: 14px; }
.g-notelist li { display: flex; gap: 12px; align-items: flex-start; line-height: 1.7; }
.g-notelist .bk-ico { color: var(--bk-accent); margin-top: 3px; }

/* ---------- AI steps (the gate lane) ---------- */
.g-steps { display: flex; flex-direction: column; gap: 18px; }
.g-steps__empty[hidden] { display: none; }
.g-empty-art { width: 120px; height: 72px; color: var(--bk-fg-3); margin-bottom: 6px; }
.g-req { min-width: 0; scroll-margin-top: calc(var(--g-stick) + 12px); }
.g-req + .g-req { padding-top: 14px; border-top: 1px solid var(--bk-line); }
.g-req[open] > .g-flow { margin-top: 10px; }
/* the summary line of a request: number, words, what happened; tap to fold or unfold */
.g-req__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 4px 8px; min-height: 44px; padding: 2px 0; font-size: var(--bk-text-sm); color: var(--bk-fg-2); line-height: 1.5; cursor: pointer; list-style: none; border-radius: var(--bk-r-sm); }
.g-req__head::-webkit-details-marker { display: none; }
.g-req__head:hover .g-req__text { color: var(--bk-fg); }
.g-req__line { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.g-req__no { flex-shrink: 0; font-size: var(--bk-text-xs); font-weight: 700; color: var(--bk-accent); letter-spacing: .04em; white-space: nowrap; }
.g-req__text { min-width: 0; }
.g-req__tally { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.g-req__tally:empty { display: none; }  /* a request that only talked has no badges and no empty row */
.g-req__head > .bk-ico { color: var(--bk-fg-3); margin-top: 2px; transition: transform var(--bk-fast) var(--bk-ease); }
.g-req[open] .g-req__head > .bk-ico { transform: rotate(180deg); }
.g-req:not([open]) .g-req__text { -webkit-line-clamp: 1; line-clamp: 1; }
.g-req[open] .g-req__text { display: block; -webkit-line-clamp: unset; line-clamp: none; overflow: visible; }  /* open: the whole request; folded: one line */
.g-flow { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.g-step { animation: bk-rise var(--bk-med) var(--bk-ease) both; min-width: 0; }
.g-step--plan, .g-step--answer, .g-step--notice { display: flex; gap: 8px; align-items: flex-start; font-size: var(--bk-text-sm); color: var(--bk-fg-2); line-height: 1.6; padding-inline: 2px; }
.g-step--plan > p, .g-step--answer > p, .g-step--notice > p { flex: 1 1 0; min-width: 0; }
.g-step--plan .bk-ico, .g-step--answer .bk-ico, .g-step--notice .bk-ico { color: var(--bk-fg-3); margin-top: 3px; }
.g-step--notice, .g-step--notice .bk-ico { color: var(--bk-danger); }
.g-step__label { font-weight: 700; color: var(--bk-fg); margin-right: 6px; white-space: nowrap; }

.g-call { background: var(--bk-surface-2); border: 1px solid var(--bk-line); border-radius: var(--bk-r-md); overflow: hidden; }
.g-call__head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 10px 12px 6px; }
.g-call__head .bk-ico { color: var(--bk-fg-3); }
.g-call__title { font-weight: 700; line-height: 1.4; }
.g-call__fn { font-family: var(--bk-font-mono); font-size: var(--bk-text-xs); color: var(--bk-fg-3); overflow-wrap: anywhere; }
.g-args { margin: 0; padding: 0 12px 10px; display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 2px 10px; font-size: var(--bk-text-xs); line-height: 1.6; }
.g-args { font-size: var(--bk-text-sm); }
.g-args { grid-template-columns: fit-content(42%) minmax(0, 1fr); }
.g-args dt { color: var(--bk-fg-3); font-size: var(--bk-text-xs); padding-top: 1px; min-width: 0; overflow-wrap: break-word; }
.g-args dt.is-code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }  /* a long part number is cut with "…" (full text on hover); words wrap */
.g-args dd { color: var(--bk-fg); overflow-wrap: break-word; white-space: pre-wrap; min-width: 0; }
.g-raw { padding: 0 12px 10px; font-size: var(--bk-text-xs); color: var(--bk-fg-3); }
.g-raw > summary { cursor: pointer; width: max-content; min-height: 24px; }
.g-raw__code { display: block; margin-top: 4px; font-family: var(--bk-font-mono); color: var(--bk-fg-2); overflow-wrap: anywhere; white-space: pre-wrap; }
.g-log .g-raw { padding: 2px 0 0; }
.g-verdict { display: flex; align-items: flex-start; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--bk-line); background: color-mix(in srgb, var(--_bg, var(--bk-surface)) 65%, var(--bk-surface)); font-size: var(--bk-text-sm); line-height: 1.55; }  /* a lighter tint keeps the coloured label above 4.5:1 in both themes */
.g-verdict > .bk-ico { color: var(--_c, var(--bk-fg-3)); margin-top: 2px; }
.g-verdict > div { flex: 1 1 0; min-width: 0; }
.g-verdict__label { font-weight: 700; color: var(--_c, var(--bk-fg)); }
.g-verdict__class { font-weight: 500; color: var(--bk-fg-2); font-size: var(--bk-text-xs); margin-left: 6px; white-space: nowrap; }
.g-verdict__rule { display: block; color: var(--bk-fg-2); }
.g-verdict__after { display: block; margin-top: 2px; font-weight: 700; color: var(--_after, var(--bk-fg-2)); }
.g-verdict__after.is-approved { --_after: var(--bk-ok); }
.g-verdict--allow { --_c: var(--bk-info); --_bg: var(--bk-info-soft); }
.g-verdict--approval { --_c: var(--bk-warn); --_bg: var(--bk-warn-soft); }
.g-verdict--forbidden, .g-verdict--invalid { --_c: var(--bk-danger); --_bg: var(--bk-danger-soft); }

/* ---------- approval card ---------- */
.g-approval { position: relative; background: var(--bk-surface); border: 1px solid var(--bk-line-strong); border-radius: var(--bk-r-lg); box-shadow: var(--bk-shadow-2); padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; scroll-margin: calc(var(--g-stick) + 12px) 0 160px; }
.g-approval[data-status="pending"] { border-color: var(--bk-warn); }
.g-approval[data-status="approved"] { border-color: var(--bk-ok); box-shadow: var(--bk-shadow-1); }
.g-approval[data-status="rejected"], .g-approval[data-status="stale"] { box-shadow: none; }
.g-approval.is-flash { animation: g-flash 900ms var(--bk-ease); }
.g-approval__head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-height: 28px; }
.g-approval[data-status="approved"] .g-approval__head { padding-right: 64px; min-height: 52px; }  /* room for the stamp */
.g-approval__title { font-weight: 700; font-size: var(--bk-text-md); line-height: 1.4; flex: 1 1 100%; }
.g-approval__meta { font-size: var(--bk-text-xs); color: var(--bk-fg-2); white-space: nowrap; }
.g-approval .bk-stamp { position: absolute; top: 10px; right: 12px; background: var(--bk-surface); }
.g-diff { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.g-diff__row { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--bk-r-md); background: var(--bk-surface-2); border: 1px solid var(--bk-line); min-width: 0; }
.g-diff__title { font-weight: 700; font-size: var(--bk-text-sm); line-height: 1.5; overflow-wrap: anywhere; }
.g-change { display: grid; grid-template-columns: minmax(3.5em, max-content) minmax(0, 1fr); gap: 4px 12px; align-items: baseline; font-size: var(--bk-text-sm); line-height: 1.6; }
.g-change__field { color: var(--bk-fg-2); font-size: var(--bk-text-xs); white-space: nowrap; }
.g-change__value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.g-before { color: var(--bk-fg-2); text-decoration: line-through; white-space: nowrap; }
.g-arrow { color: var(--bk-fg-3); display: inline-flex; align-self: center; }
.g-arrow svg { width: 16px; height: 16px; }
.g-after { font-weight: 700; color: var(--bk-fg); white-space: nowrap; }
.g-after--num { font-size: var(--bk-text-lg); }
.g-delta { font-size: var(--bk-text-xs); color: var(--bk-fg-2); white-space: nowrap; }
.g-change__text { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.g-approval__reason { font-size: var(--bk-text-sm); color: var(--bk-fg-2); line-height: 1.6; overflow-wrap: anywhere; }
.g-approval__reason b { color: var(--bk-fg-2); font-size: var(--bk-text-xs); font-weight: 700; margin-right: 8px; white-space: nowrap; }
.g-approval__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.g-approval__actions[hidden] { display: none; }
.g-approval__actions .bk-btn { flex: 1 1 7em; padding-inline: 12px; }
.g-approval__actions .bk-btn--ok { flex-grow: 1.5; }
.g-approval__outcome { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: var(--bk-text-sm); color: var(--bk-fg-2); line-height: 1.6; }
.g-approval__outcome .bk-link-btn { white-space: nowrap; }
.g-rejectform { display: flex; flex-direction: column; gap: 10px; scroll-margin-bottom: calc(84px + env(safe-area-inset-bottom)); }

/* ---------- company data ---------- */
.g-company { font-size: var(--bk-text-sm); color: var(--bk-fg-2); flex: 1 1 0; }
.g-pane--data > .bk-pane__head { justify-content: flex-start; }
.g-datahead { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--bk-line); flex-shrink: 0; }
.g-seg { display: grid; width: 100%; }
.g-seg .bk-seg__item { padding-inline: 6px; min-width: 0; }
.g-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bk-ok); flex-shrink: 0; }
.g-dot[hidden] { display: none; }
.g-count { font-size: var(--bk-text-xs); color: var(--bk-fg-2); white-space: nowrap; }
.g-data:focus-visible { outline-offset: -3px; }
.g-skel { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.g-skel .bk-skel { min-height: 44px; }
.g-pad { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.g-data .bk-table th:first-child, .g-data .bk-table td:first-child, .g-log .bk-table th:first-child, .g-log .bk-table td:first-child { padding-left: 16px; }
.g-data .bk-table th:last-child, .g-data .bk-table td:last-child, .g-log .bk-table th:last-child, .g-log .bk-table td:last-child { padding-right: 16px; }
.g-data .bk-table thead th, .g-log .bk-table thead th { position: sticky; top: 0; z-index: var(--bk-z-sticky); box-shadow: 0 1px 0 var(--bk-line); }
.g-code { font-family: var(--bk-font-latin); font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.g-code.bk-truncate { display: block; width: 0; min-width: 100%; }  /* takes the cell's width but never widens the table */
.g-code.is-full { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.g-draft__code { min-width: 0; max-width: 100%; }
.g-qty { font-weight: 700; font-size: var(--bk-text-md); }
.g-cell { display: block; min-width: 0; }
.g-cell .bk-cell__main, .g-cell .bk-cell__sub { overflow-wrap: anywhere; }  /* a long phrase may break rather than widen the table */
/* a change that waits for approval is written on its own line under the row it would change */
.bk-table tr.g-subrow td { border-top: 0; padding-top: 0; padding-bottom: 10px; background: transparent; }
.g-wait { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 6px 10px; border-radius: var(--bk-r-sm); background: var(--bk-warn-soft); font-size: var(--bk-text-xs); line-height: 1.6; text-align: left; }
.g-wait b { color: var(--bk-warn); white-space: nowrap; }
.g-readbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bk-info-soft); border-bottom: 1px solid var(--bk-line); font-size: var(--bk-text-sm); font-weight: 500; }
.g-readbar > .bk-ico { color: var(--bk-info); }
.g-readbar .bk-link-btn { white-space: nowrap; min-height: 32px; }
.g-subhead { font-size: var(--bk-text-sm); font-weight: 700; }
.g-draftlist { border: 1px solid var(--bk-line); border-radius: var(--bk-r-md); }
.g-draft { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--bk-line); font-size: var(--bk-text-sm); }
.g-draft:first-child { border-top: 0; }
.g-draft > .bk-grow { flex: 1 1 8em; }
.g-msgcard { background: var(--bk-surface-2); border: 1px solid var(--bk-line); border-radius: var(--bk-r-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.g-msgcard__subject { font-weight: 700; line-height: 1.5; font-size: var(--bk-text-md); overflow-wrap: anywhere; }
.g-msgcard__meta { font-size: var(--bk-text-xs); color: var(--bk-fg-2); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.g-msgcard__body { font-size: var(--bk-text-sm); color: var(--bk-fg-2); white-space: pre-wrap; line-height: 1.7; overflow-wrap: anywhere; }
.g-msgcard.is-flash, .g-draft.is-flash { animation: bk-flash 1.6s var(--bk-ease); }
.g-none { padding: 28px 16px; text-align: center; color: var(--bk-fg-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* narrow panes (a phone, or the data pane in a small three-pane window): a row is two columns,
   the name on the left and its values stacked on the right, so the name keeps its width */
.g-pane--data { container: datapane / inline-size; }
.g-pane--log { container: logpane / inline-size; }
@container datapane (max-width: 560px) {
  .g-rows, .g-rows tbody { display: block; width: 100%; }
  .g-rows thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .g-rows tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 14px; row-gap: 2px; align-items: start; padding: 12px 16px; border-top: 1px solid var(--bk-line); }
  .g-rows tr:first-child { border-top: 0; }
  .g-data .g-rows td, .g-data .g-rows td:first-child, .g-data .g-rows td:last-child { display: block; padding: 0; border: 0; text-align: right; white-space: nowrap; width: auto; }
  .g-data .g-rows td.is-title { grid-column: 1; grid-row: 1 / span 3; text-align: left; white-space: normal; }
  .g-rows td:not(.is-title) { grid-column: 2; font-size: var(--bk-text-sm); line-height: 1.6; }
  .g-rows td.g-labelled::before { content: attr(data-label) " "; color: var(--bk-fg-3); font-size: var(--bk-text-xs); }
  .g-data .g-rows td.is-empty { display: none; }
  .g-rows tr.g-subrow { display: block; border-top: 0; padding: 0 16px 12px; }
  .g-data .g-rows tr.g-subrow td { text-align: left; white-space: normal; }
  .g-rows tr.is-flash { animation: bk-flash 1.6s var(--bk-ease); }
}
@container logpane (max-width: 640px) {
  .g-logrows, .g-logrows tbody { display: block; width: 100%; }
  .g-logrows thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .g-logrows tr { display: block; padding: 10px 16px; border-top: 1px solid var(--bk-line); }
  .g-logrows tr:first-child { border-top: 0; }
  .g-log .g-logrows td, .g-log .g-logrows td:first-child, .g-log .g-logrows td:last-child { display: inline; padding: 0; border: 0; width: auto; font-size: var(--bk-text-xs); color: var(--bk-fg-2); white-space: nowrap; }
  .g-log .g-logrows td + td:not(.g-log__what)::before { content: "・"; color: var(--bk-fg-3); }
  .g-log .g-logrows td[data-label]:nth-child(2)::before { content: "・" attr(data-label) " "; }
  .g-log .g-logrows td.g-log__what, .g-log .g-logrows td.g-log__what:last-child { display: block; margin-top: 3px; font-size: var(--bk-text-sm); color: var(--bk-fg); white-space: pre-wrap; }
  .g-log .g-logrows tr.is-newreq { border-top: 2px solid var(--bk-line-strong); }
  .g-log .bk-table tr.is-newreq td { border-top: 0; }
}

/* ---------- record ---------- */
.g-log__save { flex-wrap: nowrap; }
.g-log .g-log__time { font-family: var(--bk-font-latin); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--bk-fg-2); }
.g-log .g-log__what { overflow-wrap: anywhere; white-space: pre-wrap; }
.g-log .bk-table tr.is-newreq td { border-top: 2px solid var(--bk-line-strong); }
.g-log__rule { display: block; color: var(--bk-fg-2); }
.g-log__args { display: block; font-family: var(--bk-font-mono); font-size: var(--bk-text-xs); color: var(--bk-fg-2); overflow-wrap: anywhere; }

/* ---------- motion ---------- */
/* a refused call is pushed back once by the gate */
@keyframes g-bounce { 0% { transform: translateX(0); } 30% { transform: translateX(8px); } 62% { transform: translateX(-4px); } 100% { transform: translateX(0); } }
@keyframes g-nudge { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-4px); } }
@keyframes g-flash { 0%, 100% { box-shadow: var(--bk-shadow-2); } 40% { box-shadow: 0 0 0 4px var(--bk-warn-soft), var(--bk-shadow-2); } }
