/* ─────────────────────────────────────────────────────────────
   ระบบสำรวจงบประมาณคงเหลือ ปี 69 — Custom overrides
   (Bootstrap 5 + Bootstrap Icons + Highcharts)
   ───────────────────────────────────────────────────────────── */

:root {
  --bs-body-font-family: 'Sarabun', 'Tahoma', system-ui, sans-serif;
  --brand:        #0e7490;
  --brand-dark:   #155e75;
  --brand-soft:   #ecfeff;
  --brand-border: #a5f3fc;
}

body {
  font-family: var(--bs-body-font-family);
  font-size: 15px;
}

/* ─── Navbar ───────────────────────────────────────────────── */
.app-navbar {
  background: var(--brand-dark);
}
.app-navbar .navbar-brand .brand-mark {
  background: #fff;
  color: var(--brand-dark);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.app-navbar .navbar-brand .brand-logo {
  height: 38px;
  width: 38px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 2px;
}
.app-navbar .nav-link {
  color: rgba(255, 255, 255, .85);
  padding: 6px 14px !important;
  border-radius: 6px;
}
.app-navbar .nav-link:hover,
.app-navbar .nav-link.active {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

/* ─── Stat cards ───────────────────────────────────────────── */
.stat-card {
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  background: #fff;
  padding: 1rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
}
.stat-card .stat-label {
  color: var(--bs-secondary-color);
  font-size: 13px;
  font-weight: 500;
}
.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--bs-body-color);
  font-variant-numeric: tabular-nums;
}
.stat-card.highlight {
  background: var(--brand-soft);
  border-color: var(--brand-border);
}
.stat-card.highlight .stat-value { color: var(--brand-dark); }
.stat-card.warn {
  background: #fff7ed;
  border-color: #fed7aa;
}
.stat-card.warn .stat-value { color: #b45309; }

/* ─── Tables ───────────────────────────────────────────────── */
.table-bj { font-size: 14px; vertical-align: top; }
.table-bj th {
  font-size: 13px;
  font-weight: 600;
  color: var(--bs-secondary-color);
  background: #f9fafb;
}
.table-bj th small {
  display: block;
  font-weight: 400;
  color: var(--bs-tertiary-color);
}
.table-bj .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table-bj tr.row-filled   { background-color: #f0fdfa70; }
.table-bj tr.row-unfilled { background-color: transparent; }

.cell-head { font-weight: 600; color: var(--bs-body-color); }
.cell-sub  { color: var(--bs-secondary-color); font-size: 13px; }
.cell-tag  { display: inline-block; margin-top: 4px; color: var(--bs-tertiary-color); font-size: 12px; }
.project   { max-width: 360px; font-size: 13.5px; white-space: pre-wrap; }

.val-set    { color: var(--bs-body-color); font-weight: 500; }
.val-unset  { color: var(--bs-tertiary-color); }
.val-total  { color: #047857; font-weight: 600; }
.val-neg    { color: #b91c1c; font-weight: 600; }

/* ─── Edit form ────────────────────────────────────────────── */
.calc-box {
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: .5rem;
  padding: .9rem 1.1rem;
}
.calc-box .calc-label { color: var(--bs-secondary-color); font-size: 13px; }
.calc-box .calc-value {
  color: var(--brand-dark);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.calc-box small { color: var(--bs-tertiary-color); font-size: 12px; }

.kv-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: .5rem 1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--bs-border-color-translucent);
  font-size: 14px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .kv-label { color: var(--bs-secondary-color); font-weight: 500; }
.kv-row .kv-value { color: var(--bs-body-color); }
.kv-row .kv-value.pre { white-space: pre-wrap; }
.kv-row .num-big {
  font-size: 19px;
  font-weight: 700;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}

/* ─── Auth (login) page ────────────────────────────────────── */
.auth-bg {
  min-height: 100vh;
  background: #eef1f5;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--bs-border-color);
  border-top: 3px solid var(--brand);
  border-radius: .375rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.auth-logo {
  height: 84px;
  width: 84px;
  object-fit: contain;
}

/* ─── Brand color helpers ──────────────────────────────────── */
.btn-brand {
  background-color: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-brand:hover,
.btn-brand:focus {
  background-color: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn-outline-brand {
  color: var(--brand-dark);
  border-color: var(--brand);
}
.btn-outline-brand:hover {
  background-color: var(--brand);
  color: #fff;
}
.text-brand { color: var(--brand-dark) !important; }

/* ─── Analytics charts ─────────────────────────────────────── */
.chart-box   { min-height: 320px; }
.chart-box.tall { min-height: 420px; }

.bar-cell {
  position: relative;
  background: #f1f3f7;
  border-radius: 99px;
  height: 18px;
  min-width: 90px;
  overflow: hidden;
}
.bar-cell .bar-fill {
  background: var(--brand);
  height: 100%;
  border-radius: 99px;
}
.bar-cell span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ─── Misc ─────────────────────────────────────────────────── */
.page-title { font-size: 22px; font-weight: 600; margin: 0; }
.page-subtitle { color: var(--bs-secondary-color); font-weight: 400; font-size: 17px; }
