/* ───────────── KPIs ───────────── */
.kpi-grid { display: grid; gap: 14px; margin-bottom: 22px; }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-2 { grid-template-columns: repeat(2, 1fr); }
.kpi {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--line); padding: 16px 18px; position: relative;
}
.kpi-label {
  font-size: 11px; color: var(--ink-3); font-weight: 500;
  text-transform: uppercase; letter-spacing: .06em;
}
.kpi-value {
  font-family: 'Inter Tight'; font-size: 28px; font-weight: 600;
  margin: 6px 0 4px; letter-spacing: -0.02em; color: var(--ink);
}
.kpi-value.sm { font-size: 20px; }
.kpi-sub {
  font-size: 12px; color: var(--ink-3);
  display: flex; align-items: center; gap: 4px;
}
.kpi-sub.up { color: var(--ok); }
.kpi-sub.down { color: var(--err); }
.kpi-sub.warn { color: var(--warn); }
.kpi-trend {
  position: absolute; top: 14px; right: 16px;
  width: 60px; height: 24px; color: var(--ink-5);
}

/* ───────────── PANELS ───────────── */
.panel {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--line); margin-bottom: 18px; overflow: hidden;
}
.ph {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
}
.ph-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.ph-meta { font-size: 12px; color: var(--ink-4); font-weight: 500; }
.pb { padding: 18px; }
.pb-tight { padding: 6px 18px; }
.pb-flush { padding: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }

/* ───────────── TABLES ───────────── */
.dt { width: 100%; border-collapse: collapse; font-size: 13px; }
.dt th {
  text-align: left; padding: 11px 18px; color: var(--ink-3);
  font-weight: 600; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.dt td {
  padding: 12px 18px; border-bottom: 1px solid var(--line-2);
  color: var(--ink-2);
}
.dt tr:last-child td { border-bottom: none; }
.dt tr:hover td { background: var(--bg); }
.dt td.strong { color: var(--ink); font-weight: 500; }
.dt td.muted { color: var(--ink-4); }

/* ───────────── BADGES ───────────── */
.badge {
  font-size: 11px; padding: 3px 9px; border-radius: 20px;
  font-weight: 500; white-space: nowrap; display: inline-block;
  letter-spacing: 0; border: 1px solid transparent;
}
.b-green { background: #E8F3EC; color: #0F6E4D; border-color: #D0E6D8; }
.b-amber { background: #FEF3DC; color: #925A0E; border-color: #F8E5B8; }
.b-red { background: #FCE8E3; color: #A8281A; border-color: #F4D2C9; }
.b-blue { background: #E2EEFB; color: #1F4E94; border-color: #C9DEF5; }
.b-purple { background: #EDE8FB; color: #4F3BA0; border-color: #DDD4F2; }
.b-gray { background: var(--line-2); color: var(--ink-3); border-color: var(--line); }
.b-cyan { background: #DCF1F1; color: #0E5E5D; border-color: #BFE3E2; }

/* ───────────── BUTTONS ───────────── */
.btn {
  padding: 8px 14px; border-radius: 8px; font-size: 13px;
  cursor: pointer; font-weight: 500; transition: .14s;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; border: 1px solid transparent; line-height: 1;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: #A82917; }
.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover { background: #0C6E4B; }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-sm svg { width: 12px; height: 12px; }

/* ───────────── FORMS ───────────── */
.input-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.input-label {
  font-size: 11px; color: var(--ink-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.input-field {
  padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; color: var(--ink);
  outline: none; background: var(--surface); width: 100%;
  transition: .12s;
}
.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-field::placeholder { color: var(--ink-4); }
textarea.input-field { resize: vertical; font-family: inherit; }

/* ───────────── STAT ROWS ───────────── */
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13px;
}
.stat-row:last-child { border-bottom: none; }
.sl { color: var(--ink-3); }
.sv { font-weight: 500; color: var(--ink); }

/* ───────────── PROGRESS ───────────── */
.progress-wrap { background: var(--line-2); border-radius: 6px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 6px; transition: width .6s; }

/* ───────────── TIMELINE ───────────── */
.timeline-item {
  display: flex; gap: 14px; padding: 13px 0;
  border-bottom: 1px solid var(--line-2); font-size: 13px; align-items: flex-start;
}
.timeline-item:last-child { border-bottom: none; }
.tl-time {
  color: var(--ink-4); font-size: 11px; min-width: 64px;
  padding-top: 2px; font-weight: 500; font-family: 'JetBrains Mono';
}
.tl-content { flex: 1; min-width: 0; }
.tl-title {
  font-weight: 500; font-size: 13px; color: var(--ink);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.tl-sub { color: var(--ink-3); font-size: 12px; margin-top: 3px; }

/* ───────────── MESSAGES ───────────── */
.msg-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line-2); cursor: pointer;
}
.msg-item:hover { background: var(--bg); margin: 0 -18px; padding: 12px 18px; }
.msg-item:last-child { border-bottom: none; }
.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--line-2); color: var(--ink-2);
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.msg-body { flex: 1; min-width: 0; }
.msg-from {
  font-size: 13px; font-weight: 500; color: var(--ink);
  display: flex; align-items: center; gap: 6px;
}
.msg-preview {
  font-size: 12px; color: var(--ink-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.msg-time { font-size: 11px; color: var(--ink-4); }

/* ───────────── FEED ───────────── */
.feed-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line-2); font-size: 13px; align-items: flex-start;
}
.feed-item:last-child { border-bottom: none; }
.feed-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; background: var(--line-2); color: var(--ink-2);
}
.feed-icon.alert { background: #FCE8E3; color: var(--err); }
.feed-icon.warn { background: #FEF3DC; color: var(--warn); }
.feed-icon.ok { background: #E8F3EC; color: var(--ok); }
.feed-icon.info { background: #E2EEFB; color: var(--info); }
.feed-icon.brand { background: var(--accent-soft); color: var(--accent); }
.feed-body { flex: 1; min-width: 0; }
.feed-title { font-weight: 500; font-size: 13px; color: var(--ink); }
.feed-meta { font-size: 12px; color: var(--ink-4); margin-top: 2px; }

/* ───────────── SYSTEM GRID ───────────── */
.sys-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.sys-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
}
.sys-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.s-ok { background: var(--ok); }
.s-warn { background: var(--warn); }
.s-err { background: var(--err); }
.sys-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.sys-meta { font-size: 11px; color: var(--ink-4); margin-top: 2px; font-family: 'JetBrains Mono'; }

/* ───────────── ATTENDANCE ───────────── */
.att-toggle { display: flex; gap: 5px; }
.att-btn {
  padding: 5px 11px; border-radius: 6px; font-size: 11px;
  font-weight: 600; cursor: pointer; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-3); transition: .14s;
  letter-spacing: .04em;
}
.att-btn:hover { border-color: var(--ink-5); }
.att-btn.p { background: #E8F3EC; color: #0F6E4D; border-color: #D0E6D8; }
.att-btn.a { background: #FCE8E3; color: #A8281A; border-color: #F4D2C9; }
.att-btn.l { background: #FEF3DC; color: #925A0E; border-color: #F8E5B8; }
.att-day { text-align: center; }
.att-dot {
  width: 30px; height: 30px; border-radius: 8px;
  margin: 0 auto; display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 600;
}
.ad-present { background: #E8F3EC; color: #0F6E4D; }
.ad-absent { background: #FCE8E3; color: #A8281A; }
.ad-late { background: #FEF3DC; color: #925A0E; }
.ad-holiday { background: var(--line-2); color: var(--ink-4); }

/* ───────────── SCHEDULE ───────────── */
.sch-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--line-2); font-size: 13px;
}
.sch-row:last-child { border-bottom: none; }
.sch-time { font-size: 12px; color: var(--ink-3); min-width: 108px; font-weight: 500; font-family: 'JetBrains Mono'; }
.sch-subj { flex: 1; font-weight: 500; color: var(--ink); }
.sch-loc { font-size: 12px; color: var(--ink-4); }
.sch-tag { width: 3px; align-self: stretch; border-radius: 3px; background: var(--accent); }

/* ───────────── CHARTS ───────────── */
.chart-bar-wrap {
  display: flex; align-items: flex-end; gap: 10px;
  height: 140px; padding-top: 24px;
}
.chart-bar {
  flex: 1; border-radius: 6px 6px 0 0;
  background: var(--accent-soft); position: relative;
  transition: .25s; min-height: 6px; cursor: pointer;
}
.chart-bar:hover { background: var(--accent); }
.chart-bar.active { background: var(--accent); }
.chart-bar span {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: var(--ink-3); white-space: nowrap;
  font-weight: 600; font-family: 'JetBrains Mono';
}
.chart-labels { display: flex; gap: 10px; margin-top: 8px; }
.chart-label { flex: 1; text-align: center; font-size: 11px; color: var(--ink-4); font-weight: 500; }

/* ───────────── TOAST ───────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--ink); color: #fff;
  padding: 14px 18px; border-radius: var(--radius);
  font-size: 13px; display: none; align-items: center; gap: 12px;
  box-shadow: 0 14px 36px rgba(0,0,0,.18); z-index: 100; max-width: 400px;
}
#toast.show { display: flex; animation: slideIn .25s ease-out; }
.toast-icon { width: 18px; height: 18px; color: var(--ok); flex-shrink: 0; }
.toast-meta { font-size: 11px; color: #9A9AA2; margin-top: 3px; font-family: 'JetBrains Mono'; }

/* ───────────── HASH ───────────── */
.hash {
  font-family: 'JetBrains Mono'; font-size: 11px; color: var(--ink-3);
  background: var(--bg); padding: 2px 7px; border-radius: 5px;
  border: 1px solid var(--line);
}

/* ───────────── CALENDAR ───────────── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head {
  font-size: 11px; color: var(--ink-4); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  text-align: center; padding: 8px 0;
}
.cal-day {
  aspect-ratio: 1.1; border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; display: flex;
  flex-direction: column; font-size: 12px;
  background: var(--surface); cursor: pointer;
  min-height: 74px; transition: .12s;
}
.cal-day:hover { background: var(--bg); border-color: var(--ink-5); }
.cal-day.other { color: var(--ink-5); background: var(--bg); }
.cal-day.today { border: 1.5px solid var(--accent); background: var(--accent-soft); }
.cal-num { font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--ink); }
.cal-day.other .cal-num { color: var(--ink-5); }
.cal-event {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  margin-bottom: 2px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-weight: 500;
}
.ce-exam { background: #FCE8E3; color: #A8281A; }
.ce-event { background: #E2EEFB; color: #1F4E94; }
.ce-holiday { background: #FEF3DC; color: #925A0E; }
.ce-ptm { background: #EDE8FB; color: #4F3BA0; }
.ce-sport { background: #E8F3EC; color: #0F6E4D; }

/* ───────────── TRANSPORT / MAP ───────────── */
.bus-track {
  background: linear-gradient(180deg, #F4FAF6, #EAF5EE);
  border: 1px solid #D0E6D8; border-radius: var(--radius);
  padding: 20px; margin-bottom: 14px;
}
.bus-eta-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bus-eta { font-family: 'Inter Tight'; font-size: 36px; font-weight: 600; color: #0F6E4D; letter-spacing: -0.03em; }
.bus-live {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: #0F6E4D; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
}
.bus-live::before {
  content: ""; width: 6px; height: 6px;
  border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite;
}
.bus-coords { font-size: 11px; color: #0F8A5F; margin-top: 8px; font-family: 'JetBrains Mono'; }
.stop-line { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.stop-line:last-child { border-bottom: none; }
.stop-pin { display: flex; flex-direction: column; align-items: center; padding-top: 5px; }
.stop-circle {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-5); flex-shrink: 0;
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--ink-5);
}
.stop-circle.active { background: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
.stop-line-conn { width: 1px; height: 28px; background: var(--line); margin-top: 3px; }

/* ───────────── RBAC TABLE ───────────── */
.rbac-cell { text-align: center; font-size: 12px; }
.r-yes { color: var(--ok); font-weight: 600; font-size: 14px; }
.r-no { color: var(--ink-5); }
.r-partial { color: var(--warn); font-size: 11px; font-weight: 600; }

/* ───────────── MAP ───────────── */
.map-area {
  background: linear-gradient(120deg, #F0F4FA, #E8EFF8);
  border-radius: var(--radius); height: 200px;
  position: relative; overflow: hidden; border: 1px solid var(--line);
}
.map-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(15,15,20,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,15,20,.04) 1px, transparent 1px);
  background-size: 24px 24px;
}
.map-route {
  position: absolute; top: 50%; left: 8%; right: 8%;
  height: 2px; background: var(--accent); border-radius: 2px;
  transform: translateY(-50%); box-shadow: 0 0 0 4px rgba(79,70,229,.08);
}
.map-pin {
  position: absolute; top: 50%; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent);
  border: 2px solid #fff; transform: translate(-50%,-50%);
  box-shadow: 0 2px 6px rgba(79,70,229,.3);
}
.map-pin.active { background: var(--ok); box-shadow: 0 2px 6px rgba(15,138,95,.4); }
.map-bus {
  position: absolute; top: 50%; width: 30px; height: 30px;
  background: #fff; border-radius: 50%; border: 2px solid var(--ok);
  transform: translate(-50%,-50%);
  display: flex; align-items: center; justify-content: center;
  animation: busMove 12s linear infinite;
  box-shadow: 0 4px 12px rgba(15,138,95,.25); color: var(--ok);
}
@keyframes busMove { 0% { left: 8%; } 100% { left: 92%; } }

/* ───────────── LOADING / EMPTY STATES ───────────── */
.state-loading {
  text-align: center; padding: 48px; color: var(--ink-3);
  font-size: 14px;
}
.state-empty {
  text-align: center; padding: 48px;
}
.state-empty svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 16px; }
.state-empty p { color: var(--ink-3); font-size: 14px; }
.state-error {
  text-align: center; padding: 48px; color: var(--err);
}

/* ───────────── PAGINATION ───────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 18px 0; font-size: 13px; color: var(--ink-3);
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
