:root {
  color-scheme: dark;
  --bg-primary: rgba(3, 15, 31, 0.92);
  --bg-card: linear-gradient(180deg, rgba(12,28,56,0.98), rgba(5,16,40,0.96));
  --border-glass: rgba(255,255,255,0.10);
  --text-primary: #f8fbff;
  --text-dim: rgba(255,255,255,0.68);
  --accent-blue: rgba(44, 176, 255, 0.95);
  --accent-orange: rgba(255, 160, 0, 0.95);
  --sidebar-width: 250px;
  --sidebar-gap: 24px;
  font-family: 'Poppins', Arial, Helvetica, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  min-height: 100%;
  height: 100%;
  overflow-x: hidden;
  margin: 0;
}

body {
  min-height: 100vh;
  color: var(--text-primary);
  background: linear-gradient(120deg, rgba(3,15,31,0.86) 0%, rgba(8,31,57,0.72) 45%, rgba(2,17,31,0.84) 100%), url('../Background_kereta_api.jpg') center/cover no-repeat fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text-primary);
}

.table>:not(caption)>*>* {
  background-color: transparent !important;
  color: var(--text-primary);
}

/* ========== APP LAYOUT ========== */
.app-root {
  min-height: 100vh;
  width: 100%;
  position: relative;
}

.app-root::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(140deg, rgba(6,20,56,0.56), rgba(8,25,60,0.40));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
  z-index: 0;
}

.app-main { position: relative; z-index: 2; }

body.dashboard-page .app-main {
  margin-left: calc(var(--sidebar-width) + var(--sidebar-gap) * 2);
  padding: 200px 0 0;
}

/* ========== HAMBURGER TOGGLE ========== */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(6, 17, 42, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 180ms ease;
}

.hamburger-btn:hover { background: rgba(15, 76, 129, 0.75); }

.sidebar-overlay {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}

/* ========== SIDEBAR ========== */
.app-sidebar {
  position: fixed;
  left: var(--sidebar-gap);
  top: var(--sidebar-gap);
  bottom: var(--sidebar-gap);
  width: var(--sidebar-width);
  background: rgba(6, 17, 42, 0.72);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 30px 90px rgba(0,0,0,0.35);
  border: 1px solid var(--border-glass);
  z-index: 999;
  transition: transform 280ms ease, left 280ms ease;
}

.sidebar-top { padding-bottom: 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.sidebar-logos { display: flex; gap: 16px; align-items: center; justify-content: center; width: 100%; }
.sidebar-logos img { width: 56px; height: 56px; object-fit: contain; display: block; border-radius: 14px; background: rgba(255,255,255,0.14); padding: 8px; }

.sidebar-nav ul { list-style: none; padding: 0; margin: 20px 0 0; }
.sidebar-nav li { margin-bottom: 14px; }
.sidebar-nav a {
  color: #cfe9ff; text-decoration: none; display: flex; gap: 12px; align-items: center;
  padding: 12px 16px; border-radius: 14px; font-size: 1rem; font-weight: 600;
  transition: background 180ms ease, transform 180ms ease;
}
.sidebar-nav li.active a, .sidebar-nav a:hover {
  background: rgba(15,76,129,0.75); color: #fff;
  box-shadow: 0 12px 28px rgba(15,76,129,0.22); transform: translateX(2px);
}

.sidebar-bottom { margin-top: auto; display: flex; justify-content: center; }
.btn-logout {
  width: 100%; padding: 12px 16px; border-radius: 14px;
  background: linear-gradient(90deg, #1d7bd8 0%, #49b6ff 100%);
  color: #fff; border: 1px solid var(--border-glass);
  font-weight: 700; font-size: 0.9rem;
  box-shadow: 0 14px 32px rgba(29,123,216,0.24);
  cursor: pointer; transition: transform 180ms ease, box-shadow 180ms ease;
}
.btn-logout:hover {
  transform: translateX(2px); box-shadow: 0 18px 38px rgba(29,123,216,0.32);
  background: linear-gradient(90deg, #1569bb 0%, #2d97e9 100%);
}

/* ========== HEADER ========== */
.app-header {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  text-align: center;
  padding: 0 20px;
}

.header-inner { width: 100%; }

.header-title {
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: 0.10em;
  line-height: 1.15;
  margin: 0 0 0.3rem;
}

.header-sub {
  font-size: clamp(0.7rem, 0.9vw, 0.85rem);
  color: rgba(255,255,255,0.88);
  margin: 0 auto 0.4rem;
  max-width: 620px;
  position: relative;
  padding-bottom: 12px;
}
.header-sub::after {
  content: '';
  position: absolute;
  left: 50%; transform: translateX(-50%);
  width: 100px; height: 3px;
  background: #ff8a00; bottom: 0;
  border-radius: 99px;
}

.header-clock {
  position: absolute;
  right: 24px; top: 24px;
  color: rgba(255,255,255,0.98);
  font-weight: 800; font-size: 16px;
  background: rgba(3,24,52,0.96);
  padding: 10px 16px; border-radius: 18px;
  border: 1px solid var(--border-glass);
  box-shadow: 0 18px 44px rgba(0,0,0,0.24);
  white-space: nowrap;
}

/* ========== CARDS GRID (Dashboard) ========== */
.cards-panel {
  width: 100%; max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  justify-content: center;
}

.metric-card {
  border-radius: 16px;
  padding: 16px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 2px solid var(--border-glass);
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.28);
}

.metric-card.blue { border-color: var(--accent-blue); box-shadow: 0 14px 36px rgba(0,0,0,0.28), 0 0 30px rgba(44,176,255,0.08); }
.metric-card.orange { border-color: var(--accent-orange); box-shadow: 0 14px 36px rgba(0,0,0,0.28), 0 0 30px rgba(255,160,0,0.08); }

.metric-card::before {
  content: '';
  position: absolute; left: 0; top: 0; right: 0; height: 36%;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
  pointer-events: none;
}

.metric-card .card-title {
  font-weight: 800; color: rgba(255,255,255,0.96);
  margin: 0 0 6px; font-size: 0.8rem;
  letter-spacing: 0.12em; text-transform: uppercase;
}

.metric-card .card-value {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 800; color: #fff;
  line-height: 1; display: flex; align-items: baseline;
  justify-content: center; gap: 6px;
}

.metric-card .unit {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.88);
}

.metric-card:hover {
  transform: translateY(-4px);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

/* ========== LOG PAGE ========== */
body.log-page {
  overflow: hidden;
}

body.log-page .app-root {
  height: 100vh;
  overflow: hidden;
}

body.log-page .app-main {
  margin-left: calc(var(--sidebar-width) + var(--sidebar-gap) * 2);
  padding: 32px 24px 24px;
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

body.log-page .log_frame {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(3, 24, 52, 0.94);
  border: 1px solid var(--border-glass);
  border-radius: 28px;
  box-shadow: 0 28px 60px rgba(0,0,0,0.24);
  overflow: hidden;
  margin-top: 16px;
}

body.log-page .log-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 20px;
}

body.log-page .log-table-wrapper {
  flex: 1;
  overflow: auto;
  border-radius: 20px;
  background: rgba(6, 22, 50, 0.96);
  border: 1px solid var(--border-glass);
}

body.log-page .table.log-table {
  width: 100%;
  min-width: 900px;
  margin-bottom: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
  border-collapse: collapse;
}

body.log-page .table.log-table thead th {
  color: var(--text-primary);
  background: rgba(12, 36, 70, 0.95);
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
  padding: 16px 14px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}

body.log-page .table.log-table tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
body.log-page .table.log-table tbody tr:nth-of-type(odd) {
  background: rgba(255,255,255,0.03);
}

body.log-page .table.log-table tbody td,
body.log-page .table.log-table tbody th {
  padding: 14px 12px;
  color: rgba(247, 251, 255, 0.92);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: none;
}

body.log-page .table.log-table thead th:first-child,
body.log-page .table.log-table tbody th {
  width: 50px;
  text-align: center;
}

body.log-page .log-panel__footer {
  display: flex;
  justify-content: center;
  padding: 14px 0 4px;
  flex-shrink: 0;
}

body.log-page .pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

body.log-page .btn-page {
  color: var(--text-primary);
  background: rgba(3, 24, 52, 0.96);
  border: 1px solid var(--border-glass);
  min-width: 80px;
  padding: 10px 18px;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}
body.log-page .btn-page:hover:not(:disabled) {
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}
body.log-page .btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 700;
}

/* ========== GRAFIK PAGE ========== */
body.grafik-page .app-main {
  margin-left: calc(var(--sidebar-width) + var(--sidebar-gap) * 2);
  padding: 24px;
}

body.grafik-page .app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  text-align: left;
}

body.grafik-page .header-left { flex: 1; min-width: 200px; }
body.grafik-page .header-left .header-title { text-align: left; }
body.grafik-page .header-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.72);
  margin-top: 2px;
}

body.grafik-page .header-right {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

body.grafik-page .header-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(3,24,52,0.92);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 0.8rem;
  box-shadow: 0 10px 20px rgba(0,0,0,0.20);
}

body.grafik-page .header-card__icon { font-size: 1.4rem; color: rgba(255,255,255,0.75); }
body.grafik-page .header-card__content { display: flex; flex-direction: column; gap: 1px; }
body.grafik-page .header-card__label { font-size: 0.65rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
body.grafik-page .header-card__value { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); }

body.grafik-page .chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

body.grafik-page .chart-card {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(9,24,45,0.94), rgba(5,14,30,0.96));
  border: 1px solid var(--border-glass);
  box-shadow: 0 20px 45px rgba(0,0,0,0.28);
}

body.grafik-page .chart-card--dc { border-color: rgba(44, 176, 255, 0.30); }
body.grafik-page .chart-card--ac { border-color: rgba(255, 160, 0, 0.30); }

body.grafik-page .chart-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

body.grafik-page .chart-card__title {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #dceeff;
}

body.grafik-page .chart-card__subtitle {
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

body.grafik-page .chart-card__status {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.grafik-page .chart-card__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #37e68b;
  box-shadow: 0 0 12px rgba(55,230,139,0.9);
}

body.grafik-page .chart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.85rem;
  min-width: 80px;
}
body.grafik-page .chart-badge--dc { color: #66d2ff; background: rgba(44,176,255,0.14); }
body.grafik-page .chart-badge--ac { color: #ffbf5d; background: rgba(255,160,0,0.14); }

body.grafik-page .chart-card__body {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

body.grafik-page .chart-card__summary {
  width: 130px;
  text-align: center;
  flex-shrink: 0;
  padding: 10px 8px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

body.grafik-page .chart-card__summary-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #7ee0ff;
  background: rgba(44,176,255,0.16);
  margin-bottom: 6px;
}

body.grafik-page .chart-card__summary-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

body.grafik-page .chart-card__chart {
  flex: 1;
  min-height: 200px;
}

body.grafik-page .trend-canvas {
  display: block;
  width: 100% !important;
  height: 220px !important;
}

.gauge-canvas { display: none !important; }
.gauge-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-top: 8px;
}

/* ========== LOGIN / AUTH PAGE ========== */
.auth-page {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(3,15,31,0.86) 0%, rgba(8,31,57,0.72) 45%, rgba(2,17,31,0.84) 100%),
    url('../Background_kereta_api.jpg') center/cover no-repeat;
  color: var(--text-primary);
}

.auth-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(2,20,43,0.35), rgba(0,0,0,0.2));
  pointer-events: none;
}

.auth-page > .container { position: relative; z-index: 1; }

.auth-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  animation: fadeUp 0.8s ease both;
}

.auth-copy { padding: 60px 20px 20px; }

.logo-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.logo-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.10);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
}

.logo-pill .brand-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  display: block;
}

.eyebrow {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #ffcf99;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.auth-copy h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800;
  line-height: 1.08;
  margin-bottom: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.auth-copy p {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.88);
  max-width: 520px;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  gap: 0.7rem;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 600;
  font-size: 1rem;
}

.feature-list i { color: #ffb36b; font-size: 1.2rem; }

.auth-card {
  padding: 2rem 2.2rem;
  border-radius: 24px;
  max-width: 480px;
  width: 100%;
  background: rgba(8,24,43,0.72);
  border: 1px solid var(--border-glass);
  box-shadow: 0 20px 50px rgba(1,12,24,0.35);
  backdrop-filter: blur(20px);
  animation: fadeUp 1s ease both;
  margin: 0 auto;
}

.brand-pill {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9f43, #f97316);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.auth-card h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.3rem; }
.auth-card .text-muted { color: rgba(255,255,255,0.68) !important; font-size: 0.9rem; }
.auth-card .input-group-text { background: rgba(255,255,255,0.10); color: #fff; border: 1px solid var(--border-glass); }
.auth-card .form-control {
  background: rgba(255,255,255,0.06);
  color: #fff;
  border: 1px solid var(--border-glass);
  padding: 0.8rem 1rem;
  min-height: 48px;
  font-size: 0.95rem;
}
.auth-card .form-control::placeholder { color: rgba(255,255,255,0.55); }
.auth-card .form-control:focus {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: #ffb36b;
  box-shadow: 0 0 0 0.2rem rgba(255,179,107,0.20);
}
.auth-card .btn-outline-light { border-color: var(--border-glass); color: #fff; }
.auth-card .btn-outline-light:hover { background: rgba(255,255,255,0.12); color: #fff; }
.form-check-label { color: rgba(255,255,255,0.85); font-size: 0.9rem; }
.form-check-input:checked { background-color: #f97316; border-color: #f97316; }
.forgot-link { color: rgba(255,255,255,0.9); text-decoration: underline; font-weight: 600; font-size: 0.9rem; }

.btn-login {
  border: none; border-radius: 999px;
  padding: 0.9rem 1.1rem;
  font-weight: 800; font-size: 1rem;
  color: #fff;
  background: linear-gradient(90deg, #0f4c81 0%, #1f6fa8 45%, #f97316 100%);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 16px 40px rgba(15,76,129,0.28);
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 16px 30px rgba(15,76,129,0.32); }

.footer-identity {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
  border-top: 1px solid var(--border-glass);
  padding-top: 0.8rem;
}

.alert-danger {
  border: none; border-radius: 10px;
  background: rgba(255,99,99,0.12);
  color: #ffd4d4;
  font-size: 0.9rem;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== LOGOUT MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.64);
  display: none;
  align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
}
.modal-overlay.modal-open { display: flex !important; }
.modal-dialog { max-width: 420px; width: 100%; }
.modal-content {
  background: rgba(12,26,52,0.92);
  border: 1px solid var(--border-glass);
  border-radius: 22px;
  backdrop-filter: blur(24px);
  padding: 24px 28px;
  text-align: center;
}
.modal-header, .modal-body, .modal-footer { border: none; padding: 0; }
.modal-header { margin-bottom: 12px; }
.modal-warning-icon { font-size: 42px; color: #ffbf00; display: block; margin-bottom: 10px; }
.modal-title { font-size: 1.3rem; font-weight: 900; margin: 0; }
.modal-body { font-size: 1rem; color: #f4f7ff; line-height: 1.5; margin-bottom: 20px; }
.modal-footer { display: flex; gap: 12px; justify-content: center; }
.modal-footer .btn {
  padding: 12px 0; font-size: 0.95rem;
  min-width: 120px; border-radius: 12px;
  font-weight: 700; cursor: pointer; border: none;
}
.btn.btn-primary { background: rgba(29,123,216,0.85); border: 1px solid rgba(29,123,216,0.95); color: #f4f7ff; }
.btn.btn-primary:hover { background: rgba(29,123,216,0.95); }
.btn.btn-secondary { background: rgba(255,255,255,0.08); border: 1px solid var(--border-glass); color: #f4f7ff; }
.btn.btn-secondary:hover { background: rgba(255,255,255,0.12); }

/* ========== RESPONSIVE ========== */

/* Tablet and below */
@media (max-width: 992px) {
  .hamburger-btn { display: flex; }

  .app-sidebar {
    left: 0; top: 0; bottom: 0;
    border-radius: 0 20px 20px 0;
    transform: translateX(-100%);
  }
  .app-sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-overlay.sidebar-open { opacity: 1; pointer-events: auto; }

  body.dashboard-page .app-main,
  body.log-page .app-main,
  body.grafik-page .app-main {
    margin-left: 0;
    padding-top: 72px;
  }

  body.log-page .app-main { padding-left: 12px; padding-right: 12px; }
  body.grafik-page .app-main { padding-left: 12px; padding-right: 12px; }

  .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  body.grafik-page .chart-grid { gap: 16px; }
  body.grafik-page .chart-card__body { flex-direction: column; }
  body.grafik-page .chart-card__summary { width: 100%; flex-direction: row; gap: 10px; }
  body.grafik-page .trend-canvas { height: 180px !important; }

  .auth-shell { grid-template-columns: 1fr; gap: 1.2rem; }
  .auth-copy { text-align: center; padding: 20px 12px 0; }
  .logo-row { justify-content: center; }
  .auth-copy p { max-width: 100%; }
  .feature-list { justify-items: center; }
  .auth-card { max-width: 100%; padding: 1.5rem; }

  body.grafik-page .app-header { flex-direction: column; align-items: flex-start; }
  body.grafik-page .header-left .header-title { text-align: center; width: 100%; }
  body.grafik-page .header-right { width: 100%; justify-content: center; }
}

/* Mobile */
@media (max-width: 576px) {
  .hamburger-btn { top: 10px; left: 10px; width: 40px; height: 40px; font-size: 20px; }

  .app-sidebar { width: 80vw; max-width: 300px; }

  .sidebar-logos img { width: 60px; height: 60px; }
  .sidebar-nav a { font-size: 1.1rem; padding: 14px 14px; }

  .header-clock { position: static; display: inline-flex; margin: 8px auto 0; }

  body.dashboard-page .app-main,
  body.log-page .app-main,
  body.grafik-page .app-main {
    padding-top: 60px;
  }

  .cards-grid { grid-template-columns: 1fr; gap: 12px; }
  .metric-card { min-height: 100px; padding: 14px; }
  .metric-card .card-value { font-size: clamp(1.6rem, 8vw, 2.2rem); }
  .metric-card .card-title { font-size: 0.75rem; }

  body.grafik-page .chart-grid { grid-template-columns: 1fr; gap: 14px; }
  body.grafik-page .trend-canvas { height: 160px !important; }
  body.grafik-page .chart-card { padding: 12px; }
  body.grafik-page .header-card { font-size: 0.7rem; padding: 8px 12px; }

  body.log-page .table.log-table { min-width: 700px; font-size: 0.8rem; }
  body.log-page .table.log-table thead th { padding: 12px 10px; font-size: 0.75rem; }
  body.log-page .table.log-table tbody td,
  body.log-page .table.log-table tbody th { padding: 10px 8px; font-size: 0.8rem; }

  .logo-pill .brand-logo { width: 60px; height: 60px; }
  .auth-copy h1 { font-size: 1.8rem; }
  .auth-card { padding: 1.2rem; }
  .auth-card .form-control { min-height: 44px; padding: 0.7rem 0.9rem; }
}

/* Small mobile */
@media (max-width: 400px) {
  body.grafik-page .header-right { flex-direction: column; align-items: stretch; }
  body.grafik-page .header-card { justify-content: center; }
  body.log-page .table.log-table { min-width: 660px; }
}
