/* The native app's palette (DesignTheme.swift, sampled from the running app). */
:root {
  --action: #2a64c5;          /* AccentColor as rendered */
  --focus: #0071e3;
  --link: #0066cc;
  --ink: #1d1d1f;
  --muted: #7a7a7a;
  --canvas: #ffffff;
  --parchment: #f5f5f7;
  --pearl: #fafafc;
  --sidebar: #eeeded;
  --hairline: #e0e0e0;
  --divider: #d6d6d7;
  --drop: #eeeeee;
  --header: #e8e8ec;
  --row-alt: #f4f5f5;
  --inserted: #ece0f9;
  --selected-row: rgba(42, 100, 197, .14);
  --warning: #f68712;
  --translated: #30b350;
  --imported-cat: #d1c2ed;
  --translated-cat: #c4e2c8;
  --archive-cat: #dcdcdc;
  /* Library category rows: a grey band that reads on the web sidebar (the
     native value #e8e8ed sits on a lighter macOS sidebar material). */
  --category-fill: #dcdce1;
  --chip: #7a7a7a;
  --chip-quiet: #d9d9d9;
  --chrome: #1e1e1e;          /* toolbar band, always dark */
  --chrome-control: #3e3e3e;
  --chrome-selected: #555555;
  --chrome-ink: #f5f5f7;
  --notice: #ffe08a;
  --notice-ink: #5c3b00;
  --translate-fill: #bce8c8;
  --translate-label: #143d24;
  --unemphasized: #d4e0f3;
  --disabled: #bfbfbf;
  --bar: #f6f6f6;
  --dark-pane: rgba(122,122,122,.65);
  --pane-warning: #ffc76b;
  --control-bg: #ffffff;
  --radius: 8px;
  --radius-large: 16px;
  --gutter: 24px;
  --icon-size: 20px;          /* a little above the 17px body line */
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --link: #2997ff; --ink: #ffffff; --muted: #cccccc; --canvas: #272729; --parchment: #252527;
    --pearl: #2a2a2c; --sidebar: #2a2a2c; --hairline: #333333; --divider: #3a3a3c; --drop: #1e1e20;
    --header: #1e1e20; --row-alt: #2c2c2e; --inserted: #3d3159; --selected-row: rgba(42, 100, 197, .35);
    --category-fill: #3e3e41; --imported-cat: #4b3f66; --translated-cat: #2f5236; --archive-cat: #3a3a3c; --chip: #58585a; --chip-quiet: #3a3a3c; --translate-fill: #3a7d52; --translate-label: #eaf7ee; --chip-glyph: #d9d9d9; --loop-header: #4a4a4e; --unemphasized: #2f3d55; --disabled: #5a5a5c; --bar: #2b2b2d; --dark-pane: rgba(51,51,51,.65); --pane-warning: #ffb340; --control-bg: #1e1e20;
  }
}
:root[data-theme="dark"] {
  --link: #2997ff; --ink: #ffffff; --muted: #cccccc; --canvas: #272729; --parchment: #252527;
    --pearl: #2a2a2c; --sidebar: #2a2a2c; --hairline: #333333; --divider: #3a3a3c; --drop: #1e1e20;
    --header: #1e1e20; --row-alt: #2c2c2e; --inserted: #3d3159; --selected-row: rgba(42, 100, 197, .35);
    --category-fill: #3e3e41; --imported-cat: #4b3f66; --translated-cat: #2f5236; --archive-cat: #3a3a3c; --chip: #58585a; --chip-quiet: #3a3a3c; --translate-fill: #3a7d52; --translate-label: #eaf7ee; --chip-glyph: #d9d9d9; --loop-header: #4a4a4e; --unemphasized: #2f3d55; --disabled: #5a5a5c; --bar: #2b2b2d; --dark-pane: rgba(51,51,51,.65); --pane-warning: #ffb340; --control-bg: #1e1e20;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 12px/1.42 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--parchment); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.loading { display: grid; place-items: center; height: 100%; color: var(--muted); }
.muted { color: var(--muted); }
.warning-text { color: var(--warning); }

/* Icons */
.icon { display: inline-flex; width: var(--icon-size); height: var(--icon-size); flex: none; vertical-align: -5px; }
.icon svg { width: 100%; height: 100%; }
.icon-translation {
  width: calc(var(--icon-size) * 1.38); background: currentColor;
  -webkit-mask: url(img/translation.svg) center / contain no-repeat; mask: url(img/translation.svg) center / contain no-repeat;
}
.icon.small { --icon-size: 16px; vertical-align: -3px; }
.icon.large { --icon-size: 28px; }
.icon.hero { --icon-size: 64px; }

/* Buttons: DesignPrimaryButtonStyle, DesignUtilityButtonStyle, DesignCompactButtonStyle, DesignIconButtonStyle */
.primary {
  display: inline-flex; align-items: center; gap: 6px; background: var(--action); color: #fff; border: 0;
  border-radius: 980px; padding: 11px 22px; font-size: 13px; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: transform .12s, filter .12s;
}
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: scale(.96); }
.primary:disabled { background: var(--parchment); color: var(--muted); cursor: default; filter: none; transform: none; }
.primary.translate { background: var(--translate-fill); color: var(--translate-label); }
.primary.neutral { background: rgba(127,127,127,.14); color: var(--ink); }
.utility {
  display: inline-flex; align-items: center; gap: 6px; background: var(--pearl); color: var(--ink);
  border: .5px solid var(--hairline); border-radius: 8px; padding: 7px 15px; font-size: 12px; white-space: nowrap;
  transition: transform .12s;
}
.utility:hover { background-image: linear-gradient(rgba(127,127,127,.08), rgba(127,127,127,.08)); }
.utility:active { transform: scale(.95); background-image: linear-gradient(rgba(127,127,127,.18), rgba(127,127,127,.18)); }
.utility:disabled { background: var(--parchment); opacity: .5; cursor: default; transform: none; background-image: none; }
.utility.default { background: var(--action); border-color: var(--action); color: #fff; }
.compact {
  background: var(--pearl); color: var(--ink); border: .5px solid var(--hairline); border-radius: 980px; padding: 2px 8px; font-size: 12px; white-space: nowrap;
}
.compact:hover { background-image: linear-gradient(rgba(127,127,127,.08), rgba(127,127,127,.08)); }
.icon-button, .bare {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; background: none; border: 0; padding: 5px;
  color: inherit; border-radius: 6px; white-space: nowrap;
}
.icon-button:hover, .bare:hover { background: rgba(127,127,127,.12); }
.icon-button:active, .bare:active { background: rgba(127,127,127,.22); }
.icon-button:disabled, .bare:disabled { opacity: .4; cursor: default; background: none; }
.bare.on { color: var(--action); }
/* The bottom bar's button: caption label, then the icon, both in the same color (enabled or disabled). */
.bar-button { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 5px; border-radius: 6px; }
.bar-button span { font-size: 12px; color: var(--ink); }
.bar-button .icon { --icon-size: 18px; color: var(--ink); }
.bar-button:hover { background: rgba(127,127,127,.12); }

.bar-button:disabled { cursor: default; background: none; }
.bar-button:disabled span, .bar-button:disabled .icon { color: var(--disabled); }
.link { background: none; border: 0; color: var(--link); padding: 0; cursor: pointer; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Sign-in: the native splash */
.auth { display: grid; place-items: center; min-height: 100%; padding: 48px 16px; background: var(--parchment); overflow-x: clip; }
.welcome-stage { position: relative; width: min(560px, 100%); }
.welcome {
  position: relative; z-index: 1;
  width: 100%; background: var(--canvas); border-radius: var(--radius-large); overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.12);
}
/* The sign-in card's glow, in the CueSift logo's colors: the wordmark's
   "Cue" gradient (emerald #15bf89 → jade #35c8a3 → aqua #54d1bd → sky
   #8fe1ee) laid out like the logo, green on the left flowing into blue on the
   right, with the app icon's mint #67f1c0 between them. Each field drifts and
   breathes on its own cycle (7–15 s, through three waypoints) and the whole
   glow turns once a minute, so the colors flow organically around the card. In dark mode the
   icon's deep teal #013e4b adds depth. Still with Reduce Motion. */
.aura {
  position: absolute; inset: -90px -110px; z-index: 0; pointer-events: none;
  opacity: .85; animation: aura-turn 60s linear infinite;
}
.aura .blob { position: absolute; border-radius: 50%; will-change: transform; }
.aura .b1 { left: -2%; top: 10%; width: 60%; height: 64%; background: radial-gradient(closest-side, rgba(21, 191, 137, .75), rgba(21, 191, 137, 0)); animation: aura-a 9s ease-in-out infinite alternate; }
.aura .b2 { right: -4%; top: 4%; width: 60%; height: 62%; background: radial-gradient(closest-side, rgba(143, 225, 238, .9), rgba(143, 225, 238, 0)); animation: aura-b 12s ease-in-out infinite alternate; }
.aura .b3 { left: 16%; bottom: -4%; width: 70%; height: 54%; background: radial-gradient(closest-side, rgba(84, 209, 189, .75), rgba(84, 209, 189, 0)); animation: aura-c 7s ease-in-out infinite alternate; }
.aura .b4 { right: 8%; bottom: 4%; width: 48%; height: 48%; background: radial-gradient(closest-side, rgba(103, 241, 192, .7), rgba(103, 241, 192, 0)); animation: aura-d 13s ease-in-out infinite alternate; }
.aura .b5 { left: 24%; top: -6%; width: 54%; height: 46%; background: radial-gradient(closest-side, rgba(53, 200, 163, .6), rgba(53, 200, 163, 0)); animation: aura-e 15s ease-in-out infinite alternate; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .aura .b5 { background: radial-gradient(closest-side, rgba(1, 62, 75, .95), rgba(1, 62, 75, 0)); } }
:root[data-theme="dark"] .aura .b5 { background: radial-gradient(closest-side, rgba(1, 62, 75, .95), rgba(1, 62, 75, 0)); }
@keyframes aura-turn { to { transform: rotate(360deg); } }
@keyframes aura-a { 0% { transform: translate(0, 0) scale(1); } 33% { transform: translate(18%, 22%) scale(1.22); } 66% { transform: translate(-10%, 34%) scale(.88); } 100% { transform: translate(8%, -12%) scale(1.1); } }
@keyframes aura-b { 0% { transform: translate(0, 0) scale(1.05); } 33% { transform: translate(-24%, 16%) scale(.86); } 66% { transform: translate(-8%, -20%) scale(1.24); } 100% { transform: translate(-30%, 8%) scale(1); } }
@keyframes aura-c { 0% { transform: translate(0, 0) scale(.94); } 33% { transform: translate(20%, -24%) scale(1.18); } 66% { transform: translate(-22%, -10%) scale(1); } 100% { transform: translate(6%, 10%) scale(1.12); } }
@keyframes aura-d { 0% { transform: translate(0, 0) scale(1); } 33% { transform: translate(-30%, -26%) scale(1.26); } 66% { transform: translate(-12%, 12%) scale(.84); } 100% { transform: translate(-36%, -4%) scale(1.08); } }
@keyframes aura-e { 0% { transform: translate(0, 0) scale(1.08); } 33% { transform: translate(-22%, 28%) scale(.9); } 66% { transform: translate(24%, 12%) scale(1.2); } 100% { transform: translate(0, 30%) scale(.96); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .aura { opacity: .9; } }
:root[data-theme="dark"] .aura { opacity: .9; }
@media (prefers-reduced-motion: reduce) { .aura, .aura .blob { animation: none; } }
.welcome .splash { width: 100%; aspect-ratio: 2320 / 1024; object-fit: cover; display: block; }
.welcome form { padding: 28px 40px 32px; display: grid; gap: 14px; }
.welcome .logo { height: 64px; justify-self: center; }
.welcome label { display: grid; gap: 4px; color: var(--muted); }
.welcome input, .welcome select {
  padding: 9px 12px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--pearl); color: var(--ink);
}
.welcome .lead { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
.welcome .actions { display: flex; justify-content: center; }
.welcome .auth-switch { margin: 0; text-align: center; font-size: 13px; }
.welcome .auth-switch .link { white-space: normal; }
/* The Mac app offer under the sign-in fields, centered. */
.native-offer { display: grid; justify-items: center; gap: 6px; text-align: center; margin-top: 10px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.native-offer p { margin: 0; }
/* Support contact: sign-in screens and Settings ▸ Support. */
.support-contact { display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 13px; }
.support-contact p { margin: 0; color: var(--muted); }
.support-contact a { color: var(--link); font-weight: 600; }
.support-contact .support-glyph { --icon-size: 28px; color: var(--muted); }
.welcome .support-contact { margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.support-pane { display: grid; place-items: center; padding: 48px 24px; }
/* Settings ▸ Usage */
.usage-pane { display: grid; gap: 18px; padding: 24px; }
.usage-head { display: flex; align-items: center; gap: 12px; }
.usage-head .spacer { flex: 1; }
.usage-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; align-items: stretch; }
.usage-tile { display: grid; gap: 2px; align-content: start; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--pearl); }
.usage-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.usage-label { font-size: 12px; color: var(--muted); }
.usage-sub { font-size: 11px; color: var(--muted); }
.usage-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.support-pane .support-contact { font-size: 15px; }
.support-pane .support-glyph { --icon-size: 44px; }
.native-offer .offer-title { font-size: 20px; font-weight: 600; letter-spacing: -.2px; }
.native-offer .offer-text { color: var(--muted); font-size: 13px; max-width: 400px; }
.native-offer .offer-note { color: var(--muted); font-size: 11px; }
.native-offer .offer-app { display: grid; justify-items: center; gap: 4px; margin: 6px 0 2px; color: var(--link); text-decoration: none; font-weight: 600; font-size: 14px; border-radius: 12px; padding: 6px 12px; }
.native-offer .offer-app img { width: 64px; height: 64px; transition: transform .15s ease-out; }
.native-offer .offer-app:hover span { text-decoration: underline; }
.native-offer .offer-app:hover img { transform: scale(1.05); }
.license-grid .grid-value { user-select: text; }
.error { color: var(--warning); margin: 0; min-height: 1em; white-space: pre-line; }
.error.ok { color: var(--ink); }
.welcome input[readonly] { color: var(--muted); }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: block; } }
:root[data-theme="dark"] .logo-light { display: none; } :root[data-theme="dark"] .logo-dark { display: block; }

/* Shell */
#app.shell { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.toolbar {
  display: grid; grid-template-columns: minmax(40px, 1fr) minmax(0, 480px) minmax(40px, 1fr); align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--chrome); color: var(--chrome-ink);
}
.toolbar .left, .toolbar .right { display: flex; align-items: center; gap: 6px; }
.toolbar .right { justify-content: flex-end; }
.toolbar .bare:hover { background: rgba(255,255,255,.1); }
.toolbar .right { gap: 10px; min-width: 0; }
.toolbar-user { color: var(--chrome-ink); opacity: .75; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.toolbar-signout { flex: none; border: .5px solid rgba(255,255,255,.28); background: rgba(255,255,255,.08); color: var(--chrome-ink); font-size: 12px; padding: 4px 10px; border-radius: 6px; white-space: nowrap; }
.toolbar-signout:hover { background: rgba(255,255,255,.16); }
.toolbar-signout:active { background: rgba(255,255,255,.24); }
.toolbar-settings { --icon-size: 26px; flex: none; }
.workflow {
  display: grid; grid-template-columns: repeat(3, 1fr); width: 480px; max-width: 100%; height: 32px;
  background: var(--chrome-control); border-radius: 980px; padding: 3px; position: relative;
}
.workflow button {
  background: none; border: 0; color: var(--chrome-ink); border-radius: 980px; font-size: 13.5px; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.workflow button[aria-selected="true"] { background: var(--chrome-selected); }
.workflow .ring { width: 15px; height: 15px; }
.split { display: grid; grid-template-columns: var(--library-width, 300px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); min-height: 0; position: relative; }
/* The Library's right edge, dragged to resize it (libraryResizer). */
.library-resizer { position: absolute; top: 0; bottom: 0; left: calc(var(--library-width, 300px) - 4px); width: 8px; z-index: 5; cursor: col-resize; }
.split.library-hidden .library-resizer { left: 0; width: 5px; }
.split.library-hidden { grid-template-columns: 0 minmax(0, 1fr); }
.split.library-hidden .library { visibility: hidden; }
.library { display: flex; flex-direction: column; min-height: 0; background: var(--sidebar); border-right: 1px solid var(--divider);
  /* Library re-renders never re-lay out the detail pane beside it. */
  contain: strict; }
.library .outline { flex: 1; overflow: auto; padding: 8px 6px; }
.library footer { display: flex; justify-content: space-between; padding: 6px 10px; border-top: 1px solid var(--divider); }
.main { display: grid; grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); min-width: 0; min-height: 0; }
.detail { overflow: hidden; background: var(--canvas); display: flex; flex-direction: column; min-width: 0; min-height: 0; contain: strict; }
.bottombar {
  align-items: center; gap: 12px; padding: 7px 16px; border-top: 1px solid var(--divider);
  background: var(--parchment); min-height: 44px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}
.bottombar .bar-side { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bottombar .bar-side.end { justify-content: flex-end; }
.bottombar .bar-logo { display: flex; align-items: center; gap: 6px; user-select: none; }
.bottombar .bar-logo img { pointer-events: none; }
.bottombar .bar-version { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bottombar .bar-logo img { height: 22px; width: auto; }
.bottombar .spacer { flex: 1; }
.bottombar .status { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 0 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bottombar .status span { overflow: hidden; text-overflow: ellipsis; }

/* Library outline */
.row {
  display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: none; border: 0;
  padding: 5px 8px; border-radius: 7px; min-height: 30px; color: var(--ink); user-select: none;
}
.row:hover { background: rgba(127,127,127,.1); }
.row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.row .trail { color: var(--muted); white-space: nowrap; font-size: 12px; }
.row .disclosure { width: 14px; display: inline-flex; color: var(--muted); }
.row .disclosure .icon { --icon-size: 12px; }
/* Library selection, as in the Mac app: the accent while the Library is the
   active control, a light accent tint once focus is elsewhere (the table). */
.row.selected { background: var(--unemphasized); color: var(--ink); }
.outline:focus-within .row.selected { background: var(--action); color: #fff; }
.outline:focus-within .row.selected .trail, .outline:focus-within .row.selected .disclosure { color: rgba(255,255,255,.85); }
.row.unread .title { font-weight: 700; }
/* Native LibraryWarningBadge: a reserved 16px gutter ahead of every icon,
   holding an orange "?" on Imported-rule violations; titles keep their color. */
.row .badge-gutter { width: 16px; flex: none; display: inline-flex; align-items: center; justify-content: flex-start; margin-right: -4px; }
.warning-badge { width: 14px; height: 14px; border-radius: 50%; background: #ff9500; color: #fff; font-size: 9px; font-weight: 700; line-height: 14px; text-align: center; }
.row > .icon { color: var(--muted); }
.outline:focus-within .row.selected > .icon { color: #fff; }
.category > .icon { color: var(--ink); }
.row.drop-target { box-shadow: inset 0 0 0 2px var(--action); }
/* Insertion line between rows (custom order within a category or group):
   a straight 2px line from the row's indent with a small ring at its left
   end, centered on the gap above or below the row (native outline). */
.row.drop-before, .row.drop-after { position: relative; }
.row.drop-before::after, .row.drop-after::after {
  content: ""; position: absolute; left: calc(var(--indent, 8px) + 6px); right: 4px; height: 2px;
  background: var(--action); pointer-events: none; z-index: 1;
}
.row.drop-before::before, .row.drop-after::before {
  content: ""; position: absolute; left: var(--indent, 8px); width: 6px; height: 6px; border-radius: 50%;
  border: 2px solid var(--action); background: var(--sidebar); pointer-events: none; z-index: 2;
}
.row.drop-before::after { top: -1px; }
.row.drop-before::before { top: -5px; }
.row.drop-after::after { bottom: -1px; }
.row.drop-after::before { bottom: -5px; }
/* The drag image: see-through, so the rows under it stay readable. */
.row.drag-ghost { position: fixed; top: -1000px; left: 0; opacity: .55; background: rgba(127,127,127,.18) !important;
  color: var(--ink) !important; box-shadow: none; pointer-events: none; }
.row.drag-ghost .icon, .row.drag-ghost .trail, .row.drag-ghost .disclosure { color: var(--muted) !important; }
.category { font-size: 18px; font-weight: 600; min-height: 40px; margin: 4px 0; }
.category .title { font-size: 18px; }
/* Category headers: one neutral grey band (native nsLibraryCategoryFill),
   lifted above the sidebar in dark mode; never selected. */
.category { background: var(--category-fill); cursor: default; }
.category:hover { background: var(--category-fill); }
.category .trail { color: var(--ink); opacity: .6; }
/* Native LibraryImportButton: 52pt high in 16pt padding above the outline;
   dark grey, accent while hovered or drop-targeted; icon only when narrow. */
.import-launcher { padding: 16px; border-bottom: 1px solid var(--divider); container-type: inline-size; flex: none; }
.import-face {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 52px; border: 0;
  border-radius: var(--radius); background: var(--loop-header); color: #fff; font-size: 16px; font-weight: 600;
  --icon-size: 26px; --icon-knockout: var(--loop-header); transition: background .15s; will-change: transform;
}
.import-face:hover, .import-launcher.targeted .import-face { background: var(--action); --icon-knockout: var(--action); }
.import-face:disabled { opacity: .6; cursor: default; }
@container (max-width: 128px) {
  .import-face { width: 52px; margin: 0 auto; --icon-size: 30px; }
  .import-face > span:not(.icon) { display: none; }
}
.rename { flex: 1; font-size: 13px; padding: 2px 6px; border: 1px solid var(--focus); border-radius: 4px; background: var(--canvas); }

/* Context menu */
.menu {
  position: fixed; z-index: 50; min-width: 220px; background: var(--canvas); border: 1px solid var(--divider);
  border-radius: 10px; padding: 5px; box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.menu button:hover:not(:disabled) { background: var(--action); color: #fff; }
.menu button:disabled { color: var(--muted); opacity: .6; cursor: default; }
.menu button.has-submenu { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.menu button.has-submenu .icon { --icon-size: 12px; color: var(--muted); }
.menu button.has-submenu:hover:not(:disabled) .icon { color: #fff; }
.menu hr { border: 0; border-top: 1px solid var(--hairline); margin: 4px 0; }
.menu .swatches { display: flex; gap: 6px; padding: 6px 10px; }
.menu .swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); padding: 0; }

/* Empty panes: the native look, drop highlight and greeting spring */
.empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--gutter);
  padding: 48px 24px; text-align: center; background: var(--parchment); min-height: 0; overflow: auto;
}
.empty .hero { font-size: 56px; font-weight: 600; letter-spacing: -.28px; margin: 0; line-height: 1.1; will-change: transform; }
/* Native tint timing: in 0.15 s ease-out, out 0.6 s ease-in-out; a drag over
   the pane tints at once. The hero's tint and scale run on its spring (app.js). */
.empty .glyph { color: var(--muted); transition: color .6s ease-in-out; }
.empty .headline { font-size: 17px; font-weight: 600; margin: 0; transition: color .6s ease-in-out; }
.empty .caption { color: var(--muted); margin: 0; font-size: 12px; transition: color .6s ease-in-out; }
.empty .note { color: var(--muted); margin: 0; font-size: 22px; font-weight: 300; transition: color .6s ease-in-out; }
.empty.lit .glyph, .empty.lit .headline, .empty.lit .caption, .empty.lit .note { color: var(--action); transition: color .15s ease-out; }
.empty.targeted .glyph, .empty.targeted .headline, .empty.targeted .caption, .empty.targeted .note { color: var(--action); transition: none; }
.empty.snap .glyph, .empty.snap .headline, .empty.snap .caption, .empty.snap .note { transition: none; }

/* Review */
.review { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.review-header { display: flex; gap: 20px; align-items: flex-start; padding: 14px 16px 10px; flex-wrap: wrap; }
.review-header .facts { display: grid; grid-template-columns: auto 1fr; column-gap: 20px; row-gap: 2px; align-items: baseline; min-width: 0; flex: 1; }
.review-header .label { color: var(--muted); font-size: 13px; }
.review-header .name { font-size: 24px; font-weight: 600; min-width: 0; }
.review-header .meta { color: var(--muted); font-size: 13px; }
.review-header .ok { color: var(--translated); }
.chips { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.chip { display: grid; justify-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.chip input, .chip .box {
  width: 64px; height: 44px; text-align: center; font-size: 26px; font-weight: 600; border: 0; border-radius: var(--radius);
  background: var(--chip); color: #fff; padding: 0; display: grid; place-items: center;
}
.chip .box { cursor: pointer; }
.chip .box.static { cursor: default; }
/* Native TranslatedReviewHeader: title, version tag and language capsule over
   a muted summary; static chips on the right. */
.translated-header { padding: 8px 16px; gap: 24px; flex-wrap: nowrap; }
.translated-facts { flex: 1; min-width: 0; display: grid; gap: 6px; }
.translated-facts .title-line { display: flex; align-items: center; gap: 12px; min-width: 0; }
.translated-facts .name { font-size: 24px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.translated-facts .version { font-size: 15px; font-weight: 600; color: var(--muted); flex: none; }
.translated-facts .summary { font-size: 12px; color: var(--muted); }
.chip .box .icon { --icon-size: 30px; }
.chip input { display: block; }
.chip-field { position: relative; display: block; }
.chip-placeholder { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: 26px; font-weight: 600; color: rgba(255, 255, 255, .6); }
.chip input:not(:placeholder-shown) + .chip-placeholder { display: none; }
.chip.attention input { background: var(--warning); }
.segments { display: flex; border-radius: var(--radius); overflow: hidden; }
.segments button { width: 56px; height: 44px; border: 0; font-size: 26px; font-weight: 600; background: var(--chip); color: #fff; }
.segments button[aria-pressed="true"] { background: var(--action); }
.messages { padding: 0 16px 8px; display: grid; gap: 4px; }
.messages .warning-text { display: flex; gap: 6px; align-items: center; }
/* Above the review table: import notes left, the source preview toggle right. */
.table-bar { display: flex; align-items: flex-start; gap: 8px; padding: 0 12px 4px 16px; flex: none; }
.table-bar .spacer { flex: 1; }
.table-bar details.notes { min-width: 0; padding: 4px 0; }
.source-toggle { color: var(--ink); --icon-size: 22px; }
.source-toggle.on { color: var(--action); }
details.notes summary { cursor: pointer; font-size: 13px; }
details.notes div { color: var(--warning); padding-left: 16px; }
details.notes .note { display: flex; align-items: baseline; gap: 8px; }
details.notes .note button { flex: none; }
.review-body { flex: 1; display: flex; min-height: 0; position: relative; border-top: 1px solid var(--divider); overflow: hidden; }
.table-scroll { flex: 1; overflow: auto; }
/* Wide enough for the fixed columns plus 140 px per text column; any wider
   window gives the text columns the rest, so the last column ends at the
   window's edge. */
table.lines { border-collapse: collapse; width: 100%; min-width: 560px; table-layout: fixed; }
table.lines.translated { min-width: 700px; }
.lines th {
  position: sticky; top: 0; z-index: 1; background: var(--header); text-align: left;
  font-size: 14px; font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--divider); white-space: nowrap;
}
/* The Replica | Translation resize handle: a thin grip on the border. */
.split-handle { position: absolute; top: 0; bottom: 0; left: -5px; width: 10px; cursor: col-resize; }
.split-handle::after { content: ""; position: absolute; top: 6px; bottom: 6px; left: 4px; width: 2px; border-radius: 1px; background: var(--divider); transition: background .12s; }
.split-handle:hover::after, .col-resizing .split-handle::after { background: var(--action); }
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing * { cursor: col-resize !important; }
.lines td { padding: 5px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; font-size: 12.5px; }
.lines tbody tr:nth-child(even) td { background-color: var(--row-alt); }
/* Selected table row, as in the Mac app: the accent with white text. A text
   being edited in the row keeps a white field. Hovered rows get the native
   hover wash (the accent at 8%). */
.lines tr.selected td { background: var(--action) !important; color: #fff; }
.lines tr.selected td.num, .lines tr.selected .tog button { color: rgba(255, 255, 255, .85); }
.lines tr.selected .role-chevron { color: #fff; }
.lines tr.selected .role-name.aliased, .lines tr.selected mark { color: #fff; }
.lines tr.selected [contenteditable]:focus { color: var(--ink); }
.lines tbody tr:not(.selected):hover td { background-image: linear-gradient(rgba(42, 100, 197, .08), rgba(42, 100, 197, .08)), var(--cell-tint, linear-gradient(transparent, transparent)); }
.table-scroll { outline: none; }
/* The selected row's issues, under the table (native). */
.review > .row-issues { display: flex; align-items: center; gap: 6px; padding: 8px; font-size: 12px; color: var(--warning); background: var(--parchment); border-top: 1px solid var(--divider); flex: none; }
.review > .row-issues[hidden] { display: none; }
.lines tr.inserted td { background-color: var(--inserted); }
/* Import notes ▸ Mark: the replica (whole row) or the cell a note refers to,
   in the warning orange; an outline on the selected row. */
.lines tr.note-mark td, .lines td.note-mark { --cell-tint: linear-gradient(rgba(246, 135, 18, .28), rgba(246, 135, 18, .28)); background-image: var(--cell-tint); }
.lines tr.selected.note-mark td, .lines tr.selected td.note-mark { box-shadow: inset 0 0 0 2px var(--warning); }
.lines .num { text-align: right; color: var(--muted); width: 48px; }
.lines .tog { width: 38px; text-align: center; color: var(--muted); }
.lines .tog button { background: none; border: 0; padding: 2px; color: var(--muted); border-radius: 4px; }
/* Native ReviewCell / SongCell: a mark that is set stays visible; otherwise the
   icon appears (full strength) only while the pointer is on its own cell. The
   header's Include/Exclude All eye is always shown. */
.lines td.tog button:not(.shown) { opacity: 0; }
.lines td.tog:hover button:not(:disabled) { opacity: 1; }
.lines .tog button:not(:disabled):hover { color: var(--ink); background: rgba(127,127,127,.12); }
.lines td.song button.on { color: var(--ink); }
.lines tr.selected .tog button { color: var(--ink); }
.lines tr.selected .tog button.shown, .lines tr.selected td.song button.on { color: #fff; }
/* Excluded rows dim to 40% like native; the eye stays full strength as the
   control that includes the row again. */
/* An excluded row fades, but its hidden song note stays hidden (the fade must
   not override the toggles' opacity 0, or the note looks switched on). */
.lines tr.excluded td:not(.tog) > *, .lines tr.excluded td.song button.shown { opacity: .4; }
/* Native nsTranslatedColumn: a very light green wash over every Translation
   cell of the translated review, translucent so the row stripes read through
   it (striped rows show a slightly deeper green); a selected row shows its
   selection color instead. The stripes set only background-color, so they
   never clear this layer. */
.lines td.translation { --cell-tint: linear-gradient(rgba(48, 179, 80, .12), rgba(48, 179, 80, .12)); background-image: var(--cell-tint); }
.lines .tc { width: 124px; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Timecodes stay right-aligned; the Start header centers (native DialogueTable). */
.lines td.tc { text-align: right; }
.lines th.tc { text-align: center; }
.lines .role { width: 170px; }
.lines [contenteditable] { outline: none; display: block; min-height: 1.4em; border-radius: 4px; padding: 1px 3px; white-space: pre-wrap; word-break: break-word; }
.lines [contenteditable="plaintext-only"]:focus, .lines [contenteditable="true"]:focus { box-shadow: 0 0 0 2px var(--focus); background: var(--canvas); }
/* Native role cell: the name (purple for an alias, systemPurple) with ⌃⌄
   chevrons on hover that open the role popup. */
:root { --alias-role: #af52de; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --alias-role: #bf5af2; } }
:root[data-theme="dark"] { --alias-role: #bf5af2; }
.lines td.role { position: relative; padding-right: 26px; }
.lines .role-name { display: block; padding: 1px 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.lines .role-name.aliased { color: var(--alias-role); }
.lines tr.selected .role-name { cursor: pointer; }
.lines .role-chevron { position: absolute; right: 2px; top: 4px; width: 22px; height: 24px; --icon-size: 16px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; opacity: 0; cursor: pointer; }
.lines td.role:hover .role-chevron, .lines .role-chevron:focus-visible { opacity: 1; }
.lines .role-chevron:hover { background: rgba(127,127,127,.14); color: var(--ink); }
.menu.popup-menu { overflow-y: auto; overscroll-behavior: contain; }
.menu .menu-detail { color: var(--muted); }
.menu button:hover .menu-detail { color: rgba(255,255,255,.8); }
.lines mark { background: none; color: inherit; font-weight: 700; }
.source-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(430px, calc(100% - 200px)); background: var(--canvas);
  border-left: 1px solid var(--divider); box-shadow: -6px 0 16px rgba(0,0,0,.12); display: flex; flex-direction: column;
  animation: slide-in .22s ease-out; z-index: 3;
}
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
.source-panel header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-weight: 600; font-size: 17px; }
.source-panel iframe { flex: 1; border: 0; width: 100%; background: var(--canvas); }
/* The Word preview is white paper; keep the frame white before it loads. */
.source-panel iframe.docx-frame { background: #fff; }
.search { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--divider); border-radius: 980px; background: var(--canvas); width: min(420px, 100%); }
.search input { border: 0; outline: none; flex: 1; background: transparent; font-size: 14px; min-width: 60px; }
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.search { padding: 0 8px 0 6px; gap: 4px; }
.search-loupe { display: inline-flex; align-items: center; gap: 1px; border: 0; background: none; padding: 3px 4px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.search-loupe:hover { background: rgba(127,127,127,.14); color: var(--ink); }
.search-clear { border: 0; background: rgba(127,127,127,.35); color: var(--canvas); width: 16px; height: 16px; border-radius: 50%; padding: 0; display: none; align-items: center; justify-content: center; cursor: pointer; }
.search.filled .search-clear { display: inline-flex; }
.icon.tiny { --icon-size: 10px; vertical-align: 0; }
.search-clear .icon.tiny { --icon-size: 9px; }
/* Menu headers, checkmarks and glyphs (the search loupe's menu). */
.menu .menu-header { padding: 6px 10px 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.menu button.menu-item { display: flex; align-items: center; gap: 6px; }
.menu button.menu-item.indented { padding-left: 6px; }
.menu .menu-check { width: 14px; text-align: center; font-size: 12px; flex: none; }
.menu button.menu-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Queues (Translate, Export) */
.pane { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--parchment); }
.pane-section { background: var(--canvas); border-bottom: 1px solid var(--divider); display: flex; flex-direction: column; min-height: 0; }
.pane-section.grow { flex: 1; }
.section-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px 8px; flex-wrap: wrap; }
.section-header h2 { font-size: 21px; font-weight: 600; margin: 0; }
.section-header .spacer { flex: 1; }
.section-header select, .section-header input { padding: 4px 8px; border: 1px solid var(--divider); border-radius: 6px; background: var(--canvas); }
.list { overflow: auto; padding: 0 8px 8px; }
.list .row { font-size: 13px; }
.list .row .trail { display: inline-flex; align-items: center; gap: 8px; }
.list .row select { font-size: 12px; padding: 2px 6px; border: 1px solid var(--divider); border-radius: 6px; background: var(--canvas); color: var(--ink); max-width: 200px; }
.list .row.selected select { color: var(--ink); }
.progress-ring { width: 18px; height: 18px; }
.banner { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--notice); color: var(--notice-ink); flex-wrap: wrap; }
.dropzone {
  margin: 8px 16px 12px; border: 2px dashed var(--divider); border-radius: var(--radius-large); padding: 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); background: var(--drop);
}
.dropzone.targeted { border-color: var(--action); color: var(--action); }
.loops { overflow: auto; padding: 8px 16px 16px; flex: 1; }
.episode-heading { background: #000; color: #fff; font-weight: 700; padding: 6px 10px; border-radius: 6px; margin: 14px 0 4px; display: flex; gap: 8px; align-items: center; }
.episode-heading .caption { font-weight: 400; opacity: .7; font-size: 11px; margin-left: auto; }
.loop { border: 1px solid var(--hairline); border-radius: var(--radius); margin: 6px 0; background: var(--canvas); }
.loop header { display: flex; align-items: center; gap: 10px; padding: 5px 10px; background: var(--header); border-radius: var(--radius) var(--radius) 0 0; }
.loop header .label { font-weight: 700; font-variant-numeric: tabular-nums; }
.loop header .duration { color: var(--muted); font-variant-numeric: tabular-nums; }
.loop header .duration.over { color: var(--warning); }
.loop header .spacer { flex: 1; }
.loop .line { display: grid; grid-template-columns: 110px 150px 1fr 20px; gap: 10px; padding: 3px 10px; cursor: pointer; font-size: 12.5px; }
.loop .line:hover { background: rgba(127,127,127,.08); }
.loop .line.selected { background: var(--selected-row); }
.loop .line .tc { font-variant-numeric: tabular-nums; color: var(--muted); }
.notice-box { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--translated-cat); }

/* Dialogs (Settings, roles, alerts) */
dialog { border: 0; border-radius: var(--radius-large); padding: 0; width: min(720px, calc(100% - 24px)); max-height: calc(100% - 24px); background: var(--canvas); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog.alert { width: min(420px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dialog > header { display: flex; gap: 4px; padding: 10px 12px 0; flex-wrap: wrap; border-bottom: 1px solid var(--hairline); }
.dialog > header button { background: none; border: 0; padding: 8px 12px; border-radius: 8px 8px 0 0; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.dialog > header button[aria-selected="true"] { color: var(--action); box-shadow: inset 0 -2px 0 var(--action); }
.dialog .body { padding: 20px 24px; overflow: auto; display: grid; gap: 16px; }
.dialog > footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--hairline); flex-wrap: wrap; }
.dialog > footer .spacer { flex: 1; }
.alert .body { text-align: center; }
.alert .body h3 { margin: 0; font-size: 15px; }
.form { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 10px 14px; align-items: center; }
.form > label { color: var(--muted); text-align: right; }
.form input, .form select, .form textarea, .editor input, .editor select, .editor textarea {
  padding: 6px 10px; border: 1px solid var(--divider); border-radius: 6px; background: var(--pearl); color: var(--ink); width: 100%;
}
.form textarea, .editor textarea { min-height: 70px; resize: vertical; font-family: inherit; }
.form .hint { grid-column: 2; color: var(--muted); margin-top: -6px; }
.editor { display: grid; grid-template-columns: 200px 1fr; gap: 12px; min-height: 280px; }
.editor .items { border: 1px solid var(--hairline); border-radius: var(--radius); overflow: auto; padding: 4px; }
table.plain { border-collapse: collapse; width: 100%; }
table.plain td, table.plain th { padding: 5px 6px; border-bottom: 1px solid var(--hairline); text-align: left; }
table.plain input, table.plain select { width: 100%; padding: 4px 6px; border: 1px solid var(--divider); border-radius: 5px; background: var(--pearl); color: var(--ink); }
.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 60; max-width: min(560px, calc(100% - 24px));
  background: var(--chrome); color: var(--chrome-ink); padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.3);
  white-space: pre-line;
}

/* Responsive: a narrow window hides the Library behind the toolbar toggle,
   compacts the workflow control and lets header blocks wrap. */
@media (max-width: 900px) {
  :root { --library-width: 250px; }
  .empty .hero { font-size: 40px; }
  .chip input, .chip .box, .segments button { width: 48px; height: 38px; font-size: 20px; }
  .chip-placeholder { font-size: 20px; }
}
@media (max-width: 900px) { .toolbar-user { display: none; } }
@media (max-width: 720px) {
  .split, .split.library-hidden { grid-template-columns: minmax(0, 1fr); }
  .library-resizer { display: none; }
  .split .library { position: fixed; inset: 56px 0 0 0; z-index: 20; width: min(320px, 90vw); box-shadow: 8px 0 24px rgba(0,0,0,.25); }
  .split:not(.library-open) .library { display: none; }
  .toolbar { grid-template-columns: auto minmax(0, 1fr) auto; padding: 10px; gap: 8px; }
  .workflow { height: 30px; }
  .workflow button { font-size: 12px; }
  .workflow button .label-long { display: none; }
  .empty { padding: 24px 16px; gap: 16px; }
  .empty .hero { font-size: 32px; }
  .icon.hero { --icon-size: 48px; }
  .review-header { padding: 10px; }
  .bottombar .bar-side { flex-wrap: wrap; }
  .bottombar .bar-logo { display: none; }
  .chips { gap: 6px; }
  .chip input, .chip .box, .segments button { width: 42px; height: 34px; font-size: 17px; }
  .chip-placeholder { font-size: 17px; }
  .chip .box .icon { --icon-size: 22px; }
  .review-header .facts { grid-template-columns: 1fr; }
  .review-header .facts .label { display: none; }
  table.lines { min-width: 540px; }
  .lines .num { width: 30px; } .lines .tog { width: 28px; }
  .lines .tc { width: 92px; } .lines .role { width: 96px; }
  .lines td, .lines th { padding-left: 4px; padding-right: 4px; }
  .review-header .name { font-size: 18px; }
  .translated-header { flex-wrap: wrap; }
  .translated-facts .name { font-size: 18px; }
  .key-gate > span { display: none; }
  .form { grid-template-columns: 1fr; }
  .form > label { text-align: left; }
  .form .hint { grid-column: 1; }
  .editor { grid-template-columns: 1fr; }
  .loop .line { grid-template-columns: 90px 1fr; }
  .loop .line .text { grid-column: 1 / -1; }
  .source-panel { width: 100%; }
}

/* ===== Translate pane (TranslationView.swift) ===== */
.pane { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--parchment); }
.divider { height: 1px; background: var(--divider); flex: none; }
.queue-section { flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.section-title { padding: 16px 16px 8px; }
.section-title h2 { margin: 0; font-size: 21px; font-weight: 600; }
.native-list { flex: 1; overflow: auto; min-height: 0; }
.list-row {
  display: flex; align-items: center; gap: 8px; min-height: 32px; padding-right: 16px; font-size: 12px; user-select: none;
}
.list-row:hover { background: rgba(42, 100, 197, .08); }
.list-row.selected { background: var(--unemphasized); }
.list-row.emphasized { background: var(--action); color: #fff; }
.list-row .spacer { flex: 1; min-width: 12px; }
.list-row .node-icon { --icon-size: 17px; width: 18px; justify-content: center; color: var(--muted); }
.list-row.emphasized .node-icon { color: #fff; }
.list-row .node-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.list-row .node-title.document { font-weight: 700; }
.list-row .node-detail { font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row.emphasized .node-detail, .list-row.emphasized .row-caption { color: rgba(255,255,255,.85); }
.list-row:not(.selected) .row-control { pointer-events: none; }
.popup { position: relative; display: inline-flex; align-items: center; gap: 4px; width: 170px; height: 20px; flex: none; }
.popup-title { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup .popup-chevron { --icon-size: 11px; color: var(--muted); }
.list-row.emphasized .popup .popup-chevron { color: #fff; }
.popup select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
/* No API key configured: the preset popup dims and does nothing (native). */
.popup.gated { opacity: .5; }
.popup.gated select { cursor: default; }
.roles-chip {
  width: 26px; height: 19px; flex: none; border-radius: 4px; border: 1.5px solid var(--chip-glyph, #7a7a7a); background: var(--chip-quiet);
  padding: 0; overflow: hidden; display: inline-flex; align-items: flex-end; justify-content: center; color: var(--chip-glyph, #7a7a7a); cursor: pointer;
}
.roles-chip .icon { --icon-size: 17px; margin-bottom: -4px; }
.roles-chip:hover { filter: brightness(.9); }
.list-row.emphasized .roles-chip { border-color: #fff; color: #fff; background: rgba(255,255,255,.2); }
.row-caption { font-size: 12px; color: var(--muted); white-space: nowrap; }
.language-capsule { font-size: 11px; font-weight: 600; color: #fff; background: var(--translated); border-radius: 980px; padding: 2px 6px; white-space: nowrap; }
.language-capsule.large { font-size: 12px; padding: 3px 8px; }
.controls-strip { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--parchment); flex: none; }
.controls-strip .counts { font-size: 12px; }
.controls-strip .spacer { flex: 1; }
/* The API-key gate beside the Translate button (native controls strip). */
.key-gate { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.key-gate .icon { color: var(--warning); }
.progress-ring { flex: none; }

/* Queue roles popover (TranslationQueueRolesEditor) */
.popover {
  position: fixed; z-index: 70; background: var(--canvas); color: var(--ink); border: 1px solid var(--divider); border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.roles-popover { width: 500px; max-width: calc(100vw - 16px); }
.popover-title { font-size: 13px; font-weight: 600; text-align: center; padding: 14px 16px 6px; }
.popover-caption { font-size: 12px; color: var(--muted); padding: 0 16px 8px; }
.popover .divider { margin-bottom: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); padding: 0 16px 12px; }
.legend-item { display: inline-flex; gap: 4px; align-items: center; }
.gender-glyph { display: inline-flex; width: 16px; justify-content: center; font-size: 14px; font-weight: 600; --icon-size: 12px; }
.roles-header, .role-row { display: grid; grid-template-columns: 170px 150px 1fr; gap: 8px; align-items: center; padding: 0 16px; height: 28px; font-size: 12px; }
.roles-header { background: var(--header); font-weight: 600; border-bottom: 1px solid var(--divider); }
.roles-rows { height: 280px; overflow: auto; }
.role-row.striped { background: var(--parchment); }
.role-row.selected { background: var(--action); color: #fff; }
/* A row's fields and gender buttons edit only once the row is selected. Until
   then clicks pass through them to the row (which selects it): a disabled
   control would swallow the click, so the row never selected. */
.role-row:not(.selected) input, .role-row:not(.selected) button { pointer-events: none; }
.role-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-translation { border: 0; background: transparent; font-size: 12px; padding: 2px 4px; border-radius: 3px; color: inherit; min-width: 0; }
.role-row.selected .role-translation::placeholder { color: rgba(255,255,255,.7); }
.role-translation:focus { background: var(--control-bg); color: var(--ink); outline: none; }
.gender-radios { display: inline-flex; gap: 2px; }
.gender-radio { width: 24px; height: 20px; border: 0; border-radius: 4px; background: none; color: var(--muted); padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.gender-radio.active { background: var(--action); color: #fff; }
.role-row.selected .gender-radio { color: rgba(255,255,255,.7); }
.role-row.selected .gender-radio.active { background: #fff; color: var(--action); }
.empty-roles { text-align: center; padding: 16px; }

/* Sheets: consent, API key guide, alerts */
dialog.sheet { width: min(540px, calc(100% - 24px)); }
.sheet-body { padding: 36px; display: grid; gap: 16px; }
.sheet-body p { margin: 0; line-height: 1.6; font-size: 13px; }
.sheet-title { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.sheet-title h2 { margin: 0; font-size: 24px; font-weight: 600; }
.sheet-title .shield { --icon-size: 36px; color: var(--warning); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 16px; }
dialog.guide { width: min(560px, calc(100% - 24px)); }
.guide .sheet-body { padding: 28px; gap: 20px; }
.guide h1.display { font-size: 32px; font-weight: 600; margin: 0; }
.guide section { display: grid; gap: 6px; }
.guide h3 { margin: 0; font-size: 17px; }
.guide .sub { font-size: 12px; }
.bullets { margin: 0; padding-left: 16px; color: var(--muted); font-size: 12px; display: grid; gap: 8px; }
/* Native PermanentRemovalSheet: centered lines, bold count, red confirm. */
.alert.removal .body { padding: 36px; gap: 20px; }
.alert.removal h3 { font-size: 20px; font-weight: 600; }
.alert.removal p { font-size: 13px; }
.alert.removal .count { display: grid; gap: 2px; }
.alert.removal .buttons { display: flex; gap: 12px; justify-content: center; padding-top: 8px; }
.alert.removal .buttons button { border: 0; border-radius: 980px; padding: 11px 22px; font-size: 13px; }
.alert.removal .quiet { background: rgba(127,127,127,.14); color: var(--ink); }
.alert.removal .danger { background: #ff3b30; color: #fff; }
.alert .alert-icon { width: 64px; height: 64px; margin: 0 auto; }
.alert .body p { white-space: pre-line; font-size: 12px; margin: 0; }
.alert footer.stacked { flex-direction: column; align-items: stretch; }
.alert footer.stacked button { justify-content: center; }

/* ===== Settings window (SettingsView.swift) ===== */
dialog.settings-window { width: min(860px, calc(100% - 24px)); height: min(820px, calc(100% - 24px)); border-radius: 12px; }
dialog.settings-window:has(.section-translation-presets) { width: min(1040px, calc(100% - 24px)); }
.window { display: flex; flex-direction: column; height: 100%; }
.titlebar { display: grid; grid-template-columns: 60px 1fr 60px; align-items: center; height: 28px; background: var(--bar); flex: none; }
.window-title { text-align: center; font-size: 13px; font-weight: 600; }
.close-light { width: 12px; height: 12px; border-radius: 50%; border: 0; background: #ff5f57; margin-left: 12px; padding: 0; }
.close-light:hover { box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.category-bar { display: flex; justify-content: center; gap: 4px; height: 81px; align-items: center; background: var(--bar); border-bottom: 1px solid var(--divider); flex: none; overflow-x: auto; padding: 0 8px; }
.category-bar .category {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.category-bar .category:hover { background: rgba(127,127,127,.1); }
.category-bar .category.selected { color: var(--action); background: rgba(42,100,197,.1); }
.category-glyph { --icon-size: 27px; }
.category-glyph.icon-translation { --icon-size: 24px; }
.settings-body { flex: 1; overflow: auto; min-height: 0; background: var(--canvas); }
.settings-body > .settings-form, .settings-body > div > .settings-form { padding: 24px; }
.settings-form { display: grid; grid-template-columns: minmax(140px, max-content) minmax(160px, 1fr); gap: 10px 16px; align-items: center; }
.settings-form .form-label { text-align: right; }
.settings-form .form-help { grid-column: 2; font-size: 12px; color: var(--muted); margin-top: -4px; white-space: pre-line; max-width: 480px; }
.settings-form .form-gap { grid-column: 1 / -1; height: 8px; }
.settings-form .form-divider { grid-column: 1 / -1; height: 1px; background: var(--hairline); margin: 12px 0; }
.settings-form .note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin: 0; }
.settings-form .form-section { grid-column: 1 / -1; margin: 28px 0 0; font-size: 17px; font-weight: 600; }
.settings-form .form-section.first { margin-top: 0; }
/* SettingsBlock: a rounded box whose rows stay on the form's columns (subgrid). */
.settings-form .settings-block { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; gap: 10px 16px; align-items: center;
  margin-top: 20px; padding: 16px; background: var(--pearl); border: 1px solid var(--hairline); border-radius: var(--radius); }
.settings-form .settings-block + .settings-block { margin-top: 12px; }
.settings-form .settings-block-title { grid-column: 1 / -1; margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.settings-form .form-subhead { grid-column: 1 / -1; margin: 12px 0 0; font-size: 13px; font-weight: 600; }
.form-input, .form-select, .form-textarea {
  font-size: 13px; padding: 7px; border-radius: 5px; border: 1px solid var(--divider); background: var(--control-bg); color: var(--ink); width: 100%; min-width: 0;
}
.form-select { width: auto; max-width: 100%; padding-right: 24px; justify-self: start; }
.form-textarea { min-height: 80px; resize: vertical; font-family: inherit; line-height: 1.4; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 1px var(--action); }
.form-input:disabled { opacity: .55; }
.form-input.stepper { width: 80px; }
.form-inline { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.form-buttons { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.form-buttons.start { justify-content: flex-start; }
.form-buttons .spacer { flex: 1; }
.provider-status code { font-family: ui-monospace, Menlo, monospace; }
.settings-footer { display: flex; align-items: center; padding: 0 24px 24px; }
.small { font-size: 12px; }
.tabular { font-variant-numeric: tabular-nums; }
.hover-row:hover { background: rgba(42,100,197,.08); }
.users td { padding: 6px; }
/* Translation presets: list | editor */
.presets-pane { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; height: 100%; }
.preset-list { display: flex; flex-direction: column; border-right: 1px solid var(--divider); min-height: 0; }
.preset-rows { flex: 1; overflow: auto; padding: 6px; }
.preset-row { padding: 6px 10px; border-radius: 6px; cursor: default; }
.preset-row .preset-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset-row .preset-summary { font-size: 12px; color: var(--muted); }
.preset-row.selected { background: var(--action); color: #fff; }
.preset-row.selected .preset-summary, .preset-row.selected .preset-summary span { color: rgba(255,255,255,.85) !important; }
.preset-row .rename { width: 100%; font-size: 13px; }
.list-footer { display: flex; align-items: center; gap: 8px; padding: 12px; }
.list-footer .spacer { flex: 1; }
.preset-editor { display: flex; flex-direction: column; min-height: 0; }
.editor-scroll { flex: 1; overflow: auto; }
.editor-scroll .settings-form { padding: 24px; }
.editor-footer { display: flex; align-items: center; gap: 12px; padding: 16px; border-top: 1px solid var(--hairline); }
.editor-footer .spacer { flex: 1; }
.problems { display: grid; gap: 4px; font-size: 12px; }
.empty-editor { align-items: center; justify-content: center; gap: 8px; color: var(--muted); }
.empty-editor h3 { margin: 0; color: var(--ink); }
/* Loop presets */
.loop-rows { border: 1px solid var(--hairline); border-radius: 8px; overflow: hidden; max-height: 320px; overflow-y: auto; }
.loop-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 52px; }
.loop-row .loop-text { flex: 1; display: grid; gap: 4px; min-width: 0; }
.loop-row .more { opacity: 0; width: 36px; height: 32px; }
.loop-row:hover .more, .loop-row.selected .more { opacity: 1; }
.loop-row.selected { background: var(--action); color: #fff; }
.loop-row.selected .muted { color: rgba(255,255,255,.85); }
.loop-popover { width: 480px; max-width: calc(100vw - 16px); padding: 20px; }
.loop-popover .settings-form { gap: 14px 12px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row input[type=range] { width: 160px; accent-color: var(--action); }
.slider-value { width: 52px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
/* License pane */
.license-pane { padding: 24px; display: grid; gap: 16px; }
.pane-heading { margin: 0; font-size: 17px; font-weight: 600; }
.company { display: flex; gap: 20px; align-items: flex-start; }
.logo-well {
  width: 128px; height: 128px; flex: none; border-radius: var(--radius-large); background: var(--drop); border: 2px solid var(--drop-ring);
  display: grid; place-items: center; overflow: hidden; color: var(--muted);
}
.logo-well.targeted { border-color: var(--action); color: var(--action); }
.logo-well img { max-width: 108px; max-height: 108px; }
.logo-placeholder { display: grid; justify-items: center; gap: 6px; font-size: 12px; }
.company-grid { flex: 1; display: grid; grid-template-columns: max-content 1fr; gap: 8px 12px; align-items: center; }
.grid-label { text-align: right; }
.license-card { background: var(--dark-pane); border-radius: 8px; padding: 16px; display: grid; gap: 14px; }
.license-card h4 { margin: 0; font-size: 13px; font-weight: 700; }
.license-card .callout { margin: 0; font-size: 13px; line-height: 1.45; }
.license-card .small { margin: 0; white-space: pre-line; }
.license-grid { display: grid; grid-template-columns: max-content 1fr; gap: 12px; align-items: center; }
.valid-badge { background: rgb(122, 184, 41); color: #fff; font-weight: 500; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.license-message { color: var(--pane-warning); font-weight: 600; margin: 0; }
@media (max-width: 720px) {
  .settings-form { grid-template-columns: 1fr; }
  .settings-form .form-label { text-align: left; }
  .settings-form .form-help { grid-column: 1; }
  .presets-pane { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .preset-list { border-right: 0; border-bottom: 1px solid var(--divider); max-height: 240px; }
  .company { flex-direction: column; }
  .popup { width: 110px; }
  dialog.settings-window { width: 100%; height: 100%; max-width: 100%; max-height: 100%; border-radius: 0; }
}

/* Review Roles editor (RolesEditorView) and the shared roles popover parts */
.roles-popover.document-roles { width: 616px; }
.roles-header.review-roles, .role-row.document-roles { grid-template-columns: 150px 130px 130px 120px; }
.roles-header .header-button { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; }
.roles-header .sort-glyph { --icon-size: 9px; }
.role-field { border: 0; background: transparent; font-size: 12px; padding: 2px 4px; margin: 0 -4px; border-radius: 3px; color: inherit; min-width: 0; font-family: inherit; }
.role-field:disabled { color: inherit; opacity: 1; -webkit-text-fill-color: currentColor; }
.role-field::placeholder { color: var(--muted); }
.role-row.document-roles .untouched { font-weight: 700; }
.role-row.selected .role-field::placeholder { color: rgba(255,255,255,.7); }
.role-field.alias { color: #af52de; -webkit-text-fill-color: #af52de; }
.role-row.selected .role-field.alias:not(:focus) { color: #fff; -webkit-text-fill-color: #fff; }
.role-field:focus { background: var(--control-bg); color: var(--ink); -webkit-text-fill-color: var(--ink); outline: none; }
.role-row:not(.selected):hover { background: rgba(42,100,197,.08); }
.gender-radio:disabled { cursor: default; }
.roles-footer { display: flex; gap: 16px; align-items: center; padding: 0 16px; height: 32px; }
.roles-footer .icon { --icon-size: 16px; }
.roles-footer .spacer { flex: 1; }
dialog.role-import { width: min(720px, calc(100% - 24px)); }
.role-import-controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; font-size: 12px; }
.role-import-controls label { display: grid; gap: 4px; }
.roles-header.role-import-row, .role-row.role-import-row { grid-template-columns: 150px 110px 110px 30px 110px 1fr; padding: 0 8px; }
.role-import-row .role-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-import-row .alias { color: var(--alias-role); }
.role-import-row select { font-size: 12px; height: 22px; padding: 0 4px; }
dialog.role-import .roles-rows { height: 260px; }
.divider.flush { margin: 0; }
/* The Review header's Roles chip face (RolesChipFace): quiet fill, glyph rising from the bottom edge, bordered. */
.chip .box.roles-face {
  background: var(--chip-quiet); border: 2.5px solid var(--chip-glyph, #7a7a7a); color: var(--chip-glyph, #7a7a7a);
  overflow: hidden; display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
.chip .box.roles-face .icon { --icon-size: 36px; margin-bottom: -7px; }
.chip .box.roles-face:hover { filter: brightness(.9); }
/* Selected while the Roles window is open (the button is a toggle). */
.chip .box.roles-face.on { background: var(--action); border-color: var(--action); color: #fff; }
.chip .box.roles-face.on:hover { filter: brightness(1.08); }
.roles-chip.on { background: var(--action); border-color: var(--action); color: #fff; }
:root { --chip-glyph: #7a7a7a; }

/* ===== Export pane (ExportView.swift) ===== */
:root { --loop-header: #48484c; }
.pane.export { background: var(--parchment); }
.export-queue { display: flex; flex-direction: column; min-height: 0; flex: none; }
.loop-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 12px 16px; flex: none; }
.loop-controls-row { display: flex; align-items: center; gap: 12px; width: 100%; flex-wrap: wrap; }
.loop-controls-row .spacer { flex: 1; }
.loop-controls .summary { text-align: right; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.checkbox input { accent-color: var(--action); margin: 0; }
.offset { display: inline-flex; align-items: center; gap: 4px; }
/* The Offset label sits right by its value, well apart from Convert to 25fps. */
.loop-controls-row .offset { margin-left: 12px; }
.offset .stepper-value { width: auto; min-width: 2ch; }
.offset-sign { padding: 2px 0; width: 22px; justify-content: center; font-size: 13px; }
.timecode-input { min-width: 84px; padding: 3px 6px; font-size: 12px; text-align: center; border: .5px solid var(--divider); border-radius: 5px; background: var(--control-bg, var(--canvas)); white-space: nowrap; }
.timecode-input:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 1px var(--action); }
.fps-mismatch { display: inline-flex; align-items: center; gap: 3px; color: var(--warning); font-size: 11px; font-weight: 500; }
/* The Export Queue | loops boundary: an 8px band between hairlines with a
   centered grip, accent while hovered or dragged (native queueSplitter). */
.divider.queue-splitter { position: relative; height: 8px; background: var(--header); border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); box-sizing: content-box; cursor: row-resize; }
.queue-splitter::before { content: ""; position: absolute; left: 0; right: 0; top: -3px; bottom: -3px; z-index: 2; }
.queue-splitter::after { content: ""; position: absolute; left: 50%; top: 50%; width: 32px; height: 4px; margin: -2px 0 0 -16px; border-radius: 2px; background: var(--muted, #8e8e93); opacity: .6; transition: background .12s, opacity .12s; }
.queue-splitter:hover::after, .row-resizing .queue-splitter::after { background: var(--action); opacity: 1; }
body.row-resizing { cursor: row-resize; user-select: none; }
body.row-resizing * { cursor: row-resize !important; }
.selected.emphasized .fps-mismatch { color: #fff; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper-value { width: 36px; text-align: right; font-size: 12px; }
.stepper-buttons { display: inline-flex; flex-direction: column; border: .5px solid var(--divider); border-radius: 5px; background: var(--pearl); overflow: hidden; }
.stepper-buttons button { border: 0; background: none; padding: 0 3px; height: 11px; display: flex; align-items: center; color: var(--ink); }
.stepper-buttons button + button { border-top: .5px solid var(--divider); }
.stepper-buttons button:hover { background: rgba(127,127,127,.15); }
.stepper-buttons .icon { --icon-size: 9px; }
.popup.compact-popup { width: auto; max-width: 220px; padding: 3px 8px; border: .5px solid var(--divider); border-radius: 5px; background: var(--pearl); height: auto; }
/* DesignContextButtonStyle: a sunken well while disabled, a dark face once available. */
.context { font-size: 12px; padding: 8px 15px; border-radius: 8px; border: 0; background: var(--loop-header); color: #fff; white-space: nowrap; }
.context:hover { background-image: linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.14)); }
.context:active { background: var(--action); }
.context:disabled { background: rgba(127,127,127,.05); color: var(--muted); box-shadow: inset 0 1px 1.5px rgba(0,0,0,.28); cursor: default; background-image: none; }
.utility.small { padding: 5px 10px; }
.export-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; flex: none; }
.export-bar .spacer { flex: 1; }
.export-bar .export-all { margin-left: 6px; }
.loops-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.section-title.with-detail { display: flex; align-items: baseline; justify-content: space-between; }
.loops-scroll { flex: 1; overflow: auto; padding: 0 16px 12px; outline: none; }
.loop-heading { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 8px; margin: 12px 0 8px; user-select: none; }
.loop-heading:hover { background: rgba(42,100,197,.08); }
.loop-heading.selected { background: var(--unemphasized); }
.loop-heading.emphasized { background: var(--action); color: #fff; }
.loop-heading .heading-text { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loop-heading .caption { color: var(--muted); white-space: nowrap; }
.loop-heading.emphasized .caption { color: rgba(255,255,255,.8); }
.disclosure-button { padding: 3px; color: var(--muted); }
.disclosure-button .icon { --icon-size: 11px; transition: transform .15s; }
.disclosure-button.open .icon { transform: rotate(90deg); }
.loop-heading.emphasized .disclosure-button { color: rgba(255,255,255,.85); }
.loop-card { background: var(--canvas); border: .5px solid var(--hairline); border-radius: 8px; overflow: hidden;
  /* Off-screen cards skip layout and paint: a title holds hundreds. */
  content-visibility: auto; contain-intrinsic-size: auto 220px; }
.loop-band { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; background: var(--loop-header); color: #fff; font-size: 12px; }
.loop-band .spacer { flex: 1; }
.loop-band .band-meta { color: rgba(255,255,255,.7); }
.over-limit { color: rgb(255,179,64); display: inline-flex; align-items: center; gap: 4px; }
.loop-line { display: grid; grid-template-columns: 14px 100px 140px 1fr 56px; gap: 14px; align-items: start; padding: 6px 12px; border-top: .5px solid var(--hairline); font-size: 12px; user-select: none; }
.loop-line:hover { background: rgba(42,100,197,.08); }
.loop-line.emphasized { background: var(--action); color: #fff; }
.loop-line .mono { font-family: ui-monospace, Menlo, monospace; }
.loop-line .start { color: var(--muted); }
.loop-line .role { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loop-line .timing { font-size: 11px; color: var(--muted); text-align: right; }
.loop-line .song-slot { color: var(--muted); }
.loop-line.emphasized .start, .loop-line.emphasized .timing, .loop-line.emphasized .song-slot { color: rgba(255,255,255,.85); }
.loop-gap { height: 8px; }
.loop-boundary { position: relative; height: 24px; display: flex; align-items: center; justify-content: center; cursor: ns-resize; outline: none; z-index: 1; }
.loop-boundary .boundary-line { position: absolute; left: 0; right: 0; top: 11px; height: 2px; background: var(--divider); }
.loop-boundary .grip { position: relative; padding: 3px 10px; border-radius: 980px; background: var(--pearl); box-shadow: 0 0 0 .5px var(--divider); display: inline-flex; color: var(--ink); }
.loop-boundary .grip .icon { --icon-size: 11px; }
.loop-boundary:hover .boundary-line, .loop-boundary:focus .boundary-line, .loop-boundary.selected .boundary-line, .loop-boundary.dragging .boundary-line { background: var(--action); }
.loop-boundary:hover .grip, .loop-boundary:focus .grip, .loop-boundary.selected .grip, .loop-boundary.dragging .grip { background: var(--action); color: #fff; box-shadow: none; }

/* Pressed feedback: every clickable control darkens while the pointer is down,
   whatever state (on / off, hovered or not) it is in. Transparent icon
   buttons get a grey plate, filled controls darken. Last in the file so it wins over the :hover rules. */
.bar-button:not(:disabled):active, .search-loupe:active, .lines .role-chevron:active,
.lines .tog button:not(:disabled):active { background: rgba(127,127,127,.28); color: var(--ink); }
.lines tr.selected .tog button:not(:disabled):active, .lines tr.selected .role-chevron:active { background: rgba(255,255,255,.28); color: #fff; }
.primary:not(:disabled):active, .compact:active, .context:not(:disabled):active, .import-face:not(:disabled):active,
.roles-chip:active, .chip .box.roles-face:active, .segments button:active, .search-clear:active,
.alert.removal .buttons button:active, .close-light:active, .menu .swatch:active { filter: brightness(.8); }
.compact:active { background-image: linear-gradient(rgba(127,127,127,.18), rgba(127,127,127,.18)); filter: none; }
.workflow button:active { background: rgba(255,255,255,.14); }
.workflow button[aria-selected="true"]:active { filter: brightness(1.25); }
.link:active, .header-button:active, .popup:active .popup-title { opacity: .55; }
.native-offer .offer-app:active img { transform: scale(.95); }
.stepper-buttons button:active, .category-bar .category:active, .gender-radio:not(.active):active { background: rgba(127,127,127,.28); }
.role-row.selected .gender-radio:not(.active):active { background: rgba(255,255,255,.28); }
.gender-radio.active:active { filter: brightness(.8); }

/* MARK: Recipe Lab (lab.js; native RecipeLabUI/LabViews.swift)
   The pens' colours are the SwiftUI system colours the native Lab uses
   (Pen.color): role orange, dialogue blue, time in green, time out teal,
   not dialogue red, reel/episode brown, start/end purple. Callout = 12px,
   caption = 10px, title3 = 15px, title2 = 17px, as on macOS. */
:root {
  --sys-orange: #ff9500; --sys-blue: #007aff; --sys-green: #28cd41; --sys-teal: #30b0c7;
  --sys-red: #ff3b30; --sys-brown: #a2845e; --sys-purple: #af52de;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --sys-orange: #ff9f0a; --sys-blue: #0a84ff; --sys-green: #32d74b; --sys-teal: #40c8e0; --sys-red: #ff453a; --sys-brown: #ac8e68; --sys-purple: #bf5af2; }
}
:root[data-theme="dark"] { --sys-orange: #ff9f0a; --sys-blue: #0a84ff; --sys-green: #32d74b; --sys-teal: #40c8e0; --sys-red: #ff453a; --sys-brown: #ac8e68; --sys-purple: #bf5af2; }
.pen-role { --pen: var(--sys-orange); } .pen-dialogue { --pen: var(--sys-blue); }
.pen-timecodeIn { --pen: var(--sys-green); } .pen-timecodeOut { --pen: var(--sys-teal); }
.pen-notDialogue { --pen: var(--sys-red); } .pen-section { --pen: var(--sys-brown); }
.pen-start, .pen-end { --pen: var(--sys-purple); }

/* Review header: which reader read the lines (caption, accent when a recipe). */
.review-header .reader { display: inline-flex; align-items: center; gap: 8px; }
.review-header .reader > span { display: inline-flex; align-items: center; gap: 4px; --icon-size: 14px; }
.review-header .reader .recipe { color: var(--action); }
.review-header .reader .link { font-size: 13px; }

dialog.lab-window { width: calc(100% - 40px); height: calc(100% - 24px); max-width: none; max-height: none; border-radius: 12px; padding: 0; }
.lab-loading { display: grid; place-items: center; height: 100%; color: var(--muted); }
.lab { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* PenBar: capsules tinted with the pen's colour, solid when chosen. */
.lab-pens { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--divider); flex-wrap: wrap; }
.lab-pens .spacer { flex: 1; }
.lab-pen { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; border: 0; font-size: 12px; cursor: pointer; --icon-size: 13px;
  color: var(--ink); background: color-mix(in srgb, var(--pen) 14%, transparent); }
.lab-pen.on { color: #fff; font-weight: 600; background: var(--pen); }
.lab-pen-divider { width: 1px; height: 18px; background: var(--divider); margin: 0 4px; }

.lab-panes { flex: 1; display: grid; grid-template-columns: minmax(560px, 1fr) minmax(420px, 560px); min-height: 0; }
.lab-document { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--divider); }
.lab-document header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 12px; border-bottom: 1px solid var(--divider); }
.lab-file { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lab-pen-hint { font-size: 12px; color: var(--pen); }
.pen-text-role { --pen: var(--sys-orange); } .pen-text-dialogue { --pen: var(--sys-blue); }
.pen-text-timecodeIn { --pen: var(--sys-green); } .pen-text-timecodeOut { --pen: var(--sys-teal); }
.pen-text-notDialogue { --pen: var(--sys-red); } .pen-text-section { --pen: var(--sys-brown); }
.pen-text-start, .pen-text-end { --pen: var(--sys-purple); }

/* UnitRow: a 4px bar (red excluded, purple boundary, brown heading, accent
   read), rows not read at half opacity, headings tinted brown. */
.lab-scroll { flex: 1; overflow: auto; padding: 2px 8px 2px 4px; background: var(--canvas); }
.lab-rows { display: flex; flex-direction: column; }
.lab-row { display: flex; gap: 6px; padding: 4px 0; cursor: default; }
.lab-row.dim { opacity: .5; }
.lab-row.heading { background: color-mix(in srgb, var(--sys-brown) 14%, transparent); }
.lab-row.selected { background: color-mix(in srgb, var(--action) 12%, transparent); }
.lab-bar { flex: none; width: 4px; border-radius: 2px; background: transparent; }
.lab-row.cue .lab-bar { background: var(--action); }
.lab-row.heading .lab-bar { background: var(--sys-brown); }
.lab-row.boundary .lab-bar { background: var(--sys-purple); }
.lab-row.excluded .lab-bar { background: var(--sys-red); }
.lab-cells { flex: 1; display: grid; column-gap: 10px; font-size: 12px; min-width: 0; }
.lab-cell { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lab-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; }
/* PieceView: the mark's colour at 28% with a 1px outline; hover 9%. */
.piece { border-radius: 4px; padding: 1px 4px; border: 1px solid transparent; overflow-wrap: anywhere; cursor: pointer; }
.piece:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.piece.tc { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.piece.mark { background: color-mix(in srgb, var(--pen) 28%, transparent); border-color: var(--pen); }

.lab-preview { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
/* Guide */
.lab-guide { padding: 24px; display: flex; flex-direction: column; gap: 16px; overflow: auto; }
.lab-guide h2 { margin: 0; font-size: 17px; font-weight: 600; }
.lab-guide p { margin: 0; color: var(--muted); font-size: 13px; }
.lab-step { display: flex; gap: 12px; align-items: flex-start; }
.lab-step strong { font-size: 13px; font-weight: 500; }
.lab-step .muted { font-size: 12px; }
.lab-step-glyph { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--pen); --icon-size: 15px; }
.lab-hint { display: flex; gap: 6px; align-items: flex-start; color: var(--sys-orange); font-size: 13px; --icon-size: 15px; }
.lab-hint.small { font-size: 12px; }
/* Summary */
.lab-summary { display: flex; flex-direction: column; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--divider); font-size: 13px; }
.lab-facts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.lab-facts .spacer { flex: 1; }
.lab-count { font-size: 15px; font-weight: 600; }
.lab-brown { color: var(--sys-brown); font-weight: 600; }
.lab-orange { color: var(--sys-orange); }
.lab-choice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.lab-choice .form-select { width: auto; }
.lab-fps { min-width: 140px; }
.lab-start { width: 96px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.lab-advice { display: flex; flex-direction: column; gap: 5px; padding: 7px 10px; border-radius: 8px; font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--sys-orange) 10%, transparent); --icon-size: 14px; }
.lab-advice.ready { background: color-mix(in srgb, var(--sys-green) 10%, transparent); }
.lab-advice .ask, .lab-advice .ready { display: flex; gap: 6px; align-items: flex-start; }
.lab-advice .ask { color: var(--sys-orange); }
.lab-advice .ready { color: var(--sys-green); background: none; }
.lab-kinds { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.lab-kind { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 10px; cursor: default;
  color: var(--sys-orange); background: color-mix(in srgb, var(--sys-orange) 12%, transparent); --icon-size: 11px; }
.lab-none { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--sys-green); --icon-size: 11px; }
/* CueList and CueRow */
.lab-cues { flex: 1; overflow: auto; }
.lab-section { display: flex; align-items: center; gap: 5px; padding: 9px 8px 0 52px; font-size: 12px; font-weight: 600; color: var(--sys-brown); --icon-size: 13px; }
.lab-cue { display: grid; grid-template-columns: 34px 82px minmax(0, 1fr) 24px; gap: 10px; padding: 3px 8px; align-items: start; cursor: default; }
.lab-cue.selected { background: color-mix(in srgb, var(--action) 16%, transparent); }
.lab-number { font-size: 10px; color: color-mix(in srgb, var(--ink) 30%, transparent); text-align: right; padding-top: 2px; font-variant-numeric: tabular-nums; }
.lab-tc { display: flex; flex-direction: column; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 10px; padding-top: 2px; }
.lab-cue-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12px; }
.lab-cue-role { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px; }
.lab-cue-role strong { font-weight: 600; }
.lab-cue-role .small { font-size: 10px; }
.lab-tag { font-size: 10px; padding: 0 4px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 15%, transparent); }
.lab-cue-dialogue { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lab-issue { display: flex; gap: 4px; align-items: center; font-size: 10px; color: var(--sys-orange); --icon-size: 11px; }
.lab-not { opacity: 0; width: 24px; height: 22px; border: 0; background: none; color: var(--ink); }
.lab-cue:hover .lab-not { opacity: 1; }
/* LabSheet footer */
.lab-footer { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--divider); flex-wrap: wrap; font-size: 13px; }
.lab-footer .spacer { flex: 1; }
.lab-footer .form-select { width: auto; }
.lab-footer .checkbox { font-size: 13px; }
.lab-footer .lab-taken { font-size: 10px; }
.lab-name { width: 190px; }
.recipe-rows:focus { outline: none; }
.recipe-rows .checkbox { flex: none; }
.loop-row.selected .checkbox { color: #fff; }
.settings-form .remove-recipe { color: var(--sys-red); }
@media (max-width: 1000px) {
  .lab-panes { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
  .lab-document { border-right: 0; border-bottom: 1px solid var(--divider); }
}
