/* =========================================================================
   IVR Console - design tokens
   Subject: outbound telephony dialer ops console. Palette and structure
   are drawn from call-center wallboards and PBX signal panels: graphite
   equipment housing, a dial-tone teal for the interactive accent, and
   real status colors (green/amber/red) that encode actual call states
   rather than decorate them. Data is set in a monospace face - phone
   numbers, timestamps, and counts read as telemetry, not prose.
   ========================================================================= */
:root {
  color-scheme: dark;

  --bg: #14171a;
  --bg-elevated: #1a1e22;
  --panel: #1d2226;
  --panel-border: #2b3136;
  --panel-border-soft: #23282c;
  --text: #e6e9eb;
  --text-dim: #8d969d;
  --text-faint: #5f676d;

  --accent: #3fb8c9;
  --accent-dim: #256470;
  --accent-text: #0f1416;

  --ok: #4caf6d;
  --ok-dim: #24382b;
  --warn: #e8a93b;
  --warn-dim: #3a3020;
  --danger: #de5f58;
  --danger-dim: #3a2420;

  --font-display: 'IBM Plex Sans Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;

  --radius: 3px;
  --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
::selection { background: var(--accent-dim); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Native chrome (scrollbars, form popups, autofill) defaults to light
   unless told otherwise - color-scheme above handles most of it, this
   covers the two things that still need an explicit push. */
* { scrollbar-color: var(--panel-border) var(--bg); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-elevated) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- login ---- */

.login-body { min-height: 100vh; background: var(--bg); }

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
}

.login-visual {
  position: relative;
  background: linear-gradient(160deg, #171b1e 0%, #13181b 60%, #101416 100%);
  border-right: 1px solid var(--panel-border);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.login-visual-glow {
  position: absolute;
  inset: -20% -20% auto auto;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(63, 184, 201, 0.16), transparent 65%);
  pointer-events: none;
}

.login-visual-inner { position: relative; max-width: 380px; }

.signal-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 64px;
  margin-bottom: 28px;
}
.signal-bars span {
  display: block;
  width: 6px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.85;
  animation: signal 1.6s ease-in-out infinite;
}
.signal-bars span:nth-child(1) { height: 30%; animation-delay: 0.0s; }
.signal-bars span:nth-child(2) { height: 55%; animation-delay: 0.08s; }
.signal-bars span:nth-child(3) { height: 80%; animation-delay: 0.16s; }
.signal-bars span:nth-child(4) { height: 45%; animation-delay: 0.24s; }
.signal-bars span:nth-child(5) { height: 100%; animation-delay: 0.32s; background: #7fd6e2; }
.signal-bars span:nth-child(6) { height: 65%; animation-delay: 0.4s; }
.signal-bars span:nth-child(7) { height: 90%; animation-delay: 0.48s; }
.signal-bars span:nth-child(8) { height: 40%; animation-delay: 0.56s; }
.signal-bars span:nth-child(9) { height: 70%; animation-delay: 0.64s; }
.signal-bars span:nth-child(10) { height: 25%; animation-delay: 0.72s; }
@keyframes signal { 0%, 100% { transform: scaleY(0.55); opacity: 0.55; } 50% { transform: scaleY(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .signal-bars span { animation: none; transform: none; opacity: 0.85; } }

.visual-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin: 0 0 10px;
}
.visual-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  color: var(--text);
}
.visual-tagline { font-size: 15px; color: var(--text-dim); line-height: 1.4; margin: 0; }

.login-visual-foot { position: relative; border-top: 1px solid var(--panel-border-soft); padding-top: 16px; }
.visual-clock-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; color: var(--text-faint); text-transform: uppercase; margin: 0 0 4px; }
.visual-clock { font-family: var(--font-mono); font-size: 22px; font-weight: 500; color: var(--accent); margin: 0; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }

.login-panel { display: grid; place-items: center; padding: 24px; }

.login-card { width: 100%; max-width: 340px; }

.login-eyebrow-mobile { display: none; }

.login-card .login-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  margin: 0 0 6px;
  text-transform: uppercase;
}
.login-card .login-title { font-family: var(--font-display); font-weight: 700; font-size: 24px; margin: 0 0 6px; color: var(--text); }
.login-sub { color: var(--text-dim); margin: 0 0 22px; font-size: 13px; }

.login-error {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid rgba(222, 95, 88, 0.35);
  padding: 8px 10px;
  border-radius: var(--radius);
  margin: 0 0 16px;
}
.login-error[data-has-error="false"] { display: none; }

.login-foot { margin: 18px 0 0; font-size: 11px; color: var(--text-faint); text-align: center; }

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-eyebrow-mobile { display: block; }
}

/* ---- form controls ---- */

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
}
textarea { font-family: var(--font-mono); resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--panel-border);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 9px 14px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent-dim); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn-primary:hover { background: #4cc6d7; }
.btn-danger { color: var(--danger); border-color: rgba(222, 95, 88, 0.4); }
.btn-danger:hover { background: var(--danger-dim); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- app shell ---- */

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

.sidebar {
  width: 216px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--panel-border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}

.brand { padding: 2px 6px 20px; position: relative; }
.brand-mark { display: flex; align-items: flex-end; gap: 3px; height: 18px; margin-bottom: 10px; }
.brand-mark span { display: block; width: 4px; border-radius: 1px; background: var(--accent-dim); }
.brand-mark span:nth-child(1) { height: 45%; }
.brand-mark span:nth-child(2) { height: 100%; background: var(--accent); }
.brand-mark span:nth-child(3) { height: 70%; }
.brand-eyebrow { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em; color: var(--text-faint); text-transform: uppercase; margin: 0 0 4px; }
.brand-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; margin: 0; }

.nav { list-style: none; margin: 0; padding: 0; flex: 1; }
.nav-item { margin-bottom: 2px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
}
.nav-link:hover { background: var(--panel); color: var(--text); }
.nav-link.active { background: var(--panel); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-badge { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

.sidebar-foot { border-top: 1px solid var(--panel-border-soft); padding-top: 14px; margin-top: 8px; }
.session-user { font-size: 12px; color: var(--text-dim); margin: 0 0 8px; padding: 0 6px; }
.session-user b { color: var(--text); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--panel-border);
  background: var(--bg-elevated);
}
.topbar-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin: 0; flex: 1; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  text-transform: uppercase;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.status-pill[data-state="on"] .status-dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-dim); animation: pulse 2s ease-in-out infinite; }
.status-pill[data-state="paused"] .status-dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-dim); }
.status-pill[data-state="off"] .status-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-dim); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.content { flex: 1; padding: 22px 24px 40px; overflow-y: auto; }
.view { display: none; }
.view.active { display: block; animation: view-in 0.22s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.grid { display: grid; gap: 14px; }
.grid-cards { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  transition: border-color 0.15s ease;
}
.card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--panel-border);
}
.card:has(.card-value.ok)::before { background: var(--ok); }
.card:has(.card-value.warn)::before { background: var(--warn); }
.card:has(.card-value.danger)::before { background: var(--danger); }
.card-title { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 8px; }
.card-value { font-family: var(--font-mono); font-size: 28px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.card-value.ok { color: var(--ok); }
.card-value.warn { color: var(--warn); }
.card-value.danger { color: var(--danger); }
.card-sub { font-size: 12px; color: var(--text-dim); margin: 4px 0 0; }

.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin: 0; flex: 1; }

/* ---- trunk occupancy (signature element) ---- */

.trunk-list { display: flex; flex-direction: column; gap: 10px; }
.trunk-row { display: flex; align-items: center; gap: 12px; }
.trunk-name { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); width: 110px; flex-shrink: 0; }
.trunk-bar { flex: 1; display: flex; gap: 3px; height: 16px; }
.trunk-seg { flex: 1; border-radius: 2px; background: var(--bg-elevated); border: 1px solid var(--panel-border-soft); }
.trunk-seg.occupied { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 8px rgba(63, 184, 201, 0.5); }
.trunk-count { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); width: 52px; text-align: right; flex-shrink: 0; }

/* ---- tables ---- */

.table-wrap { background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; font-size: 12.5px; border-bottom: 1px solid var(--panel-border-soft); }
th { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; background: var(--bg-elevated); }
td { font-family: var(--font-mono); color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.015); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-pending { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--panel-border); }
.badge-dialing { background: var(--warn-dim); color: var(--warn); }
.badge-completed { background: var(--ok-dim); color: var(--ok); }
.badge-blacklisted, .badge-failed, .badge-rejected { background: var(--danger-dim); color: var(--danger); }
.badge-busy, .badge-no_answer, .badge-no_input, .badge-invalid_input, .badge-caller_hangup, .badge-congestion { background: var(--warn-dim); color: var(--warn); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; }
.spacer { flex: 1; }

.pagination { display: flex; gap: 8px; align-items: center; margin-top: 10px; justify-content: flex-end; }
.pagination span { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }

.empty-state { padding: 32px 16px; text-align: center; color: var(--text-faint); font-size: 13px; }

.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 180px; margin-bottom: 0; }

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  max-width: 360px;
  box-shadow: var(--shadow-panel);
  z-index: 100;
}
.toast.error { border-left-color: var(--danger); }

.hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }

.recording-cell { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.recording-cell audio { width: 220px; height: 32px; }
.recording-actions { display: flex; gap: 6px; }

/* Bounded tables for long operational lists (audio directory scans, etc.) */
.table-scroll {
  max-height: 360px;
  overflow: auto;
}
.table-scroll-audio {
  max-height: 320px;
}
.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}


/* ---- responsive dashboard shell ---- */

.sidebar-backdrop,
.mobile-nav-toggle {
  display: none;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  min-width: 720px;
}

#view-overview .table-wrap table {
  min-width: 420px;
}

.recording-cell audio {
  max-width: 100%;
}

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

  .topbar-title {
    flex: 1 1 220px;
  }

  .status-pill {
    padding: 5px 8px;
  }

  .grid-cards {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

@media (max-width: 900px) {
  body.sidebar-open {
    overflow: hidden;
  }

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

  .mobile-nav-toggle {
    display: inline-flex;
    min-height: 38px;
    flex-shrink: 0;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    width: min(84vw, 304px);
    max-width: 304px;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 18px 0 42px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.54);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    min-height: 100vh;
    width: 100%;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    padding: 10px 12px;
    align-items: center;
  }

  .topbar-title {
    font-size: 16px;
    min-width: 120px;
  }

  .status-pill {
    font-size: 10px;
    gap: 6px;
    min-height: 32px;
  }

  #btn-pause-resume {
    min-height: 34px;
  }

  .content {
    padding: 14px 12px 28px;
    overflow: visible;
  }

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

  .card {
    padding: 13px;
  }

  .card-value {
    font-size: 23px;
  }

  .section {
    margin-top: 20px;
  }

  .section-head {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .section-head .section-title {
    flex: 1 1 100%;
  }

  .section-head input,
  .section-head select,
  .section-head .btn,
  .section-head .hint {
    width: 100%;
    max-width: none !important;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .toolbar input,
  .toolbar select,
  .toolbar .btn {
    width: 100%;
    min-width: 0;
  }

  .toolbar .spacer {
    display: none;
  }

  .form-row {
    display: block;
  }

  .form-row .field,
  .form-row .field[style] {
    display: block;
    width: 100%;
    max-width: none !important;
    min-width: 0;
    margin-bottom: 12px;
  }

  .view .grid[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="file"],
  select,
  textarea,
  .btn {
    min-height: 40px;
    font-size: 13px;
  }

  textarea {
    min-height: 96px;
  }

  .table-wrap {
    border-radius: var(--radius);
    max-width: 100%;
  }

  th,
  td {
    padding: 9px 10px;
    white-space: nowrap;
  }

  td:nth-child(6),
  td:nth-child(9) {
    white-space: normal;
    min-width: 170px;
  }

  .table-scroll,
  .table-scroll-audio {
    max-height: 280px;
  }

  .recording-cell {
    min-width: 180px;
  }

  .recording-cell audio {
    width: 180px;
  }

  .pagination {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .pagination .btn {
    flex: 1 1 96px;
  }

  .pagination span {
    order: -1;
    flex: 1 1 100%;
    text-align: center;
  }

  .trunk-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .trunk-name {
    width: auto;
    flex: 1 1 auto;
  }

  .trunk-bar {
    order: 3;
    flex-basis: 100%;
  }

  .trunk-count {
    width: auto;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 13px;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .topbar-title {
    align-self: center;
  }

  .status-pill,
  #btn-pause-resume {
    grid-column: span 1;
    justify-content: center;
  }

  #btn-pause-resume {
    grid-column: 1 / -1;
  }

  .grid-cards {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .card-title {
    font-size: 10px;
  }

  .card-value {
    font-size: 21px;
  }

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

  .section-head .btn,
  .toolbar .btn,
  .btn-block {
    width: 100%;
  }

  .table-wrap table {
    min-width: 680px;
  }

  #view-overview .table-wrap table {
    min-width: 360px;
  }

  .brand {
    padding-bottom: 16px;
  }
}

@media (max-width: 380px) {
  .grid-cards {
    grid-template-columns: 1fr;
  }

  .content {
    padding-left: 10px;
    padding-right: 10px;
  }
}

.muted-section { opacity: 0.55; }
.muted-section select, .muted-section input { cursor: not-allowed; }

/* ---- campaign audio file preview / download ---- */
.audio-preview-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 420px) auto;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 12px;
}
.audio-preview-bar[hidden] { display: none; }
.audio-preview-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.audio-preview-label { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.audio-preview-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audio-preview-bar audio { width: 100%; height: 34px; }
.audio-file-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.required-mark { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--warn-dim); color: var(--warn); font-family: var(--font-mono); font-size: 9px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.audio-only-highlight { background: linear-gradient(180deg, rgba(232, 169, 59, 0.12), rgba(232, 169, 59, 0.04)); border: 1px solid rgba(232, 169, 59, 0.45); border-radius: var(--radius); padding: 10px; }
.audio-only-highlight .field-label { color: var(--warn); font-weight: 600; }
.audio-only-highlight input { border-color: rgba(232, 169, 59, 0.55); }

@media (max-width: 760px) {
  .audio-preview-bar { grid-template-columns: 1fr; }
  .audio-preview-bar .btn { width: 100%; }
  .audio-file-actions .btn { flex: 1 1 92px; }
}

/* ---- prompt upload + public API security ---- */
.prompt-upload-card {
  margin-bottom: 20px;
  border-left: 3px solid var(--accent);
}
.prompt-upload-policy {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--panel-border-soft);
  background: var(--bg-elevated);
  border-radius: var(--radius);
}
.prompt-upload-form .field { margin-bottom: 0; }
.prompt-upload-result {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--panel-border);
  background: var(--bg-elevated);
  border-radius: var(--radius);
}
.prompt-upload-warning {
  color: var(--warn);
  background: var(--warn-dim);
  border: 1px solid rgba(232, 169, 59, 0.35);
  padding: 8px 10px;
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.prompt-upload-ok {
  color: var(--ok);
  background: var(--ok-dim);
  border: 1px solid rgba(76, 175, 109, 0.35);
  padding: 8px 10px;
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.prompt-upload-detected {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.prompt-upload-commit-row { align-items: center; }
.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 240px;
}
.checkbox-field input[type="checkbox"] { width: auto; }

@media (max-width: 780px) {
  .prompt-upload-policy { grid-template-columns: 1fr; }
  .prompt-upload-commit-row { flex-direction: column; align-items: stretch; }
  .checkbox-field { min-width: 0; }
}

/* ---- v25 audio library + campaign form clarity ---- */
.audio-library-head { align-items: center; flex-wrap: wrap; }
.policy-highlight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--panel-border-soft);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 14px;
}
.policy-card {
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.policy-card-ok { border-left: 3px solid var(--ok); }
.policy-card-danger { border-left: 3px solid var(--danger); }
.policy-card-info { border-left: 3px solid var(--accent); }
.policy-value {
  margin: 6px 0 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}
.policy-value.small { color: var(--text-dim); }
.audio-library-row td { vertical-align: middle; }
.audio-file-main { display: flex; flex-direction: column; gap: 3px; min-width: 170px; }
.row-audio-player { width: 260px; height: 34px; display: block; }
.audio-missing-row { opacity: 0.7; }
.btn.disabled, .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.campaign-form-card { padding: 0; overflow: hidden; }
.campaign-form-block {
  padding: 18px;
  border-bottom: 1px solid var(--panel-border-soft);
}
.campaign-form-block:last-of-type { border-bottom: none; }
.campaign-form-block-head { margin-bottom: 12px; }
.campaign-form-block-head h4 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text);
}
.campaign-form-grid { align-items: flex-start; }
.required-mark,
.optional-mark {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.required-mark { color: var(--warn); background: var(--warn-dim); }
.optional-mark { color: var(--text-dim); background: var(--bg-elevated); border: 1px solid var(--panel-border-soft); }
.help-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  border-radius: 50%;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.help-icon:hover { background: var(--accent-dim); color: var(--text); }
.field-help-pop {
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}
.campaign-form-errors {
  margin: 16px 18px 0;
  padding: 12px 14px;
  border: 1px solid rgba(222,95,88,0.45);
  border-left: 3px solid var(--danger);
  background: var(--danger-dim);
  color: var(--danger);
  border-radius: var(--radius);
}
.campaign-form-errors ul { margin: 6px 0 0 18px; padding: 0; }
.audio-only-highlight {
  padding: 10px;
  background: rgba(63,184,201,0.08);
  border: 1px solid rgba(63,184,201,0.35);
  border-radius: var(--radius);
}

@media (max-width: 980px) {
  .policy-highlight-grid { grid-template-columns: 1fr; }
  .row-audio-player { width: 220px; }
}

@media (max-width: 640px) {
  .row-audio-player { width: 190px; }
  .campaign-form-block { padding: 14px; }
}

/* ---- v26 collapsible prompt upload + delete file action ---- */
.prompt-upload-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.prompt-upload-card-head .section-title { margin-bottom: 4px; }
.prompt-upload-card-head .hint { margin: 0; max-width: 760px; }
.prompt-upload-collapse {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--panel-border-soft);
}
.prompt-upload-collapse[hidden] { display: none; }
.prompt-upload-card.is-collapsed .prompt-upload-policy { margin-bottom: 0; }
.policy-highlight-grid .policy-card {
  border-width: 1px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset;
}
.policy-highlight-grid .policy-card-ok { border-color: rgba(76, 175, 109, 0.45); background: linear-gradient(180deg, rgba(76,175,109,0.11), rgba(76,175,109,0.035)); }
.policy-highlight-grid .policy-card-danger { border-color: rgba(222, 95, 88, 0.5); background: linear-gradient(180deg, rgba(222,95,88,0.12), rgba(222,95,88,0.035)); }
.policy-highlight-grid .policy-card-info { border-color: rgba(63, 184, 201, 0.45); background: linear-gradient(180deg, rgba(63,184,201,0.11), rgba(63,184,201,0.035)); }
.policy-highlight-grid .policy-card .card-title { color: var(--text-dim); }
.policy-highlight-grid .policy-value { color: var(--text); font-weight: 600; }
.audio-file-actions .btn-danger[data-delete-audio-file] { border-color: rgba(222, 95, 88, 0.55); }

@media (max-width: 760px) {
  .prompt-upload-card-head { flex-direction: column; align-items: stretch; }
  .prompt-upload-card-head .btn { width: 100%; }
}

/* v28: exact prompt duration feedback */
.warn-text {
  color: var(--warn) !important;
}
