:root {
  --navy: #092f57;
  --navy-2: #154a78;
  --blue: #1f69a8;
  --gold: #d2aa44;
  --ink: #17212b;
  --muted: #647180;
  --line: #dce3ea;
  --soft: #f4f7fa;
  --white: #ffffff;
  --success: #176b44;
  --warning: #9a6500;
  --danger: #a63131;
  --shadow: 0 12px 30px rgba(23, 42, 61, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--soft); color: var(--ink); font-family: Inter, "Segoe UI", Arial, sans-serif; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.noscript { padding: 1rem; background: #fff3cd; color: #664d03; text-align: center; }
.app-header { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.15rem clamp(1rem, 4vw, 3.5rem); color: #fff; background: linear-gradient(120deg, #072a4d, #0d426f); border-bottom: 4px solid var(--gold); }
.brand-wrap { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.brand-mark { display: block; width: 78px; height: 78px; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(0 8px 16px rgba(0,0,0,.18)); }
.eyebrow { margin: 0 0 .2rem; font-size: .72rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; color: #c9dbeb; }
.eyebrow.dark { color: var(--blue); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .15rem; font-size: clamp(1.35rem, 2.5vw, 2rem); line-height: 1.15; }
h2 { margin-bottom: .35rem; font-size: clamp(1.35rem, 2.2vw, 1.85rem); }
h3 { margin-bottom: .25rem; font-size: 1.05rem; }
.subtitle { margin: 0; color: #d9e7f2; font-size: .9rem; }
.header-actions { position: relative; display: flex; align-items: center; gap: .65rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .62rem .92rem; border: 1px solid transparent; border-radius: 8px; font-weight: 750; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--navy); color: #fff; box-shadow: 0 6px 16px rgba(9,47,87,.18); }
.btn-primary:hover { background: #0b3c6c; }
.btn-secondary { background: #eef3f7; color: var(--navy); border-color: #ccd8e2; }
.btn-light { background: #fff; color: var(--navy); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: #d7aaaa; }
.export-menu { position: absolute; right: 0; top: calc(100% + .5rem); min-width: 230px; padding: .4rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.export-menu button { width: 100%; padding: .65rem .75rem; border: 0; border-radius: 7px; text-align: left; background: transparent; color: var(--ink); }
.export-menu button:hover { background: var(--soft); }
.tab-nav { position: sticky; top: 0; z-index: 4; display: flex; gap: .2rem; overflow-x: auto; padding: 0 clamp(1rem, 4vw, 3.5rem); background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 4px 14px rgba(21,44,64,.05); }
.tab { flex: 0 0 auto; padding: .95rem 1rem .8rem; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #526170; font-weight: 750; }
.tab.active { color: var(--navy); border-bottom-color: var(--gold); }
.page-shell { max-width: 1580px; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.muted { margin-bottom: 0; color: var(--muted); }
.last-saved { padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .9rem; margin-bottom: 1rem; }
.metric-card { min-height: 120px; padding: 1rem; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.metric-card.warning { border-left-color: #d69019; }
.metric-card.success { border-left-color: var(--success); }
.metric-card.danger { border-left-color: var(--danger); }
.metric-label { color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.metric-value { margin: .35rem 0 .05rem; color: var(--navy); font-size: 1.75rem; font-weight: 900; line-height: 1.05; }
.metric-note { color: var(--muted); font-size: .78rem; }
.dashboard-grid, .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.card { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.span-2 { grid-column: span 2; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem .8rem; border-bottom: 1px solid var(--line); }
.card-header p { margin-bottom: 0; color: var(--muted); font-size: .86rem; }
.compact-card { padding: .85rem; }
.toolbar { display: grid; grid-template-columns: 1.5fr repeat(3, minmax(150px,.75fr)) auto; gap: .75rem; margin-bottom: 1rem; }
label { display: flex; flex-direction: column; gap: .3rem; color: #445260; font-size: .8rem; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid #cbd6df; border-radius: 7px; background: #fff; color: var(--ink); padding: .65rem .7rem; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,105,168,.12); }
textarea { resize: vertical; }
.align-end { align-self: end; }
.table-scroll { overflow-x: auto; }
.wide-table table { min-width: 1450px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .72rem .75rem; border-bottom: 1px solid #e5eaf0; text-align: left; vertical-align: top; font-size: .82rem; }
th { background: #f6f8fa; color: #53606d; font-size: .72rem; letter-spacing: .035em; text-transform: uppercase; white-space: nowrap; }
tbody tr:hover { background: #fbfcfd; }
tbody tr:last-child td { border-bottom: 0; }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; padding: .28rem .48rem; border-radius: 999px; background: #e8eef4; color: #3b5267; font-size: .7rem; font-weight: 850; white-space: nowrap; }
.badge.success { background: #dcf2e7; color: #176b44; }
.badge.warning { background: #fff0ce; color: #8a5b00; }
.badge.danger { background: #f8dede; color: #8f2929; }
.badge.info { background: #dcecf8; color: #195987; }
.progress-wrap { min-width: 90px; }
.progress-track { height: 7px; border-radius: 999px; background: #e5ebf0; overflow: hidden; }
.progress-fill { height: 100%; background: var(--blue); }
.progress-label { margin-top: .25rem; color: var(--muted); font-size: .72rem; }
.action-row { display: flex; gap: .35rem; white-space: nowrap; }
.action-btn { padding: .34rem .48rem; border: 1px solid #ced8e1; border-radius: 6px; background: #fff; color: var(--navy); font-size: .72rem; font-weight: 800; }
.action-btn.danger { color: var(--danger); border-color: #e2bcbc; }
.stack-list { padding: .85rem 1rem 1rem; }
.stack-item { padding: .72rem 0; border-bottom: 1px solid var(--line); }
.stack-item:last-child { border-bottom: 0; }
.stack-item strong { display: block; margin-bottom: .15rem; }
.stack-meta { display: flex; flex-wrap: wrap; gap: .4rem; color: var(--muted); font-size: .75rem; }
.empty-state { color: var(--muted); font-style: italic; }
.deadline-list { padding: .85rem 1rem 1rem; }
.deadline-row { display: flex; align-items: center; justify-content: space-between; gap: .7rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.deadline-row:last-child { border-bottom: 0; }
.deadline-label { font-weight: 800; }
.deadline-date { color: var(--muted); font-size: .78rem; }
.attention-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .75rem; padding: 1rem; }
.attention-card { padding: .8rem; border: 1px solid #ead7b4; border-radius: 9px; background: #fffaf0; }
.attention-card strong { display: block; }
.attention-card p { margin: .25rem 0 .5rem; color: var(--muted); font-size: .78rem; }
.submission-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1rem; }
.submission-card { padding: 1rem; }
.submission-card h3 { color: var(--navy); }
.submission-card .form-grid { margin-top: .9rem; }
.status-line { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.form-card { padding-bottom: 1rem; }
.form-card > .form-grid, .form-card > .form-actions, .form-card > .button-stack, .form-card > .notice, .form-card > .retention-grid { margin-left: 1rem; margin-right: 1rem; }
.form-grid { display: grid; gap: .8rem; margin-top: 1rem; }
.form-grid.two-col { grid-template-columns: repeat(2,minmax(0,1fr)); }
.form-grid.three-col { grid-template-columns: repeat(3,minmax(0,1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions, .modal-actions { display: flex; justify-content: flex-end; gap: .7rem; margin-top: 1rem; }
.button-stack { display: grid; gap: .7rem; margin-top: 1rem; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.notice { margin-top: 1rem; padding: .85rem; border-radius: 8px; font-size: .82rem; }
.notice.warning { background: #fff6df; color: #684b0c; border: 1px solid #eed69d; }
.retention-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .8rem; margin-top: 1rem; }
.retention-grid div { padding: .8rem; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.retention-grid dt { color: var(--navy); font-weight: 850; }
.retention-grid dd { margin: .3rem 0 0; color: var(--muted); font-size: .82rem; }
.app-footer { display: flex; justify-content: space-between; gap: 2rem; padding: 1.4rem clamp(1rem,4vw,3.5rem); background: #071f37; color: #d9e5ef; font-size: .82rem; border-top: 4px solid var(--gold); }
.footer-right { text-align: right; }
.modal { width: min(1000px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.modal::backdrop { background: rgba(4,20,34,.72); backdrop-filter: blur(2px); }
.modal form { padding: 1.2rem; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: .8rem; border-bottom: 1px solid var(--line); }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: 8px; background: #eef2f5; color: #344a5d; font-size: 1.5rem; line-height: 1; }
.checklist-fieldset { margin-top: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.checklist-fieldset legend { padding: 0 .4rem; color: var(--navy); font-weight: 850; }
.check-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem .9rem; padding: .5rem; }
.check-item { flex-direction: row; align-items: center; gap: .55rem; font-size: .8rem; font-weight: 650; }
.check-item input { width: 18px; height: 18px; }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 20; transform: translateY(140%); padding: .75rem 1rem; border-radius: 8px; background: #10283c; color: #fff; box-shadow: var(--shadow); transition: transform .2s ease; }
.toast.show { transform: translateY(0); }
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .toolbar { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .align-end { align-self: stretch; }
  .submission-grid, .attention-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .retention-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .app-header, .section-heading, .app-footer { flex-direction: column; align-items: stretch; }
  .header-actions { align-self: stretch; }
  .header-actions .btn { flex: 1; }
  .metric-grid, .dashboard-grid, .settings-grid, .submission-grid, .attention-grid, .toolbar, .form-grid.two-col, .form-grid.three-col, .retention-grid, .check-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-grid .full { grid-column: auto; }
  .footer-right { text-align: left; }
  .last-saved { align-self: flex-start; }
}
@media print {
  body { background: #fff; font-size: 10pt; }
  .app-header { color: #000; background: #fff; border-bottom: 2px solid #000; padding: .5in .4in .2in; }
  .brand-mark { filter: none; }
  .subtitle, .eyebrow { color: #333; }
  .header-actions, .tab-nav, .toolbar, .section-heading .btn, .action-row, .toast, #settingsPanel, #submissionsPanel { display: none !important; }
  .page-shell { max-width: none; padding: .2in .4in; }
  .tab-panel { display: block !important; page-break-after: always; }
  .tab-panel:last-of-type { page-break-after: auto; }
  .card, .metric-card { box-shadow: none; break-inside: avoid; }
  .table-scroll { overflow: visible; }
  .wide-table table { min-width: 0; }
  th, td { padding: .25rem; font-size: 7.5pt; }
  .dashboard-grid, .metric-grid { gap: .4rem; }
  .app-footer { color: #000; background: #fff; border-top: 2px solid #000; padding: .2in .4in; }
}

/* PHP/MySQL edition additions */
.user-chip { display:flex; flex-direction:column; justify-content:center; min-height:40px; padding:.4rem .7rem; border:1px solid rgba(255,255,255,.3); border-radius:8px; background:rgba(255,255,255,.08); line-height:1.2; white-space:nowrap; }
.user-chip strong { font-size:.8rem; }
.user-chip span { color:#d8e5ef; font-size:.67rem; }
.loading-state { display:flex; align-items:center; justify-content:center; gap:.7rem; min-height:72px; margin-bottom:1rem; padding:1rem; border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--muted); box-shadow:var(--shadow); }
.loading-state[hidden] { display:none; }
.loading-state.error { display:block; color:var(--danger); text-align:center; }
.spinner { width:22px; height:22px; border:3px solid #d8e2ea; border-top-color:var(--blue); border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.doc-summary { color:var(--muted); font-size:.74rem; line-height:1.45; white-space:nowrap; }
.file-fieldset { padding-bottom:.9rem; }
.file-upload-grid { display:grid; grid-template-columns:minmax(220px,.7fr) minmax(260px,1.3fr); gap:.75rem; padding:.6rem .5rem .1rem; }
.field-help { margin:.45rem .5rem .65rem; color:var(--muted); font-size:.76rem; }
.document-list { margin:.4rem .5rem 0; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.document-row { display:flex; align-items:center; justify-content:space-between; gap:1rem; padding:.7rem .75rem; border-bottom:1px solid var(--line); background:#fff; }
.document-row:last-child { border-bottom:0; }
.document-row a { color:var(--navy); text-decoration:none; }
.document-row a:hover { text-decoration:underline; }
.document-row span { display:block; margin-top:.15rem; color:var(--muted); font-size:.72rem; }
.document-list.empty-state { padding:.7rem .75rem; }
.notice code, .install-help code { padding:.08rem .25rem; border-radius:4px; background:rgba(0,0,0,.06); }
.success-note { margin-top:1rem; padding:1rem; border:1px solid #acd4bd; border-radius:8px; background:#e8f7ee; color:#165d3b; }
.alert { margin:1rem 0; padding:.85rem 1rem; border-radius:8px; font-weight:650; }
.alert-danger { border:1px solid #e4b6b6; background:#fbeaea; color:#8e2929; }
.alert-success { border:1px solid #a7d2b8; background:#e7f6ed; color:#17633e; }
.auth-body { min-height:100vh; background:linear-gradient(145deg,#061f38,#0d426f 55%,#e9eef3 55%); }
.auth-shell, .install-shell { min-height:100vh; display:grid; place-items:center; padding:2rem 1rem; }
.auth-card { width:min(520px,100%); padding:1.4rem; border:1px solid rgba(255,255,255,.6); border-radius:16px; background:rgba(255,255,255,.98); box-shadow:0 28px 70px rgba(0,0,0,.26); }
.install-card { width:min(920px,100%); }
.auth-brand { display:flex; align-items:center; gap:1rem; padding-bottom:1rem; margin-bottom:1rem; border-bottom:1px solid var(--line); }
.auth-brand img { width:82px; height:82px; object-fit:contain; filter:drop-shadow(0 8px 14px rgba(0,0,0,.15)); }
.auth-brand h1 { color:var(--navy); font-size:1.55rem; }
.auth-note { margin:1rem 0 0; color:var(--muted); font-size:.78rem; text-align:center; }
.install-card h2 { margin:1.4rem 0 .35rem; color:var(--navy); font-size:1.1rem; }
.install-help { margin-bottom:.7rem; }
.admin-shell { max-width:1450px; margin:0 auto; padding:1.5rem clamp(1rem,3vw,2.5rem) 3rem; }
.admin-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:1rem; }
.admin-toolbar { display:flex; align-items:center; justify-content:space-between; gap:1rem; }
.role-note { color:var(--muted); font-size:.75rem; }
.audit-details { max-width:440px; white-space:pre-wrap; word-break:break-word; color:var(--muted); font-size:.72rem; }
.status-dot { display:inline-block; width:9px; height:9px; margin-right:.35rem; border-radius:50%; background:#9aa6b1; }
.status-dot.active { background:var(--success); }

@media (max-width: 1200px) {
  .app-header { align-items:flex-start; }
  .header-actions { flex-wrap:wrap; justify-content:flex-end; }
}
@media (max-width: 760px) {
  .user-chip { width:100%; }
  .file-upload-grid { grid-template-columns:1fr; }
  .document-row { align-items:flex-start; }
  .auth-brand { align-items:flex-start; }
}
@media print {
  .user-chip, .loading-state { display:none !important; }
  .brand-mark { width:64px; height:64px; }
}

/* Version 2.1.0: command staff access and Chief request decisions */
.toolbar { grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); }
.action-row { flex-wrap: wrap; }
.action-btn.success { color: var(--success); border-color: #9fcdb8; background: #f2fbf6; }
.action-btn.warning { color: var(--warning); border-color: #e4c887; background: #fffaf0; }
.decision-meta { padding: .75rem; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; color: var(--muted); font-size: .8rem; }
.import-results { margin-top: 1rem; }
.alert-success, .notice.success { background: #e6f6ed; color: #155f3c; border: 1px solid #a8d8bd; }
.field-help { color: var(--muted); font-size: .78rem; }

/* Version 2.1.1: dedicated Chief Review decision center */
.chief-review-tab { color: var(--navy); font-weight: 850; }
.review-authority-badge { display:inline-flex; align-items:center; min-height:36px; padding:.48rem .72rem; border:1px solid #d8b75c; border-radius:999px; background:#fff8df; color:#6b4d05; font-size:.74rem; font-weight:850; white-space:nowrap; }
.review-metric-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.9rem; margin-bottom:1rem; }
.review-metric-card { display:flex; flex-direction:column; min-height:108px; padding:1rem; border:1px solid var(--line); border-left:5px solid var(--blue); border-radius:11px; background:#fff; box-shadow:var(--shadow); }
.review-metric-card span { color:var(--muted); font-size:.72rem; font-weight:850; letter-spacing:.055em; text-transform:uppercase; }
.review-metric-card strong { margin:.25rem 0 .1rem; color:var(--navy); font-size:1.9rem; line-height:1; }
.review-metric-card small { color:var(--muted); font-weight:700; }
.review-metric-card.success { border-left-color:var(--success); }
.review-metric-card.warning { border-left-color:#d69019; }
.review-metric-card.danger { border-left-color:var(--danger); }
.chief-review-toolbar { grid-template-columns:minmax(240px,1.5fr) repeat(3,minmax(150px,.75fr)) auto; }
.chief-review-table table { min-width:1320px; }
.chief-action-stack { display:grid; gap:.45rem; min-width:250px; }
.chief-decision-buttons { display:flex; flex-wrap:wrap; gap:.35rem; }

@media (max-width: 1050px) {
  .review-metric-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .chief-review-toolbar { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 650px) {
  .review-metric-grid, .chief-review-toolbar { grid-template-columns:1fr; }
  .review-authority-badge { align-self:flex-start; }
}
@media print {
  #chiefReviewPanel { display:none !important; }
}
