:root {
  --navy: #0B1E3B; --navy2: #112B4D; --gold: #C39A43; --gold-bright: #D7B05A;
  --ink: #16263B; --body: #33455B; --muted: #5C6B7C; --border: #E4E8EE;
  --soft: #F6F8FB; --green: #1F9D6B; --amber: #C5982F; --red: #C0392B;
  --green-soft: #EAF7F1; --amber-soft: #FAF3E2; --red-soft: #FBEBE9;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif; color: var(--ink); background: #EEF1F6; line-height: 1.5; }
a { color: var(--gold); }
.topbar { background: radial-gradient(120% 200% at 85% -40%, #16345A, var(--navy)); color: #fff; padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 800; letter-spacing: 0.02em; }
.brand .eyebrow { color: var(--gold-bright); font-size: 11px; letter-spacing: 0.18em; font-weight: 700; }
.brand .title { font-size: 17px; }
.topbar .status { font-size: 12px; color: #A7B7CC; }
.wrap { max-width: 940px; margin: 26px auto 80px; padding: 0 20px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 22px 24px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(16,38,59,0.04); }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.card .sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.step { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 13px; font-weight: 700; margin-right: 9px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label { display: block; font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.req { color: var(--red); }
input[type=text], input[type=date], input[type=url], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14px; font-family: inherit; color: var(--ink); background: #fff;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(195,154,67,0.15); }
textarea { resize: vertical; min-height: 150px; }
.field { margin-bottom: 14px; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { padding: 8px 14px; border: 1px solid var(--border); border-radius: 9px; background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--body); }
.tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.tabpane { display: none; } .tabpane.active { display: block; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 20px; border-radius: 10px; border: none; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-primary { background: linear-gradient(135deg, #16345A, var(--navy)); color: #fff; }
.btn-gold { background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: var(--navy); }
.btn-ghost { background: #fff; border: 1px solid var(--border); color: var(--body); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--muted); }
.err { background: var(--red-soft); color: var(--red); border-radius: 9px; padding: 10px 14px; font-size: 13px; margin-top: 10px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* Result */
.scoreHead { display: flex; align-items: center; gap: 22px; background: linear-gradient(135deg, var(--navy2), var(--navy)); border-radius: 14px; padding: 22px 26px; color: #fff; }
.scoreCircle { width: 96px; height: 96px; flex: none; border-radius: 50%; background: radial-gradient(circle at 36% 30%, #DDB868, #BE9638); color: var(--navy); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.scoreCircle b { font-size: 36px; line-height: 1; } .scoreCircle span { font-size: 11px; font-weight: 700; }
.scoreHead .tier { font-size: 20px; font-weight: 800; color: var(--gold-bright); }
.scoreHead .who { font-size: 13px; color: #C7D3E1; margin-top: 4px; }
.depts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 16px 0; }
.deptChip { border: 1px solid var(--border); border-left: 4px solid; border-radius: 9px; padding: 9px 12px; }
.deptChip .n { font-weight: 800; font-size: 13px; }
.deptChip .dc-top { display: flex; justify-content: space-between; align-items: baseline; }
.deptChip .s { font-weight: 700; color: var(--muted); }
.deptChip .b { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; margin-top: 4px; }
.bar { height: 6px; background: #E9EDF2; border-radius: 4px; margin: 7px 0 5px; overflow: hidden; } .bar > div { height: 100%; }
.gaps li { margin-bottom: 6px; }
.flags { font-size: 12px; color: var(--muted); margin-top: 8px; }
.flags b { color: var(--amber); }

/* Worksheet */
details.sheet { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; }
details.sheet > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; }
.deptGroup { padding: 6px 16px 14px; }
.deptGroup h4 { margin: 14px 0 8px; font-size: 13px; color: var(--navy); border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.qrow { display: grid; grid-template-columns: 1.6fr 1.4fr auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed #EEF1F5; }
.qrow .qt { font-size: 12.5px; } .qrow .qt small { color: var(--muted); display: block; }
.qrow select { padding: 6px 8px; font-size: 12.5px; }
.qrow label.ck { font-size: 11px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 4px; margin: 0; }
.metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 6px 16px 16px; }
.metrics .m label { font-size: 11px; } .metrics .m input { padding: 7px 9px; font-size: 12.5px; }

/* Costs */
.costsBtn { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; padding: 7px 12px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.costsBtn:hover { background: rgba(255,255,255,0.2); }
.modal { position: fixed; inset: 0; background: rgba(11,30,59,0.55); display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; z-index: 50; overflow-y: auto; }
.modalCard { background: #fff; border-radius: 14px; padding: 22px 24px; max-width: 720px; width: 100%; box-shadow: 0 20px 60px rgba(11,30,59,0.3); }
.modalHead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modalHead h2 { margin: 0; font-size: 18px; }
.ctiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
.ctile { background: var(--soft); border: 1px solid var(--border); border-radius: 10px; padding: 12px; text-align: center; }
.ctile .cval { font-size: 18px; font-weight: 800; color: var(--navy); }
.ctile .clbl { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.ctbl { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0 14px; }
.ctbl th { text-align: left; color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--border); padding: 6px 8px; }
.ctbl td { border-bottom: 1px dashed #EEF1F5; padding: 6px 8px; }
.ctbl td:last-child, .ctbl th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
#costsBody h4 { margin: 14px 0 4px; font-size: 13px; color: var(--navy); }
@media (max-width: 640px) { .ctiles { grid-template-columns: repeat(2, 1fr); } }

/* History */
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.histTbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.histTbl th { text-align: left; color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--border); padding: 8px; }
.histTbl td { border-bottom: 1px solid #EEF1F5; padding: 9px 8px; vertical-align: middle; }
.scoreBadge { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 30px; border-radius: 8px; font-weight: 800; font-size: 14px; padding: 0 8px; }
.scoreBadge.minor { background: var(--green-soft); color: var(--green); }
.scoreBadge.moderate { background: var(--amber-soft); color: var(--amber); }
.scoreBadge.critical { background: var(--red-soft); color: var(--red); }
.histActions { text-align: right; white-space: nowrap; }
.histActions .btn { margin-left: 6px; }

/* PDF preview */
#pdfModal { z-index: 60; }
.pdfCard { max-width: 920px; }
.pdfFrame { width: 100%; height: 76vh; border: 1px solid var(--border); border-radius: 8px; background: #e9edf2; }

/* ── Dropzone (file upload) ───────────────────────────────────────── */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; text-align: center; padding: 32px 22px; border: 2px dashed #d7dee7; border-radius: 12px; cursor: pointer; background: var(--soft); transition: border-color .15s, background .15s, transform .1s; }
.dropzone:hover { border-color: var(--gold); background: #fffdf8; }
.dropzone.drag { border-color: var(--gold); background: #fff7e9; transform: scale(1.004); }
.dropzone.has-file { border-style: solid; border-color: var(--green); background: var(--green-soft); }
.dz-icon { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 800; line-height: 1; }
.dropzone.has-file .dz-icon { background: linear-gradient(135deg, #2bbd86, var(--green)); }
.dz-title { font-size: 14px; color: var(--ink); }
.dz-sub { font-size: 12px; color: var(--muted); max-width: 32rem; line-height: 1.5; }
.dz-selected { margin-top: 12px; display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: #fff; border: 1px solid var(--border); border-radius: 9px; font-size: 13px; }
.dz-file { font-weight: 700; color: var(--ink); }
.dz-clear { margin-left: auto; background: none; border: none; color: var(--red); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; }

/* ── Polish: motion, hover, hierarchy ─────────────────────────────── */
.btn { transition: transform .08s ease, box-shadow .15s ease, filter .15s ease, opacity .15s ease; }
.btn:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.03); }
.btn-primary:not(:disabled):hover { box-shadow: 0 6px 18px rgba(11,30,59,.28); }
.btn-gold:not(:disabled):hover { box-shadow: 0 6px 18px rgba(195,154,67,.4); }
.btn-lg { padding: 14px 30px; font-size: 15px; }
.card { transition: box-shadow .2s ease; }
.tab:hover:not(.active) { border-color: var(--gold); color: var(--ink); }
.deptChip { transition: transform .1s ease, box-shadow .15s ease; }
.deptChip:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(16,38,59,.08); }
.costsBtn { transition: background .12s; }
input:hover:not(:focus), textarea:hover:not(:focus), select:hover:not(:focus) { border-color: #cdd5df; }
.gaps { padding-left: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: gap; }
.gaps li { list-style: none; padding: 11px 14px 11px 40px; background: var(--soft); border-radius: 9px; border-left: 3px solid var(--gold); position: relative; }
.gaps li::before { counter-increment: gap; content: counter(gap); position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.transcriptBox { white-space: pre-wrap; word-break: break-word; font-size: 12.5px; line-height: 1.6; color: var(--body); padding: 4px 16px 12px; max-height: 380px; overflow-y: auto; }
