/* ============================================================
   BẢNG SỐ LIỆU GIÁO VIÊN

   Màu của phần biểu đồ lấy nguyên từ bảng màu đã được kiểm định
   (độ tương phản + phân biệt được với người mù màu). Không tự chế
   màu mới cho dữ liệu.
============================================================ */

:root {
  /* nền & chữ */
  --surface-1:      #fcfcfb;
  --plane:          #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --hairline:       rgba(11, 11, 11, 0.10);

  /* dữ liệu */
  --series-1:       #2a78d6;   /* xanh dương — ô dữ liệu một chuỗi */
  --status-good:    #0ca30c;
  --status-crit:    #d03b3b;

  /* giao diện, lấy theo màu thương hiệu của app */
  --brand:          #4F46E5;
  --brand-grad:     linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-1:      #1a1a19;
    --plane:          #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --grid:           #2c2c2a;
    --baseline:       #383835;
    --hairline:       rgba(255, 255, 255, 0.10);
    --series-1:       #3987e5;
  }
}

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--plane);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  padding: 0;
}

/* ---------------- đăng nhập ---------------- */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-box {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 28px;
  width: 100%; max-width: 380px;
  text-align: center;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.2);
}
.login-emoji { font-size: 2.4rem; line-height: 1; margin-bottom: 8px; }
.login-box h1 { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.login-box p { color: var(--text-secondary); font-size: 0.88rem; margin-bottom: 16px; }
.login-input {
  width: 100%; padding: 11px 14px; margin-bottom: 10px;
  border: 2px solid var(--grid); border-radius: 10px;
  background: var(--plane); color: var(--text-primary);
  font-size: 0.95rem; font-family: inherit; outline: none;
}
.login-input:focus { border-color: var(--brand); }
.login-error {
  display: none; margin-top: 10px; padding: 9px 12px;
  background: rgba(208, 59, 59, 0.10); color: var(--status-crit);
  border-radius: 8px; font-size: 0.84rem; font-weight: 600;
}
.login-hint { font-size: 0.76rem; color: var(--text-muted); margin-top: 14px; margin-bottom: 0; }
code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  background: var(--grid); padding: 1px 5px; border-radius: 4px; font-size: 0.86em;
}

/* ---------------- nút ---------------- */
.btn {
  background: var(--brand-grad); color: #fff; border: none;
  border-radius: 10px; padding: 9px 16px;
  font-size: 0.88rem; font-weight: 700; font-family: inherit;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn.ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--baseline);
}

/* ---------------- bố cục ---------------- */
.dash { display: none; max-width: 1000px; margin: 0 auto; padding: 20px 16px 60px; }

.dash-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.dash-head h1 { font-size: 1.5rem; font-weight: 800; }
.sub { color: var(--text-muted); font-size: 0.82rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 16px;
}
.panel h2 { font-size: 1.02rem; font-weight: 800; margin-bottom: 4px; }
.note { color: var(--text-secondary); font-size: 0.84rem; margin-bottom: 14px; }

/* ---------------- ô số liệu ---------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.tile {
  background: var(--plane); border: 1px solid var(--hairline);
  border-radius: 12px; padding: 14px;
}
.tile-v { font-size: 1.7rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.tile-k { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; margin-top: 2px; }

/* ---------------- biểu đồ ---------------- */
.chart-host { width: 100%; overflow-x: auto; }
.chart { width: 100%; height: auto; display: block; min-width: 460px; }
.chart .ax   { font-size: 11px; fill: var(--text-muted); font-family: inherit; }
.chart .ax-t { font-size: 11px; fill: var(--text-secondary); font-family: inherit; font-weight: 600; }
.chart .lbl  { font-size: 11px; fill: var(--text-primary); font-family: inherit; font-weight: 700; }
.chart .val  {
  font-size: 11px; fill: var(--text-secondary); font-family: inherit;
  font-weight: 700; font-variant-numeric: tabular-nums;
}

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.lg { font-size: 0.82rem; color: var(--text-secondary); font-weight: 600; }
.lg-sym { font-size: 0.9rem; margin-right: 4px; }

.conclusion {
  margin-top: 14px; padding: 12px 14px;
  background: var(--plane); border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  font-size: 0.86rem; color: var(--text-secondary); line-height: 1.6;
}
.conclusion b { color: var(--text-primary); }

.empty {
  padding: 28px 16px; text-align: center;
  color: var(--text-muted); font-size: 0.86rem;
  background: var(--plane); border-radius: 10px;
}

/* ---------------- bảng ---------------- */
.table-host { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.82rem; min-width: 720px; }
.tbl th {
  text-align: left; padding: 8px 10px;
  border-bottom: 2px solid var(--baseline);
  color: var(--text-secondary); font-weight: 700; white-space: nowrap;
}
.tbl td {
  padding: 8px 10px; border-bottom: 1px solid var(--grid);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tbl tbody tr:hover { background: var(--plane); }
.tbl td.good { color: var(--status-good); font-weight: 700; }
.tbl td.bad  { color: var(--status-crit); font-weight: 700; }

@media (max-width: 640px) {
  .dash-head { flex-direction: column; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
}
