/* ============================================================
   assets/css/app.css — Shared UI layer for all portals
   (Admin, Coordinator, Faculty, Login/Register)
   · Responsive layout (sidebar drawer, bottom nav, grids, tables)
   · Menu components (menu toggle, user menu, bottom nav)
   · Motion (page enter/leave, dropdowns, modals, tabs, ripple)
   ============================================================ */

:root {
  --ui-surface: var(--card, #ffffff);
  --ui-text:    var(--text, #0f172a);
  --ui-sub:     var(--sub, #64748b);
  --ui-border:  var(--border, #e2e8f0);
  --ui-hover:   var(--hover, #f1f5f9);
  --ui-accent:  var(--accent, #1d4ed8);
  --ui-ease:    cubic-bezier(.4, 0, .2, 1);
  --ui-spring:  cubic-bezier(.22, 1, .36, 1);
  --ui-bottom-nav-h: 64px;
}
body.dark {
  --ui-surface: var(--card, #111827);
  --ui-text:    var(--text, #e2e8f0);
  --ui-sub:     var(--sub, #94a3b8);
  --ui-border:  var(--border, #1f2937);
  --ui-hover:   var(--hover, #1f2937);
}

html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img, svg, canvas, video { max-width: 100%; }
body.no-anim, body.no-anim *, body.no-anim *::before, body.no-anim *::after { transition: none !important; }

/* ── PAGE PROGRESS BAR ── */
.page-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--ui-accent), #60a5fa);
  box-shadow: 0 0 8px rgba(59, 130, 246, .5);
  z-index: 20000; opacity: 0; pointer-events: none;
}
body.is-submitting .page-body, body.is-submitting .content { opacity: .6; pointer-events: none; }
body.is-leaving .page-progress, body.is-submitting .page-progress {
  opacity: 1;
  animation: progressGrow 2.4s var(--ui-spring) forwards;
}
@keyframes progressGrow { 0% { width: 0 } 20% { width: 45% } 100% { width: 88% } }

/* ── PAGE ENTER ── (short, so content is readable right away; the old page stays
   visible while the next one loads, with only the progress bar showing) */
.page-body, .content { animation: pageIn .15s var(--ui-ease) backwards; }
/* Smooth page changes (browsers with cross-page view transitions): the sidebar, top bar and bottom bar
   stay still and only the content cross-fades, the same for every link, filter, search and save */
@view-transition { navigation: auto; }
.sidebar    { view-transition-name: eslo-sidebar; }
.topbar     { view-transition-name: eslo-topbar; }
.bottom-nav { view-transition-name: eslo-bottomnav; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; animation-timing-function: ease; }
::view-transition-group(eslo-sidebar), ::view-transition-group(eslo-topbar), ::view-transition-group(eslo-bottomnav) { animation-duration: .18s; }
@supports (view-transition-name: none) { .page-body, .content { animation: none; } }   /* the cross-fade replaces the fade-in */
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .page-body, .content { animation: none; }
}
#reviewModal { animation: fadeIn .2s var(--ui-ease); backdrop-filter: blur(2px); }

/* ── SKELETON LOADING ── (shown by app.js when the next page takes over ~0.15s)
   The current content is hidden and plain gray blocks take its place. */
body.is-loading .page-body > :not(.sk-page) { display: none !important; }
.sk-page { display: flex; flex-direction: column; gap: 14px; animation: none; }
.sk { background: var(--border, #e2e8f0); border-radius: 6px; animation: skPulse 1.2s ease-in-out infinite; }
.sk-title { height: 22px; width: 32%; }
.sk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.sk-card { background: var(--card, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: var(--radius, 10px); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.sk-line { height: 11px; }
.sk-big { height: 26px; width: 30%; }
.sk-table { gap: 14px; }
.sk-row { display: flex; gap: 16px; padding-top: 12px; border-top: 1px solid var(--border, #e2e8f0); }
@keyframes skPulse { 0%, 100% { opacity: 1 } 50% { opacity: .45 } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

@keyframes pageIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes riseIn  { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
@keyframes dropIn  { from { opacity: 0; transform: translateY(-6px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97) } to { opacity: 1; transform: none } }

/* ── INTERACTION FEEDBACK ── */
.btn, .nav-item, .sb-link, .tab-btn, .qtr-btn, .bn-item, .btn-login, .btn-submit,
.icon-btn, .profile-btn, .um-btn, .um-item, .dd-item {
  transition: background-color .2s var(--ui-ease), color .2s var(--ui-ease),
              border-color .2s var(--ui-ease), box-shadow .2s var(--ui-ease),
              transform .15s var(--ui-ease), opacity .2s var(--ui-ease);
}
.btn:active, .btn-login:active, .btn-submit:active, .icon-btn:active,
.profile-btn:active, .um-btn:active, .qtr-btn:active { transform: scale(.97); }
.btn:hover, .btn-login:hover, .btn-submit:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .1); }
.nav-item:not(.active):hover, .sb-link:not(.active):hover { transform: translateX(3px); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ui-accent); outline-offset: 2px;
}

/* Ripple */
.btn, .nav-item, .sb-link, .tab-btn, .qtr-btn, .bn-item, .btn-login, .btn-submit, .um-item, .dd-item {
  position: relative; overflow: hidden;
}
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .18; transform: scale(0);
  animation: ripple .55s var(--ui-ease) forwards;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* Dropdowns, tabs, modals */
.dropdown-menu.open, .notif-panel.open { animation: dropIn .2s var(--ui-spring); transform-origin: top right; }
.tab-content.active { animation: riseIn .3s var(--ui-spring); }
.modal-overlay.open { animation: fadeIn .2s var(--ui-ease); backdrop-filter: blur(2px); }
.modal-overlay.open .modal, #reviewModal > div { animation: modalIn .3s var(--ui-spring); }
.progress-bar { transition: width .6s var(--ui-spring); }

/* ── MENU TOGGLE (hamburger) ── */
.menu-toggle {
  width: 36px; height: 36px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; border: 1px solid var(--ui-border);
  background: var(--ui-surface); color: var(--ui-sub); cursor: pointer;
}
.menu-toggle:hover { background: var(--ui-hover); color: var(--ui-text); }
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
  display: block; width: 16px; height: 2px; border-radius: 2px;
  background: currentColor; position: relative;
  transition: transform .3s var(--ui-spring), opacity .2s, background .2s;
}
.menu-toggle span::before, .menu-toggle span::after { content: ''; position: absolute; left: 0; }
.menu-toggle span::before { top: -5px; }
.menu-toggle span::after  { top: 5px; }
body.sb-open .menu-toggle span { background: transparent; }
body.sb-open .menu-toggle span::before { transform: translateY(5px) rotate(45deg); }
body.sb-open .menu-toggle span::after  { transform: translateY(-5px) rotate(-45deg); }

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-left > div { min-width: 0; }
.topbar-left .page-title, .topbar-title {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── SIDEBAR: desktop collapse ── */
body .sidebar { transition: margin-left .32s var(--ui-spring), transform .32s var(--ui-spring), box-shadow .32s, background .3s; }
body .main { transition: margin-left .32s var(--ui-spring); }
@media (min-width: 1025px) {
  body.sb-collapsed .sidebar { margin-left: calc(-1 * var(--sb-w, var(--sidebar, 240px))); }
  body.sb-collapsed .main    { margin-left: 0; }
}

.sb-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .3s var(--ui-ease);
}
.sb-close { display: none; }

/* ── USER MENU (faculty / coordinator) ── */
.um { position: relative; }
.um-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 4px 4px; border-radius: 10px;
  border: 1px solid var(--ui-border); background: var(--ui-surface);
  font-family: inherit; cursor: pointer; color: var(--ui-text);
}
.um-btn:hover { background: var(--ui-hover); }
.um-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: var(--ui-accent); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.um-avatar img { width: 100%; height: 100%; object-fit: cover; }
.um-meta { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.um-name { font-size: 12px; font-weight: 600; color: var(--ui-text); max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.um-role { font-size: 10px; color: var(--ui-sub); }
.um-chev { width: 12px; height: 12px; stroke: var(--ui-sub); fill: none; stroke-width: 2; transition: transform .25s var(--ui-spring); }
.um.open .um-chev { transform: rotate(180deg); }
.um-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px;
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: 14px; box-shadow: 0 14px 38px rgba(15, 23, 42, .16);
  padding: 6px; z-index: 300; display: none; transform-origin: top right;
}
.um.open .um-menu { display: block; animation: dropIn .2s var(--ui-spring); }
.um-head { padding: 10px 10px 12px; border-bottom: 1px solid var(--ui-border); margin-bottom: 6px; }
.um-head-name  { font-size: 13px; font-weight: 700; color: var(--ui-text); }
.um-head-email { font-size: 11px; color: var(--ui-sub); word-break: break-all; }
.um-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 9px; border: none; background: none;
  font-family: inherit; font-size: 13px; color: var(--ui-text);
  text-decoration: none; cursor: pointer; text-align: left;
}
.um-item:hover { background: var(--ui-hover); }
.um-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; flex-shrink: 0; opacity: .8; }
.um-item.danger { color: #dc2626; }
.um-sep { height: 1px; background: var(--ui-border); margin: 6px 0; }

/* ── BOTTOM NAV (phones) ── */
.bottom-nav { display: none; }
.bottom-nav .bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 6px 2px; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 10px; font-weight: 600; letter-spacing: .01em;
  color: var(--ui-sub); text-decoration: none; border-radius: 12px; min-width: 0;
}
.bottom-nav .bn-item svg {
  width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.9;
  transition: transform .25s var(--ui-spring);
}
.bottom-nav .bn-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bottom-nav .bn-item.active { color: var(--ui-accent); }
.bottom-nav .bn-item.active svg { transform: translateY(-2px); }
.bottom-nav .bn-item.active::before {
  content: ''; position: absolute; top: 0; left: 50%; width: 22px; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--ui-accent); transform: translateX(-50%);
}
body.dark .bottom-nav .bn-item.active { color: #60a5fa; }
body.dark .bottom-nav .bn-item.active::before { background: #60a5fa; }

/* ── TABLES ── */
.tbl-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 768px) { .tbl-scroll > table { min-width: 560px; } }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  text-align: left; padding: 9px 12px; color: var(--ui-sub);
  border-bottom: 1px solid var(--ui-border); font-weight: 600; font-size: 10px;
  letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--ui-border); color: var(--ui-text); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--ui-hover); }

/* ── MONTHLY PROJECT ROWS (Quarter Projects page) ── */
.mp-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--ui-border); }
.mp-dept     { min-width: 90px; }
.mp-main     { flex: 1; min-width: 180px; }
.mp-name     { font-size: 13px; color: var(--ui-text); font-weight: 700; overflow-wrap: anywhere; }
.mp-agenda   { min-width: 160px; max-width: 220px; font-size: 11px; color: var(--ui-sub); }
.mp-deadline { min-width: 100px; }

/* ── NEW PROPOSAL ── */
.proposal-type { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pt-option input { position: absolute; opacity: 0; pointer-events: none; }
.pt-card {
  display: flex; flex-direction: column; gap: 2px; height: 100%;
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--ui-border); background: var(--inp, var(--ui-surface));
  transition: border-color .2s var(--ui-ease), background-color .2s var(--ui-ease), box-shadow .2s var(--ui-ease);
}
.pt-card:hover { border-color: var(--ui-sub); }
.pt-option input:checked + .pt-card { border-color: var(--ui-accent); background: var(--blu-bg, #eff6ff); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.pt-option input:focus-visible + .pt-card { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
.pt-title { font-size: 13px; font-weight: 700; color: var(--ui-text); }
.pt-hint  { font-size: 11px; color: var(--ui-sub); }

.activity-row {
  display: grid; grid-template-columns: 34px 1fr 160px 34px; gap: 8px; align-items: center;
  margin-bottom: 8px; padding: 10px; border: 1px solid var(--ui-border); border-radius: 10px;
  background: var(--inp, var(--ui-surface)); animation: riseIn .25s var(--ui-spring);
}
.activity-row .act-no {
  width: 28px; height: 28px; border-radius: 50%; background: var(--ui-accent); color: #fff;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; align-self: start;
}
.activity-row .act-remove { color: var(--red, #dc2626); border-color: var(--red, #dc2626); padding: 4px 8px; justify-content: center; }
.activity-row .act-money { grid-column: 2 / 4; display: flex; align-items: center; gap: 6px; }
.activity-row .act-peso { font-weight: 700; color: var(--ui-sub); }
.activity-row .act-budget { flex: 1; min-width: 0; }
.activity-row .act-fund { width: 110px; flex-shrink: 0; }
.activity-row .act-desc { grid-column: 2 / 4; }
.pp-team { font-size: 11px; color: var(--ui-sub); margin: 0 0 10px; }

/* ── DATE PICKER (assets/js/app.js enhances every input[type=date]) ── */
.dp-field { position: relative; min-width: 0; }
.dp-field .dp-display {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; box-sizing: border-box; cursor: pointer; user-select: none; overflow: hidden;
}
.dp-field .dp-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-field .dp-placeholder { color: var(--ui-sub); opacity: .8; }
.dp-field .dp-icon {
  width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--ui-sub); stroke-width: 1.8;
  stroke-linecap: round; transition: stroke .2s var(--ui-ease);
}
.dp-field .dp-input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0;
  opacity: 0; cursor: pointer; border: 0; caret-color: transparent;
}
.dp-field:hover .dp-display { border-color: var(--ui-accent); }
.dp-field:focus-within .dp-display, .dp-field.dp-open .dp-display {
  border-color: var(--ui-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-accent) 18%, transparent);
}
.dp-field:focus-within .dp-icon, .dp-field.dp-open .dp-icon { stroke: var(--ui-accent); }
.dp-field .dp-input:focus-visible { outline: none; }
.dp-field.dp-disabled { opacity: .6; pointer-events: none; }

.dp-pop {
  position: fixed; z-index: 21000; width: 296px; padding: 12px;
  background: var(--ui-surface); color: var(--ui-text);
  border: 1px solid var(--ui-border); border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .06);
  animation: dropIn .18s var(--ui-spring); font-size: 13px;
}
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.dp-title {
  flex: 1; border: 0; background: none; color: var(--ui-text); font: inherit; font-weight: 700; font-size: 14px;
  padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.dp-title:hover { background: var(--ui-hover); }
.dp-nav {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--ui-border); background: var(--ui-surface);
  color: var(--ui-text); font-size: 18px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.dp-nav:hover { background: var(--ui-hover); border-color: var(--ui-accent); color: var(--ui-accent); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 10px; font-weight: 700; color: var(--ui-sub); text-transform: uppercase; letter-spacing: .04em; padding: 4px 0 6px; }
.dp-day {
  aspect-ratio: 1; min-height: 34px; border: 0; border-radius: 9px; background: none; color: var(--ui-text);
  font: inherit; font-size: 13px; cursor: pointer; position: relative;
  transition: background-color .15s var(--ui-ease), color .15s var(--ui-ease);
}
.dp-day:hover:not(:disabled) { background: var(--ui-hover); }
.dp-day.is-out { color: var(--ui-sub); opacity: .55; }
.dp-day.is-today { font-weight: 700; color: var(--ui-accent); }
.dp-day.is-today::after {
  content: ''; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: currentColor;
}
.dp-day.is-focus { box-shadow: inset 0 0 0 1.5px var(--ui-accent); }
.dp-day.is-selected, .dp-day.is-selected:hover { background: var(--ui-accent); color: #fff; font-weight: 700; opacity: 1; }
.dp-day:disabled { opacity: .3; cursor: not-allowed; }
.dp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dp-month {
  padding: 12px 0; border: 1px solid var(--ui-border); border-radius: 10px; background: var(--ui-surface);
  color: var(--ui-text); font: inherit; font-weight: 600; cursor: pointer;
}
.dp-month:hover { border-color: var(--ui-accent); color: var(--ui-accent); }
.dp-month.is-selected { background: var(--ui-accent); border-color: var(--ui-accent); color: #fff; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--ui-border); }
.dp-link {
  border: 0; background: none; color: var(--ui-accent); font: inherit; font-weight: 600; font-size: 12px;
  padding: 6px 10px; border-radius: 8px; cursor: pointer;
}
.dp-link:hover { background: var(--ui-hover); }
.dp-clear { color: var(--ui-sub); }

/* Phones: the calendar opens as a bottom sheet */
.dp-pop.dp-sheet {
  left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: 480px; margin: 0 auto;
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  animation: sheetUp .22s var(--ui-spring); box-shadow: 0 -12px 40px rgba(15, 23, 42, .25);
}
.dp-pop.dp-sheet .dp-day { min-height: 42px; font-size: 14px; }
@keyframes sheetUp { from { transform: translateY(100%) } to { transform: none } }

/* Activity card in the faculty proposal form: labelled fields, two columns, one column on phones */
.act-card {
  margin-bottom: 10px; padding: 12px 14px; border: 1px solid var(--ui-border); border-radius: 12px;
  background: var(--inp, var(--ui-surface)); min-width: 0; animation: riseIn .25s var(--ui-spring);
}
.act-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.act-card .act-no {
  width: 24px; height: 24px; border-radius: 50%; background: var(--ui-accent); color: #fff; flex-shrink: 0;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.act-card-title { flex: 1; font-size: 13px; font-weight: 700; color: var(--ui-text, inherit); }
.act-card .act-remove { color: var(--red, #dc2626); border-color: var(--red, #dc2626); padding: 4px 10px; }
.act-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.act-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; }
.act-field > span { font-size: 11px; font-weight: 700; color: var(--ui-sub); }
.act-field > span em { font-style: normal; font-weight: 500; }
.act-field .form-control { width: 100%; min-width: 0; box-sizing: border-box; }
.act-span { grid-column: 1 / -1; }
.act-quarters { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 4px 0; }
.act-quarters label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
@media (max-width: 640px) {
  .act-grid { grid-template-columns: minmax(0, 1fr); }
  .act-card { padding: 12px; }
}
.act-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.act-total { font-size: 12px; color: var(--ui-sub); }
.act-total strong { font-size: 14px; color: var(--ui-text); }

.rating-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rating-row label { display: flex; flex-direction: column; gap: 3px; font-size: 10px; font-weight: 600; color: var(--ui-sub); }
.rating-row .form-control { text-align: center; }
@media (max-width: 480px) { .rating-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ── PHYSICAL & FINANCIAL METERS ── */
.meter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.meter-card .meter-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.meter-card .meter-value { font-size: 30px; font-weight: 800; line-height: 1; color: var(--ui-text); }
.meter-card .meter-bar { height: 10px; border-radius: 6px; background: var(--ui-border); overflow: hidden; }
.meter-card .meter-fill { height: 100%; border-radius: 6px; transition: width .8s var(--ui-spring); }
.meter-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.meter-facts div { font-size: 11px; color: var(--ui-sub); }
.meter-facts strong { display: block; font-size: 14px; color: var(--ui-text); }
@media (max-width: 768px) {
  .meter-grid { grid-template-columns: 1fr; }
  .meter-facts { grid-template-columns: 1fr 1fr; }
}

/* ── TRAINING ACCOMPLISHMENT REPORT ── */
.tr-report { border-collapse: collapse; width: 100%; font-size: 11px; }
.tr-report th, .tr-report td { border: 1px solid var(--ui-border); padding: 5px 6px; vertical-align: top; }
.tr-report th { background: var(--inp, #f8fafc); color: var(--ui-sub); font-size: 10px; font-weight: 700; text-align: center; }
.tr-report td.num { text-align: center; white-space: nowrap; }
.tr-report tr.tr-program td { background: color-mix(in srgb, var(--ui-accent) 10%, var(--ui-surface)); font-weight: 700; }
.tr-report tr.tr-project td { background: var(--inp, #f8fafc); font-weight: 700; }
.tr-report tr.tr-total td { font-weight: 800; background: var(--ui-hover); }
.tr-report .tr-type { font-weight: 700; white-space: nowrap; }
.tr-report .rate { background: #fef3c7; color: #0f172a; }
body.dark .tr-report .rate { background: #422006; color: #fde68a; }
@media print {
  @page { size: landscape; margin: 10mm; }
  .sidebar, .topbar, .bottom-nav, .no-print, .page-progress, .sb-backdrop { display: none !important; }
  body, .main-wrap, .page-body { display: block !important; padding: 0 !important; background: #fff !important; color: #000 !important; }
  .card { border: none !important; padding: 0 !important; }
  .tbl-scroll, .table-wrap { overflow: visible !important; }
  .tr-report { font-size: 9px; }
  .page-body > * { animation: none !important; }
}

/* ── CLICKABLE TABLE ROWS (Department Summary) ── */
.row-link { cursor: pointer; }
.row-link.is-selected td { background: var(--ui-hover); font-weight: 600; }

/* ── DEPARTMENT PAGE ── */
.dept-hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dept-hero-title { font-size: 17px; font-weight: 700; color: var(--ui-text); margin-bottom: 2px; }
.dept-filters { display: flex; gap: 10px 24px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--ui-border); }
.dept-filter-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ── LARGE SCREENS ── */
@media (min-width: 1680px) {
  .page-body, .content { width: 100%; max-width: 1560px; margin-left: auto; margin-right: auto; }
}

/* ── LAPTOP / SMALL DESKTOP ── */
@media (max-width: 1280px) {
  .kpi-grid, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  body .dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── TABLET: sidebar becomes a drawer ── */
@media (max-width: 1024px) {
  body .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    height: 100vh; height: 100dvh;
    width: min(290px, 86vw); margin-left: 0;
    transform: translateX(-105%); z-index: 1001;
  }
  body.sb-open .sidebar { transform: none; box-shadow: 0 0 48px rgba(15, 23, 42, .3); }
  body.sb-open .sb-backdrop { opacity: 1; pointer-events: auto; }
  body.sb-open { overflow: hidden; }
  .main { margin-left: 0 !important; }
  .main-wrap, .main { width: 100%; }

  .sb-close {
    display: flex; align-items: center; justify-content: center;
    position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
    border-radius: 8px; border: none; cursor: pointer; font-size: 18px; line-height: 1;
    background: rgba(148, 163, 184, .18); color: inherit;
  }
  body .has-close { position: relative; padding-right: 50px; }

  body .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-body [style*="grid-template-columns:1.3fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* ── PHONES & SMALL TABLETS ── */
@media (max-width: 768px) {
  .topbar { padding: 0 14px !important; height: auto !important; min-height: 58px; gap: 10px; }
  .topbar-left .breadcrumb { display: none; }
  .topbar-left .page-title, .topbar-title { font-size: 15px !important; }
  .topbar-right { gap: 6px !important; flex-shrink: 0; }
  .profile-btn { padding: 3px !important; }
  .profile-btn > div:not(.avatar), .profile-btn .profile-chevron { display: none; }
  .um-btn { padding: 3px; }
  .um-meta, .um-btn .um-chev { display: none; }

  /* Full-width sheet under the topbar, kept clear of the bottom nav */
  .notif-panel {
    position: fixed !important; top: 64px !important;
    left: 12px !important; right: 12px !important; width: auto !important;
    max-height: calc(100vh - 64px - var(--ui-bottom-nav-h) - 24px - env(safe-area-inset-bottom)) !important;
    max-height: calc(100dvh - 64px - var(--ui-bottom-nav-h) - 24px - env(safe-area-inset-bottom)) !important;
  }
  .notif-item { padding: 14px 16px 14px 30px; }
  .notif-msg  { font-size: 13px; }
  .dropdown-menu:not(.notif-panel) { max-width: calc(100vw - 24px); }

  .page-body, .content {
    padding: 16px 14px calc(var(--ui-bottom-nav-h) + 24px + env(safe-area-inset-bottom)) !important;
  }

  /* Grids collapse */
  .grid-2, .grid-3, .form-grid, .form-row { grid-template-columns: 1fr !important; }
  .form-group.full { grid-column: auto !important; }
  .page-body [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .page-body [style*="grid-template-columns"] > * { min-width: 0; }
  .page-body .stats-grid, .page-body .stats-grid[style], .kpi-grid, .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  body .dept-grid { grid-template-columns: 1fr 1fr; }

  /* Activity rows in New Proposal: stack under the number badge */
  .activity-row { grid-template-columns: 28px 1fr 34px; }
  .activity-row .act-title  { grid-column: 2; grid-row: 1; }
  .activity-row .act-remove { grid-column: 3; grid-row: 1; }
  .activity-row .act-date   { grid-column: 2 / 4; grid-row: 2; }
  .activity-row .act-money  { grid-column: 2 / 4; grid-row: 3; }
  .activity-row .act-desc   { grid-column: 2 / 4; grid-row: 4; }
  .proposal-type { grid-template-columns: 1fr; }

  /* Wide fixed-width inline widgets shrink */
  .page-body [style*="min-width"], .content [style*="min-width"] { min-width: 0 !important; }
  .page-body [style*="max-width:520px"], .content .card[style*="max-width"] { max-width: 100% !important; }

  /* Headers & rows wrap */
  .card-header, .card-head { flex-wrap: wrap; gap: 10px; }
  .page-body .card { padding: 14px; }
  /* Monthly project rows: name on top, details wrap underneath */
  .mp-row { flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 0; }
  .mp-main { order: -1; flex: 1 1 100%; min-width: 0; }
  .mp-dept, .mp-agenda, .mp-deadline { min-width: 0; max-width: 100%; }
  .mp-agenda { flex: 1 1 100%; order: 0; }
  .mp-dept { order: 1; }
  .mp-deadline { order: 2; }
  .mp-status { order: 3; margin-left: auto; }
  .page-body .card-header > div[style*="display:flex"] { flex-wrap: wrap; }
  .page-body div[style*="padding:14px 20px"] { padding: 12px 4px !important; }

  .proj-row { flex-wrap: wrap; }
  .proj-right { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .qtr-btns { flex-wrap: wrap; }
  .sms-preview { overflow-wrap: anywhere; }
  .detail-header { padding: 16px !important; }
  .detail-title { font-size: 16px !important; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

  /* Tabs wrap into two columns, so every tab stays visible */
  body .section-tabs, body .tab-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; overflow: visible; }
  body .section-tabs .tab-btn, body .tab-row .tab-btn { white-space: normal; padding-left: 8px; padding-right: 8px; text-align: center; justify-content: center; }

  /* Modals as bottom sheets */
  .modal-overlay { padding: 0 !important; align-items: flex-end !important; }
  .modal-overlay .modal, #reviewModal > div {
    max-width: 100% !important; width: 100% !important;
    border-radius: 18px 18px 0 0 !important; max-height: 92vh; max-height: 92dvh;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom)) !important;
  }
  #reviewModal { align-items: flex-end !important; }
  #reviewModal > div > form > div:last-child { flex-wrap: wrap; }

  /* Bottom nav */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    height: calc(var(--ui-bottom-nav-h) + env(safe-area-inset-bottom));
    padding: 4px 6px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--ui-surface) 92%, transparent);
    backdrop-filter: saturate(1.6) blur(12px);
    border-top: 1px solid var(--ui-border);
    box-shadow: 0 -6px 24px rgba(15, 23, 42, .06);
  }
}

@media (max-width: 480px) {
  .page-body .stats-grid, .page-body .stats-grid[style], .kpi-grid, .stat-grid, .dept-grid {
    grid-template-columns: 1fr 1fr !important; gap: 10px !important;
  }
  .stat-card { padding: 12px !important; gap: 10px !important; }
  .stat-value, .stat-val { font-size: 20px !important; }
  body .kpi-value { font-size: 22px; }
  .topbar .icon-btn { width: 32px; height: 32px; }
}

@media (max-width: 360px) {
  .page-body .stats-grid, .page-body .stats-grid[style], .kpi-grid, .stat-grid, .dept-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Short screens: keep sidebar usable */
@media (max-height: 640px) {
  .sb-footer { display: none; }
}

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-delay: 0s !important;
    transition-duration: .001ms !important;
  }
}

/* ── PROJECTS TABLE: stacks whenever the table has no room for all its columns
      (laptops with the sidebar, tablets, phones) so nobody has to swipe sideways ── */
.table-wrap:has(> table.table-stack) { container-type: inline-size; }
@container (max-width: 1100px) {
  table.table-stack, table.table-stack tbody { display: block; width: 100%; }
  table.table-stack thead { display: none; }
  table.table-stack tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px;
    padding: 14px 4px; border-bottom: 1px solid var(--border);
  }
  table.table-stack tbody tr:last-child { border-bottom: none; }
  table.table-stack tbody tr:hover td { background: none; }
  table.table-stack tbody td { display: block; padding: 0; border: none; min-width: 0; overflow-wrap: anywhere; }
  table.table-stack tbody td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 3px;
    font-size: 10px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--sub);
  }
  table.table-stack td.st-title { grid-column: 1 / -1; order: -1; }
  table.table-stack td.st-full { grid-column: 1 / -1; }
  table.table-stack td.st-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; white-space: normal !important; }
  table.table-stack td.st-actions form { display: inline-flex !important; }
  table.table-stack td[colspan] { grid-column: 1 / -1; }
}

/* ── Table search bar (admin Programs / Projects / Activities) ── */
.table-search-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.table-search-bar input[type="search"] {
  width: 280px; max-width: 100%; padding-left: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center; background-size: 15px;
}
@media (max-width: 640px) {
  .table-search-bar { width: 100%; }
  .table-search-bar input[type="search"] { flex: 1; width: auto; }
}
/* Name fields: title, first, middle initial, last, extension, degree (registration and Edit Profile) */
.name-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:0 12px;align-items:end}
.name-grid .nf-opt{font-weight:400;color:var(--sub);font-size:10px}
.nf-preview{font-size:12px;color:var(--sub);margin:2px 0 12px}
.nf-preview strong{color:var(--text)}
@media (max-width:700px){.name-grid{grid-template-columns:1fr 1fr}}
@media (max-width:420px){.name-grid{grid-template-columns:1fr}}

/* Edit Profile header: photo with a camera button (Faculty and Coordinator Portals) */
.pf-head{text-align:center;margin:4px 0 20px}
.pf-photo{position:relative;display:inline-block;margin-bottom:10px}
.pf-photo .pf-avatar{width:92px;height:92px;font-size:28px;background-size:cover;background-position:center;box-shadow:0 0 0 3px var(--card),0 0 0 5px var(--border)}
.pf-photo .pf-avatar[style*="background-image"]{background-color:transparent}
.pf-camera{position:absolute;bottom:0;right:-2px;width:30px;height:30px;border-radius:50%;background:var(--accent);color:#fff;display:flex;
  align-items:center;justify-content:center;cursor:pointer;border:2px solid var(--card);box-shadow:0 2px 8px rgba(0,0,0,.2)}
.pf-camera:hover{filter:brightness(1.1)}
.pf-name{font-size:16px;font-weight:700;color:var(--text)}
.pf-email{font-size:12px;color:var(--sub);margin-top:2px}
.pf-role{margin-top:8px;display:flex;gap:6px;justify-content:center;flex-wrap:wrap}
.pf-hint{font-size:11px;color:var(--sub);margin-top:8px}

/* Primary Administrator badge, readable in both modes */
.badge-gold{background:#fef3c7;color:#92400e;border:1px solid #fde68a}
body.dark .badge-gold{background:#3a2a05;color:#fcd34d;border-color:#78530a}

/* Readable in both modes (found by the hover check) */
.profile-btn{color:var(--text)}
body.dark .pp-cbtn{color:#93c5fd}
body.dark .pp-cbtn:hover{border-color:#93c5fd}
.btn-gold-outline{color:#a16207;border-color:#ca8a04}
.btn-gold-outline:hover{background:#fef3c7;color:#854d0e}
body.dark .btn-gold-outline{color:#fcd34d;border-color:#a16207}
body.dark .btn-gold-outline:hover{background:#3a2a05;color:#fde68a}

/* ── Phones and small tablets: table rows as cards ─────────── */
@media (max-width: 768px) {
  .table.cards-on-phone, .table.cards-on-phone tbody, .table.cards-on-phone tfoot { display: block; width: 100%; }
  .table.cards-on-phone tfoot tr { border-color: var(--accent); }
  .table.cards-on-phone tfoot td { font-weight: 700; }
  .table.cards-on-phone thead { display: none; }
  .table.cards-on-phone tr { display: block; border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; background: var(--card);
                             box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
  .table.cards-on-phone tbody tr:hover td { background: transparent; }
  .table.cards-on-phone td { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 6px 0; border: none;
                             text-align: right; font-size: 12.5px; min-height: 0; }
  .table.cards-on-phone td::before { content: attr(data-label); flex-shrink: 0; max-width: 42%; text-align: left;
                                     font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--sub); padding-top: 2px; }
  .table.cards-on-phone td[data-label=""]::before { display: none; }
  .table.cards-on-phone td.td-title { display: block; text-align: left; padding: 0 0 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
  .table.cards-on-phone td.td-title::before { display: none; }
  .table.cards-on-phone td.td-title .table-name { font-size: 14px; }
  .table.cards-on-phone td.td-wide { display: block; text-align: left; border-radius: 10px; }
  .table.cards-on-phone td.td-wide::before { display: none; }
  .table.cards-on-phone td.td-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: stretch; text-align: left;
                                        border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }
  .table.cards-on-phone td.td-actions::before { display: none; }
  .table.cards-on-phone td.td-actions > .btn, .table.cards-on-phone td.td-actions > a, .table.cards-on-phone td.td-actions > form,
  .table.cards-on-phone td.td-actions > div { flex: 1 1 0; min-width: 88px; }
  .table.cards-on-phone td.td-actions .btn { width: 100%; }
  .table.cards-on-phone td.td-actions > div { display: flex; flex-wrap: wrap; gap: 8px; }
  .table.cards-on-phone td.td-actions > div { flex-basis: 100%; }
  .table.cards-on-phone td.td-actions > div > * { flex: 1 1 0; min-width: 88px; }
  .table.cards-on-phone td .badge { white-space: nowrap; }
  .table.cards-on-phone td select.form-control { width: auto; min-width: 130px; max-width: 60%; }
  .table.cards-on-phone td form:not(.td-actions form) { margin-left: auto; }
  .table-wrap:has(> .cards-on-phone) { overflow: visible; }
}

/* ── Phones: bigger buttons ─────────── */
@media (max-width: 640px) {
  .btn { min-height: 40px; padding: 9px 14px; font-size: 13px; border-radius: 10px; justify-content: center; -webkit-tap-highlight-color: transparent; }
  .btn-sm { min-height: 36px; padding: 7px 12px; font-size: 12px; }
  .card-header { flex-wrap: wrap; gap: 10px; }
  .card-header > .btn, .card-header > a.btn { width: 100%; }


  /* Proposal review: the steps in two columns, nothing wider than the screen */
  .pp-steps { display: grid; grid-template-columns: 1fr 1fr; }
  .pp-step { min-width: 0; }
  .pp-tosection { flex-wrap: wrap; }
  .pp-title { flex-wrap: wrap; }
}

/* Same header on Programs, Projects and Activities: period filter | search + Review Proposals, then the tabs */
.mon-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; min-height: 38px; }
.mon-left { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mon-left .form-control { width: auto; }
.mon-label { font-size: 12px; font-weight: 600; color: var(--sub); margin-right: 2px; }
.mon-tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.mon-tabs .form-control { width: auto; max-width: 360px; }
@media (max-width: 640px) {
  .mon-toolbar .table-search-bar { width: 100%; margin-left: 0; }
  .mon-toolbar .table-search-bar input[type="search"] { flex: 1 1 auto; width: auto; }
}

/* Action buttons of a project's activities: a 2 × 2 grid that never spills out of the table */
.act-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; min-width: 150px; }
.act-btns form { margin: 0; }
.act-btns .btn { width: 100%; justify-content: center; white-space: nowrap; }

/* Phone cards: nothing in a card may be wider than the card (long names, emails, several small forms) */
@media (max-width: 768px) {
  .table.cards-on-phone td { white-space: normal !important; min-width: 0; flex-wrap: wrap; overflow-wrap: anywhere; }
  .table.cards-on-phone td > * { max-width: 100%; }
  .table.cards-on-phone td:not(.td-actions) > form + form { margin-top: 6px; }
}
@media (max-width: 768px) {
  .tbl-scroll > table.cards-on-phone { min-width: 0; }
  .tbl-scroll:has(> .cards-on-phone) { overflow: visible; }
}
/* Action buttons go to a second line instead of spilling out of the table */
.table td.td-actions { white-space: normal !important; }
@media (min-width: 769px) and (max-width: 1100px) {
  .table td .badge { white-space: normal; }
}

/* ── Profile menu (top right): who is signed in, My Profile and Logout ── */
.dropdown-menu.pm { width: 270px; min-width: 0; padding: 8px; border-radius: 16px; box-shadow: 0 16px 40px rgba(15, 23, 42, .18); }
.pm-head { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 6px; border-radius: 12px;
           background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--card)), color-mix(in srgb, var(--accent) 4%, var(--card))); }
.pm-head .avatar { width: 44px; height: 44px; font-size: 15px; box-shadow: 0 0 0 2px var(--card), 0 0 0 4px color-mix(in srgb, var(--accent) 50%, transparent); }
.pm-who { min-width: 0; }
.pm-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-role { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: 20px; font-size: 10px; font-weight: 700;
           color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.pm-email { font-size: 10.5px; color: var(--sub); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--text); transition: background .15s; }
.pm-item:hover { background: var(--hover); }
.pm-ico { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
          background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.pm-ico svg, .pm-logout svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pm-item b { display: block; font-size: 12.5px; font-weight: 600; }
.pm-item small { display: block; font-size: 10.5px; color: var(--sub); }
.pm-logout { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; padding: 9px; border-radius: 10px;
             font-size: 12.5px; font-weight: 700; text-decoration: none; color: var(--red);
             background: color-mix(in srgb, var(--red) 9%, var(--card)); border: 1px solid color-mix(in srgb, var(--red) 25%, var(--border));
             transition: background .15s, color .15s; }
.pm-logout:hover { background: var(--red); color: #fff; }
body.dark .pm-role, body.dark .pm-ico { color: #93c5fd; background: rgba(59, 130, 246, .18); }
body.dark .pm-logout { color: #fca5a5; background: rgba(220, 38, 38, .14); border-color: rgba(248, 113, 113, .35); }
body.dark .pm-logout:hover { background: #dc2626; color: #fff; }

/* Required field mark */
.req { color: var(--red); font-weight: 700; }

/* ── Edit Profile: summary on the left, the form in sections on the right ── */
.pf-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.pf-side { position: sticky; top: 76px; padding: 26px 22px 18px; }
.pf-side .pf-head { margin: 0 0 16px; }
.pf-facts { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.pf-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-fact span { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sub); }
.pf-fact b { font-size: 13px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.pf-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pf-sec { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; padding: 22px 24px; margin: 0; }
.pf-sec-head h3 { font-size: 14.5px; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.pf-sec-head p { font-size: 12px; color: var(--sub); line-height: 1.5; margin: 0; }
.pf-sec-body .form-grid { margin: 0; }
.pf-sec-body .form-group:last-child, .pf-sec-body .form-grid > .form-group { margin-bottom: 0; }
.pf-sec-body .form-grid { row-gap: 14px; }
.pf-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
@media (min-width: 901px) {   /* computer: the Save button stays in view at the bottom of the screen */
  .pf-actions { position: sticky; bottom: 0; z-index: 5; margin: 0 -2px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg);
                background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
                box-shadow: 0 -8px 24px -18px rgba(15, 23, 42, .45); }
  .pf-actions::before { content: 'Changes are saved when you click Save Changes.'; margin-right: auto; font-size: 12px; color: var(--sub); }
}
.pf-actions .btn { min-width: 160px; }
@media (max-width: 1180px) { .pf-sec { grid-template-columns: 1fr; gap: 12px; } }
@media (max-width: 900px) {
  .pf-layout { grid-template-columns: 1fr; }
  .pf-side { position: static; }
  .pf-actions .btn { width: 100%; }
}

/* ── Faculty dashboard: To do ── */
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.todo-item { --tc: var(--accent); display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
             background: color-mix(in srgb, var(--tc) 5%, var(--card)); }
.todo-item.todo-red { --tc: var(--red); } .todo-item.todo-amb { --tc: var(--amb); } .todo-item.todo-blu { --tc: var(--blu); } .todo-item.todo-pur { --tc: var(--pur); }
.todo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tc); flex-shrink: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 18%, transparent); }
.todo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.todo-text b { font-size: 13px; color: var(--text); }
.todo-text small { font-size: 12px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-item .btn { flex-shrink: 0; }
.todo-empty { padding: 14px 16px; border: 1px dashed var(--border); border-radius: 12px; font-size: 13px; color: var(--grn); background: color-mix(in srgb, var(--grn) 5%, var(--card)); }
@media (max-width: 640px) {
  .todo-item { flex-wrap: wrap; }
  .todo-text small { white-space: normal; }
  .todo-item .btn { width: 100%; }
}

.pf-hint:empty { display: none; }

/* ── Coordinator: Remind button, What changed, Faculty list ── */
.remind-form { margin: 0; display: inline-block; flex-shrink: 0; }
.chg-key ins, .chg-text ins { background: color-mix(in srgb, var(--grn) 20%, transparent); color: inherit; text-decoration: none; border-radius: 3px; padding: 0 2px; }
.chg-key del, .chg-text del { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--sub); text-decoration: line-through; border-radius: 3px; padding: 0 2px; }
.chg-key { margin-left: 4px; white-space: nowrap; }
.chg-sec { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.chg-sec > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 13px; color: var(--text); background: color-mix(in srgb, var(--accent) 4%, var(--card)); list-style: none; }
.chg-sec > summary::-webkit-details-marker { display: none; }
.chg-sec > summary::before { content: "\25B8"; display: inline-block; margin-right: 8px; transition: transform .15s; color: var(--sub); }
.chg-sec[open] > summary::before { transform: rotate(90deg); }
.chg-text { padding: 12px 14px; font-size: 13px; line-height: 1.7; color: var(--text); border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.chg-same { font-size: 12px; color: var(--sub); padding: 4px 2px 0; }
.fac-who { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.fac-ava { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; object-fit: cover; display: inline-flex; align-items: center; justify-content: center;
           background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); font-weight: 700; font-size: 14px; }
@media (max-width: 640px) {
  .todo-item .remind-form { width: 100%; }
  .todo-item .remind-form .btn { width: 100%; }
}
/* A hidden table row stays hidden in the phone card layout; an empty action cell takes no room there */
.table tr[hidden] { display: none !important; }
@media (max-width: 768px) { .table td.no-print:empty { display: none; } }

/* ── Page content a little bigger (all portals). Only inside .page-body: the sidebar, top bar and bottom nav keep their size. ── */
.page-body { font-size: 15px; }
.page-body .card-title  { font-size: 16px; }
.page-body .card-sub    { font-size: 12.5px; }
.page-body .kpi-label   { font-size: 12.5px; }
.page-body .kpi-note    { font-size: 12.5px; }
.page-body .stat-label  { font-size: 12.5px; }
.page-body .table       { font-size: 13px; }
.page-body .table th    { font-size: 11px; }
.page-body .table-name  { font-size: 13px; }
.page-body .table-sub   { font-size: 11px; }
.page-body .badge       { font-size: 11px; }
.page-body .btn         { font-size: 13px; }
.page-body .btn-sm      { font-size: 12px; }
.page-body .form-label  { font-size: 12px; }
.page-body .form-control { font-size: 13px; }
.page-body .alert       { font-size: 13px; }
.page-body .text-sm     { font-size: 12px; }
.page-body .pp-title    { font-size: 15px; }
.page-body .pp-muted, .page-body .pp-team, .page-body .pp-nav a { font-size: 12px; }
.page-body .pp-meta span { font-size: 11px; }
.page-body .pp-text, .page-body .pp-review, .page-body .pp-step b, .page-body .pp-project-no, .page-body .pp-profile,
.page-body .pp-subhead, .page-body .pp-act-desc, .page-body .pp-table td, .page-body .pp-table th, .page-body .pp-comment summary,
.page-body .pp-tosection, .page-body .pp-budget-adjust summary { font-size: 13px; }
.page-body .pp-pl       { font-size: 12px; }
.page-body .todo-text b { font-size: 14px; }
.page-body .todo-text small { font-size: 12.5px; }
.page-body .todo-empty, .page-body .chg-text { font-size: 14px; }
.page-body .chg-sec > summary { font-size: 14px; }
.page-body .chg-same    { font-size: 13px; }
.page-body .proj-name   { font-size: 13px; }
.page-body .proj-meta, .page-body .legend-item { font-size: 11px; }
@media (min-width: 901px) { .kpi-grid.kpi-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ── Auto-logout notice ── */
.idle-warn { position: fixed; right: 18px; bottom: 18px; z-index: 3000; max-width: 360px; display: flex; align-items: center; gap: 14px;
             padding: 14px 16px; border-radius: 14px; background: var(--card); color: var(--text); border: 1px solid var(--border);
             border-left: 4px solid var(--amb); box-shadow: 0 12px 32px rgba(0,0,0,.18); font-size: 13px; }
.idle-warn b { display: block; font-size: 14px; margin-bottom: 2px; }
.idle-warn span { color: var(--sub); line-height: 1.45; }
.idle-warn em { font-style: normal; font-weight: 700; color: var(--amb); font-variant-numeric: tabular-nums; }
.idle-warn .btn { flex-shrink: 0; }
@media (max-width: 640px) { .idle-warn { left: 12px; right: 12px; bottom: 76px; max-width: none; } }

/* ── Admin Projects list ── */
.stat-value .pl-of { font-size: .6em; font-weight: 700; color: var(--sub); }
@media (min-width: 769px) {
  #projects-table .pl-name, #prev-projects-table .pl-name { min-width: 220px; }
  #projects-table .pl-leaders, #prev-projects-table .pl-leaders { min-width: 140px; max-width: 220px; }
}
/* A cell with several lines (count, note, bar) stays one block; on phone cards it sits on the right */
@media (max-width: 768px) { .table.cards-on-phone td .cell-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; } }
.pl-agenda { text-transform: uppercase; letter-spacing: .02em; margin-top: 3px; }

/* ── All Departments: every card the same size ── */
.dept-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); grid-auto-rows: 1fr; gap: 16px; }
.dept-hub-item { display: block; text-decoration: none; min-width: 0; }
.card.dept-hub-card { height: 100%; margin: 0; display: flex; flex-direction: column; border-left-width: 4px; border-left-style: solid; transition: box-shadow .2s, transform .2s; }
.dept-hub-item:hover .dept-hub-card, .dept-hub-item:focus-visible .dept-hub-card { box-shadow: 0 6px 18px rgba(0,0,0,.12); transform: translateY(-2px); }
.dept-hub-stats { display: flex; gap: 12px; margin-top: auto; }
@media (max-width: 640px) { .dept-hub { grid-template-columns: 1fr; } }

/* ── Extension Map (CarCanMadCarLan) ── */
:root { --xm0: #e7ebf1; --xm1: #cfe0fb; --xm2: #8db8f5; --xm3: #3f83ea; --xm4: #1747a6; --xm-line: #ffffff; --xm-out: #334155; }
body.dark { --xm0: #263244; --xm1: #1c3a66; --xm2: #22589f; --xm3: #3b82f6; --xm4: #9cc3ff; --xm-line: #0f172a; --xm-out: #cbd5e1; }
.xmap-bar { padding: 14px 16px; }
.xmap-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 0; }
.xmap-f { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.xmap-f > span { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--sub); }
.xmap-find { flex: 1; min-width: 220px; }
.xmap-fixed { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); min-height: 36px; }
.xmap-of { font-size: .55em; font-weight: 700; color: var(--sub); }
.xmap-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.xmap-layout > .card, .xmap-side > .card { margin-bottom: 0; }
.xmap-side { display: flex; flex-direction: column; gap: 14px; }
.xmap-metric { display: flex; gap: 6px; flex-wrap: wrap; }
.xmap-wrap { position: relative; border-radius: 12px; background: color-mix(in srgb, var(--accent) 4%, var(--card)); border: 1px solid var(--border); overflow: hidden; }
.xmap { display: block; width: 100%; height: auto; max-height: min(66vh, 640px); margin: 0 auto; }
.xmap .xb { fill: var(--xm0); stroke: var(--xm-line); stroke-width: .7; cursor: pointer; transition: fill .25s, opacity .2s; }
.xmap .xb[data-k="1"] { fill: var(--xm1); } .xmap .xb[data-k="2"] { fill: var(--xm2); } .xmap .xb[data-k="3"] { fill: var(--xm3); } .xmap .xb[data-k="4"] { fill: var(--xm4); }
.xmap.by-muni .xb { fill: var(--mc); }
.xmap .xb:hover { opacity: .78; }
.xmap .xb.sel { stroke: #f59e0b; stroke-width: 2.2; }
.xmap .xo { fill: none; stroke: var(--xm-out); stroke-width: 1.3; stroke-linejoin: round; pointer-events: none; }
.xmap .xl { font: 800 13px var(--font, sans-serif); fill: var(--text); text-anchor: middle; paint-order: stroke; stroke: var(--card); stroke-width: 3.5px; pointer-events: none; letter-spacing: .02em; }
.xmap .xpin path { fill: #ef4444; stroke: #fff; stroke-width: 1.6; }
.xmap .xpin circle { fill: #fff; }
.xmap .xpin.drop .xpin-s { animation: xpinDrop .45s cubic-bezier(.3, 1.5, .5, 1); transform-origin: 0 0; }
@keyframes xpinDrop { from { opacity: 0; translate: 0 -24px; } to { opacity: 1; translate: 0 0; } }
.xmap-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--card); border: 1px solid var(--border); border-radius: 10px;
            padding: 8px 10px; box-shadow: 0 8px 22px rgba(0,0,0,.16); display: flex; flex-direction: column; gap: 1px; font-size: 12px; color: var(--sub); max-width: 230px; }
.xmap-tip b { color: var(--text); font-size: 13px; }
.xmap-reset[hidden] { display: none; }
.xmap-reset { position: absolute; top: 10px; right: 10px; z-index: 4; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.xmap-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12px; color: var(--sub); }
.xmap-legend span { display: inline-flex; align-items: center; gap: 6px; }
.xmap-legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--border); }
.xmap-legend i.k0 { background: var(--xm0); } .xmap-legend i.k1 { background: var(--xm1); } .xmap-legend i.k2 { background: var(--xm2); }
.xmap-legend i.k3 { background: var(--xm3); } .xmap-legend i.k4 { background: var(--xm4); }
.xmap-src { margin-top: 8px; font-size: 11px; color: var(--sub); opacity: .8; }
.xmap-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--mc); display: inline-block; flex-shrink: 0; margin-right: 8px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.12); }
.xmap-info-head { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.xmap-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.xmap-stats > div { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; background: color-mix(in srgb, var(--accent) 3%, var(--card)); }
.xmap-stats b { display: block; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.xmap-stats span { font-size: 11.5px; color: var(--sub); }
.xmap-partner { font-size: 12.5px; color: var(--text); margin-bottom: 8px; }
.xmap-plist { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.xmap-plist a { color: var(--accent); text-decoration: none; font-weight: 600; }
.xmap-empty { font-size: 13px; color: var(--sub); padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px; list-style: none; }
.xmap-rank { list-style: none; margin: 10px 0 0; padding: 0; counter-reset: r; display: flex; flex-direction: column; gap: 6px; }
.xmap-rank li { counter-increment: r; }
.xmap-rank button { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 1px solid var(--border); border-radius: 10px;
                    padding: 8px 10px; cursor: pointer; color: var(--text); font: inherit; }
.xmap-rank button::before { content: counter(r); width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
                            font-size: 11px; font-weight: 800; background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); }
.xmap-rank button:hover { border-color: var(--accent); }
.xmap-rank span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.xmap-rank small { font-size: 11.5px; color: var(--sub); }
.xmap-rank em { font-style: normal; font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.xmap-none { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.xmap-none-m b { display: block; font-size: 12.5px; margin-bottom: 5px; padding-left: 8px; border-left: 3px solid var(--mc); }
.xmap-none-m > div { display: flex; flex-wrap: wrap; gap: 5px; }
.xmap-chip { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; font-family: inherit; }
.xmap-chip:hover { border-color: var(--accent); color: var(--accent); }
.xmap-open { cursor: pointer; }
.xmap-muni { padding: 0; overflow: hidden; margin-bottom: 10px; }
.xmap-muni > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 14px 44px 14px 18px; flex-wrap: wrap; position: relative; }
.xmap-muni > summary::-webkit-details-marker { display: none; }
.xmap-muni > summary::after { content: "\25BE"; position: absolute; right: 18px; top: 50%; margin-top: -9px; line-height: 18px; color: var(--sub); transition: transform .2s; }
.xmap-muni[open] > summary::after { transform: rotate(180deg); }
.xmap-muni-name { font-weight: 700; font-size: 15px; color: var(--text); }
.xmap-muni-stats { margin-left: auto; font-size: 13px; color: var(--sub); }
.xmap-muni-stats b { color: var(--text); }
.xmap-muni .table-wrap { padding: 0 18px 12px; border-top: 1px solid var(--border); }
.xmap-row { cursor: pointer; }
.xmap-row.sel td { background: color-mix(in srgb, #f59e0b 14%, var(--card)) !important; }
.xmap-zero td { color: var(--sub); }
.xmap-partners { max-width: 260px; font-size: 12px; }
@media (max-width: 1100px) { .xmap-layout { grid-template-columns: 1fr; } .xmap { max-height: none; } }
@media (max-width: 640px) { .xmap-f { min-width: 0; flex: 1 1 140px; } .xmap-muni-stats { margin-left: 0; width: 100%; padding-left: 20px; } }

/* ── Location picker (Municipality → Barangay → typed place) ── */
.loc-pick { display: contents; }
.act-loc-head { font-size: 12px; font-weight: 700; color: var(--text); margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--border); }
.act-loc-head em { font-weight: 500; color: var(--sub); font-style: normal; }
.loc-other[hidden] { display: none !important; }
.loc-admin .loc-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.loc-admin .loc-f { display: flex; flex-direction: column; gap: 4px; }
.loc-admin .loc-f > span { font-size: 11px; font-weight: 600; color: var(--sub); }
.loc-admin .loc-other { grid-column: 1 / -1; }
@media (max-width: 640px) { .loc-admin .loc-pick { grid-template-columns: 1fr; } }

/* ── Extension Map: right side as one card with swipeable panes ── */
.xmap-layout { align-items: stretch; }
.card.xmap-side { display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 0; }
.xmap-tabs { display: flex; gap: 4px; padding: 10px 10px 0; border-bottom: 1px solid var(--border); }
.xmap-tabs button { flex: 1; border: none; background: none; padding: 10px 6px 11px; font: 600 12.5px var(--font, inherit); color: var(--sub); cursor: pointer;
                    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.xmap-tabs button:hover { color: var(--text); }
.xmap-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.xmap-tab-n { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--hover, rgba(0,0,0,.06)); color: var(--sub); }
.xmap-panes { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.xmap-panes::-webkit-scrollbar { display: none; }
.xmap-panes.dragging { scroll-snap-type: none; cursor: grabbing; user-select: none; }
.xmap-pane { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; overflow-y: auto; padding: 16px 18px; }
.xmap-pane-empty { height: 100%; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 10px; }
.xmap-pane-empty svg { width: 42px; height: 42px; fill: none; stroke: var(--accent); stroke-width: 1.6; opacity: .75; margin-bottom: 4px; }
.xmap-pane-empty .card-sub { max-width: 260px; }
.xmap-dots { display: flex; justify-content: center; gap: 6px; padding: 8px 0 12px; border-top: 1px solid var(--border); }
.xmap-dots i { width: 7px; height: 7px; border-radius: 999px; background: var(--border); cursor: pointer; transition: width .2s, background .2s; }
.xmap-dots i.on { width: 20px; background: var(--accent); }
.xmap-pdept { font-size: 11px; font-weight: 700; color: var(--sub); }
.xmap-pother { color: var(--text); }
.xmap-pnote { margin-top: 8px; font-size: 11.5px; color: var(--sub); }
@media (min-width: 1101px) { .card.xmap-side { max-height: calc(min(66vh, 640px) + 150px); } }
@media (max-width: 1100px) { .xmap-pane { max-height: 460px; } }

.loc-benef .loc-pick { margin-top: 2px; }
.loc-benef .loc-f > span { font-size: 12px; font-weight: 600; color: var(--sub); letter-spacing: .02em; }
.loc-benef .loc-f > span::after { content: " *"; color: var(--red); }
.loc-benef .loc-other > span::after { content: ""; }
