:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #e4e9f2;
  --line-strong: #d6dde9;
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --success: #0f766e;
  --success-soft: rgba(15, 118, 110, 0.12);
  --warning: #b45309;
  --warning-soft: rgba(180, 83, 9, 0.12);
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.1);
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

[hidden],
.is-hidden {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", "PingFang SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.06), transparent 22%),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.dashboard-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 18px;
  min-height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(12px);
}

.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100%;
  flex: 1 1 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong,
.sidebar-user strong,
.topbar-user-pill strong {
  display: block;
  font-size: 0.98rem;
}

.brand span,
.sidebar-user span,
.topbar-user-pill span,
.workspace-card small {
  color: var(--muted);
  font-size: 0.82rem;
}

.user-avatar,
.mini-avatar {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #111827, #2563eb);
  color: white;
  font-weight: 700;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.brand-mark img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
}

.workspace-card,
.sidebar-user,
.panel,
.summary-card,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.workspace-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-lg);
}

.workspace-label,
.eyebrow,
.section-label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  align-content: start;
  flex: 1 1 auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  padding: 12px 14px;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--surface);
  border-color: var(--line);
}

.nav-item.is-active {
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.nav-icon {
  display: inline-flex;
  min-width: 26px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
  margin-top: auto;
}

.user-avatar {
  width: 46px;
  height: 46px;
}

.main-shell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  min-width: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar h1,
.panel h2,
.role-detail-content h2,
.role-detail-content h3,
.modal-header h2 {
  margin: 0;
  font-weight: 700;
}

.page-subtitle,
.muted-line,
.hint-text {
  margin: 0;
  color: var(--muted);
}

.topbar-actions,
.toolbar,
.panel-header,
.field-title,
.modal-header,
.form-actions,
.detail-head,
.detail-meta,
.detail-timing,
.role-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.topbar-actions,
.toolbar,
.form-actions,
.detail-timing {
  flex-wrap: wrap;
}

.panel-header-stack {
  align-items: flex-start;
}

.toolbar-row {
  width: 100%;
  justify-content: space-between;
  align-items: flex-end;
}

.topbar-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
}

.topbar-tools {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tool-dot {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.mini-avatar {
  width: 36px;
  height: 36px;
  font-size: 0.76rem;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  cursor: pointer;
}

.btn-compact {
  padding: 7px 11px;
  font-size: 0.82rem;
}

.btn:hover {
  border-color: var(--line-strong);
}

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

.btn-segment:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #4f8cff);
  color: white;
}

.btn-danger {
  border-color: rgba(185, 28, 28, 0.14);
  color: var(--danger);
  background: white;
}

.btn-ghost,
.btn-filter,
.btn-segment {
  background: var(--surface);
}

.btn-filter.is-active,
.btn-segment.is-active {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--accent-soft);
  color: var(--accent);
}

.health-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  font-weight: 600;
  background: var(--surface);
}

.health-pill[data-good="true"] {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(15, 118, 110, 0.16);
}

.health-pill[data-good="false"] {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(185, 28, 28, 0.16);
}

.status-pill[data-status="queued"] {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(180, 83, 9, 0.12);
}

.status-pill[data-status="running"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.16);
}

.status-pill[data-status="completed"] {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(15, 118, 110, 0.16);
}

.status-pill[data-status="failed"] {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(185, 28, 28, 0.14);
}

.status-pill[data-status="used"] {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(15, 118, 110, 0.16);
}

.status-pill[data-status="unused"] {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: rgba(180, 83, 9, 0.12);
}

.status-pill.is-clickable {
  cursor: pointer;
}

.error-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(185, 28, 28, 0.14);
  background: var(--danger-soft);
  color: var(--danger);
}

.view-stack,
.view-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  min-width: 0;
}

.dashboard-quickbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at right top, rgba(37, 99, 235, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.96));
  box-shadow: var(--shadow);
}

.dashboard-quickbar-copy h2 {
  margin: 0;
}

.dashboard-quickbar-copy .page-subtitle {
  margin-top: 4px;
}

.dashboard-pulse {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 10px;
  min-width: 360px;
}

.pulse-chip {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.pulse-chip span {
  color: var(--muted);
  font-size: 0.8rem;
}

.pulse-chip strong {
  font-size: 1.2rem;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel,
.summary-card {
  border-radius: var(--radius-xl);
}

.panel {
  padding: 18px;
}

.summary-card {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.summary-card strong {
  font-size: 1.7rem;
  line-height: 1;
}

.summary-card small,
.summary-card span {
  color: var(--muted);
}

.summary-card.compact {
  padding: 16px;
}

.summary-card.compact strong {
  font-size: 1.35rem;
}

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

.dashboard-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-dual {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
}

.task-stat-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 12px;
}

.video-stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.material-stat-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 16px;
}

.highlight-list {
  display: grid;
  gap: 12px;
}

.highlight-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.highlight-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.highlight-index {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.completed-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.video-waterfall {
  column-count: 5;
  column-gap: 18px;
}

.video-waterfall.is-empty {
  column-count: 1;
}

.video-card {
  break-inside: avoid;
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.video-card-media {
  overflow: hidden;
  border-radius: 16px;
  background: #0f172a;
}

.video-card-media video {
  display: block;
  width: 100%;
  height: auto;
  min-height: 140px;
  background: #0f172a;
}

.video-card-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  background: #edf2f7;
}

.video-card-body {
  display: grid;
  gap: 10px;
}

.video-card-top,
.video-card-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.video-card-title,
.video-card-source,
.video-card-copy {
  margin: 0;
}

.video-card-source,
.video-card-copy {
  color: var(--muted);
}

.video-card-copy {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-height: 1.55;
}

.video-empty-state {
  width: 100%;
  min-height: 112px;
  display: grid;
  place-items: center;
  text-align: center;
  break-inside: avoid;
  column-span: all;
}

.material-grid {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.material-grid.is-empty {
  display: block;
  overflow: visible;
  border: none;
  border-radius: 0;
  background: transparent;
}

.material-list-grid {
  display: grid;
  grid-template-columns: 84px 112px 112px minmax(280px, 2.1fr) minmax(220px, 1.3fr) 170px 260px;
  gap: 14px;
  align-items: center;
}

.material-row {
  min-width: 0;
}

.material-row.is-selected {
  background: rgba(37, 99, 235, 0.05);
}

.material-row.is-disabled {
  opacity: 0.6;
}

.material-cell {
  min-width: 0;
}

.material-select-head,
.material-select-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.material-select-head input,
.material-select-cell input {
  width: 16px;
  height: 16px;
}

.material-select-head span,
.material-select-cell span {
  color: var(--muted);
  font-size: 0.86rem;
}

.material-actions-cell {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.material-actions-cell .btn {
  white-space: nowrap;
  padding: 8px 12px;
}

.material-type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  font-weight: 600;
}

.material-content-compact {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.material-inline-link,
.material-inline-text,
.material-note-text {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
  word-break: break-word;
}

.material-inline-link {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.material-row-id,
.material-note-empty {
  color: var(--muted);
  font-size: 0.82rem;
}

.material-empty-state {
  min-height: 132px;
}

.completed-feed-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.completed-feed-card p,
.completed-feed-card strong {
  margin: 0;
}

.completed-feed-card p {
  color: var(--muted);
}

.completed-feed-top,
.completed-feed-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.table-head,
.table-row {
  display: grid;
  gap: 14px;
  align-items: center;
}

.table-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.table-body {
  display: grid;
}

.table-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

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

.task-grid {
  grid-template-columns: 92px 1.6fr 110px 1.25fr 110px 170px 280px;
}

.recent-grid {
  grid-template-columns: 120px 1.5fr 170px 220px;
}

.recent-row {
  font-size: 0.94rem;
}

.col-source,
.status-hint,
.recent-source {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.task-grid > span {
  min-width: 0;
}

.col-actions,
.recent-actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.col-actions {
  min-width: 0;
}

.col-actions .btn,
.col-actions a.btn {
  padding: 8px 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 4px 0;
}

.pagination-summary {
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.progress-chip {
  display: grid;
  gap: 6px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf5;
}

.progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #73a0ff);
}

.role-page-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.settings-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

.settings-form-grid {
  display: grid;
  gap: 16px;
}

.settings-actions {
  justify-content: space-between;
}

.inline-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.inline-stat {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.inline-stat span {
  color: var(--muted);
  font-size: 0.82rem;
}

.inline-stat strong {
  font-size: 1.1rem;
}

.role-list {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.role-list-panel {
  min-width: 0;
  overflow: hidden;
}

.role-search-box {
  min-width: 0;
  width: 100%;
}

.role-actions-row {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
}

.role-actions-row .btn {
  min-width: 0;
}

.role-list-item {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.role-list-item.is-selected {
  border-color: rgba(37, 99, 235, 0.2);
  background: var(--accent-soft);
}

.role-list-item img,
.role-detail-avatar-frame img,
.media-chip img,
.scene-card img,
.preview-card img {
  width: 100%;
  object-fit: cover;
  background: #edf2f7;
}

.role-list-item img {
  width: 54px;
  height: 54px;
  border-radius: 16px;
}

.role-list-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.role-list-title {
  display: block;
  line-height: 1.35;
  word-break: break-word;
}

.role-list-subtitle {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-word;
}

.role-detail-content {
  display: grid;
  gap: 20px;
}

.role-detail-panel {
  min-width: 0;
  overflow: hidden;
}

.role-detail-head {
  flex-wrap: wrap;
  align-items: flex-start;
}

.role-detail-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 360px;
}

.role-detail-profile > div:last-child {
  min-width: 0;
}

.role-detail-head > .toolbar,
.panel-subsection > .panel-header > .toolbar {
  flex: 0 1 auto;
  justify-content: flex-end;
}

.panel-subsection > .panel-header {
  flex-wrap: wrap;
  align-items: flex-start;
}

.role-detail-avatar-frame {
  width: 84px;
  height: 84px;
  padding: 4px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent-soft), rgba(15, 118, 110, 0.12));
}

.role-detail-avatar-frame img {
  width: 100%;
  height: 100%;
  border-radius: 20px;
}

.panel-subsection {
  display: grid;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.role-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.media-chip,
.scene-card {
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}

.media-chip.is-selected,
.scene-card.is-selected {
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.media-chip {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 96px;
  min-width: 96px;
  padding: 10px 8px;
  border-radius: 18px;
  text-align: center;
}

.media-chip img {
  width: 60px;
  height: 60px;
  border-radius: 999px;
}

.scene-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.scene-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  text-align: left;
}

.scene-card img,
.preview-card img {
  aspect-ratio: 4 / 5;
  border-radius: 14px;
}

.media-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-height: 1.35;
}

.media-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
}

.form-stack,
.field,
.advanced-grid,
.detail-card {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.selector-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.search-box {
  display: grid;
  gap: 6px;
  min-width: 230px;
  color: var(--muted);
  font-size: 0.82rem;
}

.search-box-compact {
  min-width: 0;
  flex: 1 1 180px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 180px;
}

.advanced-panel {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  background: var(--surface-soft);
}

.material-task-banner {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  line-height: 1.6;
}

.advanced-grid {
  margin-top: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented-control {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(12px);
}

.modal-card {
  width: min(1120px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 20px;
  border-radius: 28px;
}

.modal-small {
  width: min(520px, 100%);
}

.modal-medium {
  width: min(840px, 100%);
}

.modal-preview {
  width: min(960px, 100%);
}

.detail-transcript {
  margin: 0;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-error-box {
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(185, 28, 28, 0.14);
  background: var(--danger-soft);
  color: var(--danger);
  white-space: pre-wrap;
  word-break: break-word;
}

.uploader {
  display: grid;
  place-items: center;
  min-height: 120px;
  border-radius: 16px;
  border: 1px dashed var(--line-strong);
  background: white;
  text-align: center;
  cursor: pointer;
  padding: 14px;
}

.uploader input {
  display: none;
}

.preview-card {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
}

.preview-card-avatar {
  min-height: 120px;
}

.preview-card-avatar img {
  width: 110px;
  height: 110px;
  aspect-ratio: 1 / 1;
  border-radius: 24px;
}

.uploader-avatar {
  min-height: 100px;
}

.uploader-avatar small {
  color: var(--muted);
  margin-top: 4px;
}

.preview-video {
  width: 100%;
  max-height: 72vh;
  border-radius: 18px;
  background: black;
}

.empty-state {
  min-height: 110px;
  display: grid;
  place-items: center;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line-strong);
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.compact-empty {
  min-height: 72px;
  border: none;
  border-radius: 0;
  background: transparent;
}

@media (max-width: 1360px) {
  .dashboard-cards,
  .task-stat-grid,
  .material-stat-grid,
  .completed-card-grid,
  .settings-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .material-list-grid {
    grid-template-columns: 84px 112px 112px minmax(220px, 1.6fr) minmax(180px, 1fr) 150px 240px;
  }

  .dashboard-dual {
    grid-template-columns: 1fr;
  }

  .task-grid {
    grid-template-columns: 92px 1.5fr 110px 1.1fr 110px 150px 160px;
  }

  .video-waterfall {
    column-count: 4;
  }
}

@media (max-width: 1160px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    padding: 14px 16px;
    gap: 12px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-top {
    min-height: auto;
    gap: 12px;
  }

  .workspace-card {
    display: none;
  }

  .sidebar-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    width: auto;
    min-width: 108px;
    flex: 0 0 auto;
    padding: 10px 12px;
  }

  .sidebar-user {
    margin-top: 0;
    align-self: flex-start;
  }

  .role-page-grid {
    grid-template-columns: 1fr;
  }

  .video-waterfall {
    column-count: 3;
  }
}

@media (max-width: 920px) {
  .main-shell {
    padding: 16px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    padding: 5px;
  }

  .topbar,
  .panel-header,
  .field-title,
  .form-row,
  .task-grid,
  .recent-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header,
  .field-title,
  .role-detail-head {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .toolbar,
  .hero-actions,
  .video-card-actions,
  .col-actions,
  .recent-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar-user-pill {
    width: 100%;
    justify-content: flex-start;
  }

  .task-grid,
  .recent-grid {
    gap: 8px;
  }

  .table-head {
    display: none;
  }

  .table-row {
    grid-template-columns: 1fr;
  }

  .table-row.task-grid {
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
  }

  .table-head.material-list-grid {
    display: none;
  }

  .table-row.material-list-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
  }

  .material-grid {
    overflow: visible;
    border: none;
    border-radius: 0;
    background: transparent;
  }

  .material-cell {
    display: grid;
    gap: 6px;
  }

  .material-cell::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
  }

  .material-actions-cell {
    flex-wrap: wrap;
  }

  .table-row.task-grid > span {
    display: grid;
    gap: 6px;
  }

  .table-row.task-grid > span::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .table-row.task-grid .col-source,
  .table-row.task-grid .status-hint {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
  }

  .table-row.task-grid .col-status {
    justify-self: start;
  }

  .table-row.task-grid .col-actions {
    justify-content: flex-start;
  }

  .table-body {
    gap: 10px;
    padding: 10px;
  }

  .advanced-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-quickbar,
  .dashboard-dual,
  .completed-card-grid,
  .inline-stats,
  .settings-summary-grid,
  .video-stat-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-quickbar {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-pulse {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .hero-actions .btn,
  .hero-actions a.btn,
  .topbar-actions .btn,
  .video-card-actions .btn,
  .video-card-actions a.btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .settings-actions {
    align-items: stretch;
  }

  .video-waterfall {
    column-count: 2;
  }

  .modal-card {
    padding: 16px;
    border-radius: 22px;
  }
}

@media (max-width: 640px) {
  .sidebar {
    padding: 12px;
  }

  .sidebar-nav {
    gap: 6px;
  }

  .nav-item {
    min-width: 92px;
    padding: 9px 10px;
    gap: 8px;
  }

  .nav-icon {
    min-width: 22px;
    font-size: 0.72rem;
  }

  .main-shell {
    padding: 12px;
    gap: 10px;
  }

  .panel,
  .summary-card,
  .modal-card {
    padding: 14px;
  }

  .video-waterfall {
    column-count: 1;
  }

  .video-card {
    margin-bottom: 14px;
  }

  .video-card-media video {
    min-height: 180px;
  }
}
