body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: Arial, sans-serif;
  background: #0f172a;
  color: #111827;
}

.login-card {
  width: min(420px, 90%);
  padding: 36px;
  background: white;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

.login-card h1 { margin-bottom: 6px; }
.login-card p { margin-top: 0; color: #64748b; }
label {
  display: block;
  margin: 18px 0 7px;
  font-weight: 700;
}

input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
}

button {
  width: 100%;
  margin: 22px 0 16px;
  padding: 13px;
  border: 0;
  border-radius: 9px;
  background: #2563eb;
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.error {
  padding: 10px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 8px;
}
.dashboard-page {
  display: block;
  background: #f1f5f9;
  min-height: 100vh;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 5%;
  background: #0f172a;
  color: white;
}
.topbar h1, .topbar p { margin: 0; }
.dashboard {
  width: min(1200px, 92%);
  margin: 30px auto;
}
.panel {
  background: white;
  padding: 25px;
  margin-bottom: 25px;
  border-radius: 14px;
}
textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  resize: vertical;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}
.logout-button { width: auto; margin: 0; }
.success { padding: 10px; background: #dcfce7; color: #166534; border-radius: 8px; }
@media (max-width: 700px) { .settings-grid { grid-template-columns: 1fr; } }
select {
  width: 100%;
  box-sizing: border-box;
  padding: 13px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: white;
}

.topbar {
  width: min(1200px, 92%);
  margin: 0 auto 30px;
  padding: 20px 30px;
  box-sizing: border-box;
  border-radius: 0 0 14px 14px;
}

.topbar h1 {
  font-size: clamp(22px, 3vw, 32px);
}

.topbar form {
  margin-left: auto;
  flex-shrink: 0;
}

.dashboard {
  margin-top: 0;
}

.voice-pool {
  margin-top: 20px;
}

.voice-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin: 10px 0 18px;
}

.voice-checkboxes label {
  margin: 0;
  font-weight: 500;
}

.voice-checkboxes input {
  width: auto;
  margin-right: 5px;
}

.danger-button {
  width: auto;
  margin: 0;
  padding: 8px 14px;
  background: #dc2626;
  white-space: nowrap;
}

.danger-button:hover {
  background: #b91c1c;
}

.download-button {
  display: inline-block;
  padding: 8px 14px;
  margin-right: 8px;
  border-radius: 7px;
  background: #16a34a;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.download-button:hover {
  background: #15803d;
}

tbody td:last-child {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

tbody td:last-child form,
.download-button,
.danger-button {
  margin: 0;
}

.api-settings-link {
  position: fixed;
  top: 18px;
  right: 110px;
  z-index: 50;
  padding: 9px 16px;
  background: #111827;
  color: white;
  border-radius: 7px;
  text-decoration: none;
}

.settings-card {
  max-width: 650px;
  margin: 60px auto;
  padding: 35px;
  background: white;
  border-radius: 14px;
}

.api-settings-link {
  position: static !important;
  margin-left: auto;
  margin-right: 10px;
}

.api-settings-link {
  position: static !important;
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  margin: 0 10px 0 0 !important;
  background: #25324a;
  color: #fff;
  border-radius: 7px;
  text-decoration: none;
  font-weight: 600;
}

.api-settings-link {
  position: static !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  margin: 0 10px 0 0 !important;
  background: #25324a;
  color: #fff !important;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.api-settings-link {
  position: static !important;
  display: inline-flex !important;
  visibility: visible !important;
  align-items: center;
  justify-content: center;
  margin-left: auto !important;
  margin-right: 10px !important;
  padding: 11px 16px;
  background: #25324a !important;
  color: #fff !important;
  border-radius: 8px;
  text-decoration: none !important;
  font-weight: 600;
  white-space: nowrap;
}

.controls-six-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 14px;
  margin-top: 18px;
}

.controls-six-grid > div {
  width: 100%;
  margin: 0;
}

.controls-six-grid select,
.controls-six-grid input {
  width: 100%;
}

@media (max-width: 767px) {
  .controls-six-grid {
    grid-template-columns: 1fr;
  }
}
.controls-six-grid{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:18px 14px;
  margin:20px 0;
}
.controls-six-grid>div,.controls-six-grid select,
.controls-six-grid input{width:100%}
@media(max-width:767px){
  .controls-six-grid{grid-template-columns:1fr}
}
.settings-grid{
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:18px 14px!important;
  margin:20px 0!important;
}
.settings-grid>div,.settings-grid select{width:100%}
.voice-pool{margin:8px 0 18px!important}
@media(max-width:767px){
  .settings-grid{grid-template-columns:1fr!important}
}

.job-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  min-width:260px;
}
.job-actions form{
  display:inline-flex;
  margin:0!important;
}
.job-actions .download-button,
.job-actions .danger-button{
  margin:0!important;
  white-space:nowrap;
}

.job-actions form{
  margin-top:8px!important;
}


/* Voice preview controls */
.voice-select-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.voice-select-row select {
  flex: 1;
  min-width: 0;
}

.voice-preview-button {
  width: auto;
  min-width: 96px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: #334155;
  color: #ffffff;
  font-size: 13px;
  white-space: nowrap;
}

.voice-preview-button:hover {
  background: #1e293b;
}

.voice-preview-button.is-playing {
  background: #dc2626;
}

.voice-checkboxes {
  align-items: stretch;
}

.voice-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
}

.voice-option label {
  display: inline-flex;
  align-items: center;
  min-width: 80px;
}

.voice-option .voice-preview-button {
  min-width: 88px;
  padding: 7px 10px;
}

@media (max-width: 700px) {
  .voice-select-row {
    flex-direction: column;
  }

  .voice-select-row .voice-preview-button {
    width: 100%;
  }

  .voice-option {
    width: 100%;
    justify-content: space-between;
  }
}


/* Whisper caption controls */
.caption-settings {
  width: 100%;
  box-sizing: border-box;
  margin: 20px 0;
  padding: 18px;
  overflow: hidden;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #f8fafc;
}

.caption-settings-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.caption-settings-heading h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: #0f172a;
}

.caption-settings-heading p {
  max-width: 680px;
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

.caption-controls-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}

.caption-controls-grid > div {
  min-width: 0;
}

.caption-controls-grid label {
  display: block;
  margin-bottom: 7px;
}

.caption-controls-grid select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 1050px) {
  .caption-controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .caption-settings {
    padding: 14px;
  }

  .caption-controls-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .caption-settings-heading {
    display: block;
  }
}

/* Enhanced video queue */
.queue-job-row td {
  vertical-align: middle;
}

.job-status {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  background: #e2e8f0;
  color: #334155;
}

.job-status-waiting {
  background: #f1f5f9;
  color: #475569;
}

.job-status-script_generation,
.job-status-generating_script,
.job-status-narration,
.job-status-generating_audio,
.job-status-media,
.job-status-generating_media,
.job-status-captions,
.job-status-generating_captions,
.job-status-rendering,
.job-status-rendering_video,
.job-status-uploading,
.job-status-processing {
  background: #dbeafe;
  color: #1d4ed8;
}

.job-status-completed {
  background: #dcfce7;
  color: #15803d;
}

.job-status-failed,
.job-status-cancelled {
  background: #fee2e2;
  color: #b91c1c;
}

.job-progress {
  min-width: 190px;
}

.job-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 7px;
}

.job-progress-header span {
  font-weight: 700;
  color: #0f172a;
}

.job-progress-header small {
  color: #64748b;
  font-size: 12px;
  text-align: right;
}

.job-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.job-progress-fill {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: #2563eb;
  transition: width 0.4s ease;
}

.retry-button,
.cancel-button {
  width: auto;
  margin: 0;
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.retry-button {
  background: #2563eb;
}

.retry-button:hover {
  background: #1d4ed8;
}

.cancel-button {
  background: #d97706;
}

.cancel-button:hover {
  background: #b45309;
}

.job-error-details {
  margin-top: 8px;
  max-width: 520px;
}

.job-error-details summary {
  color: #b91c1c;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.job-error-details pre {
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  border-radius: 7px;
  background: #fff1f2;
  color: #881337;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  .job-progress {
    min-width: 150px;
  }

  .job-progress-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .job-progress-header small {
    text-align: left;
  }
}

/* Browser notification controls */
.notification-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.notification-button {
  width: auto;
  margin: 0;
  padding: 9px 14px;
  border: 0;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.notification-button:hover {
  background: #1d4ed8;
}

.notification-sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 11px;
  border-radius: 7px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.notification-sound-toggle input {
  width: auto;
  margin: 0;
}

.notification-status {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 800px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .notification-controls {
    order: 3;
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }
}

/* Notification header alignment fix */
.topbar .notification-controls {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-end;
  gap: 10px;
  width: auto !important;
  margin-left: auto;
}

.topbar .notification-sound-toggle {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  width: auto !important;
  margin: 0 !important;
}

.topbar .notification-sound-toggle input {
  width: auto !important;
  margin: 0 !important;
}

.topbar .notification-button {
  width: auto !important;
  margin: 0 !important;
}

@media (max-width: 800px) {
  .topbar .notification-controls {
    width: 100% !important;
    justify-content: flex-start;
    margin-left: 0;
  }
}

/* Dashboard popup notifications */
.dashboard-toast-container {
  position: fixed;
  top: 92px;
  right: 22px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 30px));
  pointer-events: none;
}

.dashboard-toast {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 15px 42px 15px 16px;
  border: 1px solid #dbeafe;
  border-left: 4px solid #2563eb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.18);
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}

.dashboard-toast strong {
  color: #0f172a;
  font-size: 14px;
}

.dashboard-toast span {
  color: #475569;
  font-size: 13px;
  line-height: 1.45;
}

.dashboard-toast-completed {
  border-left-color: #16a34a;
}

.dashboard-toast-failed {
  border-left-color: #dc2626;
}

.dashboard-toast-close {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.dashboard-toast-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.dashboard-toast-hiding {
  opacity: 0;
  transform: translateX(30px);
}

@media (max-width: 600px) {
  .dashboard-toast-container {
    top: 15px;
    right: 15px;
    left: 15px;
    width: auto;
  }
}

/* Final dashboard popup position */
.dashboard-toast-container {
  position: fixed !important;
  top: auto !important;
  right: auto !important;
  bottom: 24px !important;
  left: 24px !important;
  z-index: 999999 !important;
  width: min(370px, calc(100vw - 48px)) !important;
}

.dashboard-toast {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
  border-left: 5px solid #2563eb !important;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35) !important;
}

.dashboard-toast-completed {
  border-left-color: #22c55e !important;
}

.dashboard-toast-failed {
  border-left-color: #ef4444 !important;
}

.dashboard-toast strong {
  color: #ffffff !important;
}

.dashboard-toast span {
  color: #cbd5e1 !important;
}

.dashboard-toast-close {
  color: #cbd5e1 !important;
}

@media (max-width: 600px) {
  .dashboard-toast-container {
    right: 15px !important;
    bottom: 15px !important;
    left: 15px !important;
    width: auto !important;
  }
}

/* =========================================================
   Modern Responsive Dashboard Enhancements
========================================================= */

.dashboard-page {
  --dash-bg: #f4f7fb;
  --dash-surface: #ffffff;
  --dash-surface-soft: #f8fafc;
  --dash-border: #e2e8f0;
  --dash-text: #0f172a;
  --dash-muted: #64748b;
  --dash-primary: #6d5dfc;
  --dash-primary-dark: #5145cd;
  --dash-success: #16a34a;
  --dash-danger: #dc2626;
  --dash-warning: #d97706;
  --dash-radius: 20px;
  --dash-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);

  background:
    radial-gradient(circle at 10% 0%, rgba(109, 93, 252, 0.09), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(14, 165, 233, 0.08), transparent 28%),
    var(--dash-bg);
  color: var(--dash-text);
  min-height: 100vh;
}

.dashboard-page .topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.05);
}

.dashboard-page .topbar h1 {
  color: var(--dash-text);
  letter-spacing: -0.04em;
}

.dashboard-page .topbar p {
  color: var(--dash-muted);
}

.dashboard-page .dashboard {
  width: min(1480px, calc(100% - 40px));
  margin-inline: auto;
  padding-top: 32px;
  padding-bottom: 50px;
}

.dashboard-page .panel,
.dashboard-page .system-overview {
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--dash-radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--dash-shadow);
}

.dashboard-page .panel {
  padding: clamp(20px, 3vw, 34px);
}

.dashboard-page .panel h2 {
  margin-top: 0;
  color: var(--dash-text);
  letter-spacing: -0.03em;
}

.dashboard-page .panel > p {
  color: var(--dash-muted);
}

.system-overview {
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
  padding: clamp(22px, 3vw, 34px);
}

.system-overview::before {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  top: -210px;
  right: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(109, 93, 252, 0.18), transparent 70%);
  pointer-events: none;
}

.overview-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.overview-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--dash-primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.overview-header h2 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  letter-spacing: -0.04em;
}

.overview-header p {
  margin: 0;
  color: var(--dash-muted);
}

.live-monitor-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #15803d;
  font-size: 0.82rem;
  font-weight: 750;
}

.live-monitor-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
  animation: dashboard-live-pulse 1.8s infinite;
}

@keyframes dashboard-live-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.82); opacity: 0.65; }
}

.system-metrics-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.system-metric-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--dash-border);
  border-radius: 17px;
  background:
    linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

.system-metric-card:hover {
  transform: translateY(-3px);
  border-color: rgba(109, 93, 252, 0.35);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.metric-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.metric-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: rgba(109, 93, 252, 0.11);
  color: var(--dash-primary);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.metric-label {
  color: var(--dash-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.system-metric-card > strong {
  display: block;
  margin-bottom: 5px;
  font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.system-metric-card p,
.system-metric-card small {
  display: block;
  margin: 0;
  overflow: hidden;
  color: var(--dash-muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-track {
  width: 100%;
  height: 8px;
  margin: 16px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.metric-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--dash-primary), #22c55e);
  transition: width 0.65s ease;
}

.connection-status-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 16px;
  margin-top: 16px;
}

.connection-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid var(--dash-border);
  border-radius: 16px;
  background: var(--dash-surface-soft);
}

.connection-card > div:first-child {
  min-width: 0;
}

.connection-title {
  display: block;
  margin-bottom: 4px;
  font-weight: 800;
}

.connection-card small {
  display: block;
  overflow: hidden;
  color: var(--dash-muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.connection-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.connection-badge.is-online {
  background: #dcfce7;
  color: #166534;
}

.connection-badge.is-online::before {
  background: #22c55e;
}

.connection-badge.is-offline {
  background: #fee2e2;
  color: #991b1b;
}

.connection-badge.is-offline::before {
  background: #ef4444;
}

.api-connection-card {
  align-items: flex-start;
}

.api-provider-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.api-provider {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 750;
}

.api-provider.is-ready {
  background: #dcfce7;
  color: #166534;
}

.api-provider.is-missing {
  background: #f1f5f9;
  color: #94a3b8;
}

.video-creation-panel {
  position: relative;
  overflow: hidden;
}

.dashboard-page textarea,
.dashboard-page input,
.dashboard-page select {
  border: 1px solid #d8e0eb;
  border-radius: 12px;
  background: #ffffff;
  color: var(--dash-text);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.dashboard-page textarea:focus,
.dashboard-page input:focus,
.dashboard-page select:focus {
  outline: none;
  border-color: var(--dash-primary);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.12);
}

.dashboard-page button,
.dashboard-page .download-button,
.dashboard-page .api-settings-link {
  border-radius: 11px;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.dashboard-page button:hover,
.dashboard-page .download-button:hover,
.dashboard-page .api-settings-link:hover {
  transform: translateY(-1px);
}

.dashboard-page form > button[type="submit"]:not(.logout-button):not(.cancel-button):not(.danger-button):not(.retry-button) {
  min-height: 46px;
  border: 0;
  background: linear-gradient(135deg, var(--dash-primary), var(--dash-primary-dark));
  box-shadow: 0 11px 24px rgba(109, 93, 252, 0.24);
}

.dashboard-page table {
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--dash-border);
  border-radius: 15px;
  background: #ffffff;
}

.dashboard-page thead th {
  background: #f8fafc;
  color: #475569;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dashboard-page tbody tr {
  transition: background 0.18s ease;
}

.dashboard-page tbody tr:hover {
  background: #fafbff;
}

.dashboard-page .job-progress-track {
  background: #e9eef5;
}

.dashboard-page .job-progress-fill {
  background: linear-gradient(90deg, var(--dash-primary), #22c55e);
}

.dashboard-page .caption-settings {
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(109, 93, 252, 0.06), rgba(14, 165, 233, 0.04));
}

@media (max-width: 1180px) {
  .system-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .api-connection-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 800px) {
  .dashboard-page .dashboard {
    width: min(100% - 24px, 1480px);
    padding-top: 20px;
  }

  .overview-header {
    flex-direction: column;
    align-items: stretch;
  }

  .live-monitor-badge {
    align-self: flex-start;
  }

  .connection-status-grid {
    grid-template-columns: 1fr;
  }

  .api-connection-card {
    grid-column: auto;
    flex-direction: column;
  }

  .api-provider-list {
    justify-content: flex-start;
  }

  .dashboard-page .panel {
    padding: 20px;
  }

  .dashboard-page #video-queue-panel {
    overflow-x: auto;
  }

  .dashboard-page table {
    min-width: 760px;
  }
}

@media (max-width: 560px) {
  .dashboard-page .dashboard {
    width: min(100% - 16px, 1480px);
  }

  .system-overview {
    padding: 18px;
    border-radius: 17px;
  }

  .system-metrics-grid {
    grid-template-columns: 1fr;
  }

  .system-metric-card {
    padding: 17px;
  }

  .connection-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .connection-badge {
    align-self: flex-start;
  }

  .dashboard-page .panel {
    padding: 17px;
    border-radius: 17px;
  }

  .dashboard-page textarea {
    min-height: 180px;
  }

  .dashboard-page .voice-preview-button,
  .dashboard-page .notification-button,
  .dashboard-page .logout-button {
    min-height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-page *,
  .dashboard-page *::before,
  .dashboard-page *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
