/* ── Reset & Variables ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --brand: #25408F; --brand-d: #1a2f6e; --brand-l: #3a56a8;
  --brand-xl: #e8ecf7; --brand-xx: #f0f3fa;
  --white: #ffffff; --gray-50: #f8f9fc; --gray-100: #eef0f6;
  --gray-200: #d8dce8; --gray-400: #9399b0; --gray-600: #5a6180; --gray-800: #2d3352;
  --success: #1a7a4a; --success-bg: #e6f4ed;
  --warning: #8a5c00; --warning-bg: #fff5e0;
  --danger: #b02020; --danger-bg: #fdecea;
  --r: 6px; --sw: 214px; --sw-c: 46px; --top: 48px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 13px; color: var(--gray-800); background: var(--gray-100); }
#app { display: flex; height: 100vh; }
#sidebar { width: var(--sw); background: var(--brand); display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; transition: width .2s ease; }
#sidebar.collapsed { width: var(--sw-c); }
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
#topbar { height: var(--top); border-bottom: 1px solid var(--gray-200); padding: 0 18px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; background: var(--white); }
#topbar h1 { font-size: 15px; font-weight: 500; }
#content { flex: 1; overflow-y: auto; padding: 0 18px 16px; background: var(--gray-50); }
#content > *:first-child { margin-top: 16px; }
.sb-header { min-height: 76px; border-bottom: 1px solid rgba(255,255,255,.15); display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; flex-shrink: 0; overflow: hidden; }
.sb-logo-wrap { display: flex; align-items: center; gap: 10px; overflow: hidden; min-width: 0; }
.sb-logo-icon { width: 60px; height: 60px; border-radius: 8px; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 11px; font-weight: 600; flex-shrink: 0; border: 1px solid rgba(255,255,255,.25); }
.sb-logo-text { overflow: hidden; white-space: nowrap; transition: opacity .15s, width .15s; }
.sb-logo-title { font-size: 13px; font-weight: 500; color: var(--white); line-height: 1.2; }
.sb-logo-sub { font-size: 10px; color: rgba(255,255,255,.5); }
#sidebar.collapsed .sb-logo-text { opacity: 0; width: 0; }
.sb-toggle { width: 26px; height: 26px; border-radius: 5px; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.2); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: rgba(255,255,255,.8); font-size: 14px; transition: background .12s; }
.sb-toggle:hover { background: rgba(255,255,255,.25); }
nav { flex: 1; padding: 6px 0; overflow-y: auto; overflow-x: hidden; }
.nav-section { padding: 10px 12px 3px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4); white-space: nowrap; overflow: hidden; transition: opacity .15s, height .15s, padding .15s; }
#sidebar.collapsed .nav-section { opacity: 0; height: 0; padding: 0; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: pointer; color: rgba(255,255,255,.72); font-size: 12.5px; border-left: 2px solid transparent; transition: all .12s; white-space: nowrap; overflow: hidden; position: relative; }
.nav-item:hover { color: var(--white); background: rgba(255,255,255,.1); }
.nav-item.active { color: var(--white); background: rgba(255,255,255,.15); border-left-color: var(--white); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.nav-label { overflow: hidden; transition: opacity .15s, width .15s; }
#sidebar.collapsed .nav-label { opacity: 0; width: 0; }
.nav-badge { margin-left: auto; background: rgba(255,255,255,.9); color: var(--brand); border-radius: 10px; padding: 1px 6px; font-size: 10px; font-weight: 600; flex-shrink: 0; }
#sidebar.collapsed .nav-badge { opacity: 0; width: 0; overflow: hidden; padding: 0; }
#sidebar.collapsed .nav-item:hover::after { content: attr(data-label); position: absolute; left: calc(var(--sw-c) + 6px); top: 50%; transform: translateY(-50%); background: var(--brand-d); color: var(--white); padding: 4px 10px; border-radius: var(--r); font-size: 12px; white-space: nowrap; z-index: 200; pointer-events: none; }
.sb-user { padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.15); overflow: hidden; }
.sb-user-inner { display: flex; align-items: center; gap: 8px; }
.sb-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; color: var(--white); border: 1px solid rgba(255,255,255,.3); }
.sb-user-text { overflow: hidden; transition: opacity .15s, width .15s; }
.sb-user-name { font-size: 12px; font-weight: 500; white-space: nowrap; color: var(--white); }
.sb-user-role { font-size: 10px; color: rgba(255,255,255,.5); }
.sb-logout { font-size: 10px; color: rgba(255,255,255,.45); cursor: pointer; text-decoration: underline; }
.sb-logout:hover { color: rgba(255,255,255,.8); }
#sidebar.collapsed .sb-user-text { opacity: 0; width: 0; }
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r); margin-bottom: 12px; }
.card-header { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); font-size: 13px; font-weight: 500; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r); padding: 10px 12px; }
.stat-lbl { font-size: 10px; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; font-weight: 500; }
.stat-val { font-size: 22px; font-weight: 500; }
.stat.c-brand .stat-val { color: var(--brand); }
.stat.c-success .stat-val { color: var(--success); }
.stat.c-danger .stat-val { color: var(--danger); }
.stat.c-warning .stat-val { color: var(--warning); }
.tbl-wrap { overflow: visible; }
table { width: 100%; border-collapse: collapse; }
/* Freeze table header while the page scrolls */
table thead { position: sticky; top: 0; z-index: 20; }
table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
  border-bottom: 2px solid var(--gray-200);
  box-shadow: 0 1px 0 var(--gray-200);
}
th { padding: 8px 12px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); border-bottom: 1px solid var(--gray-200); text-align: left; background: var(--gray-50); }
td { padding: 9px 12px; border-bottom: 1px solid var(--gray-100); font-size: 12.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border: 1px solid var(--gray-200); border-radius: var(--r); font-size: 11.5px; cursor: pointer; background: var(--white); color: var(--gray-800); font-weight: 500; white-space: nowrap; transition: all .12s; text-decoration: none; }
.btn:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-primary { background: var(--brand); color: var(--white); border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-d); }
.btn-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 3px 9px; font-size: 11px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 500; }
.badge-scheduled { background: var(--gray-100); color: var(--gray-600); }
.badge-assigned { background: var(--brand-xl); color: var(--brand); }
.badge-submitted { background: var(--warning-bg); color: var(--warning); }
.badge-resubmitted { background: var(--warning-bg); color: var(--warning); }
.badge-approved { background: var(--success-bg); color: var(--success); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: var(--gray-100); color: var(--gray-400); }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.role-admin { background: #2d3352; color: #fff; }
.role-manager { background: var(--brand); color: #fff; }
.role-resource { background: #0f6e56; color: #fff; }
.role-customer { background: #854F0B; color: #fff; }
.role-svp      { background: #1a5fa8; color: #fff; }
.role-vp       { background: #0e7490; color: #fff; }
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(30,40,80,.4); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border: 1px solid var(--gray-200); border-radius: 10px; width: 680px; max-width: 96vw; max-height: 90vh; overflow-y: auto; }
.modal-hdr { padding: 13px 16px; border-bottom: 1px solid var(--gray-200); font-size: 14px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 16px; }
.modal-foot { padding: 11px 16px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; justify-content: flex-end; background: var(--gray-50); border-radius: 0 0 10px 10px; }
.close-x { cursor: pointer; color: var(--gray-400); font-size: 18px; line-height: 1; }
.close-x:hover { color: var(--gray-800); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fg { margin-bottom: 10px; }
.fg label { display: block; font-size: 11px; color: var(--gray-600); margin-bottom: 4px; font-weight: 500; }
.fg input, .fg select, .fg textarea { width: 100%; padding: 7px 9px; border: 1px solid var(--gray-200); border-radius: var(--r); font-size: 12.5px; background: var(--white); color: var(--gray-800); font-family: inherit; }
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,64,143,.1); }
.fg textarea { resize: vertical; min-height: 64px; }
.fg .hint { font-size: 11px; color: var(--gray-400); margin-top: 3px; }
.alert { padding: 8px 10px; border-radius: var(--r); font-size: 12px; margin-bottom: 10px; border-left: 3px solid; }
.alert-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.alert-info { background: var(--brand-xl); color: var(--brand); border-color: var(--brand); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tab-nav { display: flex; gap: 2px; border-bottom: 1px solid var(--gray-200); margin-bottom: 12px; }
.tab-btn { padding: 7px 14px; font-size: 12px; cursor: pointer; border: none; background: none; color: var(--gray-400); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; transition: all .12s; }
.tab-btn:hover { color: var(--brand); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; font-size: 12px; }
.detail-grid span:nth-child(odd) { color: var(--gray-400); }
.notes-box { background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--r); padding: 8px 10px; font-size: 12px; color: var(--gray-600); }
.prog { height: 4px; background: var(--gray-100); border-radius: 2px; overflow: hidden; min-width: 50px; }
.prog-bar { height: 100%; background: var(--brand); border-radius: 2px; }
.photo-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.photo-thumb { width: 56px; height: 56px; border-radius: 6px; background: var(--brand-xl); border: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.photo-placeholder { width: 56px; height: 56px; border-radius: 6px; background: var(--white); border: 1.5px dashed var(--gray-200); display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; color: var(--gray-400); transition: all .12s; }
.photo-placeholder:hover { border-color: var(--brand); color: var(--brand); }
.perm-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--gray-50); }
.perm-row:last-child { border-bottom: none; }
.perm-label { font-size: 12.5px; font-weight: 500; }
.perm-desc { font-size: 11px; color: var(--gray-400); }
.toggle { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--gray-200); border-radius: 18px; cursor: pointer; transition: .2s; }
.toggle-slider:before { content: ''; position: absolute; width: 12px; height: 12px; left: 3px; top: 3px; background: var(--white); border-radius: 50%; transition: .2s; }
.toggle input:checked + .toggle-slider { background: var(--brand); }
.toggle input:checked + .toggle-slider:before { transform: translateX(14px); }
.info-box { background: var(--brand-xx); border: 1px solid var(--brand-xl); border-radius: var(--r); padding: 10px 12px; font-size: 12px; color: var(--brand); margin-bottom: 12px; }
.section-divider { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--gray-400); padding: 8px 0 4px; border-bottom: 1px solid var(--gray-100); margin-bottom: 10px; }
code.pill { background: var(--brand-xl); color: var(--brand); padding: 1px 7px; border-radius: 3px; font-size: 11px; font-family: monospace; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--brand); }
.login-card { background: var(--white); border-radius: 10px; padding: 32px 36px; width: 340px; }
.login-card h1 { font-size: 18px; font-weight: 500; color: var(--brand); margin-bottom: 4px; }
.login-card p { color: var(--gray-400); font-size: 12px; margin-bottom: 20px; }
.lf-group { margin-bottom: 12px; }
.lf-group label { display: block; font-size: 11px; color: var(--gray-600); margin-bottom: 4px; font-weight: 500; }
.login-card input { width: 100%; padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: var(--r); font-size: 13px; background: var(--white); color: var(--gray-800); }
.login-card input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,64,143,.1); }
.login-btn { width: 100%; padding: 9px; background: var(--brand); color: var(--white); border: none; border-radius: var(--r); font-size: 13px; font-weight: 500; cursor: pointer; margin-top: 4px; }
.login-btn:hover { background: var(--brand-d); }

/* ── Progress bar (injected by JS) ────────────────────────── */
/* Styles are applied inline by Progress — no CSS needed here */

/* ── Skeleton shimmer ────────────────────────────────────────*/
/* Injected by Skeleton.show() dynamically */

/* ── Button loading state ────────────────────────────────────*/
.btn.loading {
  position: relative;
  pointer-events: none;
  opacity: .75;
}
.btn.loading::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ── Pagination bar ───────────────────────────────────────── */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; flex-shrink: 0;
  padding: 10px 18px; margin: 0;
  background: var(--white); border-top: 1px solid var(--gray-200);
  box-shadow: 0 -2px 8px rgba(16,24,40,.06); z-index: 30;
}
.pager-info { font-size: 12px; color: var(--gray-400); }
.pager-ctrls { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn {
  min-width: 32px; height: 32px; padding: 0 9px; border: 1px solid var(--gray-200);
  background: var(--white); color: var(--gray-600); border-radius: 6px;
  font-size: 13px; cursor: pointer; transition: all .12s;
}
.pager-btn:hover:not(:disabled):not(.active) { border-color: var(--brand); color: var(--brand); }
.pager-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); cursor: default; }
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-gap { color: var(--gray-400); padding: 0 4px; font-size: 13px; }
