/* DLS Vox AI — thème SaaS sobre */
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3a4f;
  --text: #e8edf4;
  --muted: #8b9ab5;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1e3a5f 0%, transparent 55%),
    radial-gradient(800px 400px at 100% 0%, #312e81 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.topbar {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav {
  display: flex;
  gap: 1.25rem;
}
.nav a {
  color: var(--muted);
  font-weight: 500;
}
.nav a:hover {
  color: var(--text);
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.hero {
  margin-bottom: 2rem;
}
.hero.slim {
  margin-bottom: 1.5rem;
}
.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  letter-spacing: -0.02em;
}
.lead {
  color: var(--muted);
  margin: 0 0 1rem;
  max-width: 52ch;
}
.lead.mono {
  font-family: var(--mono);
  font-size: 0.9rem;
}
.crumb {
  margin: 0 0 0.5rem;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  min-width: 120px;
}
.stat-val {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}
.card h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.inline-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}
.inline-check input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.voice-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}
@media (max-width: 640px) {
  .voice-filters {
    grid-template-columns: 1fr;
  }
}
.voice-filters label {
  margin-top: 0;
}

.data-table .cell-preview {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  white-space: nowrap;
}

label {
  display: block;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="search"],
input[type="date"],
input[type="text"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
}
textarea {
  resize: vertical;
  min-height: 120px;
}

.file-label {
  display: block;
  cursor: pointer;
}
.file-label input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}
.file-label span {
  display: block;
  padding: 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s;
}
.file-label:hover span,
.file-label:focus-within span {
  border-color: var(--accent);
  color: var(--text);
}

.upload-drop-zone {
  border-radius: var(--radius);
  padding: 0.35rem;
  margin: 0 -0.35rem;
  transition: box-shadow 0.2s, background 0.2s;
}
.upload-drop-zone.drag-over {
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 2px var(--accent);
}
.upload-drop-zone.drag-over .file-label span {
  border-color: var(--accent);
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  background: #2d3d56;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn.secondary {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn.ghost {
  background: transparent;
}
.btn.danger {
  border-color: var(--error);
  color: var(--error);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: center;
}
.row-actions.wrap {
  margin-top: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--surface2);
  color: var(--muted);
}
.badge.status-done {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}
.badge.status-processing {
  background: rgba(234, 179, 8, 0.2);
  color: var(--warning);
}
.badge.status-pending {
  color: var(--muted);
}
.badge.status-error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

.status-msg {
  margin-top: 0.75rem;
  min-height: 1.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.status-msg.error {
  color: var(--error);
}
.status-msg.ok {
  color: var(--success);
}

.player-wrap {
  margin-top: 1rem;
}
audio {
  width: 100%;
  border-radius: 8px;
}

/* Ne pas mettre display:flex sur .loader seul : ça annule l’attribut HTML hidden.
   Le flex s’applique uniquement quand le voile est affiché. */
.loader {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.75);
  z-index: 100;
  gap: 1rem;
}
.loader:not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.loader-inner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.filters {
  margin-bottom: 1.5rem;
}
.filters .filter-search {
  margin-bottom: 1rem;
}
.filters .filter-search label,
.filters .filter-field label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.filters .filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 720px) {
  .filters .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) repeat(2, minmax(0, 140px)) auto;
    align-items: end;
  }
}
.filters .filter-field-spacer {
  display: block;
  height: 1.25rem;
}
.filters .filter-submit .btn {
  width: 100%;
}
@media (min-width: 720px) {
  .filters .filter-submit .btn {
    width: auto;
    min-width: 6rem;
  }
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
}
.data-table tr:hover td {
  background: rgba(59, 130, 246, 0.06);
}
.data-table .mono {
  font-family: var(--mono);
  font-size: 0.75rem;
}

.pagination {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  align-items: center;
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}
.kv dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.kv dd {
  margin: 0;
}

.text-block {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface2);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  max-height: 320px;
  overflow: auto;
}

.segments {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.segment-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.75rem;
  padding: 0.5rem;
  background: var(--surface2);
  border-radius: 8px;
  font-size: 0.9rem;
}
.seg-time {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.8rem;
}

.alert.error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--error);
  border-radius: 8px;
  color: #fca5a5;
}

.row-inline {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}
.row-inline input {
  margin-top: 0.25rem;
}
