/* ============================================================
   DepEd School Forms System — design system
   Direction: official, document-grade. Deep institutional blue,
   serif headings (Lora) + government-grade sans (Public Sans).
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,500;0,600;1,500&family=Public+Sans:wght@400;500;600;700&display=swap');

:root {
  --navy:        #0b2a4a;   /* DepEd-style deep blue */
  --navy-700:    #123a63;
  --navy-600:    #1c4d80;
  --blue:        #2563a8;
  --blue-soft:   #e8f0f9;
  --gold:        #d4a017;   /* seal accent */
  --gold-soft:   #fbf3dd;
  --ink:         #1a2230;
  --muted:       #5a6573;
  --line:        #dfe5ec;
  --line-strong: #c7d0db;
  --bg:          #f4f6f9;
  --card:        #ffffff;
  --green:       #1f7a4d;
  --green-soft:  #e4f4ec;
  --red:         #b23b3b;
  --red-soft:    #fbe9e9;
  --amber:       #9a6b00;
  --amber-soft:  #fbf0d6;
  --radius:      10px;
  --shadow:      0 1px 2px rgba(16,32,56,.06), 0 4px 16px rgba(16,32,56,.06);
  --shadow-lg:   0 10px 40px rgba(11,42,74,.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Public Sans', system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Lora', Georgia, serif; font-weight: 600; color: var(--navy); line-height: 1.2; margin: 0 0 .4em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Auth screens ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(37,99,168,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(212,160,23,.12), transparent 55%),
    var(--navy);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-head {
  text-align: center;
  padding: 34px 32px 8px;
}
.auth-head .seal {
  width: 64px; height: 64px; object-fit: contain;
  margin: 0 auto 12px; display: block;
}
.auth-head .seal-fallback {
  width: 64px; height: 64px; border-radius: 50%;
  margin: 0 auto 12px;
  background: radial-gradient(circle at 50% 35%, var(--gold), #a87d10);
  color: #fff; display: grid; place-items: center;
  font-family: 'Lora', serif; font-weight: 600; font-size: 22px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.5);
}
.auth-head h1 { font-size: 22px; margin-bottom: 2px; }
.auth-head p { color: var(--muted); margin: 0; font-size: 13.5px; }
.auth-body { padding: 18px 32px 34px; }

/* ---------- Layout shell ---------- */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--navy);
  color: #cdd9e8;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand img { width: 38px; height: 38px; object-fit: contain; }
.brand .seal-fallback {
  width: 38px; height: 38px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--gold), #a87d10);
  color: #fff; display: grid; place-items: center;
  font-family: 'Lora', serif; font-weight: 600; font-size: 15px; flex: none;
}
.brand b { color: #fff; font-family: 'Lora', serif; font-size: 15px; font-weight: 600; line-height: 1.15; }
.brand span { display: block; font-size: 11px; color: #8ba6c4; font-family: 'Public Sans'; }

.nav { padding: 12px 10px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }
.nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.30); }
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }
.nav .group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6e89a8; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: #cdd9e8; font-size: 14px; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: var(--blue); color: #fff; }
.nav a .ico { width: 17px; text-align: center; opacity: .9; }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; color: #9fb4cd; }
.sidebar-foot form { margin-top: 8px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 5;
}
.topbar .crumbs { color: var(--muted); font-size: 13px; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.topbar .who .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--blue-soft); color: var(--navy);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.content { padding: 28px; max-width: 1180px; width: 100%; }
.page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.page-title h1 { font-size: 26px; margin: 0; }
.page-title .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- Cards / stat tiles ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.card .card-head h3 { margin: 0; font-size: 16px; }
.card .card-body { padding: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue); }
.stat.gold::before { background: var(--gold); }
.stat.green::before { background: var(--green); }
.stat .label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-family: 'Lora', serif; font-size: 32px; font-weight: 600; color: var(--navy); margin-top: 4px; }
.stat .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 600; color: var(--navy-700); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=number], input[type=file], select, textarea {
  font: inherit; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,168,.15); }
.field .err { color: var(--red); font-size: 12.5px; }
input.has-error, select.has-error { border-color: var(--red); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 18px; }
fieldset legend { font-family: 'Lora', serif; font-weight: 600; color: var(--navy); padding: 0 8px; font-size: 15px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--blue); color: #fff; transition: background .15s, box-shadow .15s;
}
.btn:hover { background: var(--navy-600); text-decoration: none; }
.btn.primary { background: var(--navy); }
.btn.primary:hover { background: var(--navy-700); }
.btn.ghost { background: #fff; border-color: var(--line-strong); color: var(--navy); }
.btn.ghost:hover { background: var(--blue-soft); }
.btn.gold { background: var(--gold); color: #3a2c00; }
.btn.gold:hover { background: #c1900f; }
.btn.danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; padding: 11px; }
.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; padding: 11px 14px; background: var(--blue-soft); color: var(--navy); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:hover td { background: #fafbfd; }
table.data .num { font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .5; }

/* ---------- Badges / pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.pill.blue { background: var(--blue-soft); color: var(--navy-600); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.gray { background: #eef1f5; color: var(--muted); }
.pill.gold { background: var(--gold-soft); color: var(--amber); }
.sex-m { color: var(--blue); font-weight: 700; }
.sex-f { color: #b0457e; font-weight: 700; }

/* ---------- Flash / alerts ---------- */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; border: 1px solid transparent; }
.alert.success { background: var(--green-soft); color: var(--green); border-color: #bfe3cf; }
.alert.error { background: var(--red-soft); color: var(--red); border-color: #eccaca; }
.alert.warn { background: var(--amber-soft); color: var(--amber); border-color: #ecdcab; }
.alert.info { background: var(--blue-soft); color: var(--navy-600); border-color: #c9dcf0; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select { width: auto; }
.toolbar .grow { flex: 1; min-width: 180px; }

/* ---------- Branding gallery ---------- */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px,1fr)); gap: 16px; }
.logo-tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; background: #fff; }
.logo-tile .frame { height: 110px; display: grid; place-items: center; background: var(--bg); border-radius: 8px; margin-bottom: 10px; }
.logo-tile .frame img { max-height: 96px; max-width: 100%; }
.logo-tile .ttype { font-size: 12px; color: var(--muted); }
.logo-tile .lbl { font-weight: 600; font-size: 13.5px; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.mt { margin-top: 18px; }
.divider { height: 1px; background: var(--line); margin: 22px 0; }
.help-box { background: var(--gold-soft); border: 1px solid #ecdcab; border-radius: var(--radius); padding: 14px 16px; font-size: 13.5px; }
.help-box b { color: var(--amber); }

/* ---------- Collapsible drawer (desktop + mobile) ---------- */
:root { --sidebar-w: 256px; }
.shell { display: block; min-height: 100vh; }
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh;
  z-index: 50; transform: translateX(0); transition: transform .2s ease;
}
.main { margin-left: var(--sidebar-w); transition: margin-left .2s ease; }
.burger {
  display: inline-flex; flex-direction: column; gap: 4px; background: transparent;
  border: 0; cursor: pointer; padding: 8px; margin-right: 8px;
}
.burger span { width: 22px; height: 2px; background: var(--navy, #0b2a4a); border-radius: 2px; display: block; }
.nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 45; }

/* Desktop: collapsing slides the drawer away and reclaims the space */
body.nav-collapsed .sidebar { transform: translateX(-100%); }
body.nav-collapsed .main { margin-left: 0; }

@media (max-width: 880px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.3); }
  body.nav-open .nav-overlay { display: block; }
  .form-grid { grid-template-columns: 1fr; }
}

.nav-badge{display:inline-block;min-width:18px;height:18px;line-height:18px;padding:0 5px;margin-left:6px;border-radius:9px;background:var(--gold,#d4a017);color:#1b1b1b;font-size:11px;font-weight:700;text-align:center;vertical-align:middle;}

.avatar-img{width:34px;height:34px;border-radius:50%;object-fit:cover;border:1px solid rgba(255,255,255,.4);display:block}

/* ---- Notification bell (phase 9g) ---- */
.who .bell{position:relative;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:50%;text-decoration:none;color:inherit}
.who .bell:hover{background:rgba(0,0,0,.06)}
.who .bell-ico{font-size:17px;line-height:1;filter:grayscale(.2)}
.who .bell-badge{position:absolute;top:2px;right:0;min-width:16px;height:16px;padding:0 4px;border-radius:9px;background:#d4263a;color:#fff;font-size:10px;font-weight:700;line-height:16px;text-align:center;box-shadow:0 0 0 2px var(--surface,#fff)}
.notif-list{list-style:none;margin:0;padding:0}
.notif-list li{display:flex;gap:12px;padding:12px 14px;border-bottom:1px solid var(--line,#e5e7eb)}
.notif-list li.unread{background:#f3f7fb}
.notif-list .n-title{font-weight:600;font-size:13.5px;color:var(--navy,#0b2a4a)}
.notif-list .n-body{font-size:12.5px;color:var(--muted,#667)}
.notif-list .n-time{font-size:11px;color:#99a;white-space:nowrap}
.pref-grid{display:grid;gap:6px;margin:6px 0 16px}
.pref-row{display:flex;gap:10px;align-items:center;font-size:13px;padding:6px 0;border-bottom:1px dashed var(--line,#eee)}
.pref-row input{width:16px;height:16px}
