:root {
  --bg: #0a0e1a;
  --surface: #0f1626;
  --surface-elevated: #161f33;
  --card: #141b2e;
  --border: #232d45;
  --teal: #14c6a5;
  --green: #2ed573;
  --text: #f5f7fa;
  --text-secondary: #8c96ac;
  --text-muted: #5d6784;
  --danger: #ff5c5c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.5px; margin-bottom: 28px; }
.brand-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(90deg, var(--teal), var(--green));
  color: #000; display: flex; align-items: center; justify-content: center; font-weight: 800;
}

/* ---- Auth ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 32px; }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.muted { color: var(--text-secondary); font-size: 13px; margin: 0 0 20px; }

label { display: block; font-size: 13px; color: var(--text-secondary); margin: 14px 0 6px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=file], input[type=number] {
  width: 100%; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-elevated); color: var(--text); font-size: 14px;
}
input:focus { outline: none; border-color: var(--teal); }
.hint { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }
.checkbox-row { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--text); }
.checkbox-row input { width: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 20px; border-radius: 26px; border: none; font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: none; }
.btn-primary { background: linear-gradient(90deg, var(--teal), var(--green)); color: #000; }
.btn-ghost { background: var(--surface-elevated); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: rgba(255,92,92,0.15); color: var(--danger); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-sm { padding: 8px 14px; font-size: 12px; }

.alert { padding: 12px 16px; border-radius: 12px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: rgba(255,92,92,0.12); color: var(--danger); border: 1px solid rgba(255,92,92,0.3); }
.alert-success { background: rgba(46,213,115,0.12); color: var(--green); border: 1px solid rgba(46,213,115,0.3); }

/* ---- Shell / Dashboard ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--surface); border-right: 1px solid var(--border); padding: 24px; display: flex; flex-direction: column; }
.nav-item { display: block; padding: 12px 14px; border-radius: 12px; color: var(--text-secondary); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav-item.active { background: var(--surface-elevated); color: var(--teal); }
.logout-form { margin-top: auto; }

.content { flex: 1; padding: 32px 40px; max-width: 1440px; }
.content-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.content-header h1 { margin: 0 0 4px; font-size: 26px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip { padding: 8px 16px; border-radius: 20px; background: var(--surface-elevated); color: var(--text-secondary); font-size: 12px; font-weight: 600; text-decoration: none; border: 1px solid var(--border); }
.chip-active { background: var(--teal); color: #000; border-color: var(--teal); }
.chip-static { cursor: default; }

.table-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; overflow-x: auto; overflow-y: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; color: var(--text-muted); text-transform: uppercase; padding: 14px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.thumb { width: 72px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--surface-elevated); }
.title-cell { font-weight: 600; max-width: 260px; }
.status { padding: 4px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.status-live { background: rgba(46,213,115,0.15); color: var(--green); }
.status-draft { background: rgba(245,166,35,0.15); color: #f5a623; }
.actions { display: flex; gap: 8px; }
.status-form { display: flex; gap: 6px; }
.status-form select {
  padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-elevated); color: var(--text); font-size: 12px;
}
.empty { text-align: center; padding: 40px; color: var(--text-muted); }

.form-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 28px; max-width: 640px; }
.preview { margin-top: 10px; width: 100%; max-width: 320px; border-radius: 12px; display: block; border: 1px solid var(--border); }

/* Textareas share the same look as text inputs, but with room to write --
   Description / What We Offer were previously left to the browser default
   (tiny, unstyled, no resize control), which is what made that part of the
   form feel broken next to everything else. */
textarea {
  width: 100%; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-elevated); color: var(--text); font-size: 14px;
  font-family: inherit; line-height: 1.55; resize: vertical; min-height: 90px;
}
textarea:focus { outline: none; border-color: var(--teal); }
/* One bullet per line -- a monospace-ish rhythm makes each line read as
   its own list item while typing, instead of one dense paragraph block. */
textarea[name="highlights"] { min-height: 140px; line-height: 1.8; }

label { margin-top: 18px; }
label:first-of-type { margin-top: 0; }

/* ---- Responsive shell: sidebar collapses to a top bar, content gets
   full width, below the tablet breakpoint. Nothing about the desktop
   layout above changes. ---- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 16px; gap: 8px 4px; }
  .sidebar .brand { margin: 0 12px 0 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
  .nav-item { padding: 8px 10px; font-size: 13px; }
  .logout-form { margin: 0 0 0 auto; }
  .content { padding: 20px 16px; max-width: 100%; }
  .content-header { flex-direction: column; gap: 8px; }
  .form-card { max-width: 100%; padding: 20px; }
}

/* ---- Responsive tables: below the breakpoint, each <tr> becomes a
   self-contained card and every <td> stacks as a labelled row (driven by
   data-label, set per-cell in the view) -- this removes the horizontal
   scrollbar entirely instead of just shrinking text to fit. ---- */
@media (max-width: 900px) {
  .table-card { border: none; background: none; overflow: visible; }
  table, thead, tbody, th, tr { display: block; }
  thead { display: none; }
  tbody { display: flex; flex-direction: column; gap: 12px; }
  tr {
    background: var(--card); border: 1px solid var(--border); border-radius: 16px;
    padding: 14px 16px;
  }
  tr:last-child td { border-bottom: 1px solid var(--border); }
  td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--border); text-align: right;
  }
  td:last-child { border-bottom: none; }
  td::before {
    content: attr(data-label); font-size: 11px; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; text-align: left; flex-shrink: 0;
  }
  td.title-cell { font-size: 15px; }
  td.actions { flex-direction: column; align-items: stretch; }
  td.actions::before { margin-bottom: 6px; }
  td.actions form { width: 100%; }
  td.actions select { flex: 1; }
  .empty { padding: 24px; }
}

/* Call session transcript bubbles (views/call-session-detail.ejs) --
   real CSS classes instead of inline style="<%= ... %>" strings: avoids
   editor tooling misreading unrendered EJS template tags as literal
   (invalid) CSS, and matches how every other dashboard page already
   styles things via admin.css rather than inline styles. */
.transcript-row { display: flex; }
.transcript-row.transcript-row--customer { justify-content: flex-end; }
.transcript-bubble {
  max-width: 70%; padding: 10px 14px; border-radius: 12px;
  background: var(--card);
}
.transcript-bubble--customer { background: #1c2a1f; }
.transcript-bubble__role {
  font-size: 11px; margin-bottom: 4px; text-transform: uppercase; color: var(--text-muted);
}