:root {
  --bg: #0f1117;
  --bg2: #181b24;
  --bg3: #1f2330;
  --border: #2a2e3b;
  --text: #e2e4ea;
  --text2: #8b8fa3;
  --accent: #5b8af5;
  --accent-dim: #3a5fb3;
  --green: #3dd68c;
  --red: #f5555d;
  --orange: #f0a03c;
  --radius: 10px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Login ── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1117 0%, #161a27 50%, #0f1117 100%);
}
.login-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.brand-icon svg { width: 56px; height: 56px; margin-bottom: 12px; }
.login-brand h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: var(--text2); font-size: 14px; margin-top: 4px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
.field input, .field select {
  width: 100%; padding: 11px 14px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 15px; outline: none;
  transition: border-color .2s;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.btn-primary {
  width: 100%; padding: 12px;
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.btn-primary:hover { background: var(--accent-dim); }
.alert-error {
  background: rgba(245,85,93,.12); border: 1px solid var(--red);
  color: var(--red); padding: 10px 14px; border-radius: 8px;
  font-size: 13px; margin-bottom: 16px;
}

/* ── Shell ── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 0;
  position: fixed; top: 0; left: 0; bottom: 0;
}
.sidebar .brand { padding: 0 20px; margin-bottom: 32px; font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.sidebar .brand svg { width: 32px; height: 32px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; color: var(--text2);
  text-decoration: none; font-size: 14px; font-weight: 500;
  transition: all .15s;
}
.sidebar nav a:hover, .sidebar nav a.active { color: var(--text); background: var(--bg3); }
.sidebar .bottom { margin-top: auto; padding: 0 20px; }
.sidebar .bottom .user-info { font-size: 12px; color: var(--text2); margin-bottom: 8px; }
.sidebar .bottom a { color: var(--red); font-size: 13px; text-decoration: none; }

.main { margin-left: 240px; flex: 1; padding: 32px 40px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 24px; }

/* ── Cards / Tables ── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
}
.card h3 { font-size: 16px; margin-bottom: 16px; font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--border); }
tr:hover { background: var(--bg3); }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-ok { background: rgba(61,214,140,.15); color: var(--green); }
.badge-nok { background: rgba(245,85,93,.15); color: var(--red); }
.badge-pending { background: rgba(240,160,60,.15); color: var(--orange); }
.badge-locked { background: rgba(91,138,245,.15); color: var(--accent); }

.btn {
  padding: 8px 16px; border-radius: 8px; font-size: 13px;
  border: none; cursor: pointer; font-weight: 500; transition: all .15s;
}
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dim); }
.btn-green { background: var(--green); color: #000; }
.btn-red { background: var(--red); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 60px 40px; text-align: center;
  transition: all .2s; cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent); background: rgba(91,138,245,.05);
}
.upload-zone svg { width: 48px; height: 48px; margin-bottom: 12px; color: var(--text2); }
.upload-zone p { color: var(--text2); font-size: 14px; }
.upload-zone .hint { font-size: 12px; color: var(--text2); margin-top: 8px; }
.upload-progress { margin-top: 16px; }
.progress-bar { height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.progress-bar .fill { height: 100%; background: var(--accent); transition: width .3s; }

/* ── Pedido List ── */
.pedido-list { display: grid; gap: 12px; }
.pedido-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: all .15s;
}
.pedido-card:hover:not(.locked) { border-color: var(--accent); transform: translateY(-1px); }
.pedido-card.locked { opacity: .5; cursor: not-allowed; }
.pedido-card .info { display: flex; flex-direction: column; gap: 4px; }
.pedido-card .numero { font-weight: 600; font-size: 16px; font-family: 'Courier New', monospace; }
.pedido-card .meta { font-size: 12px; color: var(--text2); }
.pedido-card .status { display: flex; align-items: center; gap: 8px; }

/* ── Audio Player Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; width: 100%; max-width: 800px;
  max-height: 90vh; overflow-y: auto; padding: 32px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h2 { font-size: 20px; }
.modal-close { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 24px; }

.audio-section { margin-bottom: 28px; }
.audio-section h4 { font-size: 14px; color: var(--text2); margin-bottom: 12px; font-weight: 500; }
.waveform-container {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; margin-bottom: 8px;
  min-height: 100px;
}
.spectrum-container {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; height: 80px; margin-bottom: 12px;
  overflow: hidden;
}
.audio-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.audio-controls .time { font-size: 13px; color: var(--text2); font-family: 'Courier New', monospace; }
.play-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.play-btn svg { width: 18px; height: 18px; fill: #fff; }

.audio-review { display: flex; gap: 16px; align-items: flex-start; }
.audio-review textarea {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; color: var(--text);
  font-family: var(--font); font-size: 13px; resize: vertical;
  min-height: 60px; outline: none;
}
.audio-review textarea:focus { border-color: var(--accent); }

.check-group { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.check-option {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); transition: all .15s;
  font-size: 13px;
}
.check-option:hover { border-color: var(--accent); }
.check-option.selected-ok { border-color: var(--green); background: rgba(61,214,140,.1); color: var(--green); }
.check-option.selected-nok { border-color: var(--red); background: rgba(245,85,93,.1); color: var(--red); }
.check-option input { display: none; }

.finalize-section { margin-top: 24px; text-align: center; }
.finalize-section .btn { padding: 14px 48px; font-size: 16px; }

/* ── Supervisor results ── */
.result-row { cursor: pointer; }
.result-row.ok td:first-child { border-left: 3px solid var(--green); }
.result-row.nok td:first-child { border-left: 3px solid var(--red); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg3); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: 8px;
  font-size: 13px; z-index: 9999;
  animation: slideIn .3s;
}
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Grid forms ── */
.form-row { display: flex; gap: 12px; margin-bottom: 12px; }
.form-row .field { flex: 1; }

/* ── Modal for supervisor detail ── */
.detail-audio { margin-bottom: 16px; padding: 16px; background: var(--bg); border-radius: 8px; }
.detail-audio .obs { font-size: 13px; color: var(--text2); margin-top: 8px; font-style: italic; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px; }
  .modal { padding: 20px; }
}
