:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.25);
  --accent-orange: #f59e0b;
  --accent-orange-glow: rgba(245, 158, 11, 0.25);
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.25);
  --accent-red: #ef4444;
  --border-color: #334155;
  --radius: 12px;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  padding: 24px;
}

/* PIN Overlay */
.pin-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 36px;
  border-radius: 16px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.pin-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.pin-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.pin-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.pin-card input {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  text-align: center;
  letter-spacing: 4px;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: white;
  margin-bottom: 16px;
}

.pin-card input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.pin-error {
  color: var(--accent-red);
  font-size: 13px;
  margin-top: 12px;
  display: none;
}

.app-container {
  max-width: 1320px;
  margin: 0 auto;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-card);
  padding: 20px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-icon {
  font-size: 32px;
  background: linear-gradient(135deg, #10b981, #06b6d4);
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

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

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: white;
}
.btn-primary:hover {
  background-color: #2563eb;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #334155;
  color: var(--text-main);
}
.btn-secondary:hover {
  background-color: #475569;
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 4px 15px var(--accent-orange-glow);
}
.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-orange-glow);
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
}

.full-width {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
}

/* Status Badge & Toggle */
.status-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0f172a;
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.status-badge {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
}
.status-active { color: var(--accent-green); }
.status-paused { color: var(--accent-red); }

/* Switch Slider */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #475569;
  transition: .3s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--accent-green); }
input:checked + .slider:before { transform: translateX(22px); }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 16px;
}
.card-glow-green { border-color: var(--accent-green); box-shadow: 0 0 20px var(--accent-green-glow); }
.card-glow-cyan { border-color: var(--accent-cyan); box-shadow: 0 0 20px var(--accent-cyan-glow); }

.stat-icon {
  font-size: 28px;
  background: #0f172a;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-title {
  font-size: 13px;
  color: var(--text-muted);
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Layout */
.main-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .main-layout { grid-template-columns: 1fr; }
}

.panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.panel-header h2 {
  font-size: 17px;
  font-weight: 600;
}

.margin-top {
  margin-top: 28px;
}

/* Forms */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 10px 14px;
  background: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.divider {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 20px 0;
}

/* History Table */
.table-container {
  overflow-x: auto;
  max-height: 280px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.history-table th {
  padding: 10px;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.history-table td {
  padding: 12px 10px;
  font-size: 13px;
  border-bottom: 1px solid #283548;
}

.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
}

/* Log Console */
.log-console {
  background-color: #090d16;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-entry {
  line-height: 1.4;
}
.log-entry.info { color: #94a3b8; }
.log-entry.success { color: #34d399; }
.log-entry.warning { color: #fbbf24; }
.log-entry.error { color: #f87171; }

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}
.modal-content {
  background-color: var(--bg-card);
  margin: 5% auto;
  padding: 24px;
  border-radius: var(--radius);
  max-width: 800px;
  border: 1px solid var(--border-color);
  position: relative;
}
.close-modal {
  position: absolute;
  right: 20px; top: 16px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-body img {
  width: 100%;
  border-radius: 8px;
  margin-top: 14px;
}
