/* Apps built in Acter (/a/<slug>): a dashboard page, and its full-screen mode for the shop floor computer.
   Every class is bt- prefixed. Colours come from the app's tokens (light/dark follow Settings) except the floor screen,
   which is always dark and high-contrast. Colour only where it means something: the andon light (working green,
   on hold yellow), late and missed in red. Corners 3 / 4 / 6 px, borders instead of shadows, one 150 ms ease-out. */

.bt { padding: 28px 32px 40px; max-width: 1480px; box-sizing: border-box; }
.bt-mark { display: block; flex: none; }
.bt-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.bt-head-t { min-width: 0; flex: 1; }
.bt-head h1 { font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.bt-meta { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.bt-head-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.bt-pill { font-size: 12px; color: var(--amber); background: var(--amber-bg); border-radius: 3px; padding: 3px 8px; font-weight: 500; }

.bt-btn { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 4px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms ease-out, opacity 150ms ease-out; }
.bt-btn:hover { background: var(--subtle); }
.bt-btn:disabled { opacity: .55; cursor: default; }
.bt-btn.bt-primary { background: var(--text); border-color: var(--text); color: var(--surface); }
.bt-btn.bt-primary:hover { opacity: .88; }
.bt-btn.bt-quiet { font-weight: 500; color: var(--text-2); }

.bt-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.bt-w { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; min-width: 0; box-sizing: border-box; }
.bt-w-small { grid-column: span 1; }
.bt-w-half { grid-column: span 2; }
.bt-w-full { grid-column: 1 / -1; }
.bt-w-h { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.bt-empty { color: var(--faint); margin: 4px 0; }
.bt-muted { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.bt-more { color: var(--faint); font-size: 12px; margin: 8px 0 0; }
.bt-foot { color: var(--faint); font-size: 12px; margin: 20px 0 0; }
.bt-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95em; }
.bt-sub { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.bt-late { color: var(--red); font-weight: 600; }
.bt-warn { margin: 0 0 10px; font-size: 13px; color: var(--amber); background: var(--amber-bg); padding: 6px 10px; border-radius: 3px; }
.bt-note { font-size: 17px; font-weight: 600; margin: 0; }

/* queues by station: the andon colours */
.bt-q { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.bt-q-st { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bt-q-zero { opacity: .5; }
.bt-q-name { font-size: 12px; font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-q-n { font-size: 28px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.bt-q-bar { display: flex; height: 6px; border-radius: 2px; overflow: hidden; background: var(--line); }
.bt-q-seg { display: block; height: 100%; flex: none; }
.bt-q-here, .bt-legend .bt-q-here { background: #16A34A; }
.bt-q-waiting, .bt-legend .bt-q-waiting { background: #94A3B8; }
.bt-q-held, .bt-legend .bt-q-held { background: #EAB308; }
.bt-q-meta { font-size: 12px; color: var(--muted); }
.bt-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.bt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bt-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* one KPI */
.bt-kpi-row { display: flex; align-items: baseline; gap: 6px; }
.bt-kpi-v { font-size: 34px; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.bt-kpi-u { color: var(--muted); font-size: 14px; }
.bt-kpi-none { font-size: 18px; font-weight: 600; color: var(--faint); }
.bt-kpi-goal { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.bt-goal-good .bt-kpi-goal { color: var(--green); font-weight: 600; }
.bt-goal-bad .bt-kpi-goal, .bt-goal-bad .bt-kpi-v { color: var(--red); }
.bt-spark { display: block; width: 100%; height: 28px; margin-top: 10px; color: var(--text-2); }
.bt-bd { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.bt-bd-t { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.bt-bd-r { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; align-items: center; gap: 8px; font-size: 12px; }
.bt-bd-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bt-bd-bar { height: 5px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bt-bd-bar span, .bt-pct-bar span { display: block; height: 100%; background: var(--text-2); }
.bt-bd-v { font-variant-numeric: tabular-nums; color: var(--muted); }

/* tables and lists (a wide table scrolls inside its widget, never the page) */
.bt-tw { overflow-x: auto; }
.bt-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.bt-t th { text-align: left; font-weight: 500; font-size: 12px; color: var(--faint); padding: 0 8px 6px 0; border-bottom: 1px solid var(--line); }
.bt-t td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.bt-t tr:last-child td { border-bottom: 0; }
.bt-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bt-noreason { color: var(--amber); font-weight: 600; }
.bt-pct { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.bt-pct-bar { flex: 1; height: 5px; background: var(--line); border-radius: 2px; overflow: hidden; min-width: 40px; }
.bt-tag { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 3px; white-space: nowrap; }
.bt-tag-risk { color: var(--red); border: 1px solid currentColor; }
.bt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bt-list li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.bt-list li:last-child { border-bottom: 0; }
.bt-list .bt-muted { margin: 0; }
.bt-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--faint); }
.bt-dot-high { background: var(--red); }
.bt-dot-medium { background: #EAB308; }
.bt-gone { max-width: 520px; padding: 40px 0; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.bt-gone p { color: var(--muted); margin: 0; }

/* the shop floor computer: whole screen, always dark, big type, readable from across the floor */
.bt-screen { position: fixed; inset: 0; z-index: 60; overflow: auto; max-width: none; padding: 24px 28px 28px;
  --bg: #0B0B0B; --surface: #151515; --subtle: #1E1E1E; --line: #2A2A2A; --line-strong: #3A3A3A;
  --text: #FAFAFA; --text-2: #E5E5E5; --muted: #B3B3B3; --faint: #8A8A8A;
  --green: #4ADE80; --amber: #FACC15; --amber-bg: #3A2A05; --red: #F87171;
  background: var(--bg); color: var(--text); color-scheme: dark; font-size: 16px; }
.bt-screen h1 { color: var(--text); font-size: 30px; }
.bt-screen .bt-clock { font-size: 34px; font-variant-numeric: tabular-nums; margin-right: 8px; }
.bt-screen .bt-exit { opacity: .45; }
.bt-screen .bt-exit:hover, .bt-screen .bt-exit:focus-visible { opacity: 1; }
.bt-screen .bt-w-h { font-size: 14px; }
.bt-screen .bt-kpi-v { font-size: 52px; }
.bt-screen .bt-q-n { font-size: 40px; }
.bt-screen .bt-q-name, .bt-screen .bt-q-meta { font-size: 14px; }
.bt-screen .bt-t { font-size: 16px; }
.bt-screen .bt-t th, .bt-screen .bt-sub, .bt-screen .bt-muted { font-size: 13px; }

@media (max-width: 1100px) {
  .bt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-w-half { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .bt { padding: 20px 16px 32px; }
  .bt-grid { grid-template-columns: minmax(0, 1fr); }
  .bt-w-small, .bt-w-half { grid-column: 1 / -1; }
  .bt-head { flex-wrap: wrap; }
  .bt-head-side { width: 100%; justify-content: flex-start; }
  .bt-pct { min-width: 0; }
  .bt-pct-bar { display: none; }
  .bt-sub { max-width: 160px; }
}
@media (prefers-reduced-motion: reduce) { .bt-btn { transition: none; } }

/* Apps page: an app's drawn icon in its square */
.app-sq .bt-mark { border-radius: 12px; }
.app-sq .app-sq-n { overflow-wrap: anywhere; }

/* Apps page: "Built by you" (drafts): wide cards, icon and text on top, the buttons on their own row */
.bt-yours { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.bt-yours-head h2 { font-size: 15px; font-weight: 650; margin: 0; }
.bt-yours-head p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.bt-yours-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-top: 14px; }
.bt-draft { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 0 14px; padding: 16px 16px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; transition: border-color 150ms ease-out; }
.bt-draft:hover { border-color: var(--line-strong); }
.bt-draft-ic { display: block; width: 48px; height: 48px; }
.bt-draft-ic .bt-mark { border-radius: 11px; }
.bt-draft-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.bt-draft-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bt-draft-n { font-size: 15px; font-weight: 650; color: var(--text); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-draft-n:hover { text-decoration: underline; text-underline-offset: 2px; }
.bt-draft-top .bt-pill { flex: none; font-size: 11px; padding: 2px 7px; }
.bt-draft-about { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-2); overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bt-draft-meta { font-size: 12px; color: var(--faint); }
.bt-draft-acts { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; padding-top: 12px;
  border-top: 1px solid var(--line); }
.bt-draft-acts .bt-btn { height: 32px; padding: 0 12px; font-size: 13px; }
.bt-draft-who { margin-right: auto; font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .bt-yours-list { grid-template-columns: minmax(0, 1fr); } }

/* Ask Acter's card for an app it built */
.ak-card.ak-built { align-items: flex-start; }
.ak-built .bt-mark { border-radius: 9px; }
.ak-built-ws { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ak-built-ws span { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; background: var(--surface); }
.ak-built-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* deleting an app: Delete, then "Delete for good" (two taps) */
.bt-btn.bt-del { color: var(--red); font-weight: 500; }
.bt-btn.bt-del:hover { background: #FEF3F2; border-color: #FDA29B; }
.bt-draft-acts .bt-del-left { margin-right: auto; }
.bt-draft-who + .bt-del-left { margin-right: 0; }
.bt-btn.bt-danger { background: var(--red); border-color: var(--red); color: #fff; }
.bt-btn.bt-danger:hover { opacity: .9; background: var(--red); }
.bt-confirm { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; width: 100%;
  padding: 10px 12px; border: 1px solid #FDA29B; border-radius: 6px; background: #FEF3F2; color: var(--text); }
.bt-confirm p { margin: 0; font-size: 13px; line-height: 1.45; flex: 1 1 220px; }
.bt-confirm strong { font-weight: 650; }
.bt-confirm-acts { display: flex; gap: 8px; flex: none; }
.bt-head + .bt-confirm { margin: -8px 0 20px; }
[data-theme="dark"] .bt-confirm { background: rgba(217, 45, 32, .12); border-color: rgba(253, 162, 155, .45); }
[data-theme="dark"] .bt-btn.bt-del:hover { background: rgba(217, 45, 32, .12); border-color: rgba(253, 162, 155, .45); }
