:root {
  color-scheme: dark;
  --bg: #090d13;
  --bg-elevated: #0e141d;
  --surface: #121a24;
  --surface-2: #182331;
  --surface-3: #202d3d;
  --ink: #edf3f9;
  --muted: #9aaabd;
  --line: #2a3a4c;
  --line-strong: #3a5067;
  --heading: #dcecff;
  --blue: #55a9e8;
  --blue-strong: #2f83c4;
  --green: #55c98f;
  --red: #ff8178;
  --amber: #f0bd62;
  --shadow: rgba(0, 0, 0, .34);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -8%, rgba(58, 125, 178, .18), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(56, 142, 105, .11), transparent 30rem),
    linear-gradient(180deg, #0b1119 0, var(--bg) 34rem);
  color: var(--ink);
}

::selection { background: rgba(85, 169, 232, .35); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: #3b5168 #111923; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-track { background: #111923; }
*::-webkit-scrollbar-thumb { background: #3b5168; border: 2px solid #111923; border-radius: 999px; }

.topbar {
  background: rgba(12, 20, 30, .96);
  color: #fff;
  padding: 22px max(24px, calc((100vw - 1240px) / 2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #26384a;
  box-shadow: 0 7px 26px var(--shadow);
  backdrop-filter: blur(14px);
}
.topbar h1 { margin: 2px 0; font-size: 1.72rem; color: #f1f7fc; }
.topbar h1 small { font-size: .75rem; color: #86b8de; }
.eyebrow { margin: 0; color: #8194a8; font-size: .69rem; letter-spacing: .14em; font-weight: 850; }
.topbar .eyebrow { color: #82b5da; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  min-width: 88px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: .74rem;
  line-height: 1;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  background: #273546;
  color: #c4d1dc;
}
.badge.ok { background: rgba(47, 137, 91, .22); border-color: rgba(85, 201, 143, .36); color: #7be0ae; }
.badge.error { background: rgba(174, 53, 45, .24); border-color: rgba(255, 129, 120, .35); color: #ff9d96; }
.badge.neutral { background: rgba(55, 109, 151, .25); border-color: rgba(85, 169, 232, .28); color: #9acdf2; }
.badge.warning { background: rgba(150, 99, 22, .27); border-color: rgba(240, 189, 98, .40); color: #ffd48a; }

.layout {
  width: min(1240px, calc(100% - 30px));
  margin: 28px auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}
.card {
  min-width: 0;
  background: linear-gradient(180deg, rgba(20, 29, 40, .98), rgba(16, 24, 34, .98));
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
  box-shadow: 0 10px 30px var(--shadow);
}
.layout > .card { grid-column: 1; }
.generator-card, .capture-card { min-width: 0; align-self: start; }
.generator-card .project-list { max-height: 980px; overflow: auto; padding-right: 3px; }
.card h2 { margin: 4px 0 18px; color: var(--heading); }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.sub-section-head { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-note { margin: -10px 0 16px; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.collapse-toggle {
  flex: 0 0 auto;
  min-width: 2.4rem;
  padding: 8px 10px;
  line-height: 1;
  font-size: 1rem;
}
.collapsible-card > .section-head { align-items: flex-start; }
.collapsible-card.is-collapsed > :not(.section-head) { display: none !important; }
.dashboard-card.is-collapsed > .youtube-panel { display: block !important; }
.youtube-panel.collapsible-card.is-collapsed > :not(.section-head) { display: none !important; }
.collapsible-card.is-collapsed { padding-bottom: 18px; }
.collapsible-card.is-collapsed > .section-head h2,
.collapsible-card.is-collapsed > .section-head h3 { margin-bottom: 0; }

.metrics { display: grid; grid-template-columns: repeat(8, minmax(100px, 1fr)); gap: 10px; margin: 18px 0; overflow-x: auto; padding-bottom: 2px; }
.metrics div {
  min-width: 0;
  background: linear-gradient(145deg, #172230, #131c27);
  border: 1px solid #293b4e;
  border-radius: 12px;
  padding: 17px;
  box-shadow: inset 0 1px rgba(255,255,255,.025);
}
.metrics strong { font-size: 1.8rem; color: #d9ebfa; display: block; overflow-wrap: anywhere; }
.metrics span { color: var(--muted); font-size: .82rem; }
.metrics .metric-success { border-color: rgba(85, 201, 143, .36); }
.metrics .metric-success strong { color: #6bdca5; }
.metrics .metric-attention { border-color: rgba(240, 189, 98, .42); }
.metrics .metric-attention strong { color: var(--amber); }
.metrics .metric-error { border-color: rgba(255, 129, 120, .36); }
.metrics .metric-error strong { color: #ff958d; }
.metrics .metric-published { border-color: rgba(85, 201, 143, .36); }
.metrics .metric-published strong { color: #6bdca5; }
.metrics .metric-video-ready { border-color: rgba(82, 169, 230, .42); }
.metrics .metric-video-ready strong { color: #8ecbfa; }
.metrics .metric-waiting { border-color: rgba(240, 189, 98, .42); }
.metrics .metric-waiting strong { color: var(--amber); }

.ingestion-controls { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.ingestion-controls label { min-width: 220px; }
.ingestion-controls small { display: block; color: var(--muted); margin-top: 4px; }
.progress { height: 13px; background: #202d3a; border: 1px solid #2b3b4c; border-radius: 999px; overflow: hidden; margin: 18px 0 8px; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, #348fd0, #48b57d); transition: width .35s; }
.status-line { margin: 0; color: #b3c2d0; }
.youtube-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 13, 20, .24);
  padding: 16px;
}
.compact-head { align-items: center; }
.compact-head h3 { margin: 3px 0 0; color: var(--heading); }
.mini-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.mini-metrics div {
  border: 1px solid #293b4e;
  border-radius: 10px;
  background: #101923;
  padding: 12px;
}
.mini-metrics strong { display: block; font-size: 1.25rem; color: #d9ebfa; }
.mini-metrics span { color: var(--muted); font-size: .76rem; }
.progress.slim { height: 9px; margin: 10px 0 8px; }
.youtube-tabs { margin-top: 14px; }
.youtube-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.youtube-table-wrap { max-height: 340px; margin-top: 8px; }
.youtube-col-number { width: 5%; }
.youtube-col-video { width: 44%; }
.youtube-col-state { width: 25%; }
.youtube-col-size { width: 16%; }
.youtube-col-action { width: 10%; }
.youtube-table td:nth-child(4), .youtube-table th:nth-child(4) { text-align: right; }
.youtube-table td:nth-child(5) .download { width: 100%; text-align: center; }
.reader-view {
  flex: 0 0 auto;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 16px;
}
.unified-reader { border-top-color: var(--line-strong); }
.reader-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.reader-head > div { min-width: 0; }
.reader-head h3 {
  margin: 3px 0 8px;
  color: var(--heading);
  font-size: 1rem;
  line-height: 1.3;
}
.reader-toggle { flex: 0 0 auto; margin: 1px 0 0; font-size: .76rem; color: #b7c8d8; }
#readerText {
  min-height: 220px;
  max-height: min(38vh, 460px);
  flex: 0 1 auto;
  overflow: auto;
  white-space: pre-wrap;
  background: #070b10;
  border: 1px solid #263545;
  border-radius: 9px;
  padding: 14px;
  color: #d5e0ea;
  font: 13px/1.62 "Segoe UI", Arial, sans-serif;
}
.note { font-size: .84rem; line-height: 1.5; color: var(--muted); margin-bottom: 0; }
.warning-note { color: #e7c98f; border-left: 3px solid var(--amber); padding-left: 10px; }

label { display: block; font-size: .82rem; font-weight: 750; color: #b4c3d1; margin-bottom: 13px; }
input, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid #3a4d62;
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
  background: #0e151e;
  caret-color: #76bcec;
  outline: none;
}
input[type="file"] { min-width: 0; max-width: 100%; }
input::placeholder, textarea::placeholder { color: #68798a; opacity: 1; }
input:focus, textarea:focus { border-color: #5ba7df; box-shadow: 0 0 0 3px rgba(85, 169, 232, .15); }
textarea { resize: vertical; line-height: 1.5; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-cols > * { min-width: 0; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 4px 0 16px; background: rgba(8, 13, 20, .18); }
legend { font-size: .82rem; font-weight: 800; color: #b5c6d4; padding: 0 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; margin: 3px 14px 3px 0; }
.check input { display: inline; width: auto; margin: 0; accent-color: #4c9ed9; }
.compact-check { min-height: 34px; margin: 0; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.source-count-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -4px 0 14px; color: var(--muted); }
.source-count-line strong { color: var(--heading); font-size: 1.25rem; }
.source-count-line button { padding: 7px 10px; }
.field-hint { margin: -4px 0 14px; color: var(--muted); font-size: .85rem; }
.form-message { min-height: 20px; margin: 10px 0 0; color: var(--muted); font-size: .9rem; }
.form-message.error { color: #ff9b94; }
.form-message.ok { color: #75d194; }
.error-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #6b3135;
  background: rgba(120, 36, 42, .18);
  color: #ffd1d1;
}
.error-box ul { margin: 8px 0 0; padding-left: 18px; }

button, .download {
  border: 1px solid #40556b;
  background: #1a2634;
  color: #dce8f2;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 780;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
button:hover, .download:hover { background: #233345; border-color: #5c7792; transform: translateY(-1px); }
button:focus-visible, .download:focus-visible { outline: 3px solid rgba(85, 169, 232, .25); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
[hidden] { display: none !important; }
.tiny-action {
  display: block;
  margin-top: 8px;
  padding: 6px 8px;
  font-size: .74rem;
  border-radius: 6px;
}
.primary { background: #246f9f; color: #fff; border-color: #398fc8; }
.primary:hover { background: #2d82b8; border-color: #61b0e2; }
.danger { color: #ff9b94; border-color: #75433f; background: #2b1c1e; }
.danger:hover { background: #3a2224; border-color: #a85e58; }
.large { width: 100%; padding: 13px 16px; }

.project-list { display: grid; gap: 12px; }
.project-status-group {
  border: 1px solid #2b3b4b;
  border-radius: 12px;
  background: #0d151e;
  overflow: hidden;
}
.project-status-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  background: #16222e;
  user-select: none;
}
.project-status-group > summary::-webkit-details-marker { display: none; }
.project-status-group > summary:hover { background: #1b2a38; }
.project-status-group > summary:focus-visible { outline: 3px solid rgba(85, 169, 232, .25); outline-offset: -3px; }
.project-status-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.project-status-title strong { color: #c2d0dc; font-size: .88rem; }
.project-status-toggle::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #40566b;
  border-radius: 8px;
  color: #d4e4f1;
  font-size: 1.1rem;
  font-weight: 800;
}
.project-status-group[open] .project-status-toggle::before { content: "−"; }
.project-status-items { display: grid; gap: 12px; padding: 12px; border-top: 1px solid #2b3b4b; }
.project-status-group:not([open]) .project-status-items { display: none; }
.embedded-projects { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.inline-subhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.inline-subhead h3 { margin: 0; color: var(--heading); font-size: 1.05rem; }
.project { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #101821; }
.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.project-head .badge { flex: 0 0 auto; }
.project h3 { margin: 0; color: var(--heading); }
.project p { color: #a7b7c5; margin: 7px 0; line-height: 1.45; }
.project-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.project-meta span { background: #1c2936; border: 1px solid #2c3c4d; border-radius: 999px; padding: 5px 9px; font-size: .76rem; color: #b8c7d3; }
.project-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; margin-top: 11px; }
.project-actions button,
.project-actions .download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 48px;
  padding: 10px 14px;
  font-size: .86rem;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}
.project-actions button + button { margin-top: 0; }
.inline-actions { margin-top: 10px; font-size: .9rem; color: #8fa2b4; }
.inline-actions a { color: #b9d8ff; text-decoration: none; }
.inline-actions a:hover { color: #ffffff; text-decoration: underline; }
.inline-actions .danger-link { color: #ffaaa3; }
.project-progress { height: 8px; background: #202d3a; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.project-progress div { height: 100%; background: #49b47e; }
.audio-video-progress {
  position: relative;
  height: 24px;
  border: 1px solid #2d4053;
  background: #0b121b;
  margin: 10px 0 8px;
}
.audio-video-progress div {
  background: linear-gradient(90deg, #2d82b8, #55c98f);
  transition: width .35s ease;
}
.audio-video-progress span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #e6f1fa;
  font-size: .72rem;
  font-weight: 850;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
}
.audio-video-progress.is-running div {
  min-width: 18%;
  background: linear-gradient(90deg, #2d82b8, #55c98f, #2d82b8);
  background-size: 220% 100%;
  animation: render-progress 1.2s linear infinite;
}
.youtube-critique-progress {
  position: relative;
  height: 24px;
  border: 1px solid #2d4053;
  border-radius: 999px;
  background: #0b121b;
  overflow: hidden;
  margin: 10px 0 8px;
}
.youtube-critique-progress div {
  height: 100%;
  width: 42%;
  min-width: 18%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2d82b8, #55c98f, #2d82b8);
  background-size: 220% 100%;
  animation: youtube-progress-sweep 1.15s ease-in-out infinite alternate;
}
.youtube-critique-progress.is-timed div {
  position: absolute;
  inset: 0 auto 0 var(--progress-left, 0%);
  height: 100%;
  width: var(--progress-width, 0%);
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2d82b8, #55c98f);
  background-size: auto;
  animation: none;
  transition: left .45s linear, width .45s linear;
}
.youtube-critique-progress span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #e6f1fa;
  font-size: .72rem;
  font-weight: 850;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
}
@keyframes render-progress {
  from { background-position: 0 0; }
  to { background-position: 220% 0; }
}
@keyframes youtube-progress-sweep {
  from { transform: translateX(-55%); }
  to { transform: translateX(145%); }
}

.shorts-card { min-width: 0; }
.shorts-card button + button { margin-top: 9px; }
.shorts-card .project-actions button + button { margin-top: 0; }
.shorts-hybrid-actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 9px; }
.shorts-hybrid-actions button { margin-top: 0 !important; background: #172332; color: #d8e7f5; border-color: #31475f; }
.youtube-critique-main-actions { grid-template-columns: minmax(0, 1fr) max-content; align-items: stretch; }
.youtube-critique-api-option {
  align-items: flex-start;
  margin: 10px 0 2px;
  padding: 10px 12px;
  border: 1px solid #31475f;
  border-radius: 9px;
  background: #121c27;
}
.youtube-critique-api-option input { margin-top: 3px; }
.youtube-critique-api-option span { display: grid; gap: 3px; }
.youtube-critique-api-option strong { color: #d8e7f5; font-size: .86rem; }
.youtube-critique-api-option small { color: var(--muted); font-size: .76rem; line-height: 1.35; }
.youtube-critique-main-actions .primary { width: 100%; }
.youtube-critique-main-actions .youtube-critique-batch-button {
  width: max-content;
  padding: 8px 10px;
  font-size: .76rem;
  line-height: 1.05;
  white-space: nowrap;
}
.shorts-hybrid-actions button.danger { color: #ffb1aa; border-color: #75433f; background: #2b1c1e; }
.shorts-hybrid-actions button.danger:hover { background: #3a2224; border-color: #a85e58; }
.shorts-progress { margin-top: 12px; border: 1px solid var(--line); border-radius: 999px; background: #0b121b; overflow: hidden; position: relative; height: 28px; }
.shorts-progress div { position: absolute; inset: 0 auto 0 0; width: 42%; border-radius: inherit; background: linear-gradient(90deg, #246f9f, var(--green)); animation: shorts-progress 1.1s ease-in-out infinite alternate; }
.shorts-progress span { position: relative; z-index: 1; display: grid; place-items: center; height: 100%; color: #dce8f2; font-size: .75rem; font-weight: 800; }
@keyframes shorts-progress { from { transform: translateX(-45%); } to { transform: translateX(145%); } }
.shorts-queue { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: #0b121b; overflow: hidden; }
.shorts-queue-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--heading); font-size: .82rem; }
.shorts-queue-head span { color: var(--muted); font-size: .76rem; }
.shorts-queue-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.045); }
.shorts-queue-item:last-child { border-bottom: 0; }
.shorts-queue-item strong { display: block; color: #dce8f2; font-size: .83rem; line-height: 1.25; overflow-wrap: anywhere; }
.shorts-queue-item strong a,
.short-episode strong a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(85,201,143,.45); }
.shorts-queue-item strong a:hover,
.short-episode strong a:hover { color: var(--green); border-bottom-color: currentColor; }
.shorts-queue-item small { display: block; max-width: 100%; color: var(--muted); font-size: .72rem; line-height: 1.25; margin-top: 3px; overflow-wrap: anywhere; }
.shorts-queue-item em { justify-self: end; font-style: normal; font-size: .7rem; font-weight: 850; color: var(--muted); }
.queue-dot { width: 10px; height: 10px; border-radius: 50%; background: #607386; box-shadow: 0 0 0 3px rgba(96,115,134,.12); }
.shorts-queue-item.running .queue-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(240,189,98,.18); }
.shorts-queue-item.done .queue-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(85,201,143,.18); }
.shorts-queue-item.error .queue-dot { background: var(--red); box-shadow: 0 0 0 3px rgba(255,129,120,.18); }
.shorts-queue-item.running em { color: var(--amber); }
.shorts-queue-item.done em { color: var(--green); }
.shorts-queue-item.error em { color: var(--red); }
.shorts-result { margin-top: 16px; color: var(--muted); }
.shorts-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 13px;
  background: #101821;
  margin-bottom: 12px;
}
.shorts-summary strong { color: var(--green); font-size: 1.7rem; }
.shorts-summary span { color: var(--muted); font-size: .82rem; }
.shorts-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  max-height: 620px;
  overflow: auto;
  padding-right: 3px;
}
.short-episode {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e161f;
  padding: 12px;
}
.short-episode strong { display: block; color: var(--heading); line-height: 1.3; overflow-wrap: anywhere; }
.short-episode small { display: block; color: var(--muted); margin-top: 4px; }
.short-episode p { color: #a7b7c5; margin: 8px 0 0; line-height: 1.45; font-size: .85rem; }

.queue-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 10px;
}
.queue-tab {
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 13px;
  color: #c8d7e5;
  background: #121c27;
  border-color: #314457;
}
.queue-tab span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-tab strong {
  flex: 0 0 auto;
  min-width: 2.35rem;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  font-size: .78rem;
  text-align: center;
}
.queue-tab-error.active { color: #ffaaa3; border-color: rgba(255,129,120,.58); background: rgba(121,43,39,.32); }
.queue-tab-pending.active { color: #f4ca7d; border-color: rgba(240,189,98,.58); background: rgba(111,78,29,.30); }
.queue-tab-ready.active { color: #7ce0ae; border-color: rgba(85,201,143,.58); background: rgba(38,105,73,.31); }
.queue-profile-filter { max-width: 360px; margin: 8px 0 10px; }
.queue-summary { margin: 0 0 10px; color: var(--muted); font-size: .82rem; }
.queue-status-group-row td {
  position: sticky;
  top: 42px;
  z-index: 2;
  padding: 0;
  border-bottom: 1px solid #3b5064;
  background: #16222e;
}
.queue-status-group-button {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: #16222e;
  text-align: left;
}
.queue-status-group-button:hover { background: #1d2d3b; border-color: transparent; transform: none; }
.queue-status-group-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.queue-status-group-title strong { color: #c5d3df; font-size: .83rem; }
.queue-status-group-icon {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 1px solid #40566b;
  border-radius: 8px;
  color: #d4e4f1;
  font-size: 1.1rem;
  font-weight: 800;
}

.table-wrap { max-height: 560px; overflow-y: auto; overflow-x: hidden; border: 1px solid var(--line); border-radius: 10px; background: #0e151d; }
table { border-collapse: collapse; width: 100%; font-size: .87rem; }
.queue-table { table-layout: fixed; min-width: 0; }
.queue-col-number { width: 5%; }
.queue-col-book { width: 35%; }
.queue-col-priority { width: 22%; }
.queue-col-status { width: 28%; }
.queue-col-progress { width: 10%; }
th { position: sticky; top: 0; z-index: 3; background: #1d2a38; color: #d4e6f5; text-align: left; padding: 10px; border-bottom: 2px solid #3a4d60; }
.sort-head {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-align: inherit;
  font: inherit;
  font-weight: 800;
}
.sort-head:hover,
.sort-head.active {
  background: transparent;
  border-color: transparent;
  color: #8ed0ff;
  transform: none;
}
td { padding: 10px; border-bottom: 1px solid #233242; vertical-align: top; color: #c8d4df; overflow-wrap: anywhere; word-break: break-word; }
.queue-table th, .queue-table td { min-width: 0; }
.queue-table td:nth-child(5), .queue-table th:nth-child(5) { text-align: center; }
tbody tr:nth-child(even) { background: rgba(255,255,255,.012); }
tbody tr:hover { background: rgba(85, 169, 232, .07); }
tbody tr.openable-row { cursor: pointer; }
tbody tr.openable-row:hover { background: rgba(85, 169, 232, .12); }
tbody tr.selected-row { background: rgba(85, 201, 143, .10); outline: 1px solid rgba(85, 201, 143, .35); outline-offset: -1px; }
.record-detail {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e151d;
  padding: 15px;
}
.record-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.record-detail-head h3 { margin: 3px 0 8px; color: var(--heading); }
.record-detail p { color: var(--muted); line-height: 1.45; }
.record-detail ul { color: #c8d4df; line-height: 1.45; padding-left: 20px; }
.record-detail .reader-view { margin-top: 14px; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.error-details { margin-top: 5px; color: var(--red); }
.error-details summary { cursor: pointer; color: #ff9d96; font-size: .76rem; font-weight: 750; }
.error-details small { max-height: 9.6em; overflow: auto; padding-right: 4px; color: var(--red); white-space: pre-wrap; }

.search-form { display: flex; gap: 8px; }
.search-form input { margin: 0; flex: 1; min-width: 0; }
.search-results { max-height: 520px; overflow: auto; margin-top: 13px; }
.result { border-top: 1px solid var(--line); padding: 12px 2px; }
.result h3 { font-size: .95rem; color: #69b5e9; margin: 0 0 5px; }
.result p { font: 13px/1.52 Consolas, monospace; color: #b4c2ce; white-space: pre-wrap; }
.logs-card pre { background: #070b10; color: #c9d5df; border: 1px solid #263545; border-radius: 9px; min-height: 220px; max-height: 430px; overflow: auto; padding: 15px; font: 12px/1.55 Consolas, monospace; white-space: pre-wrap; }
.empty { color: #7f91a3; font-style: italic; }
footer { text-align: center; color: #748698; padding: 3px 20px 28px; font-size: .82rem; }
.download { display: inline-block; text-decoration: none; padding: 8px 10px; font-size: .78rem; }
.error-text { color: var(--red) !important; white-space: pre-wrap; }
.review-text { color: var(--amber) !important; white-space: pre-wrap; }

@media (max-width: 1350px) {
  .layout { grid-template-columns: 1fr; }
  .layout > .card { grid-column: 1; }
  .layout > .shorts-card { grid-column: 1; grid-row: auto; position: static; }
  .metrics { grid-template-columns: repeat(8, minmax(100px, 1fr)); }
}
@media (max-width: 850px) {
  .layout { grid-template-columns: 1fr; }
  .layout > .card { grid-column: 1; }
  .queue-table { font-size: .78rem; }
  .queue-col-number { width: 6%; }
  .queue-col-book { width: 34%; }
  .queue-col-priority { width: 21%; }
  .queue-col-status { width: 29%; }
  .queue-col-progress { width: 9%; }
  .generator-card, .capture-card, .search-card, .logs-card { grid-column: 1; }
  .metrics { grid-template-columns: repeat(8, minmax(100px, 1fr)); }
  .two-cols { grid-template-columns: 1fr; }
  .section-head, .project-head { flex-direction: column; }
  .topbar { align-items: flex-start; gap: 12px; flex-direction: column; }
  .mini-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .layout { width: min(100% - 18px, 1240px); margin-top: 14px; gap: 12px; }
  .queue-tabs { gap: 6px; }
  .queue-tab { padding: 9px 7px; font-size: .76rem; }
  .queue-tab strong { min-width: 1.85rem; padding-inline: 5px; }
  .queue-col-priority, .queue-table th:nth-child(3), .queue-table td:nth-child(3) { display: none; }
  .queue-col-book { width: 46%; }
  .queue-col-status { width: 36%; }
  .queue-col-number { width: 8%; }
  .queue-col-progress { width: 10%; }
  .youtube-col-size, .youtube-table th:nth-child(4), .youtube-table td:nth-child(4) { display: none; }
  .youtube-col-video { width: 48%; }
  .youtube-col-state { width: 32%; }
  .youtube-col-number { width: 8%; }
  .youtube-col-action { width: 12%; }
  .card { padding: 17px; border-radius: 12px; }
  .metrics { grid-template-columns: repeat(8, minmax(100px, 1fr)); }
  .mini-metrics { grid-template-columns: 1fr 1fr; }
  .search-form { flex-direction: column; }
}

/* Autenticação, perfis e uploads — v022 */
select {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1px solid #3a4d62;
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
  background: #0e151e;
  outline: none;
}
select:focus { border-color: #5ba7df; box-shadow: 0 0 0 3px rgba(85, 169, 232, .15); }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.signed-user { margin: 5px 0 0; color: var(--muted); font-size: .84rem; }
.profile-pill { display: inline-flex; align-items: center; margin: 3px 4px 0 0; border: 1px solid #3d5971; background: #172536; color: #9fd1f3; border-radius: 999px; padding: 4px 9px; font-size: .76rem; }
.profile-pill.compact { margin: 0 3px 3px 0; padding: 3px 7px; font-size: .7rem; }
.upload-card, .admin-card { grid-column: 1; }
.upload-list { display: grid; gap: 9px; margin-top: 18px; max-height: 360px; overflow: auto; }
.upload-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #101821; }
.upload-item small { display: block; color: var(--muted); margin-top: 4px; }
.upload-item .error-details { grid-column: 1 / -1; }
.profile-fieldset { background: #0d151e; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-form { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #101821; }
.admin-form h3 { margin-top: 0; color: var(--heading); }
.admin-users { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.admin-user { border: 1px solid var(--line); border-radius: 12px; padding: 15px; background: #0e161f; }
.admin-user-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.admin-user-head small { display: block; color: var(--muted); margin-top: 3px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; }
.login-shell { width: min(460px, calc(100% - 28px)); }
.login-card h1 { margin-top: 4px; color: var(--heading); }
.login-card h1 small { color: var(--muted); font-size: .55em; }
.login-intro { color: var(--muted); line-height: 1.55; }
.login-card code { color: #9fd1f3; }
.forced-password { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: rgba(3, 7, 12, .88); padding: 18px; }
.password-card { width: min(520px, 100%); }
dialog { width: min(520px, calc(100% - 30px)); border: 1px solid #40556b; border-radius: 14px; padding: 0; background: #111a24; color: var(--ink); box-shadow: 0 22px 70px rgba(0,0,0,.65); }
dialog::backdrop { background: rgba(3, 7, 12, .78); }
.dialog-form { padding: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
@media (max-width: 850px) {
  .admin-grid, .admin-users { grid-template-columns: 1fr; }
  .upload-item { grid-template-columns: 1fr; }
  .topbar-actions { justify-content: flex-start; }
}
