/* ==========================================================================
   LUCRA Pilot Bioreactor — Modern Premium Dark/Light Glassmorphism Theme
   ========================================================================== */

:root {
  --bg-primary: #0b0f17;
  --bg-secondary: #131b26;
  --bg-card: rgba(23, 33, 48, 0.75);
  --bg-card-hover: rgba(30, 43, 62, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(56, 189, 248, 0.25);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-blue: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  --accent-orange: #f97316;
  --accent-indigo: #6366f1;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);
}

body.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(14, 165, 233, 0.2);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ==========================================================================
   Header Styles
   ========================================================================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  position: relative;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 15px rgba(2, 132, 199, 0.4);
}

.logo-text {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 1.5px;
  color: #ffffff;
}

.header-titles h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.header-titles .sub-title {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-center {
  display: flex;
  align-items: center;
  gap: 14px;
}

.run-control-buttons {
  display: flex;
  gap: 6px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-emerald);
}

.status-chip.offline {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-danger);
}

.status-chip.stale {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--accent-warning);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseAnimation 2s infinite;
}

.status-chip.offline .pulse-dot {
  background-color: var(--accent-danger);
  box-shadow: 0 0 8px var(--accent-danger);
  animation: none;
}

@keyframes pulseAnimation {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.heartbeat-info {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Buttons & UI Elements
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  font-family: var(--font-sans);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-warning {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
}
.btn-warning:hover {
  background: linear-gradient(135deg, #b45309, #92400e);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
}
.btn-danger:hover {
  background: linear-gradient(135deg, #b91c1c, #991b1b);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-info { background: rgba(56, 189, 248, 0.15); color: var(--accent-blue); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }
.badge-indigo { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }

/* ==========================================================================
   KPI Section
   ========================================================================== */
.kpi-section {
  padding: 16px 24px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  backdrop-filter: blur(8px);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-blue);
}

.kpi-card.accent-blue::before { background: var(--accent-blue); }
.kpi-card.accent-cyan::before { background: var(--accent-cyan); }
.kpi-card.accent-emerald::before { background: var(--accent-emerald); }
.kpi-card.accent-purple::before { background: var(--accent-purple); }
.kpi-card.accent-orange::before { background: var(--accent-orange); }
.kpi-card.accent-indigo::before { background: var(--accent-indigo); }

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.kpi-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.kpi-target {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.kpi-target strong {
  color: var(--text-main);
}

.kpi-body {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -1px;
}

.kpi-value .unit {
  font-size: 0.95rem;
  font-weight: 500;
  margin-left: 2px;
  color: var(--text-dim);
}

.kpi-delta {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-emerald);
}

.kpi-footer {
  font-size: 0.72rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 6px;
}

.kpi-footer strong {
  color: var(--text-muted);
}

/* ==========================================================================
   Quick Setpoint & Action Bar
   ========================================================================== */
.quick-bar-container {
  padding: 0 24px 16px 24px;
}

.quick-bar-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.quick-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-bar-item label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stepper-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-step {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-step:hover {
  background: rgba(255, 255, 255, 0.15);
}

.stepper-group input {
  width: 76px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-align: center;
  font-weight: 600;
}

.quick-bar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ==========================================================================
   Main Content Tabs
   ========================================================================== */
.app-main {
  flex: 1;
  padding: 0 24px 24px 24px;
}

.nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ==========================================================================
   Charts Grid
   ========================================================================== */
.chart-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

.time-range-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-range-buttons .label {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-right: 4px;
}

.btn-time {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-time.active, .btn-time:hover {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

.chart-toggles {
  display: flex;
  gap: 14px;
}

.toggle-checkbox {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
  gap: 16px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.chart-header h3, .chart-header h4 {
  font-size: 0.92rem;
  font-weight: 600;
}

.chart-wrapper {
  position: relative;
  height: 240px;
  width: 100%;
}

/* ==========================================================================
   Live Terminal Console Tab
   ========================================================================== */
.terminal-container {
  background: #030712;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.terminal-header {
  background: #111827;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.terminal-title {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

.terminal-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-right: 6px;
  display: inline-block;
}

.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #10b981; }

.terminal-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.terminal-status-indicator {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.1);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.terminal-window {
  min-height: 520px;
  max-height: 680px;
  overflow-y: auto;
  padding: 16px 20px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #38bdf8;
  background: #030712;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
}

.terminal-window .log-err { color: #f87171; font-weight: 600; }
.terminal-window .log-warn { color: #fbbf24; }
.terminal-window .log-info { color: #34d399; }
.terminal-window .log-tx { color: #c084fc; }
.terminal-window .log-step { color: #60a5fa; font-weight: 600; }

.terminal-footer {
  background: #111827;
  padding: 8px 16px;
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   Historical Runs Explorer
   ========================================================================== */
.history-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.history-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  min-height: 520px;
}

.runs-list-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.runs-list-toolbar {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
}

.runs-list-toolbar input {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 0.8rem;
}

.runs-list {
  flex: 1;
  overflow-y: auto;
  max-height: 500px;
}

.run-item {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s;
}

.run-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.run-item.active {
  background: rgba(56, 189, 248, 0.12);
  border-left: 3px solid var(--accent-blue);
}

.run-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.run-title {
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.run-item-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.run-detail-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.run-detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  text-align: center;
  gap: 8px;
}

.placeholder-icon {
  font-size: 3rem;
}

.run-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.run-detail-header h4 {
  font-size: 1.05rem;
  font-family: var(--font-mono);
}

.run-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Parameters Management Editor
   ========================================================================== */
.param-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.param-search-box input {
  width: 320px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 0.85rem;
}

.param-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.param-categories-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.category-header {
  padding: 12px 18px;
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.category-header h4 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-body {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.param-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 0.15s;
}

.param-field.modified {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.05);
}

.param-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.param-label {
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.param-unit {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.param-desc {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.param-input-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.param-input-control input[type="number"],
.param-input-control input[type="text"],
.param-input-control select {
  width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.param-input-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ==========================================================================
   Diagnostic Live Plot Tab
   ========================================================================== */
.plot-view-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.plot-view-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.plot-image-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #05080e;
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 400px;
}

.plot-image-wrapper img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Snapshots & System Grids
   ========================================================================== */
.snapshots-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.snapshots-header {
  margin-bottom: 14px;
}

.snapshots-table-wrapper {
  overflow-x: auto;
}

.snapshots-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.snapshots-table th, .snapshots-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.snapshots-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.snapshots-table td {
  font-family: var(--font-mono);
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.system-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.system-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.system-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 8px;
}

.system-item code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.log-viewer {
  background: #05080e;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #a7f3d0;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ==========================================================================
   Modals & Toasts
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 90%;
  max-width: 440px;
  box-shadow: var(--shadow-glow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-body {
  margin-bottom: 20px;
  font-size: 0.88rem;
}

.radio-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.radio-label input {
  margin-top: 3px;
}

.pin-input-group input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
  font-size: 1.1rem;
  letter-spacing: 4px;
  text-align: center;
  margin-top: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-main);
  border-left: 4px solid var(--accent-blue);
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  animation: slideIn 0.2s ease-out;
}

.toast.toast-success { border-left-color: var(--accent-emerald); }
.toast.toast-error { border-left-color: var(--accent-danger); }
.toast.toast-warning { border-left-color: var(--accent-warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.text-danger { color: var(--accent-danger); }
.text-center { text-align: center; }
.text-xs { font-size: 0.75rem; }
.ml-2 { margin-left: 8px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-3 { margin-bottom: 16px; }
.p-3 { padding: 16px; }

/* Responsive adjustments */
@media (max-width: 860px) {
  .app-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .header-center { width: 100%; justify-content: space-between; }
  .header-right { width: 100%; justify-content: flex-end; }
  .history-layout { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .quick-bar-card { flex-direction: column; align-items: stretch; }
  .quick-bar-actions { margin-left: 0; justify-content: stretch; }
  .quick-bar-actions button { flex: 1; }
}
