/* lab-kit.css · styles for lab-kit.js. Uses each app's own theme tokens (hsl(var(--primary)) and friends), so the
   added pages, menus and dialogs match the prototype they sit in, in light and dark mode. */
.lab-page { --lab-gap: 24px; max-width: 1400px; margin: 0 auto; padding: 32px 24px 64px; color: hsl(var(--foreground)); }
.lab-page h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.1; letter-spacing: -0.02em; margin: 4px 0 6px; font-weight: 600; }
.lab-page .lab-eyebrow { font: 600 11px/1 var(--font-mono, ui-monospace, monospace); letter-spacing: .16em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.lab-page .lab-lede { color: hsl(var(--muted-foreground)); margin: 0 0 24px; max-width: 70ch; }
.lab-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.lab-grid { display: grid; gap: var(--lab-gap); }
.lab-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lab-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lab-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lab-main-side { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1100px) { .lab-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lab-main-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .lab-cols-3, .lab-cols-2 { grid-template-columns: minmax(0, 1fr); } .lab-page { padding: 24px 16px 48px; } }
@media (max-width: 480px) { .lab-cols-4 { gap: 12px; } .lab-cols-4 .lab-card { padding: 16px; } .lab-stat .v { font-size: 24px; } }
.lab-card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius, .5rem) + 4px); padding: 20px; min-width: 0; }
.lab-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.lab-stat .v { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.lab-stat .k { font: 600 11px/1.2 var(--font-mono, ui-monospace, monospace); letter-spacing: .12em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.lab-stat .d { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 4px; }
.lab-muted { color: hsl(var(--muted-foreground)); }
.lab-small { font-size: 12.5px; }
.lab-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lab-row > .grow { flex: 1; min-width: 0; }
.lab-list { list-style: none; margin: 0; padding: 0; }
.lab-list > li { padding: 12px 0; border-bottom: 1px solid hsl(var(--border)); }
.lab-list > li:last-child { border-bottom: 0; }
.lab-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: hsl(var(--secondary)); color: hsl(var(--foreground)); white-space: nowrap; }
.lab-pill.good { background: hsl(145 55% 42% / .14); color: hsl(145 55% 32%); }
.lab-pill.warn { background: hsl(38 90% 50% / .16); color: hsl(30 80% 36%); }
.lab-pill.bad { background: hsl(0 70% 50% / .13); color: hsl(0 65% 44%); }
.dark .lab-pill.good { color: hsl(145 55% 62%); } .dark .lab-pill.warn { color: hsl(38 90% 62%); } .dark .lab-pill.bad { color: hsl(0 80% 70%); }
.lab-avatar { width: 32px; height: 32px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #fff; flex: none; }
/* controls */
.lab-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: calc(var(--radius, .5rem)); border: 1px solid hsl(var(--border)); background: hsl(var(--card)); color: hsl(var(--foreground)); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s, transform .05s; white-space: nowrap; }
.lab-btn:hover { background: hsl(var(--secondary)); }
.lab-btn:active { transform: translateY(1px); }
.lab-btn.primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: hsl(var(--primary)); }
.lab-btn.primary:hover { filter: brightness(1.08); }
.lab-btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.lab-btn[disabled] { opacity: .5; cursor: default; }
.lab-link { background: none; border: 0; padding: 0; color: hsl(var(--primary)); font: inherit; font-weight: 600; cursor: pointer; }
.lab-input, .lab-select, .lab-textarea { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: calc(var(--radius, .5rem)); border: 1px solid hsl(var(--border)); background: hsl(var(--background)); color: hsl(var(--foreground)); font: inherit; font-size: 14px; box-sizing: border-box; }
.lab-textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.lab-input:focus, .lab-select:focus, .lab-textarea:focus { outline: 2px solid hsl(var(--ring) / .5); outline-offset: 1px; border-color: hsl(var(--ring)); }
.lab-field { display: grid; gap: 6px; margin-bottom: 14px; }
.lab-field > span { font-size: 12.5px; font-weight: 600; color: hsl(var(--muted-foreground)); }
.lab-btn:focus-visible, .lab-link:focus-visible, .lab-switch:focus-visible, .lab-chip:focus-visible, [role="tab"]:focus-visible, .lab-navlist button:focus-visible, .lab-tr:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lab-chip { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); color: hsl(var(--muted-foreground)); font: inherit; font-size: 13px; cursor: pointer; }
.lab-chip:hover { color: hsl(var(--foreground)); }
.lab-chip[aria-pressed="true"] { background: hsl(var(--primary)); border-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.lab-chip[aria-pressed="true"] .lab-muted { color: inherit; opacity: .75; }
.lab-tabs { display: flex; gap: 4px; border-bottom: 1px solid hsl(var(--border)); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.lab-tabs [role="tab"] { min-height: 44px; padding: 0 14px; background: none; border: 0; border-bottom: 2px solid transparent; color: hsl(var(--muted-foreground)); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.lab-tabs [role="tab"][aria-selected="true"] { color: hsl(var(--foreground)); border-bottom-color: hsl(var(--primary)); }
.lab-switch { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0; background: none; border: 0; color: inherit; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.lab-switch-track { width: 40px; height: 22px; border-radius: 999px; background: hsl(var(--muted-foreground) / .35); position: relative; flex: none; transition: background-color .15s; }
.lab-switch-track span { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 999px; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.lab-switch[aria-checked="true"] .lab-switch-track { background: hsl(var(--primary)); }
.lab-switch[aria-checked="true"] .lab-switch-track span { transform: translateX(18px); }
.lab-switch-label { flex: 1; }
/* tables that turn into cards on phones */
.lab-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lab-table th { text-align: left; font: 600 11px/1 var(--font-mono, ui-monospace, monospace); letter-spacing: .1em; text-transform: uppercase; color: hsl(var(--muted-foreground)); padding: 12px 14px; border-bottom: 1px solid hsl(var(--border)); white-space: nowrap; }
.lab-table th button { all: unset; cursor: pointer; } .lab-table th button:hover { color: hsl(var(--foreground)); }
.lab-table td { padding: 14px; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
.lab-table tr:last-child td { border-bottom: 0; }
.lab-tr { cursor: pointer; } .lab-tr:hover td { background: hsl(var(--secondary) / .6); }
.lab-num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .lab-table thead { display: none; }
  .lab-table, .lab-table tbody, .lab-table tr, .lab-table td { display: block; width: 100%; box-sizing: border-box; }
  .lab-table tr { padding: 12px 14px; border-bottom: 1px solid hsl(var(--border)); }
  .lab-table td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .lab-table td::before { content: attr(data-l); font-size: 12px; color: hsl(var(--muted-foreground)); text-align: left; }
  .lab-table td:first-child { text-align: left; font-weight: 600; } .lab-table td:first-child::before { content: none; }
}
.lab-empty { padding: 40px 16px; text-align: center; color: hsl(var(--muted-foreground)); }
.lab-chart { width: 100%; height: auto; display: block; }
.lab-chart text { font-size: 11px; fill: hsl(var(--muted-foreground)); font-family: inherit; }
.lab-chart .grid { stroke: hsl(var(--border)); stroke-width: 1; }
.lab-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 8px; }
.lab-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lab-meter { height: 8px; border-radius: 999px; background: hsl(var(--secondary)); overflow: hidden; } .lab-meter > i { display: block; height: 100%; background: hsl(var(--primary)); border-radius: inherit; }
/* overlays */
.lab-ov { position: fixed; inset: 0; z-index: 80; background: rgb(10 12 16 / .45); display: flex; opacity: 0; transition: opacity .18s; }
.lab-ov.in { opacity: 1; } .lab-ov.out { opacity: 0; }
.lab-ov-modal { align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; overflow-y: auto; }
.lab-ov-drawer { justify-content: flex-end; }
.lab-modal, .lab-drawer { background: hsl(var(--card)); color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); box-shadow: 0 24px 64px rgb(0 0 0 / .28); display: flex; flex-direction: column; }
.lab-modal { width: min(560px, 100%); border-radius: 14px; max-height: 80vh; transform: translateY(8px); transition: transform .18s; }
.lab-modal.wide { width: min(820px, 100%); }
.lab-ov.in .lab-modal { transform: none; }
.lab-drawer { width: min(460px, 100%); height: 100%; border-radius: 0; transform: translateX(24px); transition: transform .18s; }
.lab-ov.in .lab-drawer { transform: none; }
.lab-modal > header, .lab-drawer > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 12px; }
.lab-modal h2, .lab-drawer h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.lab-modal header p, .lab-drawer header p { margin: 4px 0 0; font-size: 13px; color: hsl(var(--muted-foreground)); }
.lab-body { padding: 4px 20px 20px; overflow-y: auto; font-size: 14px; line-height: 1.55; }
.lab-modal > footer, .lab-drawer > footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid hsl(var(--border)); }
.lab-x { flex: none; width: 36px; height: 36px; border-radius: 8px; border: 0; background: none; color: hsl(var(--muted-foreground)); font-size: 22px; line-height: 1; cursor: pointer; }
.lab-x:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }
.lab-menu { position: fixed; z-index: 85; background: hsl(var(--popover, var(--card))); color: hsl(var(--foreground)); border: 1px solid hsl(var(--border)); border-radius: 12px; box-shadow: 0 16px 48px rgb(0 0 0 / .22); padding: 8px; max-height: 70vh; overflow-y: auto; }
.lab-menu .lab-menu-h { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 10px; font-size: 13px; font-weight: 600; }
.lab-menu .lab-menu-i { display: flex; gap: 10px; width: 100%; text-align: left; padding: 10px 8px; border-radius: 8px; border: 0; background: none; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.lab-menu .lab-menu-i:hover { background: hsl(var(--secondary)); }
.lab-menu .lab-menu-i .dot { width: 8px; height: 8px; border-radius: 999px; background: hsl(var(--primary)); margin-top: 6px; flex: none; }
.lab-menu .lab-menu-i.read .dot { background: transparent; }
.lab-menu .lab-menu-i small { display: block; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.lab-pal ul { list-style: none; margin: 12px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.lab-pal li { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.lab-pal li[aria-selected="true"], .lab-pal li:hover { background: hsl(var(--secondary)); }
.lab-pal li .g { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: hsl(var(--muted-foreground)); }
.lab-pal li .hint { font-size: 12px; color: hsl(var(--muted-foreground)); }
.lab-pal li.empty { display: block; color: hsl(var(--muted-foreground)); cursor: default; }
@media (max-width: 520px) { .lab-pal li { grid-template-columns: 1fr; gap: 2px; } }
.lab-toasts { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.lab-toast { display: flex; align-items: flex-start; gap: 12px; padding: 14px 12px 14px 16px; border-radius: 12px; background: hsl(var(--foreground)); color: hsl(var(--background)); box-shadow: 0 12px 32px rgb(0 0 0 / .25); font-size: 13.5px; animation: lab-in .2s ease; }
.lab-toast > div { flex: 1; } .lab-toast p { margin: 3px 0 0; opacity: .8; line-height: 1.45; }
.lab-toast .lab-x { color: inherit; opacity: .7; width: 28px; height: 28px; } .lab-toast .lab-link { color: inherit; text-decoration: underline; margin-top: 2px; }
.lab-toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes lab-in { from { opacity: 0; transform: translateY(8px); } }
/* phone menu */
.lab-phone-menu { display: none; }
@media (max-width: 767px) {
  .lab-phone-menu { display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; position: fixed; z-index: 46; top: calc(var(--lab-bar-h, 0px) + 6px); right: 10px; width: 44px; height: 44px; border-radius: 10px; border: 1px solid hsl(var(--border)); background: hsl(var(--card)); cursor: pointer; }
  .lab-phone-menu span { width: 18px; height: 2px; border-radius: 2px; background: hsl(var(--foreground)); }
  html.lab-capture .lab-phone-menu { top: 6px; }
}
.lab-navlist { display: grid; gap: 4px; }
.lab-navlist button { display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 0 14px; border-radius: 10px; border: 0; background: none; color: hsl(var(--foreground)); font: inherit; font-size: 16px; font-weight: 500; text-align: left; cursor: pointer; }
.lab-navlist button small { font-size: 12px; color: hsl(var(--muted-foreground)); font-weight: 400; }
.lab-navlist button:hover { background: hsl(var(--secondary)); }
.lab-navlist button.on { background: hsl(var(--secondary)); color: hsl(var(--primary)); }
@media (prefers-reduced-motion: reduce) { .lab-ov, .lab-modal, .lab-drawer, .lab-toast { transition: none; animation: none; } }
