/* ============================================================
   RTNG Management System — 2.0 design system
   Modern sidebar layout · dark mode · mobile-first
   ============================================================ */
:root {
  --green: #1e7a38;
  --green-bright: #2ea44f;
  --green-dark: #145a28;
  --green-glow: rgba(46, 164, 79, 0.15);
  --black: #101410;
  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface-2: #eef1ee;
  --text: #1a211a;
  --text-2: #5b665b;
  --text-3: #8a948a;
  --border: #e2e8e2;
  --red: #c0392b;
  --red-bg: #fdecea;
  --amber: #9a6a00;
  --amber-bg: #fff4d6;
  --blue: #1a4f9c;
  --blue-bg: #e6eefb;
  --purple: #5b2d91;
  --purple-bg: #f0e6fa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 20, 16, 0.05), 0 4px 16px rgba(16, 20, 16, 0.06);
  --shadow-lg: 0 8px 32px rgba(16, 20, 16, 0.14);
  --sidebar-w: 264px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
[data-theme="dark"] {
  --bg: #0e120e;
  --surface: #161c16;
  --surface-2: #1d241d;
  --text: #e8ede8;
  --text-2: #a7b3a7;
  --text-3: #6f7a6f;
  --border: #263026;
  --green-light: #1d3a26;
  --red-bg: #3a1d1a;
  --amber-bg: #3a2f14;
  --blue-bg: #1a2740;
  --purple-bg: #2c2140;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  transition: background 0.25s, color 0.25s;
}
::selection { background: var(--green-glow); }

/* ============ Sidebar ============ */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, #0c100c 0%, #111711 100%);
  color: #dfe7df;
  display: flex; flex-direction: column;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 16px; text-decoration: none; color: #fff;
}
.sidebar-brand img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 0 0 2px rgba(46, 164, 79, 0.5); }
.sidebar-brand .t1 { font-weight: 800; font-size: 1.3rem; letter-spacing: 2px; line-height: 1; }
.sidebar-brand .t2 { font-size: 0.62rem; letter-spacing: 3px; color: #8fd6a0; font-weight: 600; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-section { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1.5px; color: #6f7f6f; padding: 14px 10px 6px; font-weight: 700; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  color: #b9c6b9; text-decoration: none;
  padding: 9px 12px; border-radius: 9px;
  font-size: 0.93rem; font-weight: 500;
  margin-bottom: 2px; transition: all 0.15s;
}
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.75; }
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar nav a.active { background: var(--green); color: #fff; box-shadow: 0 2px 10px rgba(30, 122, 56, 0.4); }
.sidebar nav a.active svg { opacity: 1; }
.sidebar-user { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.85rem; }
.sidebar-user .nm { font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.sidebar-user .links { margin-top: 6px; display: flex; gap: 12px; }
.sidebar-user a { color: #8fd6a0; text-decoration: none; font-size: 0.82rem; }
.sidebar-user a:hover { text-decoration: underline; }
.sidebar-scrim { display: none; }

/* ============ Main + topbar ============ */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 6px; }
.hamburger svg { width: 24px; height: 24px; display: block; }
.search-trigger {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 14px;
  color: var(--text-3); font-size: 0.9rem; cursor: pointer;
  min-width: 240px; transition: border 0.15s;
  font-family: inherit;
}
.search-trigger:hover { border-color: var(--green); }
.search-trigger kbd {
  margin-left: auto; font-family: inherit; font-size: 0.72rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 7px; color: var(--text-2);
}
.topbar-spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; transition: all 0.15s;
}
.icon-btn:hover { border-color: var(--green); color: var(--green); }
.icon-btn svg { width: 19px; height: 19px; }
.container { max-width: 1180px; margin: 0 auto; padding: 26px 24px 70px; width: 100%; flex: 1; }

/* ============ Page head ============ */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.5px; }
.page-head .sub { color: var(--text-2); margin: 4px 0 0; font-size: 0.95rem; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ Stat cards ============ */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--green), var(--green-bright)); opacity: 0.85; }
.card .icon { width: 38px; height: 38px; border-radius: 10px; background: var(--green-glow); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.card .icon svg { width: 20px; height: 20px; color: var(--green-bright); }
[data-theme="dark"] .card .icon svg { color: #6fdc8c; }
.card h3 { margin: 0 0 2px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-2); font-weight: 700; }
.card .big { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.card .big.accent { color: var(--green-bright); }
[data-theme="dark"] .card .big.accent { color: #6fdc8c; }
.card .sub { font-size: 0.85rem; color: var(--text-2); margin-top: 2px; }
.card .sub a { color: var(--green-bright); }

/* ============ Panels ============ */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.panel > h2 { margin: 0 0 4px; font-size: 1.12rem; font-weight: 750; letter-spacing: -0.2px; }
.panel > .panel-sub { color: var(--text-2); font-size: 0.88rem; margin: 0 0 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 1.12rem; font-weight: 750; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 300px; }

/* ============ Tables ============ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; background: var(--surface); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--surface-2); color: var(--text-2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; white-space: nowrap; }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--green-glow) 35%, transparent); }
tbody tr:last-child td { border-bottom: none; }
td a { color: var(--green-bright); font-weight: 600; text-decoration: none; }
[data-theme="dark"] td a { color: #6fdc8c; }
td a:hover { text-decoration: underline; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.positive { color: var(--green-bright); font-weight: 700; }
[data-theme="dark"] .positive { color: #6fdc8c; }
.negative { color: var(--red); font-weight: 600; }
.rowlink { cursor: pointer; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green); color: #fff; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 0.93rem; cursor: pointer; text-decoration: none; font-weight: 650;
  transition: all 0.15s; font-family: inherit; line-height: 1.3;
  box-shadow: 0 2px 8px rgba(30, 122, 56, 0.25);
}
.btn:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(30, 122, 56, 0.35); color: #fff; }
.btn:active { transform: translateY(0); }
.btn.secondary { background: var(--surface-2); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--border); color: var(--text); box-shadow: none; }
.btn.danger { background: var(--red); box-shadow: 0 2px 8px rgba(192, 57, 43, 0.25); }
.btn.danger:hover { background: #a93226; }
.btn.small { padding: 6px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn.link { background: none; color: var(--green-bright); padding: 6px 8px; box-shadow: none; }
.btn.link:hover { background: var(--green-glow); }
.btn svg { width: 16px; height: 16px; }
.inline-form { display: inline; }

/* ============ Forms ============ */
label { display: block; font-weight: 650; margin: 14px 0 5px; font-size: 0.88rem; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; max-width: 560px; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 0.95rem; font-family: inherit;
  background: var(--surface); color: var(--text);
  transition: border 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green-bright);
  box-shadow: 0 0 0 3px var(--green-glow);
}
textarea { min-height: 90px; resize: vertical; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters label { margin: 0; font-size: 0.78rem; }
.filters input, .filters select { width: auto; padding: 8px 11px; }
label.check { font-weight: 450; display: flex; align-items: center; gap: 9px; cursor: pointer; }
label.check input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); }
.inline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 16px; align-items: end; }
.inline-grid label { margin-top: 10px; }

/* ============ Flash ============ */
.flash { padding: 13px 18px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 600; display: flex; align-items: center; gap: 10px; animation: slidein 0.25s ease; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.flash.ok { background: #dff0e3; color: #145a28; border: 1px solid #9fd8ae; }
[data-theme="dark"] .flash.ok { background: #14301d; color: #8fe3a8; border-color: #245c36; }
.flash.err { background: var(--red-bg); color: var(--red); border: 1px solid #f0b3ac; }
[data-theme="dark"] .flash.err { border-color: #6e2b25; }

/* ============ Badges ============ */
.badge { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.3px; white-space: nowrap; }
.badge.upcoming, .badge.assigned { background: var(--blue-bg); color: var(--blue); }
[data-theme="dark"] .badge.upcoming, [data-theme="dark"] .badge.assigned { color: #8fb8f5; }
.badge.in-progress, .badge.draft { background: var(--amber-bg); color: var(--amber); }
[data-theme="dark"] .badge.in-progress, [data-theme="dark"] .badge.draft { color: #f0c96a; }
.badge.complete, .badge.current, .badge.active, .badge.achieved { background: #dff0e3; color: #145a28; }
[data-theme="dark"] .badge.complete, [data-theme="dark"] .badge.current, [data-theme="dark"] .badge.active, [data-theme="dark"] .badge.achieved { background: #14301d; color: #8fe3a8; }
.badge.overdue { background: var(--red-bg); color: var(--red); }
[data-theme="dark"] .badge.overdue { color: #f0978a; }
.badge.pending { background: var(--purple-bg); color: var(--purple); }
[data-theme="dark"] .badge.pending { color: #c39bf0; }
.badge.superseded, .badge.exited, .badge.not-started { background: var(--surface-2); color: var(--text-2); }
.badge.admin { background: #141414; color: #fff; }
.badge.board { background: var(--green); color: #fff; }
.badge.staff { background: var(--blue); color: #fff; }
.badge.volunteer { background: var(--amber); color: #fff; }
.badge.applicant { background: var(--blue-bg); color: var(--blue); }
[data-theme="dark"] .badge.applicant { color: #8fb8f5; }
.badge.on-hold { background: var(--amber-bg); color: var(--amber); }
[data-theme="dark"] .badge.on-hold { color: #f0c96a; }
.badge.graduated { background: var(--green-dark); color: #fff; }

/* ============ Progress ============ */
.progress { background: var(--surface-2); border-radius: 14px; height: 30px; overflow: hidden; position: relative; border: 1px solid var(--border); }
.progress .fill { background: linear-gradient(90deg, var(--green-dark), var(--green-bright)); height: 100%; transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); border-radius: 14px; }
.progress .label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 750; font-size: 0.85rem; color: var(--text); }

/* ============ Detail / misc ============ */
.detail-grid { display: grid; grid-template-columns: 190px 1fr; gap: 8px 18px; font-size: 0.95rem; }
.detail-grid dt { font-weight: 650; color: var(--text-2); }
.detail-grid dd { margin: 0; }
.whitespace { white-space: pre-wrap; }
.sub { color: var(--text-2); font-size: 0.88rem; }
.checklist { list-style: none; padding: 0; margin: 0 0 12px; }
.checklist li { padding: 7px 0 7px 30px; position: relative; }
.checklist li.yes::before { content: "✓"; position: absolute; left: 4px; color: var(--green-bright); font-weight: 800; font-size: 1.05rem; }
.checklist li.no::before { content: "○"; position: absolute; left: 4px; color: var(--text-3); font-weight: 800; }
.notes { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.note { background: var(--surface-2); border-radius: var(--radius-sm); padding: 13px 16px; border: 1px solid var(--border); }
.note-head { margin-bottom: 5px; font-size: 0.82rem; color: var(--text-2); }
.note p { margin: 0; }
.error-box { background: var(--red-bg); color: var(--red); border: 1px solid #f0b3ac; border-radius: var(--radius-sm); padding: 11px 15px; margin-top: 14px; font-weight: 600; font-size: 0.9rem; }
[data-theme="dark"] .error-box { border-color: #6e2b25; color: #f0978a; }

/* ============ Login ============ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 600px at 50% -10%, rgba(46, 164, 79, 0.18), transparent), var(--bg); }
.login-wrap { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 38px 34px; box-shadow: var(--shadow-lg); text-align: center; animation: slidein 0.35s ease; }
.login-wrap img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--green-glow); }
.login-wrap h1 { font-size: 1.35rem; margin: 14px 0 4px; font-weight: 800; letter-spacing: -0.3px; }
.login-wrap p.tag { color: var(--text-2); font-size: 0.88rem; margin: 0 0 6px; }
.login-wrap form { text-align: left; margin-top: 14px; }
.login-wrap .btn { width: 100%; margin-top: 18px; justify-content: center; padding: 12px; }
.login-wrap .error-box { text-align: left; }

/* ============ Command palette ============ */
.palette-scrim { position: fixed; inset: 0; background: rgba(8, 12, 8, 0.55); backdrop-filter: blur(3px); z-index: 200; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette-scrim.open { display: flex; }
.palette { width: min(620px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: pop 0.18s ease; }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(-8px); } to { opacity: 1; transform: none; } }
.palette input { width: 100%; border: none; background: none; padding: 18px 20px; font-size: 1.05rem; color: var(--text); font-family: inherit; }
.palette input:focus { outline: none; box-shadow: none; border: none; }
.palette-list { max-height: 340px; overflow-y: auto; border-top: 1px solid var(--border); padding: 8px; }
.palette-group { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-3); font-weight: 700; padding: 10px 12px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; cursor: pointer; text-decoration: none; color: var(--text); }
.palette-item:hover, .palette-item.sel { background: var(--green-glow); }
.palette-item .pi-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.palette-item .pi-icon svg { width: 17px; height: 17px; color: var(--green-bright); }
.palette-item .pi-main { font-weight: 600; font-size: 0.93rem; }
.palette-item .pi-sub { font-size: 0.8rem; color: var(--text-2); }
.palette-empty { padding: 26px; text-align: center; color: var(--text-3); font-size: 0.9rem; }

/* ============ Footer ============ */
.site-footer { text-align: center; color: var(--text-3); font-size: 0.8rem; padding: 26px 12px; border-top: 1px solid var(--border); }

/* ============ Timeline / activity ============ */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: -4px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 3px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 3px var(--green-glow); }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; width: 280px; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(8, 12, 8, 0.5); z-index: 99; }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .search-trigger { min-width: 0; flex: 1; }
  .search-trigger .stext { display: none; }
  .container { padding: 18px 14px 60px; }
  .detail-grid { grid-template-columns: 1fr; gap: 2px; }
  .detail-grid dt { margin-top: 8px; }
  .topbar { padding: 10px 14px; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
}
@media (max-width: 480px) {
  .page-head h1 { font-size: 1.4rem; }
  .card .big { font-size: 1.55rem; }
}
