/* ============================================================
   Industrial Pollution Monitoring System — Styles
   Three-Tier Architecture with Admin & User Portals
   ============================================================ */

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

:root {
  --bg: #0f1117;
  --bg-card: #181a20;
  --bg-elevated: #1e2028;
  --bg-hover: #252830;
  --bg-input: #14161c;
  --border: #2a2d35;
  --border-light: #33363f;
  --text: #e4e5e9;
  --text-dim: #8b8d96;
  --text-muted: #5e606a;
  --accent: #0b8fdc;
  --accent-hover: #057cc1;
  --accent-bg: rgba(11,143,220,0.14);
  --green: #34d399;
  --green-bg: rgba(52,211,153,0.12);
  --red: #f87171;
  --red-bg: rgba(248,113,113,0.12);
  --yellow: #fbbf24;
  --yellow-bg: rgba(251,191,36,0.12);
  --blue: #60a5fa;
  --blue-bg: rgba(96,165,250,0.12);
  --orange: #fb923c;
  --orange-bg: rgba(251,146,60,0.12);
  --sidebar-w: 250px;
  --radius: 8px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
  font-family: 'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

html[data-theme="light"] {
  --bg: #f2f4f3;
  --bg-card: #ffffff;
  --bg-elevated: #eef3f6;
  --bg-hover: #e5f3fb;
  --bg-input: #ffffff;
  --border: #cfd8df;
  --border-light: #9fb5c4;
  --text: #101820;
  --text-dim: #334155;
  --text-muted: #64748b;
  --accent: #0596df;
  --accent-hover: #007bc0;
  --accent-bg: #dff3ff;
  --green: #1f8a4c;
  --green-bg: #e3f4e9;
  --red: #b42318;
  --red-bg: #fde7e5;
  --yellow: #a16207;
  --yellow-bg: #fff3c4;
  --blue: #0369a1;
  --blue-bg: #e0f2fe;
  --orange: #c05621;
  --orange-bg: #ffedd5;
}

body { display:flex; min-height:100vh; overflow:hidden; }

/* ═══════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════ */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg);
  overflow-y: auto;
}

.login-screen.hidden { display: none; }

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(108,99,255,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(96,165,250,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(251,146,60,0.06) 0%, transparent 50%);
}

html[data-theme="light"] .login-screen {
  background: #eef4f7;
}

html[data-theme="light"] .login-bg {
  background:
    linear-gradient(180deg, #214438 0 10px, transparent 10px),
    linear-gradient(90deg, rgba(5,150,223,0.14), rgba(5,150,223,0.04)),
    #eef4f7;
}

.login-container {
  position: relative;
  display: flex;
  gap: 32px;
  padding: 40px 20px;
  max-width: 950px;
  width: 100%;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 36px 32px 28px;
  width: 380px;
  flex-shrink: 0;
}

html[data-theme="light"] .login-card,
html[data-theme="light"] .arch-card {
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-icon { font-size: 44px; margin-bottom: 8px; }
.login-header h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.login-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.login-field { margin-bottom: 16px; }
.login-field label { display:block; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--text-muted); margin-bottom:6px; }
.login-field input {
  width: 100%; padding: 11px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: 14px; outline: none;
  transition: border var(--transition);
}
.login-field input:focus { border-color: var(--accent); }

.login-btn {
  width: 100%; padding: 12px; font-size: 15px;
  margin-top: 6px; border-radius: 8px;
}

.login-error {
  margin-top: 12px; text-align: center;
  font-size: 13px; color: var(--red); min-height: 20px;
}

.login-hint {
  margin-top: 20px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
.hint-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-muted); margin-bottom: 10px; }
.hint-grid { display: flex; flex-direction: column; gap: 6px; }
.hint-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--bg);
  border-radius: var(--radius-sm); font-size: 12px;
  color: var(--text-dim); cursor: pointer;
  transition: all var(--transition);
}
.hint-item:hover { background: var(--bg-hover); color: var(--text); }
.hint-role {
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 10px; text-transform: uppercase; letter-spacing: 0.5px;
}
.hint-role.admin     { background: var(--accent-bg); color: var(--accent); }
.hint-role.inspector { background: var(--blue-bg);   color: var(--blue); }
.hint-role.teacher   { background: var(--yellow-bg); color: var(--yellow); }
.hint-role.user      { background: var(--green-bg);  color: var(--green); }

/* ── Architecture Card (login page) ──────────── */
.arch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px 28px;
  width: 460px;
  flex-shrink: 0;
}
.arch-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.arch-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }

.arch-tiers { display: flex; flex-direction: column; gap: 0; }

.arch-tier {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.tier-number { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.tier-icon { font-size: 22px; margin-bottom: 4px; }
.arch-tier h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.arch-tier p { font-size: 11px; color: var(--text-dim); line-height: 1.5; }
.tier-tech { font-size: 10px; font-weight: 600; color: var(--text-muted); margin-top: 6px; }

.tier-1 { background: rgba(108,99,255,0.06); border-color: rgba(108,99,255,0.2); }
.tier-1 .tier-number { color: var(--accent); }
.tier-2 { background: rgba(96,165,250,0.06); border-color: rgba(96,165,250,0.2); }
.tier-2 .tier-number { color: var(--blue); }
.tier-3 { background: rgba(52,211,153,0.06); border-color: rgba(52,211,153,0.2); }
.tier-3 .tier-number { color: var(--green); }

.arch-arrow {
  text-align: center; font-size: 10px; font-weight: 600;
  color: var(--text-muted); padding: 6px 0; letter-spacing: 0.3px;
}

/* ═══════════════════════════════════════════════════
   APP SHELL
   ═══════════════════════════════════════════════════ */
.app-shell { display: flex; width: 100%; height: 100vh; }

html[data-theme="light"] .app-shell {
  border-top: 10px solid #214438;
}

/* ─── Sidebar ───────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--bg-card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100vh;
  position: fixed; left: 0; top: 0; z-index: 100;
}

html[data-theme="light"] .sidebar {
  top: 10px;
  height: calc(100vh - 10px);
  background: #ffffff;
  border-right-color: #bed0dc;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--border);
}

html[data-theme="light"] .sidebar-brand {
  background: #ffffff;
  border-bottom: 4px solid #0596df;
}
.brand-icon { font-size: 26px; line-height:1; }
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }
.brand-sub { font-size: 11px; color: var(--text-muted); font-weight: 500; }

html[data-theme="light"] .brand-title {
  color: #0f172a;
}

/* User badge */
.user-badge {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

html[data-theme="light"] .user-badge {
  background: #f7fafc;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--accent); margin-top: 1px;
}
.logout-btn {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 14px; padding: 4px 8px; cursor: pointer;
  transition: all var(--transition);
}
.logout-btn:hover { background: var(--red-bg); color: var(--red); border-color: rgba(248,113,113,0.3); }

.theme-toggle {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-dim);
  font-size: 15px; cursor: pointer; transition: all var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--accent); border-color: var(--border-light); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px; }
.nav-section-label { font-size:10px; font-weight:600; text-transform:uppercase; letter-spacing:1px; color:var(--text-muted); padding:14px 10px 6px; }

.nav-item {
  display:flex; align-items:center; gap:10px;
  padding:9px 12px; border-radius:var(--radius-sm);
  color:var(--text-dim); text-decoration:none; font-size:13px; font-weight:500;
  cursor:pointer; transition:all var(--transition); margin-bottom:2px;
}
.nav-item:hover { background:var(--bg-hover); color:var(--text); }
.nav-item.active { background:var(--accent-bg); color:var(--accent); }
.nav-icon { font-size:15px; width:20px; text-align:center; }

html[data-theme="light"] .nav-section-label {
  color: #475569;
}
html[data-theme="light"] .nav-item {
  color: #1f2937;
  border-radius: 4px;
}
html[data-theme="light"] .nav-item:hover {
  background: #eef8ff;
  color: #005b91;
}
html[data-theme="light"] .nav-item.active {
  background: #0596df;
  color: #ffffff;
  font-weight: 700;
}

.sidebar-footer { padding:14px 18px; border-top:1px solid var(--border); font-size:11px; color:var(--text-muted); text-align:center; }

/* ─── Main Content ──────────────────────────────── */
.main { margin-left:var(--sidebar-w); flex:1; height:100vh; overflow-y:auto; padding:28px 32px; }

html[data-theme="light"] .main {
  background:
    linear-gradient(180deg, #ffffff 0 56px, transparent 56px),
    var(--bg);
}

.view { display:none; }
.view.active { display:block; animation:fadeIn 0.25s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

.view-header { display:flex; align-items:baseline; justify-content:space-between; margin-bottom:24px; flex-wrap:wrap; gap:10px; }
.view-header h2 { font-size:22px; font-weight:700; letter-spacing:-0.4px; }
.view-subtitle { font-size:13px; color:var(--text-muted); font-weight:400; }
.view-actions { display:flex; gap:8px; }

html[data-theme="light"] .view-header {
  padding-bottom: 12px;
  border-bottom: 1px solid #cad6df;
}
html[data-theme="light"] .view-header h2 {
  color: #0f172a;
}

/* ─── Role Banner ───────────────────────────────── */
.role-banner {
  padding: 14px 20px; border-radius: var(--radius);
  margin-bottom: 20px; font-size: 13px; font-weight: 500;
  display: none;
}

html[data-theme="light"] .role-banner {
  border-radius: 0;
  border-left: 5px solid currentColor;
}
.role-banner.admin-banner {
  display: block; background: var(--accent-bg);
  border: 1px solid rgba(108,99,255,0.25); color: var(--accent);
}
.role-banner.user-banner {
  display: block; background: var(--green-bg);
  border: 1px solid rgba(52,211,153,0.25); color: var(--green);
}
.role-banner.inspector-banner {
  display: block; background: var(--blue-bg);
  border: 1px solid rgba(96,165,250,0.25); color: var(--blue);
}
.role-banner.teacher-banner {
  display: block; background: var(--yellow-bg);
  border: 1px solid rgba(251,191,36,0.25); color: var(--yellow);
}

/* ─── Buttons ───────────────────────────────────── */
.btn { display:inline-flex; align-items:center; gap:5px; padding:8px 16px; border:none; border-radius:var(--radius-sm); font-family:inherit; font-size:13px; font-weight:600; cursor:pointer; transition:all var(--transition); }
.btn-primary { background:var(--accent); color:#fff; }
.btn-primary:hover { background:var(--accent-hover); }
.btn-ghost { background:var(--bg-elevated); color:var(--text-dim); border:1px solid var(--border); }
.btn-ghost:hover { background:var(--bg-hover); color:var(--text); }
.btn-small { padding:5px 12px; font-size:12px; }
.btn-danger { background:var(--red-bg); color:var(--red); border:1px solid rgba(248,113,113,0.25); }
.btn-danger:hover { background:rgba(248,113,113,0.2); }

/* ─── Stats Grid ────────────────────────────────── */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:14px; margin-bottom:24px; }
.stat-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; transition:all var(--transition); }
.stat-card:hover { border-color:var(--border-light); }
.stat-label { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.6px; color:var(--text-muted); margin-bottom:6px; }
.stat-value { font-size:26px; font-weight:700; letter-spacing:-0.5px; }
.stat-value.green{color:var(--green)}.stat-value.red{color:var(--red)}.stat-value.blue{color:var(--blue)}.stat-value.yellow{color:var(--yellow)}.stat-value.orange{color:var(--orange)}.stat-value.accent{color:var(--accent)}

/* ─── Dashboard Panels ─────────────────────────── */
.dashboard-panels { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.dashboard-panels .panel:last-child { grid-column:1/-1; }
.panel { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.panel-title { font-size:14px; font-weight:600; margin-bottom:14px; }

html[data-theme="light"] .stat-card,
html[data-theme="light"] .panel,
html[data-theme="light"] .table-container,
html[data-theme="light"] .console-editor,
html[data-theme="light"] .console-result {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}
html[data-theme="light"] .panel-title {
  color: #0f172a;
}

.violations-charts { display:grid; grid-template-columns:1fr 1fr; gap:14px; }

.bar-chart { display:flex; flex-direction:column; gap:8px; }
.bar-row { display:flex; align-items:center; gap:10px; }
.bar-label { width:80px; font-size:12px; color:var(--text-dim); font-weight:500; text-align:right; }
.bar-track { flex:1; height:22px; background:var(--bg); border-radius:4px; overflow:hidden; }
.bar-fill { height:100%; border-radius:4px; transition:width 0.6s ease; display:flex; align-items:center; padding-left:8px; font-size:11px; font-weight:600; color:#fff; min-width:fit-content; }
.bar-fill.air{background:linear-gradient(90deg,#6c63ff,#8b83ff)}.bar-fill.water{background:linear-gradient(90deg,#60a5fa,#93c5fd)}.bar-fill.noise{background:linear-gradient(90deg,#fbbf24,#fcd34d)}
.bar-fill.pending{background:linear-gradient(90deg,#f87171,#fca5a5)}.bar-fill.resolved{background:linear-gradient(90deg,#34d399,#6ee7b7)}.bar-fill.appealed{background:linear-gradient(90deg,#fb923c,#fdba74)}

/* ─── Data Table ────────────────────────────────── */
.table-container { overflow-x:auto; border:1px solid var(--border); border-radius:var(--radius); background:var(--bg-card); }
.data-table { width:100%; border-collapse:collapse; font-size:13px; }
.data-table th { background:var(--bg-elevated); font-weight:600; font-size:11px; text-transform:uppercase; letter-spacing:0.5px; color:var(--text-muted); padding:12px 14px; text-align:left; border-bottom:1px solid var(--border); position:sticky; top:0; white-space:nowrap; }
.data-table td { padding:10px 14px; border-bottom:1px solid var(--border); color:var(--text-dim); max-width:250px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.data-table tbody tr { transition:background var(--transition); }
.data-table tbody tr:hover { background:var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom:none; }
.cell-null { color:var(--text-muted); font-style:italic; }
.cell-actions { display:flex; gap:4px; }
.cell-actions button { background:none; border:none; cursor:pointer; font-size:14px; padding:2px 6px; border-radius:3px; transition:background var(--transition); }
.cell-actions button:hover { background:var(--bg-hover); }
.status-btn {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-dim);
  padding: 5px 9px !important;
  font-size: 11px !important;
  font-weight: 600;
  border-radius: 999px !important;
}
.status-btn:hover {
  background: var(--accent-bg) !important;
  color: var(--accent) !important;
  border-color: var(--accent);
}
.status-btn.active,
.status-btn:disabled {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent);
  cursor: default;
}
.table-footer { padding:12px 16px; font-size:12px; color:var(--text-muted); display:flex; align-items:center; justify-content:space-between; }

html[data-theme="light"] .data-table th {
  background: #e6f4fb;
  color: #12384d;
  border-bottom-color: #b9d9ea;
}
html[data-theme="light"] .data-table tbody tr:nth-child(even) {
  background: #fbfdff;
}
html[data-theme="light"] .data-table tbody tr:hover {
  background: #edf8ff;
}

/* ─── Badges ────────────────────────────────────── */
.badge { display:inline-block; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:600; }
.badge-pass{background:var(--green-bg);color:var(--green)}.badge-fail{background:var(--red-bg);color:var(--red)}.badge-warning{background:var(--yellow-bg);color:var(--yellow)}
.badge-pending{background:var(--red-bg);color:var(--red)}.badge-resolved{background:var(--green-bg);color:var(--green)}.badge-appealed{background:var(--orange-bg);color:var(--orange)}

.inspection-list { display:flex; flex-direction:column; gap:8px; }
.inspection-row { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; background:var(--bg); border-radius:var(--radius-sm); gap:10px; }
.inspection-info { flex:1; }
.inspection-name { font-size:13px; font-weight:600; color:var(--text); }
.inspection-meta { font-size:11px; color:var(--text-muted); margin-top:2px; }

/* ─── SQL Console ───────────────────────────────── */
.console-area { display:flex; flex-direction:column; gap:14px; }
.console-editor { border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; background:var(--bg-card); }
.console-toolbar { display:flex; justify-content:space-between; align-items:center; padding:10px 14px; border-bottom:1px solid var(--border); background:var(--bg-elevated); }
.console-label { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--text-muted); }
.console-btns { display:flex; gap:6px; }
#sql-input { width:100%; min-height:140px; padding:14px 16px; background:var(--bg-input); color:var(--text); border:none; outline:none; font-family:'SF Mono','Fira Code','Consolas',monospace; font-size:13px; line-height:1.6; resize:vertical; }
#sql-input::placeholder { color:var(--text-muted); }
.console-presets { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.presets-label { font-size:11px; font-weight:600; color:var(--text-muted); white-space:nowrap; }
.preset-chips { display:flex; gap:6px; flex-wrap:wrap; }
.preset-chip { padding:5px 12px; background:var(--bg-card); border:1px solid var(--border); border-radius:20px; font-size:11px; font-weight:500; color:var(--text-dim); cursor:pointer; transition:all var(--transition); }
.preset-chip:hover { background:var(--accent-bg); border-color:var(--accent); color:var(--accent); }
.console-result { border:1px solid var(--border); border-radius:var(--radius); background:var(--bg-card); min-height:200px; overflow:auto; max-height:45vh; }
.result-placeholder { padding:60px 20px; text-align:center; color:var(--text-muted); font-size:13px; }
.result-message { padding:16px 20px; font-size:13px; color:var(--green); font-weight:500; }
.result-error { padding:16px 20px; font-size:13px; color:var(--red); font-weight:500; font-family:'SF Mono','Fira Code',monospace; }
.result-meta { padding:10px 14px; font-size:11px; color:var(--text-muted); border-top:1px solid var(--border); background:var(--bg-elevated); }

html[data-theme="light"] .console-toolbar,
html[data-theme="light"] .result-meta {
  background: #e6f4fb;
}
html[data-theme="light"] .preset-chip {
  border-radius: 4px;
  background: #ffffff;
}

/* ─── Modal ─────────────────────────────────────── */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:500; justify-content:center; align-items:center; backdrop-filter:blur(4px); }
.modal-overlay.open { display:flex; animation:fadeIn 0.2s ease; }
.modal { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); width:90%; max-width:520px; max-height:80vh; display:flex; flex-direction:column; }
.modal-header { display:flex; justify-content:space-between; align-items:center; padding:18px 20px; border-bottom:1px solid var(--border); }
.modal-header h3 { font-size:16px; font-weight:700; }
.modal-close { background:none; border:none; color:var(--text-muted); font-size:18px; cursor:pointer; padding:4px 8px; border-radius:4px; transition:all var(--transition); }
.modal-close:hover { background:var(--bg-hover); color:var(--text); }
.modal-body { padding:20px; overflow-y:auto; display:flex; flex-direction:column; gap:14px; }
.form-group label { display:block; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.5px; color:var(--text-muted); margin-bottom:5px; }
.form-group input,.form-group select { width:100%; padding:9px 12px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text); font-family:inherit; font-size:13px; outline:none; transition:border var(--transition); }
.form-group input:focus,.form-group select:focus { border-color:var(--accent); }
.modal-footer { padding:14px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; }
.confirm-modal { max-width: 440px; }
.confirm-message { color: var(--text-dim); line-height: 1.6; font-size: 13px; }

/* ─── Architecture Page ─────────────────────────── */
.arch-full { max-width: 900px; }

/* ─── Teacher Mode ──────────────────────────────── */
.teacher-layout { display:flex; flex-direction:column; gap:16px; max-width:1100px; }
.teacher-hero {
  background:var(--bg-card); border:1px solid var(--border);
  border-left:5px solid var(--accent); border-radius:var(--radius);
  padding:22px 24px;
}
.teacher-hero h3 { font-size:20px; margin-bottom:8px; }
.teacher-hero p { color:var(--text-dim); line-height:1.7; max-width:900px; }
.teacher-flow { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
.teacher-flow div {
  background:var(--bg); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:12px;
}
.teacher-flow strong { display:block; color:var(--text); margin-bottom:5px; }
.teacher-flow span { color:var(--text-dim); font-size:12px; line-height:1.5; }
.teacher-grid { display:grid; grid-template-columns:1.15fr 0.85fr; gap:16px; }
.teacher-list { margin-left:18px; color:var(--text-dim); line-height:1.7; }
.teacher-list li { margin-bottom:6px; }
.teacher-list strong { color:var(--text); }
.teacher-note {
  margin-top:12px; color:var(--text-dim); line-height:1.6;
  font-size:13px; border-left:4px solid var(--accent);
  padding:10px 12px; background:var(--bg);
}
.relationship-list { display:flex; flex-direction:column; gap:8px; }
.relationship-list div {
  display:flex; justify-content:space-between; align-items:center;
  gap:12px; background:var(--bg); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:10px 12px; color:var(--text-dim);
}
.relationship-list span {
  flex-shrink:0; color:var(--accent); font-weight:700;
  font-size:11px; text-transform:uppercase;
}
.relationship-list.compact div { align-items:flex-start; }
.teacher-steps {
  margin-left:18px; color:var(--text-dim); line-height:1.7;
}
.teacher-steps li { margin-bottom:6px; }
.sql-explain-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.sql-explain-grid pre {
  margin:0; padding:14px; background:var(--bg-input);
  border:1px solid var(--border); border-radius:var(--radius-sm);
  overflow:auto; color:var(--text-dim); font-size:12px; line-height:1.55;
}
.er-diagram {
  position:relative; min-height:560px; overflow:auto;
  background:
    linear-gradient(90deg, rgba(127,127,127,0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(127,127,127,0.06) 1px, transparent 1px),
    var(--bg);
  background-size:24px 24px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px;
}
.er-entity {
  position:absolute; width:220px; background:var(--bg-card);
  border:2px solid var(--border-light); border-radius:8px;
  box-shadow:0 6px 14px rgba(0,0,0,0.12); overflow:hidden;
}
.er-entity strong {
  display:block; background:var(--accent); color:#fff;
  padding:9px 12px; font-size:13px;
}
.er-entity span {
  display:block; padding:6px 12px; color:var(--text-dim);
  border-top:1px solid var(--border); font-size:12px;
}
.er-entity b { color:var(--text); font-size:10px; }
.er-location { left:calc(50% - 110px); top:18px; }
.er-industry { left:58px; top:205px; }
.er-station { right:58px; top:205px; }
.er-inspection { left:22px; top:410px; }
.er-reading { right:58px; top:390px; }
.er-violation { left:calc(50% - 110px); top:380px; }
.er-link {
  position:absolute; color:var(--accent); background:var(--bg-card);
  border:1px solid var(--accent); border-radius:12px;
  padding:3px 8px; font-size:11px; font-weight:800;
  box-shadow:0 1px 4px rgba(0,0,0,0.08);
}
.er-link::before {
  content:""; position:absolute; z-index:-1; background:var(--border-light);
}
.link-location-industry { left:245px; top:158px; }
.link-location-industry::before { width:150px; height:2px; right:-138px; top:50%; transform:rotate(-31deg); transform-origin:right center; }
.link-location-station { right:245px; top:158px; }
.link-location-station::before { width:150px; height:2px; left:-138px; top:50%; transform:rotate(31deg); transform-origin:left center; }
.link-station-reading { right:154px; top:352px; }
.link-station-reading::before { width:2px; height:72px; left:50%; bottom:-72px; }
.link-industry-inspection { left:150px; top:360px; }
.link-industry-inspection::before { width:2px; height:58px; left:50%; bottom:-58px; }
.link-industry-violation { left:310px; top:338px; }
.link-industry-violation::before { width:130px; height:2px; right:-118px; top:50%; transform:rotate(18deg); transform-origin:right center; }
.link-reading-violation { right:310px; top:370px; }
.link-reading-violation::before { width:130px; height:2px; left:-118px; top:50%; transform:rotate(-8deg); transform-origin:left center; }
html[data-theme="light"] .teacher-hero {
  background:#ffffff;
  box-shadow:0 1px 2px rgba(15, 23, 42, 0.06);
}
html[data-theme="light"] .teacher-flow div,
html[data-theme="light"] .relationship-list div {
  background:#fbfdff;
}
html[data-theme="light"] .teacher-note {
  background:#f8fbfd;
}
html[data-theme="light"] .er-diagram {
  background:
    linear-gradient(90deg, rgba(5,150,223,0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(5,150,223,0.07) 1px, transparent 1px),
    #f8fbfd;
}
html[data-theme="light"] .er-entity {
  box-shadow:0 4px 10px rgba(15, 23, 42, 0.08);
}

.arch-diagram {
  display: flex; flex-direction: column; gap: 0;
}

.arch-box {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.arch-box-header {
  padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
}
.arch-box-num {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; padding: 3px 10px; border-radius: 10px;
}
.arch-box-title { font-size: 15px; font-weight: 700; }

.arch-box-body {
  display: flex; gap: 16px; padding: 16px 20px 20px;
}
.arch-box-icon { font-size: 36px; flex-shrink: 0; }
.arch-box-details { flex: 1; }
.arch-box-details p { font-size: 12px; color: var(--text-dim); line-height: 1.6; margin-bottom: 4px; }
.arch-box-details ul { margin: 6px 0 8px 20px; }
.arch-box-details li { font-size: 12px; color: var(--text-dim); line-height: 1.7; }

.arch-tech-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.pill {
  padding: 3px 10px; border-radius: 12px; font-size: 10px;
  font-weight: 600; background: var(--bg); border: 1px solid var(--border);
  color: var(--text-dim);
}

.tier-pres { background: rgba(108,99,255,0.04); border-color: rgba(108,99,255,0.2); }
.tier-pres .arch-box-header { background: rgba(108,99,255,0.08); }
.tier-pres .arch-box-num { background: var(--accent-bg); color: var(--accent); }

.tier-app { background: rgba(96,165,250,0.04); border-color: rgba(96,165,250,0.2); }
.tier-app .arch-box-header { background: rgba(96,165,250,0.08); }
.tier-app .arch-box-num { background: var(--blue-bg); color: var(--blue); }

.tier-data { background: rgba(52,211,153,0.04); border-color: rgba(52,211,153,0.2); }
.tier-data .arch-box-header { background: rgba(52,211,153,0.08); }
.tier-data .arch-box-num { background: var(--green-bg); color: var(--green); }

.arch-connector {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
}
.connector-line { flex: 1; height: 1px; border-top: 2px dashed var(--border-light); }
.connector-label { font-size: 10px; font-weight: 600; color: var(--text-muted); white-space: nowrap; letter-spacing: 0.4px; }

/* Flow steps */
.flow-steps { display: flex; flex-direction: column; gap: 8px; }
.flow-step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 16px; background: var(--bg);
  border-radius: var(--radius-sm);
}
.flow-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.flow-content { flex: 1; }
.flow-content strong { font-size: 13px; display: block; margin-bottom: 2px; }
.flow-content p { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* Warning highlight for simulated inspections ───────── */
.data-table tbody tr.row-warning {
  background: rgba(251,191,36,0.16) !important;
  box-shadow: inset 0 0 0 1px rgba(251,191,36,0.35);
  animation: warnPulse 1.2s ease-in-out infinite;
}

.data-table tbody tr.row-violation {
  background: rgba(248,113,113,0.16) !important;
  box-shadow: inset 0 0 0 1px rgba(248,113,113,0.35);
  animation: violationPulse 1.1s ease-in-out infinite;
}

.data-table tbody tr.row-new {
  animation: rowSlideIn 0.55s ease, newRowGlow 1.6s ease-out;
  transform-origin: top center;
}

@keyframes warnPulse {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.15); }
  100% { filter: brightness(1); }
}

@keyframes violationPulse {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
  100% { filter: brightness(1); }
}

@keyframes rowSlideIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes newRowGlow {
  0% { box-shadow: inset 0 0 0 999px rgba(11,143,220,0.14); }
  100% { box-shadow: inset 0 0 0 999px rgba(11,143,220,0); }
}

/* ─── Toast Notifications ───────────────────────── */
.toast { position:fixed; bottom:20px; right:20px; padding:12px 20px; border-radius:var(--radius-sm); font-size:13px; font-weight:500; z-index:1000; animation:slideIn 0.3s ease,fadeOut 0.3s ease 2.7s forwards; max-width:400px; }
.toast-success { background:var(--green-bg); color:var(--green); border:1px solid rgba(52,211,153,0.3); }
.toast-error { background:var(--red-bg); color:var(--red); border:1px solid rgba(248,113,113,0.3); }
@keyframes slideIn { from{transform:translateX(50px);opacity:0} to{transform:translateX(0);opacity:1} }
@keyframes fadeOut { to{opacity:0;transform:translateY(10px)} }


/* ─── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--border-light); }

/* ─── Responsive ────────────────────────────────── */
@media (max-width:900px) {
  .login-container { flex-direction:column; align-items:center; }
  .login-card, .arch-card { width:100%; max-width:420px; }
  .sidebar { width:60px; min-width:60px; }
  .sidebar-brand>div,.brand-sub,.nav-section-label,.sidebar-footer span,.user-info,.nav-text { display:none; }
  .sidebar-brand { justify-content:center; padding:16px 10px; }
  .user-badge { justify-content:center; padding:10px; }
  .logout-btn { display:none; }
  .nav-item { justify-content:center; padding:10px; }
  .main { margin-left:60px; padding:20px 16px; }
  .dashboard-panels { grid-template-columns:1fr; }
  .violations-charts { grid-template-columns:1fr; }
  .teacher-flow, .teacher-grid, .sql-explain-grid { grid-template-columns:1fr; }
  .er-diagram { min-height:auto; display:flex; flex-direction:column; gap:10px; }
  .er-entity { position:static; width:100%; }
  .er-link { position:static; width:max-content; align-self:center; }
  .er-link::before { display:none; }
}
