/* ── Reset & Variables ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f0f2f5;
  --surface:   #ffffff;
  --border:    #dde1e7;
  --primary:   #2563eb;
  --primary-h: #1d4ed8;
  --danger:    #dc2626;
  --danger-h:  #b91c1c;
  --secondary: #6b7280;
  --text:      #111827;
  --muted:     #6b7280;
  --success:   #16a34a;
  --radius:    10px;
  --shadow:    0 2px 8px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Login ── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 8px; }
.login-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-sub   { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.login-form  { display: flex; flex-direction: column; gap: 12px; }

/* ── Top bar ── */
.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-title { font-weight: 700; font-size: 18px; }
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}
.btn-logout:hover { background: var(--bg); }

/* ── Step indicator ── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 12px 0;
  max-width: 680px;
  margin: 0 auto;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0;
}
.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.step-dot span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  transition: background .2s, color .2s;
}
.step-dot small { font-size: 10px; color: var(--muted); }
.step-dot.active span  { background: var(--primary); color: #fff; }
.step-dot.current span { box-shadow: 0 0 0 3px rgba(37,99,235,.3); }
.step-dot.done span    { background: var(--success); color: #fff; }
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 12px;
  max-width: 40px;
  margin-bottom: 18px;
}

/* ── Wizard / Panels ── */
.wizard {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}
.panel { display: block; }
.panel.hidden { display: none; }
.panel-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ── Forms ── */
.field-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  margin-top: 16px;
}
.hint {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}
.hint-block {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}
.input-field {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
}
.input-field:focus { border-color: var(--primary); }
.textarea-news  { min-height: 180px; resize: vertical; }
.textarea-draft { min-height: 260px; resize: vertical; font-size: 15px; line-height: 1.7; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 10px 24px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  transition: background .15s, opacity .15s;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--primary);   color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--primary-h); }
.btn-secondary { background: var(--surface);  color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger   { background: var(--danger);    color: #fff; margin-top: 12px; }
.btn-danger:hover { background: var(--danger-h); }
.btn-full     { width: 100%; }
.btn-download { font-size: 18px; min-height: 56px; margin-bottom: 12px; }
.btn-row      { display: flex; gap: 12px; margin-top: 20px; }
.btn-row .btn { flex: 1; }

/* ── Upload drop zone ── */
.drop-zone {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface);
  margin-bottom: 16px;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}
.drop-icon { font-size: 40px; margin-bottom: 8px; }
.drop-text { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.drop-sub  { font-size: 13px; color: var(--muted); }

.file-list { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
}
.file-icon { font-size: 20px; flex-shrink: 0; }
.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--muted); font-size: 13px; flex-shrink: 0; }

/* ── Progress bar ── */
.progress-wrap   { margin: 12px 0; }
.progress-label  { font-size: 14px; margin-bottom: 6px; display: flex; justify-content: space-between; }
.progress-bar-bg { background: var(--border); border-radius: 99px; height: 10px; overflow: hidden; }
.progress-bar    { background: var(--primary); height: 100%; border-radius: 99px; transition: width .2s; }

/* ── Asset cards ── */
.asset-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.asset-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: default;
}
.asset-card:hover { border-color: var(--primary); }
.drag-handle {
  font-size: 20px;
  color: var(--muted);
  cursor: grab;
  line-height: 1;
  padding: 0 4px;
  touch-action: none;
  user-select: none;
}
.asset-icon  { font-size: 24px; flex-shrink: 0; }
.asset-meta  { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.asset-name-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.asset-name-input:focus { outline: none; border-color: var(--primary); }
.sortable-ghost { opacity: .4; }

/* ── Toggle ── */
.toggle-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle-label input { display: none; }
.toggle-track {
  width: 36px; height: 20px;
  background: var(--border);
  border-radius: 99px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-thumb {
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px; left: 2px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.interview-toggle:checked + .toggle-track { background: var(--primary); }
.interview-toggle:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }

/* ── Voice cards ── */
.voice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.voice-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.voice-card:hover { border-color: var(--primary); background: #eff6ff; }
.voice-icon  { font-size: 32px; margin-bottom: 8px; }
.voice-label { font-weight: 600; font-size: 15px; }

/* ── Revise row ── */
.revise-row {
  display: flex;
  gap: 10px;
  margin: 12px 0;
}
.revise-field { flex: 1; min-width: 0; }

/* ── BAR cards ── */
.bar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.bar-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.bar-card:hover { border-color: var(--primary); background: #eff6ff; }
.bar-label { font-weight: 600; font-size: 14px; }

/* ── Queue / Render log ── */
.queue-msg {
  text-align: center;
  font-size: 16px;
  padding: 16px;
  background: #fef9c3;
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.render-log {
  background: #1e293b;
  color: #94a3b8;
  border-radius: var(--radius);
  padding: 16px;
  font-size: 14px;
  font-family: monospace;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.log-line { padding: 2px 0; }
.log-line:last-child { color: #e2e8f0; }

/* ── Done step ── */
.done-news-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 20px;
}
.done-actions { margin-bottom: 24px; display: flex; flex-direction: column; gap: 12px; }
.countdown-block {
  background: #fef3c7;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
}
.countdown-label { color: var(--muted); }
.countdown-value { font-weight: 700; font-size: 16px; color: #92400e; }

/* ── Alerts ── */
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin: 10px 0;
}
.alert-error.hidden { display: none; }
.status-msg {
  color: var(--muted);
  font-size: 14px;
  padding: 8px 0;
  text-align: center;
}
.status-msg.hidden { display: none; }

/* ── Alert success ── */
.alert-success {
  background: #dcfce7; color: #166534;
  border: 1px solid #86efac; border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
}

/* ── Settings page ── */
.settings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.settings-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  margin-bottom: 16px;
}
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--bg); border-radius: 8px;
}
.user-name { font-size: 14px; color: var(--text); }
.btn-sm {
  padding: 4px 12px; font-size: 13px; min-height: 32px;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .voice-grid { grid-template-columns: 1fr 1fr; }
  .bar-grid   { grid-template-columns: 1fr 1fr; }
  .revise-row { flex-direction: column; }
  .login-card { padding: 32px 20px; }
  .panel-title { font-size: 18px; }
  .step-indicator { padding: 12px 8px 0; }
  .step-dot span  { width: 28px; height: 28px; font-size: 13px; }
  .step-line      { min-width: 8px; }
}
