/* Okilys CTMS - graphic charter aligned with www.okilys.com (v2: hierarchy navigation, sticky menu, mobile) */
:root {
  --blue: #124cef; --blue-dark: #0d38b3; --teal: #2d9caf; --teal-dark: #21778a; --teal-bg: #eaf6f8; --teal-bg2: #dcf1f4;
  --gray: #888e8f; --ink: #1a2333; --ink-soft: #4b5563; --bg: #ffffff; --bg-alt: #f4f8fb; --border: #e3e8ef; --navy: #0d2f52;
  --peach: #faf1e0; --peach-dark: #f0dcb8; --radius: 14px; --shadow: 0 10px 30px -12px rgba(18, 76, 239, 0.18);
  --gradient: linear-gradient(90deg, var(--blue) 0%, var(--teal) 100%);
  --green: #1f9d55; --green-bg: #dcf5e6; --orange: #d97706; --orange-bg: #ffe9c7; --red: #c62828; --red-bg: #ffd9d9; --yellow-bg: #fff2cc;
  --header-h: 96px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg-alt); line-height: 1.5; font-size: 14px; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: 'Agne', 'Georgia', 'Times New Roman', serif; margin: 0 0 .4em; line-height: 1.15; color: var(--ink); font-weight: 700; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; color: var(--ink-soft); }
a { color: var(--teal-dark); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--gray); } .small { font-size: .82rem; } .nowrap { white-space: nowrap; } .mono { font-family: Consolas, 'Courier New', monospace; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .7rem; font-weight: 700; color: var(--teal-dark); margin-bottom: 6px; }
.eyebrow a { color: inherit; }

/* ---------- Sticky header + menu ---------- */
.header { position: sticky; top: 0; z-index: 40; background: rgba(250, 241, 224, .97); backdrop-filter: blur(8px); border-bottom: 1px solid var(--peach-dark); }
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 18px; max-width: 1700px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark { height: 44px; width: auto; }
.brand__name { font-family: 'Agne', Georgia, serif; font-size: 1.15rem; font-weight: 700; white-space: nowrap; line-height: 1.1; }
.brand__name .okilys { color: var(--blue); } .brand__name .app { color: var(--teal); margin-left: .3em; }
.brand__tagline { font-size: .58rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.header__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.study-select { display: flex; align-items: center; gap: 6px; }
.study-select select { max-width: 300px; padding: 6px 8px; }
.user-chip { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--ink-soft); }
.user-chip b { color: var(--ink); }
.burger { display: none; background: none; border: 1px solid var(--peach-dark); border-radius: 8px; width: 40px; height: 40px; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
.nav { display: flex; gap: 2px; padding: 0 18px; max-width: 1700px; margin: 0 auto; align-items: stretch; flex-wrap: wrap; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 12px; font-weight: 700; color: var(--ink-soft); border-bottom: 3px solid transparent; white-space: nowrap; font-size: .86rem; }
.nav a:hover { color: var(--blue); text-decoration: none; }
.nav a.is-active { color: var(--blue); border-bottom-color: var(--teal); }
.nav .right { margin-left: auto; }
.nav-group { position: relative; }
.nav-group > .nav-btn { background: none; border: none; padding: 7px 12px; font-weight: 700; color: var(--ink-soft); border-bottom: 3px solid transparent; white-space: nowrap; font-size: .86rem; cursor: pointer; font-family: inherit; }
.nav-group > .nav-btn:hover, .nav-group.open > .nav-btn { color: var(--blue); }
.nav-group.is-active > .nav-btn { color: var(--blue); border-bottom-color: var(--teal); }
.nav-menu { display: none; position: absolute; left: 0; top: 100%; z-index: 60; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); min-width: 230px; padding: 6px 0; }
.nav-group.open .nav-menu, .nav-group:hover .nav-menu { display: block; }
.nav-menu a { display: block; padding: 7px 14px; border-bottom: none !important; font-size: .85rem; color: var(--ink); }
.nav-menu a:hover { background: var(--teal-bg); color: var(--blue); }
.nav-menu a.is-active { color: var(--blue); background: var(--teal-bg2); }
.nav-menu .nav-menu__title { padding: 4px 14px; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gray); font-weight: 700; }
.nav .sep { width: 1px; background: var(--peach-dark); margin: 6px 4px; }
.crumbs { font-size: .78rem; color: var(--ink-soft); padding: 4px 18px 0; max-width: 1700px; margin: 0 auto; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.crumbs a { color: var(--teal-dark); font-weight: 600; } .crumbs span { margin: 0 4px; color: var(--gray); }

/* ---------- Layout ---------- */
.main { max-width: 1700px; margin: 0 auto; padding: 16px 18px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head p { margin: 0; }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; }
.card--flush { padding: 0; overflow: hidden; }
.card--navy { background: var(--navy); color: #e6eef8; border-color: var(--navy); }
.card--navy h2, .card--navy h3 { color: #fff; } .card--navy p { color: #cbd5e1; }
.card--link { cursor: pointer; transition: box-shadow .15s, transform .15s; } .card--link:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -12px rgba(18, 76, 239, .3); }
.grid { display: grid; gap: 12px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.hero-band { background: var(--gradient); color: #fff; border-radius: var(--radius); padding: 18px 22px; position: relative; overflow: hidden; margin-bottom: 14px; }
.hero-band::after { content: ''; position: absolute; inset: 0; background: radial-gradient(560px 320px at 88% 0%, rgba(255,255,255,.16), transparent 70%); pointer-events: none; }
.hero-band h1, .hero-band h2 { color: #fff; } .hero-band p { color: #eef4fb; } .hero-band .eyebrow { color: #d9f0f5; }
.hero-band * { position: relative; z-index: 1; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: .86rem; border: 2px solid transparent; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s, color .15s; text-decoration: none !important; white-space: nowrap; line-height: 1.2; }
.btn--primary { background: var(--gradient); color: #fff; border: none; padding: 10px 18px; } .btn--primary:hover { transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--blue); border-color: var(--blue); } .btn--ghost:hover { background: var(--blue-dark); color: #fff; }
.btn--soft { background: var(--teal-bg); color: var(--teal-dark); border: none; padding: 10px 18px; } .btn--soft:hover { background: var(--teal-bg2); }
.btn--danger { background: transparent; color: var(--red); border-color: var(--red); } .btn--danger:hover { background: var(--red); color: #fff; }
.btn--sm { padding: 5px 12px; font-size: .78rem; } .btn--xs { padding: 2px 9px; font-size: .72rem; border-width: 1px; } .btn--primary.btn--sm, .btn--soft.btn--sm, .btn--onblue.btn--sm { padding: 7px 14px; } .btn--primary.btn--xs, .btn--soft.btn--xs, .btn--onblue.btn--xs { padding: 3px 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn--onblue { background: #fff; color: var(--blue); border: none; padding: 10px 18px; }

/* ---------- Forms ---------- */
label.field { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--ink-soft); }
label.field > span .req, .req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 500; font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg-alt); color: var(--gray); }
textarea { min-height: 64px; resize: vertical; line-height: 1.4; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-all { grid-column: 1 / -1; }
.help { font-size: .74rem; color: var(--gray); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .85rem; cursor: pointer; }
.check input { width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: .76rem; font-weight: 600; cursor: pointer; color: var(--ink-soft); }
.chip.on { background: var(--teal-bg2); border-color: var(--teal); color: var(--teal-dark); }
.sponsor-only { border-left: 3px solid var(--teal); padding: 8px 10px; background: var(--teal-bg); border-radius: 0 10px 10px 0; }
.error-box { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 8px 12px; font-weight: 600; font-size: .85rem; margin-bottom: 10px; white-space: pre-line; }
.info-box { background: var(--teal-bg); color: var(--teal-dark); border-radius: 10px; padding: 8px 12px; font-size: .85rem; margin-bottom: 10px; }
.warn-box { background: var(--orange-bg); color: #7c4a03; border-radius: 10px; padding: 8px 12px; font-size: .85rem; margin-bottom: 10px; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 12px; margin: 0; } legend { font-size: .78rem; font-weight: 700; color: var(--teal-dark); padding: 0 6px; }

/* ---------- Filter bar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters label.field { min-width: 130px; flex: 1 1 130px; max-width: 220px; }
.filters .search { flex: 2 1 220px; max-width: 360px; }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 300px); border-radius: var(--radius); }
table.data { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .8rem; }
table.data th { position: sticky; top: 0; z-index: 2; background: var(--ink); color: #fff; text-align: left; padding: 7px 8px; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; cursor: pointer; user-select: none; }
table.data th.sorted::after { content: ' \25BE'; } table.data th.sorted.asc::after { content: ' \25B4'; }
table.data td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr:nth-child(even) td { background: #fafcfe; }
table.data tbody tr:hover td { background: var(--teal-bg); }
table.data tbody tr.clickable { cursor: pointer; }
table.data td.clamp { max-width: 260px; }
table.data td.clamp div { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .actions-col { white-space: nowrap; }
table.simple { border-collapse: collapse; width: 100%; font-size: .85rem; }
table.simple th, table.simple td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.simple th { background: var(--teal-bg); color: var(--teal-dark); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
table.doc-table td, table.doc-table th { border: 1px solid var(--border); }
.count { font-size: .8rem; color: var(--gray); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.badge--Open { background: var(--yellow-bg); color: #7c5a00; } .badge--Ongoing { background: var(--teal-bg2); color: var(--teal-dark); } .badge--Closed { background: var(--green-bg); color: var(--green); }
.badge--H { background: var(--red-bg); color: var(--red); } .badge--M { background: var(--orange-bg); color: #8a4b00; } .badge--L { background: var(--yellow-bg); color: #7c5a00; } .badge--O { background: #ededed; color: var(--ink-soft); }
.badge--green { background: var(--green-bg); color: var(--green); } .badge--orange { background: var(--orange-bg); color: #8a4b00; } .badge--red { background: var(--red-bg); color: var(--red); }
.badge--role { background: var(--teal-bg); color: var(--teal-dark); text-transform: uppercase; } .badge--admin { background: var(--navy); color: #fff; } .badge--off { background: #ededed; color: var(--gray); }
.badge--blue { background: #dbe4ff; color: var(--blue-dark); } .badge--navy { background: var(--navy); color: #fff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.dot--green { background: var(--green); } .dot--orange { background: var(--orange); } .dot--red { background: var(--red); } .dot--grey { background: #cfd5dd; } .dot--blue { background: var(--blue); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer; transition: box-shadow .15s; }
.kpi:hover { box-shadow: var(--shadow); }
.kpi .v { font-family: 'Agne', Georgia, serif; font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--navy); }
.kpi .l { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; }
.kpi.red .v { color: var(--red); } .kpi.orange .v { color: var(--orange); } .kpi.green .v { color: var(--green); } .kpi.teal .v { color: var(--teal-dark); }

/* ---------- Pivot & charts ---------- */
.pivot-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
table.pivot { border-collapse: collapse; font-size: .82rem; min-width: 320px; }
table.pivot th { background: var(--ink); color: #fff; padding: 6px 10px; text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
table.pivot th.col { text-align: right; }
table.pivot td { padding: 5px 10px; border-bottom: 1px solid var(--border); text-align: right; font-variant-numeric: tabular-nums; }
table.pivot td.lbl { text-align: left; font-weight: 600; } table.pivot td.lbl.lvl2 { padding-left: 26px; font-weight: 500; color: var(--ink-soft); }
table.pivot tr.total td { font-weight: 700; background: var(--teal-bg); border-top: 2px solid var(--teal); }
table.pivot tr.group td { background: var(--bg-alt); font-weight: 700; } table.pivot td.zero { color: #c3c9d1; }
.chart { width: 100%; height: auto; } .chart text { font-family: 'Manrope', sans-serif; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .78rem; margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -2px; }

/* ---------- Timeline / stages ---------- */
.timeline { display: flex; gap: 6px; flex-wrap: wrap; }
.tl { flex: 1 1 150px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: #fff; }
.tl .n { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; color: var(--ink-soft); }
.tl .d { font-size: .82rem; font-weight: 600; margin-top: 2px; }
.tl--ok { border-color: var(--green); background: var(--green-bg); } .tl--late { border-color: var(--red); background: var(--red-bg); } .tl--risk { border-color: var(--orange); background: var(--orange-bg); } .tl--pending { border-color: var(--teal); } .tl--na { opacity: .6; }
.stage-bar { display: flex; gap: 3px; flex-wrap: wrap; }
.stage-bar span { padding: 2px 8px; border-radius: 6px; font-size: .7rem; font-weight: 700; background: #ededed; color: var(--gray); }
.stage-bar span.done { background: var(--green-bg); color: var(--green); } .stage-bar span.now { background: var(--navy); color: #fff; }

/* ---------- Report questionnaire ---------- */
.q-section { margin-bottom: 14px; }
.q-section h3 { background: var(--teal-bg); padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.q-item { display: grid; grid-template-columns: 70px 1.6fr 200px 1.4fr; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--border); align-items: start; }
.q-item.rev { grid-template-columns: 70px 1.6fr 200px 1.2fr 1fr; }
.q-item .qid { font-family: Consolas, monospace; font-size: .78rem; color: var(--teal-dark); font-weight: 700; }
.q-item .q { font-weight: 600; font-size: .86rem; } .q-item .g { font-size: .76rem; color: var(--ink-soft); margin-top: 3px; } .q-item .n { font-size: .76rem; color: var(--teal-dark); margin-top: 3px; font-style: italic; }
.q-item .rules { font-size: .7rem; color: var(--gray); margin-top: 3px; }
.q-item .ans { display: flex; flex-direction: column; gap: 3px; }
.q-item .ans label { display: flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; cursor: pointer; padding: 3px 8px; border-radius: 8px; border: 1px solid var(--border); }
.q-item .ans label.sel-Yes { background: var(--green-bg); border-color: var(--green); } .q-item .ans label.sel-No { background: var(--red-bg); border-color: var(--red); }
.q-item .ans label.sel-NA { background: #ededed; } .q-item .ans label.sel-ND { background: var(--orange-bg); border-color: var(--orange); }
.q-item .ans input { width: auto; margin: 0; }
.q-item textarea { min-height: 58px; font-size: .82rem; }
.q-item.missing { background: #fff8f0; } .q-item .req-comment { color: var(--red); font-size: .72rem; font-weight: 700; }
.q-item .acts { font-size: .74rem; color: var(--teal-dark); margin-top: 3px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(13, 47, 82, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: var(--radius); width: min(1040px, 100%); box-shadow: 0 30px 60px -20px rgba(0,0,0,.4); animation: pop .18s ease; }
.modal--sm { width: min(520px, 100%); } .modal--md { width: min(760px, 100%); } .modal--xl { width: min(1400px, 100%); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--border); background: var(--peach); border-radius: var(--radius) var(--radius) 0 0; position: sticky; top: 0; z-index: 3; }
.modal__head h2 { margin: 0; font-size: 1.1rem; }
.modal__body { padding: 16px 18px; }
.modal__foot { display: flex; justify-content: space-between; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; position: sticky; bottom: 0; background: #fff; border-radius: 0 0 var(--radius) var(--radius); }
.modal__foot .right { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.close-x { background: none; border: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--ink-soft); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.meta-line { font-size: .74rem; color: var(--gray); }
.history li { padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: .82rem; }
.history .chg { display: block; color: var(--ink-soft); margin-left: 10px; }
.history .chg del { color: var(--red); } .history .chg ins { color: var(--green); text-decoration: none; }
.followup-log { white-space: pre-wrap; background: var(--bg-alt); border-radius: 10px; padding: 8px 10px; font-size: .82rem; max-height: 180px; overflow: auto; }
.doc-preview { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 24px 28px; font-size: .9rem; max-width: 820px; line-height: 1.55; }
.doc-preview h1 { font-size: 1.05rem; color: var(--teal-dark); } .doc-preview h3 { font-family: inherit; font-size: .95rem; margin-top: 14px; }
.doc-preview p { color: var(--ink); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; z-index: 200; box-shadow: var(--shadow); animation: pop .2s ease; max-width: 92vw; text-align: center; }
.toast.err { background: var(--red); }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--gradient); position: relative; }
.auth::after { content: ''; position: absolute; inset: 0; background: radial-gradient(700px 400px at 85% 10%, rgba(255,255,255,.18), transparent 70%); pointer-events: none; }
.auth__card { position: relative; z-index: 1; background: #fff; border-radius: 20px; padding: 28px 30px; width: min(440px, 100%); box-shadow: 0 30px 60px -20px rgba(0,0,0,.45); }
.auth__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; } .auth__brand img { height: 52px; }
.auth h1 { font-size: 1.35rem; margin-bottom: 4px; }
.auth .qr { display: flex; justify-content: center; margin: 10px 0; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: Consolas, monospace; font-size: .95rem; background: var(--bg-alt); padding: 12px; border-radius: 10px; }
.auth .foot { margin-top: 12px; font-size: .74rem; color: var(--gray); text-align: center; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 30px; color: var(--gray); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; overflow-x: auto; }
.tabs a { padding: 7px 12px; font-weight: 700; color: var(--ink-soft); border-bottom: 3px solid transparent; font-size: .85rem; white-space: nowrap; }
.tabs a.is-active { color: var(--blue); border-bottom-color: var(--teal); text-decoration: none; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: .72rem; }
.legend-note { font-size: .76rem; color: var(--ink-soft); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--teal-bg2); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.md h1 { font-size: 1.5rem; margin-top: 10px; } .md h2 { font-size: 1.2rem; margin-top: 22px; color: var(--teal-dark); } .md h3 { font-size: 1rem; margin-top: 14px; }
.md p, .md li { color: var(--ink); font-size: .9rem; } .md table { border-collapse: collapse; font-size: .85rem; margin: 8px 0; } .md th, .md td { border: 1px solid var(--border); padding: 5px 8px; vertical-align: top; } .md th { background: var(--teal-bg); }
.md code { background: var(--bg-alt); padding: 1px 5px; border-radius: 4px; font-size: .82rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: .85rem; } .kv dt { color: var(--ink-soft); font-weight: 600; } .kv dd { margin: 0; }
.mini-list { list-style: none; padding: 0; margin: 0; } .mini-list li { padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: .84rem; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .burger { display: inline-flex; align-items: center; justify-content: center; }
  .header__right, .nav { display: none; }
  .header.open .header__right { display: flex; width: 100%; justify-content: flex-start; padding: 6px 0; }
  .header.open .nav { display: flex; flex-direction: column; padding: 0 8px 8px; }
  .header__inner { flex-wrap: wrap; }
  .nav-group > .nav-btn { display: block; width: 100%; text-align: left; border-bottom: none; color: var(--teal-dark); text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; padding: 8px 12px 2px; }
  .nav-menu, .nav-group:hover .nav-menu { display: block; position: static; border: none; box-shadow: none; padding: 0 0 4px 10px; min-width: 0; }
  .nav .right { margin-left: 0; }
}
@media (max-width: 720px) {
  .header__inner { padding: 6px 10px; } .brand__mark { height: 36px; } .brand__tagline { display: none; }
  .main { padding: 10px; } .card { padding: 12px; } .modal__body { padding: 12px; } .modal-backdrop { padding: 8px; }
  .modal { width: 100%; border-radius: 10px; }
  .table-wrap { max-height: none; }
  .q-item, .q-item.rev { grid-template-columns: 1fr; gap: 6px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .filters label.field { max-width: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .pivot-controls { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; }
  h1 { font-size: 1.3rem; }
}
@media print { .header, .nav, .filters, .btn, .modal-backdrop, .crumbs { display: none !important; } .table-wrap { max-height: none; overflow: visible; } }


/* ---------- v3: report helpers, floating action button, tooltips ---------- */
.q-item .ans label.sel-good { background: var(--green-bg); border-color: var(--green); } .q-item .ans label.sel-bad { background: var(--red-bg); border-color: var(--red); }
.q-item .ans label.sel-neutral { background: #e6eefc; border-color: var(--blue); }
.fab { position: fixed; right: 18px; bottom: 18px; z-index: 90; background: var(--gradient); color: #fff; border: none; border-radius: 999px; padding: 12px 20px; font-weight: 700; box-shadow: 0 12px 30px -8px rgba(18,76,239,.5); cursor: pointer; }
.fab:hover { transform: translateY(-2px); }
.proposal-bar { position: sticky; top: var(--header-h); z-index: 30; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 10px; margin-bottom: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tip { position: relative; display: inline-block; }
.tip .tip__text { display: none; position: absolute; left: 0; top: 120%; z-index: 50; background: var(--ink); color: #fff; padding: 8px 10px; border-radius: 8px; font-size: .74rem; line-height: 1.4; width: 320px; max-width: 80vw; box-shadow: var(--shadow); font-weight: 500; }
.tip:hover .tip__text { display: block; }
.logo-preview { max-height: 60px; max-width: 200px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: #fff; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid var(--border); vertical-align: middle; margin-right: 4px; }
.module-badge { font-family: Consolas, monospace; font-weight: 700; }

.card--selected { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-bg2), var(--shadow); background: var(--teal-bg); }


/* ---------- v4: site life cycle funnel ---------- */
.funnel { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.funnel__step { display: grid; grid-template-columns: 150px 1fr 36px; align-items: center; gap: 8px; cursor: pointer; font-size: .78rem; }
.funnel__label { color: var(--ink-soft); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.funnel__bar { background: var(--bg-alt); border-radius: 6px; height: 14px; overflow: hidden; }
.funnel__fill { height: 100%; background: linear-gradient(90deg, var(--teal) 0%, var(--blue) 100%); border-radius: 6px; min-width: 2px; transition: width .3s; }
.funnel__fill.p2 { background: linear-gradient(90deg, var(--green) 0%, var(--teal) 100%); }
.funnel__n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .funnel__step { grid-template-columns: 110px 1fr 30px; } }


/* ---------- electronic signatures ---------- */
.sig-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.sig-step { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--bg-alt); }
.sig-step.is-done { border-color: var(--green); background: #eef9f1; } .sig-step.is-next { border-color: var(--teal); background: var(--teal-bg); } .sig-step.is-bad { border-color: #c0392b; background: #fdecea; }
.sig-step__title { font-weight: 700; margin-bottom: 4px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: .85rem; }
@media (max-width: 720px) { .sig-steps { grid-template-columns: 1fr; } }


/* ---------- tools: CRA oversight grid ---------- */
.ov-wrap { max-height: 70vh; }
table.ov th.ov-sticky, table.ov td.ov-sticky { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 180px; box-shadow: 2px 0 0 var(--border); }
table.ov thead th { position: sticky; top: 0; z-index: 2; } table.ov thead th.ov-sticky { z-index: 3; }
table.ov th.ov-date { min-width: 260px; }
table.ov td.ov-cell { padding: 3px; min-width: 260px; }
textarea.ov-note { width: 100%; min-height: 46px; font-size: .8rem; border: 1px solid transparent; background: transparent; resize: vertical; }
textarea.ov-note:focus { border-color: var(--teal); background: #fff; }
textarea.ov-note.dirty { border-color: var(--orange); } textarea.ov-note.saved { border-color: var(--green); }
tr.ov-general td { background: var(--teal-bg); }
table.ov td.ov-changed { background: #fff3c4; box-shadow: inset 0 0 0 1px #f2c94c; }
table.ov tr.ov-row-changed td.ov-sticky { box-shadow: inset 4px 0 0 var(--orange); }
.ov-legend { display: inline-block; width: 14px; height: 14px; background: #fff3c4; border: 1px solid #f2c94c; vertical-align: middle; border-radius: 3px; }
tr.row--warn td { background: #fff7ed; }

.country-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.country-cards .card { padding: 10px 12px; cursor: pointer; }


.ro-banner { background: #fdecea; color: #7a1f14; border-top: 1px solid #f5c6c0; padding: 8px 20px; font-size: .85rem; font-weight: 600; }


/* ---------- follow-up log ---------- */
.fu-log { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 260px; overflow: auto; }
.fu-line { font-size: .85rem; padding: 4px 8px; border-left: 3px solid var(--teal); background: var(--bg-alt); border-radius: 0 6px 6px 0; white-space: pre-wrap; }
.fu-line.pending { border-left-color: var(--orange); }
td.fu-cell .fu-line { font-size: .78rem; padding: 2px 6px; margin-bottom: 2px; white-space: normal; }
.badge--Voided { background: #ededed; color: #666; text-decoration: line-through; }


/* ---------- generic tables: scroll, resize, sort, filters ---------- */
.table-wrap { overflow: auto; scrollbar-gutter: stable; }
.table-wrap::-webkit-scrollbar { height: 10px; width: 10px; } .table-wrap::-webkit-scrollbar-thumb { background: #b9c3d0; border-radius: 6px; } .table-wrap::-webkit-scrollbar-track { background: #eef1f5; }
th.th-enh { position: relative; cursor: pointer; user-select: none; padding-right: 26px !important; }
th.th-enh .th-tools { position: absolute; right: 2px; top: 0; bottom: 0; display: flex; align-items: center; gap: 2px; }
th.th-enh .th-filter { font-size: .8rem; opacity: .55; padding: 0 3px; cursor: pointer; } th.th-enh .th-filter:hover { opacity: 1; }
th.th-enh .th-resize { width: 6px; align-self: stretch; cursor: col-resize; border-right: 2px solid rgba(255,255,255,.25); } th.th-enh .th-resize:hover { border-right-color: var(--teal); }
th.th-enh.sorted.asc .th-label::after { content: ' \25B4'; } th.th-enh.sorted.desc .th-label::after { content: ' \25BE'; }
table.data th.sorted::after, table.data th.sorted.asc::after { content: none; }
tr.th-filters th { position: sticky; top: 30px; z-index: 2; background: var(--bg-alt); padding: 3px 4px; }
tr.th-filters input { width: 100%; min-width: 60px; font-size: .74rem; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; }
table.simple tr.th-filters th, table.pivot tr.th-filters th { top: auto; }
td.fu-cell { min-width: 260px; } .fu-box .fu-line { font-size: .78rem; padding: 2px 6px; margin-bottom: 2px; white-space: normal; }
.fu-toggle { font-size: .74rem; font-weight: 700; color: var(--teal-dark); display: inline-block; margin-top: 2px; }
td.due-overdue { color: var(--red); font-weight: 700; }


.fu-entry { margin-top: 6px; padding: 8px 10px; border: 1px dashed var(--teal); border-radius: 10px; background: #fff; }
.fu-entry textarea { width: 100%; }
