/* ==========================================================
   TRANSCRIBE — Professional Dashboard UI
   ========================================================== */

/* ── Tokens ── */
:root {
  /* Surfaces */
  --bg:           #f1f5f9;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;

  /* Sidebar */
  --sidebar-w:    240px;
  --sidebar-bg:   #0f172a;
  --sidebar-border: rgba(255,255,255,.06);
  --sidebar-text: #94a3b8;
  --sidebar-hover:#1e293b;
  --sidebar-active:#334155;
  --sidebar-accent:#6366f1;

  /* Text */
  --text:         #0f172a;
  --text-2:       #334155;
  --muted:        #64748b;

  /* Border / shadow */
  --border:       #e2e8f0;
  --shadow-xs:    0 1px 2px rgb(0 0 0/.06);
  --shadow-sm:    0 1px 3px rgb(0 0 0/.08), 0 1px 2px -1px rgb(0 0 0/.06);
  --shadow:       0 4px 6px -1px rgb(0 0 0/.08), 0 2px 4px -2px rgb(0 0 0/.05);
  --shadow-lg:    0 10px 15px -3px rgb(0 0 0/.08), 0 4px 6px -4px rgb(0 0 0/.05);

  /* Brand / accent */
  --primary:      #6366f1;
  --primary-d:    #4f46e5;
  --primary-lt:   #eef2ff;
  --primary-ring: rgb(99 102 241/.25);

  /* Semantic */
  --green:        #10b981;
  --green-lt:     #d1fae5;
  --green-txt:    #065f46;
  --amber:        #f59e0b;
  --amber-lt:     #fef3c7;
  --amber-txt:    #78350f;
  --red:          #ef4444;
  --red-lt:       #fee2e2;
  --red-txt:      #991b1b;
  --blue:         #3b82f6;
  --blue-lt:      #dbeafe;
  --blue-txt:     #1e40af;

  /* Radius / transition */
  --r:     10px;
  --r-sm:  6px;
  --r-lg:  14px;
  --ease:  200ms cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ============================================================
   PUBLIC LAYOUT  (login / register / landing)
   ============================================================ */

.pub-nav {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.pub-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}

.pub-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 2px 8px var(--primary-ring);
}

.pub-nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pub-nav-links a {
  padding: 7px 14px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-weight: 500;
  transition: color var(--ease), background var(--ease);
  font-size: 14px;
}
.pub-nav-links a:hover { color: var(--text); background: var(--surface-2); }
.pub-nav-links a.btn, .pub-nav-links a.btn:hover { color: #fff; }

.pub-main {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.pub-footer {
  text-align: center;
  padding: 28px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 80px;
  background: var(--surface);
}

/* ============================================================
   APP LAYOUT  (authenticated dashboard)
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* — Sidebar — */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--primary-ring);
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  margin-top: 1px;
}

/* Credit pill in sidebar */
.sidebar-credit {
  margin: 14px 16px 4px;
  padding: 10px 14px;
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: var(--r);
}

.sidebar-credit-label {
  font-size: 11px;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
}

.sidebar-credit-value {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-top: 2px;
}

.sidebar-credit-sub {
  font-size: 11px;
  color: #818cf8;
  margin-top: 2px;
}

/* Nav section */
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sidebar-text);
  padding: 16px 20px 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0 10px;
  gap: 2px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 14px;
  transition: background var(--ease), color var(--ease);
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: #fff;
}

.sidebar-nav a .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: .8;
}

/* Profile section at bottom of sidebar */
.sidebar-profile {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-profile-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--ease);
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  color: inherit;
  font-family: inherit;
}

.sidebar-profile-trigger:hover { background: var(--sidebar-hover); }

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-profile-info { flex: 1; min-width: 0; }
.sidebar-profile-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-profile-email {
  font-size: 11px;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Profile dropdown */
.sidebar-profile-menu {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  border-top: 1px solid var(--sidebar-border);
  margin-top: 4px;
}

.sidebar-profile-menu.open { display: flex; }

.sidebar-profile-menu a,
.sidebar-profile-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  transition: background var(--ease), color var(--ease);
}

.sidebar-profile-menu a:hover,
.sidebar-profile-menu button:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.sidebar-profile-menu .danger:hover {
  background: rgba(239,68,68,.15);
  color: #fca5a5;
}

/* — App body — */
.app-body {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-topbar {
  height: 58px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.app-topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-main {
  flex: 1;
  padding: 28px 32px;
  max-width: 1200px;
  width: 100%;
}

/* ============================================================
   LANDING PAGE
   ============================================================ */

.hero {
  padding: 88px 0 60px;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 60px;
  align-items: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--primary-lt);
  border: 1px solid #c7d2fe;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.hero-eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

h1 {
  font-size: clamp(36px, 5.5vw, 62px);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -.04em;
  color: var(--text);
  margin-bottom: 20px;
}

.hero-lead {
  font-size: 18px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Hero demo card */
.hero-demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.hero-demo-bar {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-demo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.hero-demo-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.hero-demo-body {
  padding: 20px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-2);
}

.hero-demo-body .ts { color: var(--primary); font-weight: 700; }
.hero-demo-body .label {
  display: inline-block;
  background: var(--primary-lt);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 10px;
}

/* Feature grid */
.features {
  padding: 48px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--ease), transform var(--ease);
}

.feature-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--primary-lt);
  display: grid;
  place-items: center;
  font-size: 20px;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

/* ============================================================
   COMMON COMPONENTS
   ============================================================ */

/* — Page header inside app — */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
}

.page-header p {
  color: var(--muted);
  margin-top: 4px;
  font-size: 14px;
}

/* — Stat cards — */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.stat-value {
  font-size: 30px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.04em;
  line-height: 1.15;
  margin: 6px 0 2px;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted);
}

/* — Cards — */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-xs);
}

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

.card-header h2, .card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.card-header p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

/* — Two-col grid — */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

/* — Buttons — */
.btn, .button, .button-small, .button-secondary, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font: 600 14px/1 inherit;
  cursor: pointer;
  border: 0;
  white-space: nowrap;
  transition: background var(--ease), box-shadow var(--ease), transform var(--ease);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px var(--primary-ring);
}

.btn:hover, .button:hover, .button-small:hover, .button-secondary:hover, button:hover:not(:disabled) {
  background: var(--primary-d);
  box-shadow: 0 4px 14px var(--primary-ring);
  transform: translateY(-1px);
}

.btn:active, .button:active, .button-small:active, .button-secondary:active, button:active:not(:disabled) {
  transform: translateY(0);
}

.btn-sm, .button-small { padding: 6px 13px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; font-weight: 700; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-xs) !important;
  transform: none !important;
}

.btn-danger {
  background: var(--red);
  box-shadow: 0 1px 3px rgb(239 68 68/.25);
}
.btn-danger:hover {
  background: #dc2626 !important;
  box-shadow: 0 4px 14px rgb(239 68 68/.3) !important;
}

button:disabled { opacity: .4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* — Backwards-compat aliases — */
.button-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.button-secondary:hover { background: var(--surface-2) !important; box-shadow: var(--shadow-sm) !important; transform: translateY(-1px) !important; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* — Forms — */
.form-group {
  display: grid;
  gap: 6px;
}

label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: grid;
  gap: 6px;
}

input:not([type=checkbox]):not([type=radio]),
textarea,
select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: 14px/1.5 inherit;
  transition: border-color var(--ease), box-shadow var(--ease);
  outline: none;
  -webkit-appearance: none;
}

input:focus:not([type=checkbox]):not([type=radio]),
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

input::placeholder, textarea::placeholder { color: #c1c9d6; }
textarea { min-height: 160px; resize: vertical; line-height: 1.6; }
form { display: grid; gap: 14px; }

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

/* Dashboard upload and transcription UI */
@keyframes bar-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .65; }
}

.bar-pulsing { animation: bar-pulse 1.4s ease-in-out infinite; }

.dashboard-grid { align-items: start; }

.transcribe-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .85);
}

.transcribe-progress-card {
  width: min(420px, 100%);
  padding: 32px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .32);
}

.transcribe-progress-icon {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 12px;
}

.transcribe-progress-title {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.transcribe-progress-label {
  min-height: 20px;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.transcribe-wait-banner {
  display: none;
  margin: 12px 0 0;
  padding: 8px 12px;
  color: var(--amber-txt);
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
}

.transcribe-progress-track {
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  background: #f1f5f9;
  border-radius: 999px;
}

.transcribe-progress-bar {
  width: 4%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  border-radius: 999px;
  transition: width .5s ease;
}

.transcribe-progress-percent {
  margin-top: 10px;
  color: #94a3b8;
  font-size: 12px;
}

.source-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.source-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 13px;
  font-weight: 800;
}

.source-tab:hover {
  color: var(--text);
  background: #eef2ff;
  box-shadow: none;
  transform: none;
}

.source-tab.is-active {
  color: #fff;
  background: var(--primary);
  box-shadow: none;
}

.source-tab-youtube.is-active { background: #dc2626; }

.upload-info,
.source-note {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
}

.upload-info {
  background: var(--primary-lt);
  border: 1px solid #c7d2fe;
}

.upload-info-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.upload-info-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.upload-info-duration {
  color: var(--primary);
  font-weight: 800;
}

.upload-info-cost {
  margin-top: 6px;
  color: var(--muted);
}

.source-note-youtube {
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.field-help {
  margin-top: -8px;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
}

.empty-state-icon {
  margin-bottom: 10px;
  font-size: 36px;
}

.job-file-cell {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-danger-btn {
  padding: 5px 10px;
  color: var(--red);
  background: transparent;
  border: 1px solid #fca5a5;
  box-shadow: none;
  font-size: 12px;
}

.icon-danger-btn:hover {
  color: #fff !important;
  background: var(--red) !important;
  box-shadow: none !important;
}

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .7);
}

.modal-card {
  width: min(380px, 100%);
  padding: 28px 32px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.modal-icon {
  margin-bottom: 10px;
  font-size: 32px;
}

.modal-card h3 {
  margin-bottom: 6px;
  color: var(--text);
}

.modal-card p {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 13px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-delete {
  color: #fff;
  background: var(--red);
}

.btn-delete:hover {
  background: #dc2626 !important;
}

/* — Flash messages — */
.flash {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
}
.flash-success { background: var(--green-lt); border-color: #a7f3d0; color: var(--green-txt); }
.flash-error   { background: var(--red-lt);   border-color: #fecaca; color: var(--red-txt); }

/* — Table — */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  background: var(--surface-2);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--ease); }
.table tbody tr:hover td { background: #f8fafc; }

/* — Badges — */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  text-transform: capitalize;
  letter-spacing: .02em;
}
.badge-success { background: var(--green-lt); border-color: #a7f3d0; color: var(--green-txt); }
.badge-error   { background: var(--red-lt);   border-color: #fecaca; color: var(--red-txt); }
.badge-blue    { background: var(--blue-lt);  border-color: #bfdbfe; color: var(--blue-txt); }
.badge-amber   { background: var(--amber-lt); border-color: #fde68a; color: var(--amber-txt); }

/* ============================================================
   AUTH PAGES
   ============================================================ */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f4ff 0%, #f8fafc 50%, #fff 100%);
  padding: 40px 20px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.auth-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 2px 8px var(--primary-ring);
}

.auth-logo-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.auth-box h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  margin-bottom: 4px;
}

.auth-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
}

.auth-footer-link {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 20px;
}

.auth-footer-link a {
  color: var(--primary);
  font-weight: 600;
}

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
}

.admin-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.admin-brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.admin-brand-text small {
  font-size: 11px;
  color: var(--sidebar-text);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  gap: 2px;
  flex: 1;
}

.admin-nav a {
  display: flex;
  flex-direction: column;
  padding: 9px 13px;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--ease), color var(--ease);
  gap: 1px;
}

.admin-nav a small {
  font-size: 11px;
  opacity: .7;
}

.admin-nav a:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.admin-nav a.active { background: var(--sidebar-active); color: #fff; }
.admin-nav a.active small { opacity: .8; }

.admin-sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-sidebar-footer a {
  display: block;
  padding: 8px 13px;
  border-radius: var(--r-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--ease), color var(--ease);
}

.admin-sidebar-footer a:hover { background: var(--sidebar-hover); color: #e2e8f0; }

.admin-workspace {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  padding: 24px 32px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.admin-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--primary);
  margin-bottom: 4px;
}

.admin-topbar h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  margin: 0 0 2px;
}

.admin-topbar p {
  font-size: 13px;
  color: var(--muted);
}

.admin-account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  flex-shrink: 0;
}

.admin-content {
  padding: 28px 32px;
  flex: 1;
}

/* Admin grids */
.admin-grid { display: grid; gap: 18px; margin-bottom: 22px; }
.admin-grid-4 { grid-template-columns: repeat(4, 1fr); }
.admin-grid-2 { grid-template-columns: repeat(2, 1fr); }

.admin-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
}

.admin-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 8px;
}

.admin-stat-value {
  display: block;
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.04em;
  line-height: 1.15;
  margin-bottom: 4px;
}

.admin-stat-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 20px;
}

.admin-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-card-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.admin-card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.admin-card-header p {
  font-size: 13px;
  color: var(--muted);
}

.admin-table-wrap {
  overflow-x: auto;
  margin: -24px;
  margin-top: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  background: var(--surface-2);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--surface-2); }
.admin-empty { text-align: center; color: var(--muted); padding: 32px !important; }

.admin-package-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.admin-package-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-form-grid .full { grid-column: 1 / -1; }

.admin-checkline {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
}

.admin-checkline input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* ============================================================
   MISC
   ============================================================ */

.muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Hamburger button — hidden on desktop */
.sidebar-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  box-shadow: none;
  flex-shrink: 0;
}
.sidebar-hamburger:hover { background: var(--surface-2) !important; box-shadow: none !important; transform: none !important; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 49;
}

/* ── Tablet: 4-col stats → 2-col ── */
@media (max-width: 1100px) {
  .admin-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Tablet/small: side-by-side grids → single col ── */
@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .admin-grid-2    { grid-template-columns: 1fr; }
  .features        { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .admin-form-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding: 48px 0 32px; }
  .pub-nav  { padding: 0 20px; }
  .pub-main { width: calc(100% - 32px); }
}

/* ── Mobile: off-canvas sidebar ── */
@media (max-width: 768px) {
  /* Show hamburger */
  .sidebar-hamburger { display: inline-flex; }

  /* Sidebar: fixed off-screen left, slides in when .open */
  .sidebar,
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    /* keep width from desktop */
  }
  .sidebar.open,
  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }

  /* Overlay visible when sidebar open */
  .sidebar-overlay.visible { display: block; }

  /* Content fills full width */
  .app-body    { margin-left: 0; }
  .admin-workspace { margin-left: 0; }

  /* Topbar: show hamburger */
  .app-topbar  { padding: 0 16px; gap: 12px; }
  .admin-topbar { padding: 16px 16px 14px; flex-wrap: wrap; gap: 10px; }
  .admin-account { width: 100%; justify-content: flex-end; }

  .app-main    { padding: 16px; }
  .admin-content { padding: 16px; }

  /* Stack all grids */
  .features, .grid-2, .grid-3,
  .admin-grid-2, .admin-grid-4, .admin-form-grid { grid-template-columns: 1fr; }

  /* Tables: allow horizontal scroll */
  .admin-table-wrap, .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .transcribe-progress-card { padding: 24px 20px; }
  .source-tabs { flex-direction: column; }
  .source-tab { width: 100%; }
  .row-actions { flex-wrap: wrap; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn,
  .modal-actions button { width: 100%; }

  /* Auth box padding */
  .auth-box { padding: 24px 20px; }

  /* User-detail two-col quick-action area */
  [style*="grid-template-columns:1fr auto"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns: 1fr auto"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}
