:root {
  color-scheme: dark;
  --bg: #101010;
  --panel: #181818;
  --panel-2: #202020;
  --line: #303030;
  --line-strong: #444;
  --text: #f3f5f7;
  --muted: #a4aab3;
  --soft: #d8dde5;
  --red: #f04438;
  --red-deep: #3a1615;
  --cyan: #28d0bd;
  --green: #55d187;
  --amber: #ffd166;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.error { color: #ff827a; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 64px;
  padding: 10px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 16, 16, .94);
  backdrop-filter: blur(14px);
}

.brand-button,
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.top-actions {
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.header-queue {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.header-refresh {
  padding: 8px 11px;
  font-size: 13px;
}

.signout-link { color: var(--muted); font-size: 14px; }

.app-shell {
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c0c0c;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(40, 208, 189, .12);
}

textarea { resize: vertical; }

button {
  border: 1px solid var(--red);
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  padding: 10px 13px;
  font-weight: 750;
  cursor: pointer;
}

button:hover { filter: brightness(1.07); }
button:disabled { opacity: .55; cursor: not-allowed; }

button.secondary {
  border-color: var(--line-strong);
  background: var(--panel-2);
  color: var(--soft);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-color: var(--line);
  background: var(--panel);
  color: var(--soft);
}

.danger,
.ghost-danger {
  border-color: #7d2d27;
  background: var(--red-deep);
  color: #ffb0aa;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-weight: 650;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--soft);
  font-weight: 750;
}

.button-link:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  text-decoration: none;
}

.download-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: .98;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  margin: 20px 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.dashboard-view {
  min-height: calc(100vh - 136px);
}

.panel-status {
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 24px 22px;
  align-items: start;
}

.profile-tile {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 174px;
  padding: 10px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: center;
}

.profile-open-button {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.profile-open-button:hover {
  filter: none;
}

.profile-open-button:hover .avatar-ring,
.profile-tile:hover .avatar-ring {
  border-color: var(--cyan);
  background: #152421;
}

.profile-settings-button {
  position: absolute;
  right: 10px;
  bottom: 36px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-color: var(--line-strong);
  border-radius: 50%;
  background: rgba(12, 12, 12, .88);
  color: var(--soft);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .28);
}

.profile-settings-button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.gear-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.avatar-ring {
  display: grid;
  place-items: center;
  width: clamp(112px, 16vw, 148px);
  aspect-ratio: 1;
  border: 3px solid var(--line-strong);
  border-radius: 50%;
  background: var(--panel);
  transition: background-color .16s ease, border-color .16s ease;
  overflow: hidden;
}

.profile-avatar,
.hero-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-name {
  width: 100%;
  max-width: 170px;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.15;
}

.add-ring {
  border-style: dashed;
  background: #141414;
}

.profile-tile:hover .add-ring {
  border-style: solid;
  border-color: var(--cyan);
  background: #122522;
}

.plus-mark {
  position: relative;
  display: block;
  width: 42%;
  aspect-ratio: 1;
}

.plus-mark::before,
.plus-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--cyan);
  transform: translate(-50%, -50%);
}

.plus-mark::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.profile-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.profile-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.profile-summary-card {
  align-self: start;
}

.profile-command-card {
  margin-bottom: 18px;
}

.profile-command-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.profile-page-title {
  font-size: clamp(28px, 4vw, 44px);
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.profile-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.profile-card-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.portrait-stack {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.hero-avatar {
  width: 104px;
  aspect-ratio: 1;
  border: 3px solid var(--line-strong);
  background: var(--panel-2);
}

.profile-title-block {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.title-input-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.title-input-label input {
  max-width: 100%;
  font-size: 20px;
  font-weight: 850;
}

.queue-command {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: min(100%, 360px);
}

.compact-count {
  display: grid;
  gap: 6px;
  width: 94px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.compact-count input {
  height: 42px;
  font-weight: 850;
  text-align: center;
}

.submit-row,
.dialog-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.save-profile-btn.is-clean {
  border-color: var(--line-strong);
  background: #242424;
  color: var(--muted);
}

.save-profile-btn.is-dirty {
  border-color: #2f8f5a;
  background: #17683f;
  color: #e9fff2;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, .92fr) minmax(360px, 1.08fr);
  align-items: start;
  gap: 18px;
  margin-top: 18px;
}

.jobs-panel {
  width: 100%;
}

.detail-column {
  display: grid;
  align-content: start;
  gap: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.formgrid label,
.source-label,
.profile-dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.formgrid label.check,
.toggle-row .check {
  display: flex;
  align-items: center;
  min-height: 43px;
  gap: 9px;
  padding: 0 2px;
}

.formgrid label.check input,
.toggle-row .check input {
  width: 18px;
  height: 18px;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 12px;
}

.toggle-row .check {
  color: var(--soft);
  font-size: 13px;
}

.source-label {
  margin: 11px 0 14px;
}

/* Generation panel spans the full settings width, so spread the small fields
   across as many columns as fit instead of a fixed two. */
.generation-formgrid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

/* The notes box auto-grows in JS to fit all its text (3 lines or 70), so disable
   the manual resize handle and the inner scrollbar that would otherwise clip it. */
.generation-notes {
  min-height: 96px;
  max-height: none;
  resize: none;
  overflow: hidden;
  line-height: 1.5;
}

.asset-block {
  display: grid;
  gap: 10px;
}

.asset-block + .asset-block {
  margin-top: 18px;
}

.asset-block h3 {
  margin: 0;
}

.uploadrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}

.uploadrow > input {
  flex: 1 1 160px;
}

.uploadrow input[type="file"] {
  flex: 1 1 160px;
}

.add-category-row,
.asset-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 8px 0 10px;
}

.asset-control-row {
  margin: 0;
}

.add-category-row button,
.asset-control-row button {
  min-width: 76px;
}

.asset-control-row .upload-button {
  min-width: 156px;
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 41px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--soft);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.upload-button {
  min-width: 156px;
}

.upload-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.brand-preview-frame {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f0f0f;
}

.brand-preview-frame img {
  display: block;
  width: min(100%, 360px);
  margin: 0 auto;
  border-radius: 8px;
  background: #fff;
}

.brand-upload-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.brand-upload-row .upload-button {
  min-width: 0;
}

.scroll-options {
  display: grid;
  gap: 6px;
  max-height: 174px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101010;
}

.media-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--soft);
  font-size: 13px;
}

.media-option:hover {
  border-color: var(--line-strong);
  background: #171717;
}

.video-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--soft);
  font-size: 13px;
}

.video-option:hover {
  border-color: var(--line-strong);
  background: #171717;
}

.media-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.media-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-option input,
.media-check input {
  width: 17px;
  height: 17px;
}

.media-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-option small,
.video-option small,
.empty-option {
  color: var(--muted);
  font-size: 12px;
}

.row-icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--soft);
  cursor: pointer;
}

.row-icon-button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  filter: none;
}

.row-icon-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.row-icon-spacer {
  width: 34px;
  height: 34px;
}

.trash-button {
  background: var(--panel);
  color: #d7a3a0;
}

.trash-button:hover {
  border-color: #c45a52;
  color: #ff928a;
}

.trash-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.empty-option {
  padding: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table.mini td,
table.jobs td,
table.jobs th {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
}

table.mini td,
table.jobs td {
  font-size: 13px;
}

table.jobs th {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.badge {
  display: inline-block;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--soft);
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.b-queued { background: #2a2821; color: var(--amber); }
.b-run { background: #102f2a; color: var(--cyan); }
.b-done { background: #14301d; color: var(--green); }
.b-error { background: var(--red-deep); color: #ff9b93; }
.b-muted { background: #242424; color: var(--muted); }

.job-list {
  display: grid;
  gap: 10px;
}

.job-scroll {
  max-height: min(680px, calc(100vh - 310px));
  min-height: 260px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-color: var(--line-strong) #101010;
}

.job-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
}

.job-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.job-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.job-title {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.timeline-delete-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151515;
  color: #cda09d;
}

.timeline-delete-button:hover {
  border-color: #c45a52;
  color: #ff928a;
  filter: none;
}

.timeline-delete-button .trash-icon {
  width: 14px;
  height: 14px;
}

.error-pill {
  border: 1px solid #7d2d27;
  cursor: pointer;
}

.error-pill:hover {
  filter: none;
  border-color: #c45a52;
}

.generation-track {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  gap: 3px;
  padding: 2px 0 0;
  overflow: visible;
}

.generation-line {
  height: 2px;
  min-width: 8px;
  border-radius: 999px;
  background: var(--line-strong);
}

.generation-line.is-complete { background: var(--green); }
.generation-line.is-error { background: var(--red); }
.generation-line.is-pending { background: var(--line-strong); }

.generation-step {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--soft);
}

.generation-step:hover {
  filter: none;
  border-color: var(--cyan);
}

.generation-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #151515;
}

.generation-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.generation-icon svg path[d="M8 5v14l11-7z"] {
  fill: currentColor;
  stroke: none;
}

.generation-step.is-complete {
  border-color: #2f8f5a;
  background: #10281a;
  color: var(--green);
}

.generation-step.is-active {
  border-color: #3f6fba;
  background: #121b2a;
  color: #8bb7ff;
}

.generation-step.is-working {
  animation: workingPulse 2.8s ease-in-out infinite;
}

.generation-step.is-pending {
  opacity: .62;
  color: var(--muted);
}

.generation-step.is-error {
  border-color: #8f342e;
  background: var(--red-deep);
  color: #ff9b93;
}

.generation-step.is-muted {
  opacity: .48;
  color: var(--muted);
}

@keyframes workingPulse {
  0%, 100% {
    border-color: var(--line-strong);
    background: var(--panel-2);
    color: var(--muted);
  }
  50% {
    border-color: #3f6fba;
    background: #121b2a;
    color: #8bb7ff;
  }
}

.step-tooltip {
  position: fixed;
  z-index: 9999;
  width: min(250px, calc(100vw - 20px));
  padding: 8px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #080808;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity .12s ease, transform .12s ease;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .42);
}

.step-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.job-actions {
  font-size: 13px;
}

.jobs-loader {
  padding: 12px 4px 2px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.form-message {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.form-message.success { color: var(--green); }
.form-message.error { color: #ff827a; }

.toast-stack {
  position: fixed;
  z-index: 10000;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #101010;
  color: var(--soft);
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .38);
  opacity: 0;
  transform: translateX(calc(100% + 24px));
  transition: transform .34s ease, opacity .34s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  border-color: #2f8f5a;
  background: #102018;
  color: #dfffe9;
}

.toast.error {
  border-color: #8f342e;
  background: #23100f;
  color: #ffd1cd;
}

.job-view {
  display: grid;
  gap: 18px;
}

.job-view-head {
  margin-bottom: 0;
}

.job-detail-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.18fr) minmax(320px, .82fr);
  gap: 18px;
  align-items: start;
}

.video-view-card,
.text-view-card {
  display: grid;
  gap: 14px;
}

.job-video {
  width: 100%;
  max-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050505;
}

.video-placeholder {
  display: grid;
  place-items: center;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0b0b;
  color: var(--muted);
}

.job-description,
.job-error-log {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  color: var(--soft);
  line-height: 1.5;
}

.job-description {
  max-height: 58vh;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101010;
}

.upload-field {
  display: grid;
  gap: 6px;
}

.upload-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-field-head h3 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.upload-value {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  color: var(--soft);
  line-height: 1.5;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101010;
}

.copy-btn {
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 0.8rem;
}

.copy-btn.is-copied {
  color: var(--green);
  border-color: var(--green);
}

.copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.job-meta-card {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.segments-block {
  margin-top: 4px;
}

.segments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.segments-table th,
.segments-table td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}

.segments-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.segments-table td {
  color: var(--soft);
}

.segments-table .seg-index {
  color: var(--muted);
  width: 2rem;
}

.segments-table .seg-file {
  overflow-wrap: anywhere;
}

.segments-table .seg-speed,
.segments-table .seg-seconds {
  text-align: right;
  white-space: nowrap;
}

.segments-table tr:last-child td {
  border-bottom: none;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.meta-group h3 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-label {
  color: var(--muted);
  flex: 0 0 auto;
}

.meta-value {
  color: var(--soft);
  text-align: right;
  overflow-wrap: anywhere;
}

.error-log-block {
  display: grid;
  gap: 8px;
}

.job-error-log {
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #65312d;
  border-radius: 8px;
  background: #120d0d;
  color: #ffd1cd;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.notice-panel {
  display: grid;
  gap: 12px;
  max-width: 540px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.card,
.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
}

.login-card {
  display: grid;
  gap: 13px;
  width: min(360px, 100%);
}

.login-card h1 {
  margin: 0;
  font-size: 24px;
}

.profile-dialog {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
}

.profile-dialog::backdrop {
  background: rgba(0, 0, 0, .72);
}

.profile-dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.confirm-dialog {
  width: min(390px, calc(100vw - 32px));
}

.confirm-message {
  margin: 0;
  color: var(--soft);
  line-height: 1.45;
}

.confirm-entry {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.confirm-entry input {
  border-color: #57302d;
  background: #120d0d;
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

@media (max-width: 920px) {
  .portrait-stack {
    justify-items: start;
  }

  .detail-grid,
  .job-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding-inline: 14px;
  }

  .app-shell {
    width: min(100vw - 20px, 1240px);
    padding-top: 24px;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-status {
    white-space: normal;
  }

  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 10px;
  }

  .profile-tile {
    min-height: 170px;
  }

  .avatar-ring {
    width: min(38vw, 132px);
  }

  .profile-card,
  .panel {
    padding: 15px;
  }

  .profile-card-body,
  .profile-command-body,
  .formgrid {
    grid-template-columns: 1fr;
  }

  .queue-command {
    justify-content: stretch;
  }

  .compact-count {
    width: 100%;
  }

  .queue-command button {
    width: 100%;
  }

  table.jobs th:nth-child(3),
  table.jobs td:nth-child(3) {
    display: none;
  }
}
