:root {
  --bsg-navy: #1f3a68;
  --bsg-navy-2: #2b4f8c;
  --bsg-saffron: #f59e0b;
  --bsg-green: #15803d;
  --scout: #2563eb;
  --guide: #7c3aed;
  --cub: #0891b2;
  --bulbul: #db2777;
  --surface: #ffffff;
  --page: #f3f5fa;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e5e9f2;
  --radius: 16px;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--page);
  color: var(--ink);
}

/* ---------- navbar ---------- */
.app-nav {
  background: linear-gradient(120deg, var(--bsg-navy), var(--bsg-navy-2));
  box-shadow: 0 4px 20px rgba(31, 58, 104, .25);
}
.app-nav .navbar-brand, .app-nav .nav-link { color: #fff; }
.app-nav .nav-link:hover { color: #ffd78a; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--bsg-saffron); color: var(--bsg-navy); font-size: 1.3rem;
}
.brand-sub { color: #c7d4ee; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.user-chip { background: rgba(255,255,255,.12); border-radius: 999px; padding: .35rem .9rem !important; }

/* ---------- cards ---------- */
.card-soft {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .04);
}
.section-title { font-weight: 700; font-size: 1.05rem; margin: 0; }
.text-muted-2 { color: var(--muted); }

.hero {
  background: radial-gradient(circle at 90% 10%, rgba(245,158,11,.35), transparent 40%),
              linear-gradient(120deg, var(--bsg-navy), #34609f);
  color: #fff; border-radius: 22px; padding: 1.75rem; position: relative; overflow: hidden;
}
.hero::after {
  content: '\F2F5'; font-family: 'bootstrap-icons'; position: absolute; right: -10px; bottom: -40px;
  font-size: 11rem; opacity: .07;
}
.hero .badge-type { background: rgba(255,255,255,.16); font-weight: 600; }
.hero .meta { color: #d5def0; font-size: .9rem; }

.stat {
  padding: 1.1rem 1.2rem; display: flex; gap: 1rem; align-items: center;
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0;
}
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 500; }

.unit-Scout   { --unit: var(--scout); }
.unit-Guide   { --unit: var(--guide); }
.unit-Cub     { --unit: var(--cub); }
.unit-Bulbul  { --unit: var(--bulbul); }
.unit-Scouts  { --unit: var(--scout); }
.unit-Guides  { --unit: var(--guide); }
.unit-Cubs    { --unit: var(--cub); }
.unit-Bulbuls { --unit: var(--bulbul); }
.tint { background: color-mix(in srgb, var(--unit, var(--bsg-navy)) 12%, white); color: var(--unit, var(--bsg-navy)); }
.unit-pill {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; background: color-mix(in srgb, var(--unit) 12%, white); color: var(--unit);
}
.progress-thin { height: 8px; border-radius: 99px; background: #eef1f7; }
.progress-thin .progress-bar { background: var(--unit, var(--bsg-green)); border-radius: 99px; }

/* ---------- leader cards ---------- */
.leader-card { border: 1.5px dashed var(--line); border-radius: 14px; padding: 1rem; height: 100%; transition: .2s; }
.leader-card.filled { border-style: solid; border-color: color-mix(in srgb, var(--unit) 35%, white); background: color-mix(in srgb, var(--unit) 4%, white); }
.leader-card:hover { box-shadow: 0 6px 18px rgba(15,23,42,.08); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--unit); color: #fff;
}

/* ---------- table ---------- */
.table-modern { margin: 0; }
.table-modern thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  background: #f8fafd; border-bottom: 1px solid var(--line); font-weight: 700; white-space: nowrap;
}
.table-modern td { vertical-align: middle; border-color: var(--line); }
.table-modern tbody tr:hover { background: #fafbff; }
.measure { font-size: .8rem; color: var(--muted); min-width: 260px; max-width: 420px; line-height: 1.6; }
.measure b { color: var(--ink); font-weight: 600; }
.detail-tag {
  display: inline-block; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: .05rem .45rem; border-radius: 6px; margin-right: .35rem; background: #e7f6ec; color: var(--bsg-green);
}
.detail-tag.short { background: #eef2ff; color: #4f46e5; }

/* short / brief toggle in forms */
.mode-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1.25rem; }
.mode-btn {
  display: flex; align-items: center; gap: .7rem; text-align: left; padding: .7rem .9rem; border-radius: 14px;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); transition: .15s;
}
.mode-btn i { font-size: 1.25rem; color: var(--muted); }
.mode-btn span { display: flex; flex-direction: column; line-height: 1.25; }
.mode-btn small { color: var(--muted); font-size: .74rem; }
.mode-btn:hover { border-color: #c7d2e6; }
.mode-btn.active { border-color: var(--bsg-navy-2); background: #f2f6fd; box-shadow: 0 0 0 3px rgba(43,79,140,.12); }
.mode-btn.active i { color: var(--bsg-navy-2); }
.form-head .avatar { width: 46px; height: 46px; font-size: 1.3rem; }
.size-badge {
  display: inline-grid; place-items: center; min-width: 38px; height: 30px; border-radius: 8px; font-weight: 800;
  background: #fff7e6; color: #b45309; border: 1px solid #fde3b0;
}
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 10px; }

.upload-step { display: flex; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; margin-bottom: .8rem; }
.step-no {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: var(--bsg-navy); color: #fff; font-weight: 800; font-size: .85rem;
}

.student-group { border-top: 1px solid var(--line); }
.group-head {
  padding: .9rem 1.5rem; background: color-mix(in srgb, var(--unit) 6%, white);
  border-left: 4px solid var(--unit);
}
.group-avatar { width: 38px; height: 38px; font-size: 1.1rem; }
.btn-unit { background: var(--unit); color: #fff; font-weight: 600; border-radius: 10px; border: 0; }
.btn-unit:hover { background: color-mix(in srgb, var(--unit) 85%, black); color: #fff; }

.empty-state { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.empty-state i { font-size: 2.6rem; color: #cbd5e1; }

/* ---------- buttons / forms ---------- */
.btn-brand { background: var(--bsg-navy); color: #fff; border: 0; font-weight: 600; border-radius: 12px; }
.btn-brand:hover { background: var(--bsg-navy-2); color: #fff; }
.btn-saffron { background: var(--bsg-saffron); color: #1f2937; border: 0; font-weight: 700; border-radius: 12px; }
.btn-saffron:hover { background: #fbbf24; }
.form-control, .form-select { border-radius: 10px; border-color: #dbe1ec; padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--bsg-navy-2); box-shadow: 0 0 0 .2rem rgba(43,79,140,.15); }
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.fieldset-title {
  font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--bsg-navy);
  display: flex; align-items: center; gap: .5rem; margin: .25rem 0 .9rem;
}
.fieldset-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.modal-content { border-radius: 20px; }
/* forms wrap header/body/footer, so let the form carry the scrollable-modal layout */
#modal-content > form { display: flex; flex-direction: column; max-height: 100%; overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-footer { border-top: 1px solid var(--line); }
.measure-guide { background: #f8fafd; border-radius: 12px; padding: .75rem 1rem; font-size: .8rem; color: var(--muted); }

.filter-chip .btn { border-radius: 999px; font-weight: 600; font-size: .82rem; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #10254a 0%, #1f3a68 45%, #2f5fa5 100%); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.login-card { width: 100%; max-width: 980px; border-radius: 24px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-side {
  background: radial-gradient(circle at 20% 20%, rgba(245,158,11,.45), transparent 45%), linear-gradient(160deg, #173462, #0f2141);
  color: #fff; padding: 2.5rem;
}
.login-side .feature { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; color: #d6e0f3; font-size: .92rem; }
.login-side .feature i { color: var(--bsg-saffron); font-size: 1.2rem; }
.login-form { background: #fff; padding: 2.5rem; }
.motto { font-size: .75rem; letter-spacing: .25em; text-transform: uppercase; color: var(--bsg-saffron); font-weight: 700; }

/* ---------- admin dashboard ---------- */
.dash { display: flex; min-height: calc(100vh - 66px); }
.dash-main { flex: 1; min-width: 0; padding: 1.5rem; }
@media (min-width: 992px) {
  .dash-side { width: 250px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
               position: sticky; top: 66px; height: calc(100vh - 66px); overflow-y: auto; }
}
.side-label { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 .75rem .5rem; }
.side-link {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: .92rem;
}
.side-link i { font-size: 1.05rem; color: var(--muted); }
.side-link:hover { background: #f3f6fb; color: var(--ink); }
.side-link.active { background: #eaf0fb; color: var(--bsg-navy); font-weight: 700; }
.side-link.active i { color: var(--bsg-navy); }
.kpi-sub { font-size: .75rem; color: var(--muted); }
.pw-badge { font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; }
.pw-default { background: #fff7e6; color: #b45309; }
.pw-changed { background: #e7f6ec; color: var(--bsg-green); }
.username { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .85rem; background: #f3f6fb; padding: .15rem .45rem; border-radius: 6px; }
.copy-btn { border: 0; background: none; color: var(--muted); padding: 0 .25rem; }
.copy-btn:hover { color: var(--bsg-navy); }
.chart-box { position: relative; height: 260px; }

/* ---------- how to use ---------- */
.help h2 { font-size: 1.15rem; font-weight: 800; color: var(--bsg-navy); display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.help ol li, .help ul li { margin-bottom: .4rem; }
.help .mode-btn { cursor: default; }
.help section { scroll-margin-top: 80px; }
.help-note { display: flex; gap: .6rem; background: #f8fafd; border-left: 3px solid var(--bsg-saffron); padding: .75rem 1rem; border-radius: 8px; font-size: .9rem; }
.help-note i { color: #b45309; }
.help-toc { position: sticky; top: 84px; }
.help-toc .side-link { padding: .45rem .6rem; font-size: .88rem; }

.lang-te, .lang-te .help h2 { font-family: 'Noto Sans Telugu', 'Plus Jakarta Sans', system-ui, sans-serif; line-height: 1.75; }

/* ---------- contact ---------- */
.contact-avatar { background: var(--bsg-navy); width: 48px; height: 48px; font-size: 1.2rem; flex-shrink: 0; }
.contact-card .btn { border-radius: 10px; font-weight: 600; }
.btn-whatsapp { background: #25d366; color: #fff; border: 0; }
.btn-whatsapp:hover { background: #1ebe5a; color: #fff; }

/* htmx indicator */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-swapping { opacity: .4; transition: opacity .15s; }

@media (max-width: 575.98px) {
  .hero { padding: 1.25rem; }
  .login-form, .login-side { padding: 1.5rem; }
}
