/* ===== MT Data Portal — CEG Theme ===== */

:root {
  /* CEG brand */
  --ceg-dark: #1A3A5C;
  --ceg-blue: #2B6CB0;
  --ceg-mid: #4A90C4;
  --ceg-light: #6BADE0;

  /* Portal aliases */
  --blue: #2B6CB0;
  --blue-light: #e1edf8;
  --green: #34a853;
  --green-light: #e6f4ea;
  --yellow: #f9ab00;
  --yellow-light: #fef7e0;
  --red: #ea4335;
  --red-light: #fce8e6;
  --gray: #5f6368;
  --gray-light: #f1f3f4;
  --gray-border: #dadce0;
  --bg: #f8f9fa;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.15);
  --radius: 8px;
}

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

/* ---- Top Banner ---- */
.top-banner {
  position: fixed; top: 0; left: 0; right: 0; height: 44px; z-index: 200;
  background: linear-gradient(135deg, var(--ceg-dark) 0%, var(--ceg-blue) 50%, var(--ceg-dark) 100%);
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.top-banner .banner-logo {
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(255,255,255,0.2); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 11px; letter-spacing: -0.5px;
}
.top-banner .banner-title { font-size: 15px; font-weight: 700; color: white; letter-spacing: 0.5px; }
.top-banner .banner-sep { width: 1px; height: 20px; background: rgba(255,255,255,0.3); }
.top-banner .banner-subtitle { font-size: 12px; color: rgba(255,255,255,0.75); font-weight: 500; }
.top-banner .banner-right {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
}
.top-banner .banner-right a {
  color: rgba(255,255,255,0.7); text-decoration: none; font-size: 12px; font-weight: 500;
  transition: color 0.15s;
}
.top-banner .banner-right a:hover { color: white; }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed; top: 44px; left: 0; width: 240px; height: calc(100vh - 44px);
  background: var(--white); border-right: 1px solid var(--gray-border);
  display: flex; flex-direction: column; z-index: 100;
}
.sidebar-brand {
  padding: 20px 16px; border-bottom: 1px solid var(--gray-border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .logo {
  width: 36px; height: 36px; border-radius: 8px; background: var(--ceg-blue);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
}
.sidebar-brand h1 { font-size: 15px; font-weight: 600; }
.sidebar-brand span { font-size: 11px; color: var(--gray); }
.sidebar nav { flex: 1; padding: 8px; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 6px; text-decoration: none; color: var(--gray);
  font-size: 14px; font-weight: 500; transition: all 0.15s;
}
.sidebar nav a:hover { background: var(--gray-light); color: #202124; }
.sidebar nav a.active { background: var(--blue-light); color: var(--blue); }
.sidebar nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-footer {
  padding: 16px; border-top: 1px solid var(--gray-border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--ceg-mid);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.sidebar-footer .user-info { font-size: 13px; }
.sidebar-footer .user-info .name { font-weight: 600; }
.sidebar-footer .user-info .role { color: var(--gray); font-size: 11px; }

/* ---- Main ---- */
.main { margin-left: 240px; padding: 24px 32px; padding-top: 68px; min-height: 100vh; }

/* ---- Top bar ---- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.topbar h2 { font-size: 22px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.date-picker {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1px solid var(--gray-border); border-radius: 6px;
  background: var(--white); font-size: 14px; cursor: pointer;
}
.date-picker svg { width: 16px; height: 16px; color: var(--gray); }

/* ---- Buttons ---- */
.btn {
  padding: 8px 18px; border-radius: 6px; font-size: 14px; font-weight: 500;
  border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.15s; text-decoration: none;
}
.btn-primary { background: var(--ceg-blue); color: white; }
.btn-primary:hover { background: var(--ceg-dark); box-shadow: var(--shadow); }
.btn-outline { background: var(--white); border: 1px solid var(--gray-border); color: #202124; }
.btn-outline:hover { background: var(--gray-light); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; }

/* ---- KPI Cards ---- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--white); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border-left: 4px solid var(--gray-border);
}
.kpi-card.good { border-left-color: var(--green); }
.kpi-card.warn { border-left-color: var(--yellow); }
.kpi-card.bad { border-left-color: var(--red); }
.kpi-card.info { border-left-color: var(--blue); }
.kpi-card .label { font-size: 12px; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.kpi-card .value { font-size: 32px; font-weight: 700; margin: 4px 0; }
.kpi-card.good .value { color: var(--green); }
.kpi-card.warn .value { color: var(--yellow); }
.kpi-card.bad .value { color: var(--red); }
.kpi-card.info .value { color: var(--blue); }
.kpi-card .sub { font-size: 12px; color: var(--gray); }

/* ---- Grid layouts ---- */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 24px; }
.grid-equal { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }

/* ---- Card ---- */
.card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 0; }
.card-body.padded { padding: 20px; }

/* ---- Station table ---- */
.station-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.station-table th {
  text-align: left; padding: 10px 16px; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray);
  background: var(--gray-light); border-bottom: 1px solid var(--gray-border);
}
.station-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--gray-border);
  vertical-align: middle;
}
.station-table tr:hover { background: #f8f9fb; }
.station-table tr:last-child td { border-bottom: none; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600;
}
.badge-good { background: var(--green-light); color: var(--green); }
.badge-warn { background: var(--yellow-light); color: #b06000; }
.badge-fail { background: var(--red-light); color: var(--red); }
.badge-pending { background: var(--gray-light); color: var(--gray); }
.badge-info { background: var(--blue-light); color: var(--blue); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-good .badge-dot { background: var(--green); }
.badge-warn .badge-dot { background: var(--yellow); }
.badge-fail .badge-dot { background: var(--red); }
.badge-pending .badge-dot { background: var(--gray); }

/* ---- Channel indicators ---- */
.channels { display: flex; gap: 3px; }
.ch {
  width: 22px; height: 22px; border-radius: 3px; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; color: white;
}
.ch.ok { background: var(--green); }
.ch.warn { background: var(--yellow); color: #333; }
.ch.fail { background: var(--red); }
.ch.off { background: var(--gray-light); color: var(--gray); }

/* ---- Sparkline (CSS only) ---- */
.sparkline { display: flex; align-items: flex-end; gap: 1px; height: 28px; }
.sparkline .bar {
  width: 4px; border-radius: 1px; background: var(--blue); opacity: 0.6;
  transition: opacity 0.15s;
}
.sparkline .bar:hover { opacity: 1; }
.sparkline .bar.warn { background: var(--yellow); }
.sparkline .bar.bad { background: var(--red); }

/* ---- Progress ring (CSS) ---- */
.progress-ring-wrap { position: relative; width: 120px; height: 120px; margin: 0 auto 12px; }
.progress-ring {
  width: 120px; height: 120px; border-radius: 50%;
  background: conic-gradient(var(--green) 0deg 216deg, var(--yellow) 216deg 252deg, var(--red) 252deg 270deg, var(--gray-light) 270deg 360deg);
}
.progress-ring-inner {
  position: absolute; top: 15px; left: 15px; width: 90px; height: 90px;
  border-radius: 50%; background: var(--white);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.progress-ring-inner .pct { font-size: 28px; font-weight: 700; color: var(--green); }
.progress-ring-inner .pct-label { font-size: 11px; color: var(--gray); }

/* ---- Legend ---- */
.legend { display: flex; justify-content: center; gap: 16px; margin-top: 8px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--gray); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; }

/* ---- Activity feed ---- */
.activity-list { list-style: none; }
.activity-item {
  padding: 12px 20px; border-bottom: 1px solid var(--gray-border);
  display: flex; gap: 12px; align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.activity-icon.upload { background: var(--blue-light); color: var(--blue); }
.activity-icon.qc-pass { background: var(--green-light); color: var(--green); }
.activity-icon.qc-fail { background: var(--red-light); color: var(--red); }
.activity-icon.note { background: var(--yellow-light); color: #b06000; }
.activity-text { font-size: 13px; line-height: 1.4; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--gray); margin-top: 2px; }

/* ---- Map placeholder ---- */
.map-placeholder {
  height: 260px; background: linear-gradient(135deg, var(--blue-light) 0%, #c8ddf0 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--blue); position: relative; overflow: hidden;
}
.map-placeholder::before {
  content: ''; position: absolute; width: 100%; height: 100%;
  background:
    radial-gradient(circle at 30% 40%, rgba(43,108,176,0.15) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(52,168,83,0.1) 0%, transparent 40%);
}
.map-dot {
  position: absolute; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid white; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.map-dot.g { background: var(--green); }
.map-dot.y { background: var(--yellow); }
.map-dot.r { background: var(--red); }
.map-dot.p { background: var(--gray); }
.map-label { position: relative; z-index: 1; text-align: center; }
.map-label svg { width: 32px; height: 32px; opacity: 0.5; }
.map-label p { font-size: 12px; margin-top: 4px; opacity: 0.7; }

/* ---- Time series preview ---- */
.ts-preview {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-border);
  cursor: pointer; transition: background 0.15s;
}
.ts-preview:hover { background: #f8f9fb; }
.ts-preview:last-child { border-bottom: none; }
.ts-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ts-header .ts-station { font-weight: 600; font-size: 14px; }
.ts-wave { width: 100%; height: 40px; position: relative; }
.ts-wave svg { width: 100%; height: 40px; }
.ts-wave svg path { fill: none; stroke-width: 1.5; }
.ts-meta { display: flex; gap: 16px; margin-top: 6px; font-size: 11px; color: var(--gray); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-border); margin-bottom: 20px; }
.tab {
  padding: 10px 20px; font-size: 14px; font-weight: 500; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  color: var(--gray); transition: all 0.15s; background: none; border-top: none;
  border-left: none; border-right: none;
}
.tab:hover { color: #202124; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Upload Wizard Steps ---- */
.wizard-steps {
  display: flex; gap: 0; margin-bottom: 24px; background: var(--white);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.wizard-step {
  flex: 1; padding: 16px 20px; display: flex; align-items: center; gap: 12px;
  border-right: 1px solid var(--gray-border); cursor: pointer;
  transition: all 0.15s;
}
.wizard-step:last-child { border-right: none; }
.wizard-step .step-num {
  width: 28px; height: 28px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: 13px;
  font-weight: 700; background: var(--gray-light); color: var(--gray); flex-shrink: 0;
}
.wizard-step.active .step-num { background: var(--ceg-blue); color: white; }
.wizard-step.done .step-num { background: var(--green); color: white; }
.wizard-step .step-info .step-title { font-size: 13px; font-weight: 600; }
.wizard-step .step-info .step-desc { font-size: 11px; color: var(--gray); }

/* ---- Dropzone ---- */
.dropzone {
  border: 2px dashed var(--gray-border); border-radius: var(--radius);
  padding: 48px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--white);
}
.dropzone:hover { border-color: var(--ceg-mid); background: var(--blue-light); }
.dropzone svg { width: 48px; height: 48px; color: var(--ceg-mid); margin-bottom: 12px; }
.dropzone .drop-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.dropzone .drop-sub { font-size: 13px; color: var(--gray); }
.dropzone .drop-formats { font-size: 11px; color: var(--gray); margin-top: 8px; }

/* ---- Form styles ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #202124; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--gray-border);
  border-radius: 6px; font-size: 14px; font-family: inherit;
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--ceg-blue); box-shadow: 0 0 0 3px rgba(43,108,176,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---- Equipment selector ---- */
.equipment-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.equip-card {
  border: 2px solid var(--gray-border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: all 0.15s; text-align: center;
}
.equip-card:hover { border-color: var(--ceg-mid); }
.equip-card.selected { border-color: var(--ceg-blue); background: var(--blue-light); }
.equip-card .equip-icon { font-size: 24px; margin-bottom: 8px; }
.equip-card .equip-name { font-size: 14px; font-weight: 600; }
.equip-card .equip-type { font-size: 11px; color: var(--gray); }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 20px; flex-wrap: wrap;
}
.filter-bar select, .filter-bar input {
  padding: 8px 12px; border: 1px solid var(--gray-border); border-radius: 6px;
  font-size: 13px; background: var(--white);
}
.filter-bar .search-input {
  flex: 1; min-width: 200px;
}

/* ---- Photo grid ---- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-thumb {
  aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden;
  cursor: pointer; position: relative; transition: transform 0.15s;
}
.photo-thumb:hover { transform: scale(1.02); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .photo-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 6px 10px; background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white; font-size: 11px; font-weight: 500;
}

/* ---- Station group ---- */
.station-group { margin-bottom: 24px; }
.station-group-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--gray-border);
}
.station-group-header h3 { font-size: 16px; font-weight: 600; }

/* ---- Processing job table ---- */
.job-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.job-table th {
  text-align: left; padding: 10px 16px; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray);
  background: var(--gray-light); border-bottom: 1px solid var(--gray-border);
}
.job-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--gray-border);
  vertical-align: middle;
}
.job-table tr:hover { background: #f8f9fb; }
.progress-bar {
  height: 6px; border-radius: 3px; background: var(--gray-light); overflow: hidden;
  width: 120px;
}
.progress-bar .fill { height: 100%; border-radius: 3px; background: var(--ceg-blue); }
.progress-bar .fill.complete { background: var(--green); }

/* ---- Terminal / log ---- */
.terminal {
  background: #1a1a2e; color: #a0e0a0; font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px; padding: 16px; border-radius: var(--radius);
  max-height: 300px; overflow-y: auto; line-height: 1.6;
}
.terminal .log-time { color: #666; }
.terminal .log-info { color: #6bade0; }
.terminal .log-warn { color: #f9ab00; }
.terminal .log-error { color: #ea4335; }
.terminal .log-ok { color: #34a853; }

/* ---- Engine cards (batch processing) ---- */
.engine-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.engine-card {
  border: 2px solid var(--gray-border); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: all 0.15s;
}
.engine-card:hover { border-color: var(--ceg-mid); }
.engine-card.selected { border-color: var(--ceg-blue); background: var(--blue-light); }
.engine-card .engine-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.engine-card .engine-desc { font-size: 12px; color: var(--gray); }

/* ---- Station chips ---- */
.chip-container { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 16px; font-size: 12px; font-weight: 500;
  background: var(--blue-light); color: var(--blue); cursor: pointer;
}
.chip .chip-remove { font-size: 14px; cursor: pointer; opacity: 0.6; }
.chip .chip-remove:hover { opacity: 1; }

/* ---- Toggle switch ---- */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--gray-border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 13px; font-weight: 500; }
.toggle-desc { font-size: 11px; color: var(--gray); }
.toggle {
  width: 40px; height: 22px; border-radius: 11px; background: var(--gray-border);
  position: relative; cursor: pointer; transition: background 0.2s;
}
.toggle.on { background: var(--ceg-blue); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(18px); }

/* ---- Model viewer ---- */
.model-section { margin-bottom: 24px; }
.color-bar {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
}
.color-bar .bar-gradient {
  flex: 1; height: 16px; border-radius: 4px;
  background: linear-gradient(90deg, #00008b, #0000ff, #00bfff, #00ff00, #ffff00, #ff8c00, #ff0000, #8b0000);
}
.color-bar .bar-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--gray); margin-top: 2px; }

/* ---- Report cards ---- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.report-card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; display: flex; gap: 16px; transition: box-shadow 0.15s;
}
.report-card:hover { box-shadow: var(--shadow-hover); }
.report-card .report-icon {
  width: 48px; height: 48px; border-radius: 8px; background: var(--red-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--red); font-size: 20px; flex-shrink: 0;
}
.report-card .report-info { flex: 1; }
.report-card .report-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.report-card .report-meta { font-size: 12px; color: var(--gray); margin-bottom: 8px; }
.report-card .report-project {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; background: var(--blue-light); color: var(--blue);
}

/* ---- Pagination ---- */
.pagination {
  display: flex; justify-content: center; gap: 4px; margin-top: 24px;
}
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 6px; font-size: 14px;
  text-decoration: none; color: var(--gray); transition: all 0.15s;
}
.pagination a:hover { background: var(--gray-light); }
.pagination .current { background: var(--ceg-blue); color: white; }

/* ---- QC Processing ---- */
.channel-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.channel-tab {
  padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: 2px solid var(--gray-border); background: var(--white);
  transition: all 0.15s;
}
.channel-tab.active { border-color: var(--ceg-blue); background: var(--blue-light); color: var(--blue); }
.channel-tab.ok { border-color: var(--green); }
.channel-tab.warn { border-color: var(--yellow); }
.channel-tab.fail { border-color: var(--red); }

.toolbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.tool-btn {
  padding: 6px 12px; border-radius: 4px; font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--gray-border); background: var(--white);
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 4px;
}
.tool-btn:hover { background: var(--gray-light); }
.tool-btn.active { background: var(--ceg-blue); color: white; border-color: var(--ceg-blue); }
.tool-sep { width: 1px; height: 24px; background: var(--gray-border); }

.ts-viewer {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 16px;
}
.ts-channel {
  padding: 8px 0; border-bottom: 1px solid var(--gray-border);
}
.ts-channel:last-child { border-bottom: none; }
.ts-channel-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ts-channel-name { font-size: 12px; font-weight: 600; width: 24px; }

.qc-checklist { list-style: none; }
.qc-check {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--gray-border); font-size: 13px;
}
.qc-check:last-child { border-bottom: none; }
.qc-check .check-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; }
.qc-check .check-icon.pass { background: var(--green-light); color: var(--green); }
.qc-check .check-icon.fail { background: var(--red-light); color: var(--red); }
.qc-check .check-icon.warn { background: var(--yellow-light); color: #b06000; }

/* ---- Coherence bars ---- */
.coherence-bar-wrap { margin-bottom: 8px; }
.coherence-bar-label { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 2px; }
.coherence-bar {
  height: 8px; border-radius: 4px; background: var(--gray-light); overflow: hidden;
}
.coherence-bar .fill { height: 100%; border-radius: 4px; }

/* ---- Detail panel (slide-in) ---- */
.detail-panel {
  position: fixed; top: 44px; right: -400px; width: 400px; height: calc(100vh - 44px);
  background: var(--white); box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 150; transition: right 0.3s ease; overflow-y: auto;
}
.detail-panel.open { right: 0; }
.detail-panel-header {
  padding: 20px; border-bottom: 1px solid var(--gray-border);
  display: flex; justify-content: space-between; align-items: center;
}
.detail-panel-header .close-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--gray-light); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.detail-panel-body { padding: 20px; }

/* ---- Station selector bar ---- */
.selector-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.selector-bar select {
  padding: 8px 12px; border: 1px solid var(--gray-border); border-radius: 6px;
  font-size: 13px; background: var(--white);
}
.selector-bar .sep { width: 1px; height: 24px; background: var(--gray-border); }

/* ---- Depth slice ---- */
.depth-slider {
  display: flex; align-items: center; gap: 12px; padding: 12px;
}
.depth-slider input[type="range"] { flex: 1; }
.depth-slider .depth-val { font-size: 13px; font-weight: 600; min-width: 60px; }

/* ---- Settings page ---- */
.settings-section { margin-bottom: 32px; }
.settings-section h3 {
  font-size: 16px; font-weight: 600; margin-bottom: 16px;
  padding-bottom: 8px; border-bottom: 2px solid var(--ceg-blue);
}
.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--gray-border);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 14px; font-weight: 500; }
.settings-desc { font-size: 12px; color: var(--gray); }
.settings-value { font-size: 14px; color: var(--gray); }

/* ---- Spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--gray-border);
  border-top-color: var(--ceg-blue); border-radius: 50%;
  animation: spin 0.8s linear infinite; display: inline-block;
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-equal { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .kpi-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .equipment-grid { grid-template-columns: 1fr; }
}
