:root {
  --font-family: 'Poppins', sans-serif;
  --color-primary: #4361ee;
  --color-primary-soft: #eef1ff;
  --color-success: #2ecc71;
  --color-danger: #e74c3c;
  --color-dark: #1e293b;
  --color-muted: #6b7280;
  --color-light-bg: #f8fafc;
  --color-card-bg: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 12px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 20px rgba(0,0,0,0.08);
  --radius: 0.75rem;
  --transition: all 0.2s ease;
}

body {
  font-family: var(--font-family);
  font-weight: 400;
  font-size: 0.875rem;
  background-color: var(--color-light-bg);
  color: #334155;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.fw-300 { font-weight: 300; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }

/* Navbar */
.navbar {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.03);
  box-shadow: var(--shadow-sm);
  padding: 0.75rem 1.5rem;
}
.navbar-brand {
  font-weight: 500;
  font-size: 1.1rem;
  color: var(--color-dark) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand-icon {
  width: 20px;
  height: 20px;
  stroke: var(--color-primary);
  stroke-width: 2;
}
.btn-soft-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  font-weight: 400;
  padding: 0.3rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  transition: var(--transition);
}
.btn-soft-danger:hover {
  background: #fecaca;
  color: #7f1d1d;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f4ff 0%, #e9f0fc 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: 1.25rem;
  background: white;
}
.login-card .form-control {
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-color: #e2e8f0;
  background: #f8fafc;
  font-size: 0.875rem;
}
.login-card .form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.12);
  background: white;
}
.login-card .btn-primary {
  background: var(--color-primary);
  border: none;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  transition: var(--transition);
}
.login-card .btn-primary:hover {
  background: #3a56d4;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(67,97,238,0.25);
}

/* Dashboard Cards */
.stat-card {
  border: none;
  border-radius: var(--radius);
  background: var(--color-card-bg);
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: default;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.stat-card .card-body {
  padding: 0.9rem 1.1rem;
}
.stat-card h5 {
  font-size: 1.2rem;
}
.stat-card small {
  font-size: 0.7rem;
}
.icon-badge {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
}
.icon-badge svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}
.bg-soft-blue { background: #eef1ff; }
.bg-soft-orange { background: #fff3e0; }
.bg-soft-green { background: #e8f5e9; }
.bg-soft-purple { background: #f3e5f5; }
.bg-soft-success { background: #e6f9f0; }
.bg-soft-info { background: #e6f4ff; }

/* Chart Cards */
.chart-card {
  border: none;
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}
.chart-card .card-header {
  font-weight: 500;
  color: var(--color-dark);
}

.trading-chart-wrap {
  height: 310px;
  min-height: 280px;
  position: relative;
}
.trading-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  cursor: grab;
}
.trading-chart-wrap canvas:active {
  cursor: grabbing;
}
.time-filter .btn {
  min-width: 72px;
}
.table-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.table-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  color: #475569;
  font-size: 0.78rem;
}
.table-filter-bar select {
  width: auto;
  min-width: 92px;
}
.table-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}
.table-pagination-bar select {
  width: 90px;
}
.sensor-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
}
.sensor-table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.sensor-table-wrap th {
  white-space: nowrap;
  color: #475569;
  font-weight: 500;
}
.sensor-table-wrap td {
  white-space: nowrap;
  vertical-align: middle;
}

/* Typography */
h4 { font-size: 1.4rem; }
h6 { font-size: 0.95rem; }
.text-muted { color: #6b7280 !important; }

/* Responsive */
@media (max-width: 576px) {
  .stat-card .card-body {
    padding: 0.7rem 0.9rem;
  }
  .stat-card h5 {
    font-size: 1rem;
  }
}
