/* Lamgong HSS Admin Dashboard — clean, professional, responsive. */
:root {
  --blue: #1e5aa8; --blue-dark: #123a6b; --gold: #f2b705;
  --ok: #1a8f4c; --warn: #c9820a; --bad: #c0392b; --info: #2b6cb0; --muted: #7a869a;
  --bg: #f4f6fb; --panel: #ffffff; --text: #1f2733; --line: #e3e8f0;
  --shadow: 0 1px 3px rgba(16,32,64,.08), 0 4px 16px rgba(16,32,64,.06);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg); color: var(--text); }
h1, h2 { margin: 0; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ---- buttons ---- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 8px; }
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-dark); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.bad { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn:disabled { opacity: .6; cursor: default; }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, var(--blue-dark), var(--blue)); }
.login-card { background: #fff; padding: 32px; border-radius: 16px; width: 100%; max-width: 380px;
  box-shadow: var(--shadow); text-align: center; }
.login-logo { width: 84px; height: 84px; object-fit: contain; }
.login-card h1 { font-size: 19px; margin-top: 10px; color: var(--blue-dark); }
.tagline { color: var(--muted); font-size: 13px; margin: 4px 0 18px; }
.login-card label { display: block; text-align: left; font-size: 13px; font-weight: 600;
  margin-bottom: 12px; color: #444; }
.login-card input { width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; }
.hint { font-size: 12px; color: var(--muted); margin: 12px 0 0; }

/* ---- topbar ---- */
.topbar { display: flex; align-items: center; gap: 16px; background: #fff; padding: 10px 18px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 42px; height: 42px; object-fit: contain; }
.brand-title { font-weight: 700; color: var(--blue-dark); line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.nav-btn { border: none; background: transparent; padding: 8px 14px; border-radius: 8px; color: #445; }
.nav-btn:hover { background: #eef2fa; }
.nav-btn.active { background: var(--blue); color: #fff; }
.user { display: flex; align-items: center; gap: 10px; font-size: 14px; }

/* ---- view + cards ---- */
.view { padding: 20px; max-width: 1200px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card { background: var(--panel); border-radius: 12px; padding: 18px; box-shadow: var(--shadow);
  border-left: 5px solid var(--muted); }
.card.ok { border-color: var(--ok); } .card.warn { border-color: var(--warn); }
.card.bad { border-color: var(--bad); } .card.info { border-color: var(--info); }
.card.muted { border-color: var(--muted); }
.card-value { font-size: 30px; font-weight: 700; }
.card-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }

/* ---- panels + tables ---- */
.panel { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { font-size: 17px; color: var(--blue-dark); }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.controls.wrap { padding: 14px 18px; }
.controls input, .controls select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.controls label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.muted-text { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: #f7f9fd; color: #556; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; position: sticky; top: 0; }
table.data tr:hover td { background: #fafbff; }
td .sub { font-size: 12px; color: var(--muted); }
td.reason { max-width: 220px; }
.empty { text-align: center; color: var(--muted); padding: 26px; }

/* ---- status pills ---- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.ok { background: #e4f5ea; color: var(--ok); }
.pill.warn { background: #fdf1dd; color: var(--warn); }
.pill.bad { background: #fbe6e3; color: var(--bad); }
.pill.info { background: #e5eff9; color: var(--info); }
.pill.muted { background: #eef1f6; color: var(--muted); }

/* ---- reports ---- */
.report { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 22px; }
.report-header { display: flex; gap: 16px; align-items: center; border-bottom: 2px solid var(--blue);
  padding-bottom: 14px; margin-bottom: 16px; }
.report-logo { width: 64px; height: 64px; object-fit: contain; }
.rh-school { font-size: 20px; font-weight: 700; color: var(--blue-dark); }
.rh-sub { color: var(--muted); font-size: 13px; }
.rh-title { font-weight: 600; margin-top: 6px; }
.rh-gen { font-size: 12px; color: var(--muted); }
.summary { color: #445; }
.ind-summary { background: #f7f9fd; border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.report-actions { margin-top: 16px; display: flex; gap: 10px; }

/* ---- toast ---- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(30px);
  background: #223; color: #fff; padding: 12px 18px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 100; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--bad); }

/* ---- settings ---- */
.panel-body { padding: 16px 18px; border-top: 1px solid var(--line); }
.panel-body:first-of-type { border-top: none; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 12px 0; border-bottom: 1px dashed var(--line); }
.setting-row:last-child { border-bottom: none; }
.setting-label { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.setting-label .sub { font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 3px;
  line-height: 1.45; }
.setting-input { flex: 0 0 auto; }
.setting-input input, .setting-input select { padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff; color: var(--text); min-width: 120px; }
.setting-input input:focus, .setting-input select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.warn-banner { background: #fff6e5; border: 1px solid var(--warn); color: #7a5200;
  padding: 12px 14px; border-radius: 10px; line-height: 1.5; }
.error-text { color: var(--bad); font-size: 13px; margin-top: 10px; line-height: 1.5; }
.plain-link { text-decoration: none; }

/* ---- sub-tabs, chips ---- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tab-btn { border: none; background: transparent; padding: 10px 16px; color: #556;
  border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 600; }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #e8f0fa; color: var(--blue-dark);
  padding: 5px 6px 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.chip button { border: none; background: rgba(0,0,0,.08); border-radius: 50%; width: 20px; height: 20px;
  cursor: pointer; color: #556; line-height: 1; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
tr.row-active td { background: #f2f8ff; }

/* ---- campus boundary editor ---- */
.campus-map { height: 380px; border-radius: 10px; border: 1px solid var(--line);
  margin: 12px 0; background: #eef1f6; }
.banner-info { background: #e8f0fa; border: 1px solid #bcd3ee; color: #16406f;
  padding: 11px 13px; border-radius: 10px; font-size: 13.5px; line-height: 1.5;
  margin-bottom: 12px; }
.corner-list { margin: 12px 0 4px; padding-left: 22px; max-height: 210px; overflow-y: auto; }
.corner-list li { padding: 3px 0; }
.mono-sm { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.btn.sm { padding: 2px 8px; min-height: auto; font-size: 12px; }
.field-inline { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 13px; color: var(--muted); }
.field-inline input { width: 90px; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; }

@media (max-width: 640px) {
  .nav { width: 100%; order: 3; } .user { margin-left: auto; }
  .campus-map { height: 300px; }
  .view { padding: 12px; }
  /* Stack label above control so long help text is not squeezed to one word. */
  .setting-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .setting-input input, .setting-input select { width: 100%; }
}

/* ---- print (PDF) ---- */
@media print {
  .topbar, .no-print, .toast { display: none !important; }
  body { background: #fff; }
  .view { padding: 0; max-width: none; }
  .report { box-shadow: none; padding: 0; }
  table.data th { position: static; }
}
