:root {
  --bg: #0f172a;
  --panel: rgba(30, 41, 59, 0.7);
  --panel-2: rgba(15, 23, 42, 0.5);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-glow: rgba(56, 189, 248, 0.3);
  --primary: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  --danger: #ef4444;
  --ok: #22c55e;
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --glass-border: rgba(255, 255, 255, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(37, 99, 235, 0.1) 0px, transparent 50%);
  color: var(--text);
  line-height: 1.5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- Header --- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
}

h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: var(--primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

h1::before {
  content: '🎙️';
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* --- Layout --- */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 400px 1fr;
  overflow: hidden;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--line);
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.lines-panel {
  background: transparent;
  padding: 24px;
  overflow-y: auto;
}

h2 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

h2::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

/* --- Form Elements --- */
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

textarea, input[type="text"], input[type="file"], select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  width: 100%;
}

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
}

button:hover:not(:disabled) {
  background: rgba(255,255,255,0.05);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button.primary {
  background: var(--primary);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

button.primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

button.ghost:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

button.danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

button.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Card Styles --- */
.line-card {
  background: var(--panel);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--shadow);
}

.line-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.badge {
  background: var(--panel-2);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.line-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.line-text strong {
  font-size: 0.8rem;
  color: var(--accent);
}

.line-text span {
  font-size: 0.95rem;
}

/* --- Special Components --- */
.status {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(0,0,0,0.2);
}

.status.ready { color: var(--ok); border-left: 3px solid var(--ok); }
.status.missing { color: var(--danger); border-left: 3px solid var(--danger); }

.record-timer {
  color: var(--danger);
  font-family: monospace;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-timer::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.quality-check {
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  padding: 16px;
  margin-top: 12px;
}

.history-list, .profile-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item, .profile-item {
  background: var(--panel-2);
  padding: 10px 14px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  border: 1px solid var(--line);
}

.file-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* --- Dialog --- */
dialog {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  width: min(500px, 90vw);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}

.dialog-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-head h2 { margin: 0; color: var(--text); }

.dialog-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dialog-actions {
  padding: 16px 24px;
  background: rgba(0,0,0,0.1);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* --- Workflow Steps --- */
.workflow-step {
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 16px;
  transition: all 0.3s ease;
}

.workflow-step h3 {
  font-size: 0.8rem;
  color: var(--accent);
  margin: 0 0 12px 0;
  text-transform: uppercase;
}

.workflow-step.disabled {
  opacity: 0.3;
  pointer-events: none;
  filter: grayscale(1);
}

.consent-box {
  display: flex !important;
  align-items: center !important;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #fff;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  margin-top: 8px;
}

.consent-box input[type="checkbox"] {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px;
  cursor: pointer;
  accent-color: var(--accent);
}

.sample-script-box {
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  border-left: 4px solid var(--accent);
  margin-bottom: 16px;
  color: var(--muted);
  line-height: 1.6;
}

.status-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.status-item span.ok { color: var(--ok); }
.status-item span.error { color: var(--danger); }
.status-item span.warn { color: #f59e0b; }
