:root {
  --blue:        #0a4d8c;
  --blue-dark:   #073a6b;
  --blue-light:  #e8f1fa;
  --accent:      #1a8cff;
  --ink:         #1c2733;
  --muted:       #5d6b7a;
  --line:        #e2e8ef;
  --bg:          #f5f7fa;
  --card:        #ffffff;
  --radius:      10px;
  --shadow:      0 1px 3px rgba(16,38,66,.08), 0 1px 2px rgba(16,38,66,.04);
  --topbar-h:    62px;
  --sidebar-w:   268px;
  --maxw:        1100px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--blue); color: #fff;
  padding: 8px 14px; z-index: 100; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 38px; height: 38px; border-radius: 8px; background: #fff; object-fit: contain; padding: 3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.02rem; letter-spacing: .2px; }
.brand-text small { font-size: .72rem; opacity: .82; text-transform: uppercase; letter-spacing: .9px; }

.search { margin-left: auto; }
.search input {
  width: 280px; max-width: 42vw;
  padding: 9px 14px; border: none; border-radius: 999px;
  font-size: .92rem; background: rgba(255,255,255,.16); color: #fff;
}
.search input::placeholder { color: rgba(255,255,255,.75); }
.search input:focus { outline: 2px solid var(--accent); background: #fff; color: var(--ink); }

.menu-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 38px; height: 38px; border: none; background: transparent; cursor: pointer; padding: 7px;
}
.menu-toggle span { display: block; height: 2px; background: #fff; border-radius: 2px; }

/* ---------- Layout ---------- */
.layout { display: flex; max-width: var(--maxw); margin: 0 auto; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 18px 12px;
  background: transparent;
}
.sidebar nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar .navlink {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 9px 12px; border-radius: 8px;
  color: var(--ink); font-weight: 500; font-size: .94rem;
}
.sidebar .navlink:hover { background: var(--blue-light); text-decoration: none; }
.sidebar .navlink.active { background: var(--blue); color: #fff; }
.sidebar .navlink.active .count { background: rgba(255,255,255,.25); color: #fff; }
.sidebar .count {
  font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: var(--line); color: var(--muted);
}
.sidebar .sub { margin: 2px 0 6px 12px; padding-left: 8px; border-left: 2px solid var(--line); }
.sidebar .sub .navlink { font-weight: 400; font-size: .89rem; padding: 7px 12px; }

/* ---------- Content ---------- */
.content { flex: 1; min-width: 0; padding: 26px 30px 60px; }

.page-head { margin: 0 0 6px; }
.page-head h1 { margin: 0; font-size: 1.6rem; color: var(--blue-dark); }
.crumb { color: var(--muted); font-size: .85rem; margin-bottom: 18px; }
.crumb a { color: var(--muted); }

.doc-list { display: grid; gap: 10px; }
.doc {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 16px; box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
.doc:hover { border-color: var(--accent); transform: translateY(-1px); text-decoration: none; }
.doc .badge {
  flex: none; width: 46px; height: 46px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .64rem; font-weight: 700; letter-spacing: .5px; color: #fff;
}
.badge.pdf  { background: #d6453d; }
.badge.mp4, .badge.mov  { background: #7b46d6; }
.badge.png, .badge.jpg, .badge.jpeg { background: #1f9d6b; }
.badge.link { background: var(--muted); }
.badge.other { background: #4a6275; }
.doc .doc-body { flex: 1; min-width: 0; }
.doc .doc-title { font-weight: 600; color: var(--ink); }
.doc .doc-meta { font-size: .8rem; color: var(--muted); margin-top: 1px; }
.doc .doc-open { flex: none; color: var(--blue); font-weight: 600; font-size: .85rem; }
.doc .doc-open::after { content: " →"; }

.section-label { font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 24px 0 10px; font-weight: 700; }
.empty { color: var(--muted); padding: 30px 0; }

/* ---------- Home ---------- */
.hero {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff; border-radius: 14px; padding: 34px 32px; margin-bottom: 26px;
}
.hero h1 { margin: 0 0 8px; font-size: 1.9rem; }
.hero p { margin: 0; opacity: .9; max-width: 60ch; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,1fr)); gap: 14px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); text-decoration: none; }
.tile h3 { margin: 0 0 4px; color: var(--blue-dark); font-size: 1.05rem; }
.tile p { margin: 0; color: var(--muted); font-size: .85rem; }

/* ---------- Footer ---------- */
.footer {
  text-align: center; color: var(--muted); font-size: .82rem;
  padding: 26px 16px; border-top: 1px solid var(--line); margin-top: 20px;
}

.scrim { position: fixed; inset: 0; background: rgba(12,24,40,.45); z-index: 30; }

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .menu-toggle { display: flex; }
  .brand-text small { display: none; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; height: auto;
    width: 280px; background: var(--bg); z-index: 35;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,.12); padding-top: 14px;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .content { padding: 20px 18px 50px; }
  .search input { width: 160px; }
}
