*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --text: #0a2540;
  --text-2: #425466;
  --text-dim: #8898aa;
  --border: #e6ebf1;
  --border-strong: #cfd7df;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-soft: #eef2ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --admin: #ea580c;
  --radius: 8px;
  --side-w: 240px;
  --top-h: 64px;
  --shadow-sm: 0 2px 4px rgba(50, 50, 93, .05), 0 1px 2px rgba(0, 0, 0, .03);
  --shadow: 0 4px 6px -1px rgba(50, 50, 93, .07), 0 2px 4px -1px rgba(0, 0, 0, .04);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .72), rgba(255, 255, 255, 0) 220px),
    var(--bg);
  font-size: 14px;
  line-height: 1.65;
}

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

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

a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(79, 70, 229, .34);
  outline-offset: 2px;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--top-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-shadow: 0 1px 3px rgba(50, 50, 93, .04);
}

.topbar-logo,
.topbar-right,
.login-brand {
  display: flex;
  align-items: center;
}

.topbar-logo {
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.logo-mark,
.login-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 8px 18px rgba(79, 70, 229, .22);
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.version-tag {
  color: var(--text-dim);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
}

.topbar-right {
  gap: 14px;
}

.topbar-user {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

.sidebar {
  position: fixed;
  z-index: 90;
  left: 0;
  top: var(--top-h);
  bottom: 0;
  width: var(--side-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 24px rgba(50, 50, 93, .035);
  overflow: hidden;
}

.sidebar-inner {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 14px;
  scrollbar-width: thin;
}

.sb-group {
  margin-bottom: 22px;
}

.sb-group-title {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  color: var(--text);
  font-weight: 700;
}

.sb-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.sb-group.active .sb-group-title {
  color: var(--accent);
}

.sb-group-admin .sb-group-title {
  color: var(--admin);
}

.sb-group-admin .sb-icon {
  color: var(--admin);
  background: #fff7ed;
}

.sb-item {
  position: relative;
  display: block;
  margin: 2px 0;
  padding: 9px 14px 9px 41px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s, color .12s;
}

.sb-item:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.sb-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.sb-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  transform: translateY(-50%);
  background: var(--grad);
}

.sb-group-admin .sb-item.active {
  background: #fff7ed;
  color: #c2410c;
}

.sb-group-admin .sb-item.active::before {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

.sb-divider {
  height: 1px;
  margin: 18px 14px;
  background: var(--border);
}

.page-container {
  margin-left: var(--side-w);
  margin-top: var(--top-h);
  padding: 36px 44px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 22px;
}

.page-head h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 0;
}

.page-head p {
  margin: 7px 0 0;
  color: var(--text-dim);
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 36px;
}

.content-stack {
  display: grid;
  gap: 22px;
}

.panel {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad);
  opacity: .82;
}

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

.panel-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.panel-desc {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: #d8def0;
  box-shadow: var(--shadow);
}

.metric-label {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}

.metric-value {
  margin-top: 8px;
  color: var(--text);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.metric-foot {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 12px;
}

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

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px 12px;
}

.status-row strong {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px;
  gap: 12px;
  margin-bottom: 18px;
}

.voice-filter {
  grid-template-columns: minmax(240px, 1fr) 150px 150px 150px;
}

.form-panel {
  max-width: 820px;
}

.audio-form-panel {
  max-width: 1080px;
}

.audio-create-card {
  padding: 28px;
}

.audio-create-card textarea {
  min-height: 240px;
}

.audio-settings-grid {
  display: grid;
  grid-template-columns: minmax(220px, .9fr) minmax(300px, 1.3fr) minmax(190px, .7fr);
  gap: 16px;
  align-items: start;
}

.audio-submit-row {
  max-width: 320px;
  margin-top: 4px;
}

.audio-remark-field input,
.audio-settings-grid select,
.audio-settings-grid .stepper input,
.voice-preview-btn {
  min-height: 42px;
}

.form-hint {
  margin-top: 7px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.7;
}

.rewrite-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 4px 0 20px;
}

.level-card {
  display: grid;
  gap: 5px;
  min-height: 112px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s, background .15s;
}

.level-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.level-card.selected {
  border-color: rgba(79, 70, 229, .45);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .08), var(--shadow-sm);
}

.level-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.lv-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.lv-desc {
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.65;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

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

.form-row-three {
  grid-template-columns: minmax(180px, 1fr) 130px 180px;
}

.audio-control-row {
  grid-template-columns: minmax(320px, 1fr) minmax(220px, 320px);
}

.voice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.voice-preview-btn {
  min-width: 64px;
  min-height: 40px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.admin-form-grid-compact {
  grid-template-columns: minmax(260px, 1fr) 140px 160px;
  align-items: end;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .1), var(--shadow-sm);
}

textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.75;
}

.table-input,
table select,
table textarea {
  min-width: 0;
  box-shadow: none;
}

.compact-textarea {
  min-height: 88px;
  font-size: 12.5px;
  line-height: 1.6;
}

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

.check-line input {
  width: auto;
  box-shadow: none;
}

.check-line-compact {
  min-height: auto;
}

.char-counter {
  margin-top: 7px;
  color: var(--text-dim);
  font-size: 12.5px;
  text-align: right;
}

.char-counter.warning {
  color: var(--warning);
}

.char-counter.error {
  color: var(--danger);
}

.stepper {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
}

.stepper input {
  text-align: center;
}

.stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  box-shadow: var(--shadow-sm);
}

.stepper-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.stack-mini {
  display: grid;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, background .15s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  background: var(--surface-soft);
}

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

.btn-primary {
  color: #fff;
  border-color: transparent;
  background: var(--grad);
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, .25), 0 2px 4px -1px rgba(124, 58, 237, .1);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4338ca, #6d28d9);
}

.btn-secondary {
  color: var(--text-2);
}

.btn-danger {
  color: #991b1b;
  border-color: #fecaca;
  background: #fff;
}

.btn-sm {
  min-height: 30px;
  padding: 5px 12px;
  font-size: 12.5px;
  box-shadow: none;
}

.btn-block {
  width: 100%;
  min-height: 44px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  table-layout: fixed;
}

th {
  background: var(--bg);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

tbody tr:nth-child(even) td {
  background: #fafbfc;
}

tbody tr:hover td {
  background: var(--accent-soft);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.col-preview {
  max-width: 380px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 120px minmax(140px, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 4px 0 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.result-panel {
  overflow: visible;
}

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

.task-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.task-meta-grid > div {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px;
}

.task-meta-grid span {
  display: block;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}

.task-meta-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
}

.view-tabs {
  display: inline-flex;
  gap: 4px;
  margin: 18px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 4px;
}

.tab-btn {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 14px;
  box-shadow: none;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.dialog-lines {
  display: grid;
  gap: 10px;
}

.dialog-line {
  max-width: 880px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
}

.dialog-line.speaker-a {
  margin-right: auto;
  border-left: 3px solid #0ea5e9;
}

.dialog-line.speaker-b {
  margin-left: auto;
  border-left: 3px solid #10b981;
}

.dialog-meta {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 800;
}

.dialog-text {
  margin-top: 5px;
  color: var(--text);
  line-height: 1.8;
  white-space: pre-wrap;
}

.line-edit-grid {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(150px, 190px);
  gap: 8px;
  margin-top: 10px;
}

.dialog-line textarea,
.task-table textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
}

.line-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.line-invalid {
  border-color: #ef4444 !important;
  background: #fff7f7 !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 800;
}

.badge-draft,
.badge-not_published {
  color: #475569;
  background: #f1f5f9;
}

.badge-processing,
.badge-pending,
.badge-queued {
  color: #92400e;
  background: #fef3c7;
}

.badge-reviewing,
.badge-published,
.badge-available,
.badge-ok,
.badge-active,
.badge-https {
  color: #065f46;
  background: #d1fae5;
}

.badge-failed,
.badge-deleted,
.badge-voided,
.badge-error,
.badge-inactive {
  color: #991b1b;
  background: #fee2e2;
}

.badge-synced,
.badge-enabled,
.badge-admin {
  color: #3730a3;
  background: #e0e7ff;
}

.badge-warning,
.badge-unknown,
.badge-http {
  color: #92400e;
  background: #fef3c7;
}

.notice {
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  background: #fffbeb;
  color: #92400e;
  padding: 12px 14px;
  font-size: 13px;
}

.notice-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.notice-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.audio-create-grid {
  grid-template-columns: minmax(420px, 1.08fr) minmax(360px, .92fr);
}

.audio-result {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 14px;
}

.audio-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-2);
}

.audio-result audio,
.audio-inline-slot audio {
  width: 100%;
  max-width: 520px;
}

.audio-inline-slot {
  margin-top: 8px;
}

.audio-filter {
  grid-template-columns: minmax(320px, 1fr) 180px;
}

.audio-success-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  border: 1px solid #c7d2fe;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  padding: 16px;
}

.success-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--success);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.success-body {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.success-body span {
  color: var(--text-2);
  font-size: 13px;
}

.audio-table-wrap table {
  min-width: 1040px;
}

.audio-table-wrap .task-table th:first-child,
.audio-table-wrap .task-table td:first-child {
  width: 44px;
  padding-left: 12px;
  padding-right: 8px;
}

.audio-table-wrap .task-table th:nth-child(2),
.audio-table-wrap .task-table td:nth-child(2) {
  width: 170px;
}

.audio-table-wrap .task-table th:nth-child(3),
.audio-table-wrap .task-table td:nth-child(3) {
  width: 230px;
}

.audio-table-wrap .task-table th:nth-child(4),
.audio-table-wrap .task-table td:nth-child(4) {
  width: 210px;
}

.audio-table-wrap .task-table th:nth-child(5),
.audio-table-wrap .task-table td:nth-child(5) {
  width: 78px;
}

.audio-table-wrap .task-table th:nth-child(6),
.audio-table-wrap .task-table td:nth-child(6) {
  width: 98px;
}

.audio-table-wrap .task-table th:nth-child(7),
.audio-table-wrap .task-table td:nth-child(7),
.audio-table-wrap .task-table th:nth-child(8),
.audio-table-wrap .task-table td:nth-child(8) {
  width: 150px;
}

.audio-table-wrap .task-table th:nth-child(9),
.audio-table-wrap .task-table td:nth-child(9) {
  width: 230px;
}

.audio-table-wrap .row-actions {
  gap: 6px;
}

.audio-table-wrap .row-actions .btn-sm {
  padding-left: 9px;
  padding-right: 9px;
}

.notice ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.empty-state {
  padding: 28px;
  color: var(--text-dim);
  text-align: center;
}

.detail-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 16px;
  white-space: pre-wrap;
  line-height: 1.8;
}

.script-lines {
  display: grid;
  gap: 8px;
}

.script-line {
  display: grid;
  grid-template-columns: 52px 88px 96px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
}

.line-no,
.line-speaker,
.line-scene {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  max-width: min(420px, calc(100vw - 48px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(50, 50, 93, .18);
  color: var(--text);
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s, transform .18s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(246, 249, 252, .94)),
    repeating-linear-gradient(90deg, rgba(230, 235, 241, .42) 0, rgba(230, 235, 241, .42) 1px, transparent 1px, transparent 96px);
}

.login-box {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 25px 50px -12px rgba(50, 50, 93, .2), 0 10px 20px -8px rgba(0, 0, 0, .08);
  padding: 30px;
}

.login-brand {
  gap: 14px;
  margin-bottom: 24px;
}

.login-mark {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  font-size: 22px;
  font-weight: 900;
}

.login-brand h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.login-brand p {
  margin: 2px 0 0;
  color: var(--text-dim);
}

.captcha-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) 82px;
  gap: 8px;
  align-items: center;
}

.captcha-question {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 18px;
  color: var(--text-2);
  font-size: 13px;
}

.login-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.login-options input {
  width: auto;
  box-shadow: none;
}

.error-msg {
  min-height: 24px;
  color: #b91c1c;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  :root {
    --side-w: 210px;
  }

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

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

@media (max-width: 760px) {
  .topbar {
    padding: 0 16px;
  }

  .topbar-logo span:nth-child(2) {
    display: none;
  }

  .topbar-user {
    display: none;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--top-h);
    bottom: auto;
    display: block;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(50, 50, 93, .05);
  }

  .sidebar-inner {
    display: flex;
    gap: 8px;
    height: auto;
    max-height: calc(100vh - var(--top-h));
    overflow-y: auto;
    overflow-x: auto;
    padding: 9px 12px;
  }

  .sb-group {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 4px;
    margin: 0;
  }

  .sb-group-title,
  .sb-divider {
    display: none;
  }

  .sb-item {
    display: inline-flex;
    align-items: center;
    margin: 0;
    min-height: 34px;
    padding: 7px 12px;
    white-space: nowrap;
  }

  .sb-item.active::before {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 3px;
    width: auto;
    height: 2px;
    border-radius: 999px;
    transform: none;
  }

  .page-container {
    margin-left: 0;
    margin-top: calc(var(--top-h) + 54px);
    padding: 22px 16px;
  }

  .page-head,
  .panel-head {
    display: block;
  }

  .page-actions,
  .panel-head .row-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

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

  .form-row,
  .form-row-three,
  .audio-settings-grid,
  .captcha-row,
  .filter-bar,
  .voice-filter,
  .audio-filter,
  .rewrite-options,
  .task-meta-grid,
  .inline-form,
  .script-line {
    grid-template-columns: 1fr;
  }

  .result-head {
    display: block;
  }

  .result-head .row-actions {
    margin-top: 12px;
  }

  .task-table-wrap {
    overflow: visible;
    border: 0;
    box-shadow: none;
  }

  .task-table {
    display: block;
    min-width: 0;
    background: transparent;
  }

  .task-table thead {
    display: none;
  }

  .task-table tbody,
  .task-table tr,
  .task-table td {
    display: block;
    width: 100%;
  }

  .task-table tr {
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }

  .task-table td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 11px 12px;
    border-bottom: 1px solid #f1f5f9;
  }

  .task-table td::before {
    content: attr(data-label);
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 800;
  }

  .task-table .col-preview {
    max-width: none;
    white-space: normal;
  }

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