/* MECIP Staff Portal - industrial/engineering theme, consistent with the earlier prototypes */
:root {
  --bg: #ECEEE4; --panel: #FFFFFF; --panel-alt: #F4F5EE;
  --ink: #1B2624; --ink-soft: #5B655F; --ink-faint: #8B958D;
  --line: #CBD0BE; --line-soft: #DEE2D2;
  --accent: #2B6E63; --accent-soft: #D7E5DF;
  --sla-green: #3E8C58; --sla-amber: #D68A24; --sla-red: #C24A2E; --sla-dark: #7A2416;
}
body { font-family: 'IBM Plex Sans', sans-serif; color: var(--ink); background: var(--bg); margin: 0; }
.app-shell { display: flex; min-height: 100vh; }
.guest-shell { display: flex; justify-content: center; align-items: flex-start; padding: 60px 20px; min-height: 100vh; }

/* The checkbox that drives the whole show/hide toggle -- pure CSS, no JavaScript involved, so it
   can never fail to "attach" the way a click handler can. Every visible control is a <label
   for="sbToggle"> somewhere in the page; clicking any of them just toggles this checkbox. */
.sb-check { display: none; }

/* ---- Mobile-first base: sidebar is an off-canvas drawer, hidden until the checkbox is checked ---- */
.mobile-topbar { display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; padding: 12px 16px; position: sticky; top: 0; z-index: 1030; }
.mobile-topbar .hamburger { background: none; border: 1px solid rgba(255,255,255,.3); border-radius: 4px; color: #fff; font-size: 18px; padding: 4px 10px; line-height: 1; cursor: pointer; }
.mobile-topbar .brand-title { margin: 0; font-size: 16px; }

.sidebar {
  width: min(280px, 82vw); background: var(--ink); color: #fff; flex-shrink: 0; padding: 18px 14px;
  position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 1050;
  transform: translateX(-100%);
  transition: transform .25s ease;
  box-shadow: 2px 0 18px rgba(0,0,0,.25);
}
.sb-check:checked ~ .app-shell .sidebar { transform: translateX(0); }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1040; cursor: pointer; }
.sb-check:checked ~ .sidebar-overlay { display: block; }

.brand-eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .16em; color: #8FBBAE; text-transform: uppercase; }
.brand-title { font-family: 'Big Shoulders Display', sans-serif; font-weight: 800; font-size: 21px; text-transform: uppercase; line-height: 1.05; margin: 3px 0 16px; }
.sidebar-head { display: flex; justify-content: space-between; align-items: flex-start; }
.sidebar-close { display: block; cursor: pointer; color: #C7D2CC; font-size: 22px; line-height: 1; padding: 2px 8px; }
.nav-divider { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: #7C8C85; margin: 14px 4px 4px; }
.nav-item { display: block; font-size: 12.5px; padding: 10px 10px; border-radius: 3px; color: #C7D2CC; margin-bottom: 2px; text-decoration: none; font-weight: 500; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: 18px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.14); font-size: 11px; color: #C7D2CC; }
.sidebar-foot a { color: #C7D2CC; }

.main-wrap { flex: 1; margin-left: 0; padding: 18px 18px 48px; min-width: 0; }
.top-bar { display: flex; justify-content: flex-start; margin-bottom: 16px; }
.persona-chip { font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 6px 12px; display: flex; align-items: center; gap: 8px; }
.persona-avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

/* ---- Desktop (>=992px): sidebar is always visible and pushes the content over; no hamburger, no drawer ---- */
@media (min-width: 992px) {
  .mobile-topbar { display: none; }
  .sidebar-overlay { display: none !important; }
  .sidebar-close { display: none; }
  .sidebar { width: 230px; transform: translateX(0) !important; box-shadow: none; }
  .main-wrap { margin-left: 230px; padding: 20px 28px 60px; }
  .top-bar { justify-content: flex-end; }
}

h1, h2, h3, .section-title { font-family: 'Big Shoulders Display', sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: .01em; }
.section-title { font-size: 18px; margin: 22px 0 4px; }
.section-sub { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 10px; }
.mono-faint { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--ink-faint); }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 20px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 12px 14px; position: relative; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.stat-value { font-family: 'Big Shoulders Display', sans-serif; font-weight: 700; font-size: 26px; line-height: 1; }
.stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-top: 5px; font-weight: 600; }
.stat-sub { font-size: 10px; color: var(--ink-faint); margin-top: 2px; font-family: 'IBM Plex Mono', monospace; }

.card-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 16px; margin-bottom: 16px; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 16px; }
.table-wrap table { margin-bottom: 0; min-width: 560px; }
.table-wrap thead th { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); background: var(--panel-alt); border-bottom: 2px solid var(--ink) !important; white-space: nowrap; }
.table-wrap td, .table-wrap th { font-size: 12.5px; vertical-align: middle; }

.badge-status { font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 10px; color: #fff; text-transform: uppercase; letter-spacing: .02em; }

.form-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); font-weight: 600; }
.form-control, .form-select { font-size: 13px; border-color: var(--line); }
.btn-brand { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-brand:hover { background: #1F5049; border-color: #1F5049; color: #fff; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-family: 'IBM Plex Mono', monospace; font-size: 11px; padding: 5px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-alt); color: var(--ink-soft); text-decoration: none; text-transform: uppercase; letter-spacing: .02em; cursor: pointer; line-height: 1.4; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip:hover { border-color: var(--accent); color: var(--accent); }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-family: 'IBM Plex Mono', monospace; font-size: 10px; text-transform: uppercase; color: var(--ink-faint); text-align: center; padding: 4px 0; }
.cal-cell { display: block; background: var(--panel); border: 1px solid var(--line-soft); min-height: 78px; padding: 5px 6px; border-radius: 2px; overflow: hidden; text-decoration: none; color: inherit; }
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.empty { background: transparent; border-color: transparent; pointer-events: none; }
.cal-cell.holiday { background: #FBF3E7; }
.cal-cell.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-daynum { font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.cal-pill { font-size: 9px; padding: 2px 5px; border-radius: 3px; margin-top: 3px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { font-size: 9px; color: var(--ink-faint); margin-top: 3px; font-family: 'IBM Plex Mono', monospace; }

.legend-item { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ink-soft); font-family: 'IBM Plex Mono', monospace; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.remark-block { font-size: 12px; line-height: 1.5; color: var(--ink-soft); background: var(--panel-alt); border-left: 3px solid var(--accent); padding: 8px 10px; margin-bottom: 8px; }

.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 30px; width: 100%; max-width: 420px; }
.viewonly-tag { font-family: 'IBM Plex Mono', monospace; font-size: 9px; background: var(--ink-faint); color: #fff; padding: 2px 7px; border-radius: 8px; margin-left: 8px; letter-spacing: .04em; }

/* ============================================================
   RESPONSIVE: tablet & mobile
   Breakpoint at 991px matches Bootstrap's lg, so it lines up with the grid classes already
   used in the PHP templates (col-md-*, row, etc.)
   ============================================================ */

/* Tablet and phone: the mobile-first base rules above already make the sidebar an off-canvas
   drawer -- nothing extra needed here, this query is kept only for the phone-specific tweaks below. */

/* Phone: tighten spacing, single-column stat cards, smaller type on the branded headings */
@media (max-width: 575.98px) {
  .main-wrap { padding: 14px 14px 40px; }
  .section-title { font-size: 16px; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-value { font-size: 22px; }
  .card-panel, .auth-card { padding: 14px; }
  .guest-shell { padding: 24px 14px; }
  .persona-chip { padding: 5px 9px; }
  .persona-chip .mono-faint { display: none; } /* position/branch text is redundant on a small screen */
  .chip-row .chip { font-size: 10px; padding: 4px 8px; }

  /* The branch calendar is the one screen with genuinely dense content; let it scroll sideways
     rather than crushing each day down to nothing. */
  .cal-grid { grid-template-columns: repeat(7, minmax(64px, 1fr)); overflow-x: auto; }
  .cal-cell { min-height: 60px; }
}

/* Landscape phones are short as well as narrow -- claw back some vertical space */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .sidebar { padding-top: 10px; }
  .main-wrap { padding-top: 12px; }
  .section-title { margin: 14px 0 4px; }
}

/* Respect the notch/home-indicator safe areas on modern phones */
@supports (padding: max(0px)) {
  .mobile-topbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .main-wrap { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
}

/* ============================================================
   Camera scan-to-PDF widget (assets/scan.js)
   ============================================================ */
.scan-widget { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 10px; }
.scan-hint { margin-left: 6px; }
.scan-pages { display: flex; gap: 8px; flex-wrap: wrap; }
.scan-thumb { width: 88px; text-align: center; }
.scan-thumb img { width: 88px; height: 110px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.scan-thumb-label { font-size: 10px; color: var(--ink-faint); margin-top: 2px; }
.scan-thumb-remove { color: var(--sla-red); }
.scan-status { min-height: 14px; }

/* ============================================================
   Documents library
   ============================================================ */
.doc-row { padding: 12px 16px; }
.doc-title { font-weight: 600; color: var(--ink); text-decoration: none; margin-right: 6px; }
.doc-title:hover { color: var(--accent); text-decoration: underline; }
.empty-state { padding: 26px; text-align: center; color: var(--ink-faint); font-family: 'IBM Plex Mono', monospace; font-size: 12px; }

/* ============================================================
   Employee search-and-pick list (leave_adjust.php, leave_statement.php)
   Plain JS live-filter over a list of rows -- no AJAX, no datalist quirks, works for a large roster.
   ============================================================ */
.emp-search-input { max-width: 340px; }
.emp-search-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 3px; background: var(--panel); margin-top: 6px; box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.emp-search-row { display: block; padding: 8px 12px; text-decoration: none; color: var(--ink); font-size: 12.5px; border-bottom: 1px solid var(--line-soft); }
.emp-search-row:last-child { border-bottom: none; }
.emp-search-row:hover { background: var(--accent-soft); }
.emp-search-row.selected { background: var(--accent-soft); font-weight: 600; }
.emp-search-row .mono-faint { margin-left: 6px; }
.emp-search-empty { padding: 10px 12px; color: var(--ink-faint); font-size: 12px; font-family: 'IBM Plex Mono', monospace; }
.emp-search-more { padding: 8px 12px; color: var(--ink-faint); font-size: 11px; font-family: 'IBM Plex Mono', monospace; font-style: italic; border-top: 1px dashed var(--line); }

/* ============================================================
   Print-friendly statement (leave_statement.php)
   ============================================================ */
.statement-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--ink); padding-bottom: 10px; margin-bottom: 14px; }
.statement-brand { font-family: 'Big Shoulders Display', sans-serif; font-weight: 800; font-size: 20px; text-transform: uppercase; }
.statement-meta { text-align: right; font-size: 12px; }
.statement-meta .mono-faint { font-size: 11px; }

@media print {
  .sidebar, .mobile-topbar, .top-bar, .no-print { display: none !important; }
  .main-wrap { margin-left: 0 !important; padding: 0 !important; }
  body { background: #fff; }
  .card-panel, .table-wrap { border-color: #999 !important; box-shadow: none !important; }
}

/* Meeting rooms */
.meeting-day { padding: 8px 0; border-top: 1px solid var(--line); }
.meeting-day:first-of-type { border-top: 0; }
.meeting-day.is-today { background: rgba(43,107,95,.06); padding-left: 8px; border-left: 3px solid var(--accent); }
.meeting-pill { font-size: 13px; padding: 4px 0; color: var(--ink); }
.meeting-pill.is-public { color: var(--ink); }
.meeting-pill .mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; margin-right: 6px; }
.guest-shell { flex-wrap: wrap; gap: 16px; }

/* Helpdesk timeline */
.ticket-event { padding: 8px 0 8px 12px; border-left: 3px solid var(--line); margin-bottom: 6px; }
.ticket-event:first-of-type { border-left-color: var(--accent); }

/* Pagination */
.pagination .page-link { color: var(--accent); border-color: var(--line); font-size: 12px; }
.pagination .page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-item.disabled .page-link { color: var(--ink-faint); }

/* ----- busy indicators (assets/busy.js) ----- */
.busy-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 3000; overflow: hidden; display: none; background: rgba(0,0,0,.06); }
.busy-bar.show { display: block; }
.busy-bar span { display: block; height: 100%; width: 40%; background: var(--accent, #2B6E63); animation: busy-slide 1.1s ease-in-out infinite; }
@keyframes busy-slide { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.btn.is-busy { opacity: .75; cursor: progress; pointer-events: none; }
.btn .busy-spin { margin-right: 6px; }
.busy-overlay { position: fixed; inset: 0; z-index: 2900; background: rgba(255,255,255,.78); display: none; align-items: center; justify-content: center; }
.busy-overlay.show { display: flex; }
.busy-box { background: #fff; border: 1px solid #DDE3DC; border-radius: 10px; padding: 24px 34px; text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.busy-box .spinner-border { color: var(--accent, #2B6E63); width: 2.4rem; height: 2.4rem; }
.busy-text { margin-top: 12px; font-weight: 600; }
.busy-sub { margin-top: 4px; font-size: 12px; color: #6B756D; }

/* today: filled circle on the date number (like Microsoft Calendar) + a soft tint on the cell */
.cal-cell.today { background: #EEF6F3; border-color: var(--accent); }
.cal-cell.today .cal-daynum-in { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; padding: 0 4px; }
.cal-cell.holiday.today { background: #FBF3E7; }

/* ---- In-app alerts: bell, sidebar badges, pop-up bubbles ---- */
.top-bar { justify-content: space-between; align-items: center; }
.alert-bell { position: relative; }
.bell-btn { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 6px 11px; font-size: 15px; color: var(--ink, #1B2624); cursor: pointer; line-height: 1; }
.bell-btn:hover { background: var(--panel-alt, #F2F4F1); }
.bell-count, .nav-badge { background: #C24A2E; color: #fff; font-size: 10.5px; font-weight: 700; border-radius: 10px; min-width: 18px; padding: 1px 6px; text-align: center; line-height: 1.5; display: inline-block; }
.bell-count { position: absolute; top: -7px; right: -7px; }
.bell-count[hidden], .nav-badge[hidden] { display: none; }
.nav-badge { float: right; margin-top: -1px; }
.bell-menu { min-width: 290px; padding: 0; border-radius: 4px; font-size: 13px; }
.bell-head { padding: 9px 14px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #6B7772; border-bottom: 1px solid var(--line); }
.bell-item { display: flex; gap: 10px; align-items: center; padding: 10px 14px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.bell-item:hover { background: var(--panel-alt, #F2F4F1); }
.bell-item:last-child { border-bottom: 0; }
.bell-n { background: #C24A2E; color: #fff; font-weight: 700; border-radius: 10px; min-width: 22px; text-align: center; padding: 1px 6px; font-size: 12px; }
.bell-empty { padding: 14px; color: #6B7772; }
#alertToasts { position: fixed; right: 16px; bottom: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px)); }
.alert-toast { background: #1B2624; color: #fff; border-left: 4px solid #C24A2E; border-radius: 4px; padding: 12px 36px 12px 14px; box-shadow: 0 6px 22px rgba(0,0,0,.3); position: relative; animation: toastIn .25s ease; }
.alert-toast a { color: #fff; text-decoration: none; display: block; }
.alert-toast .t-title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.alert-toast .t-text { font-size: 12.5px; color: #D5DDD8; }
.alert-toast .t-go { font-size: 11.5px; color: #9FD3C7; margin-top: 4px; }
.alert-toast button { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: #C7D2CC; font-size: 18px; line-height: 1; cursor: pointer; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media print { #alertToasts, .alert-bell { display: none !important; } }
