/* =========================================================================
   E-Choice Solutions AI Readiness Assessment Platform — styles.css
   Palette: Navy #17324D · Teal #1F8A8A · Gold #C69C3C · Gray #F3F5F7
   ========================================================================= */
:root {
  --navy: #17324D;
  --navy-deep: #0F2233;
  --teal: #1F8A8A;
  --teal-dark: #166969;
  --gold: #C69C3C;
  --white: #FFFFFF;
  --gray: #F3F5F7;
  --ink: #22313F;
  --line: #D8DEE4;
  --muted: #5B6B78;
  --danger: #A63A3A;
  --ok: #2E7D4F;
  --radius: 3px;
  --shadow: 0 1px 3px rgba(23, 50, 77, 0.10), 0 4px 14px rgba(23, 50, 77, 0.06);
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--gray);
}

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--font-display); color: var(--navy); line-height: 1.25; }
h1 { font-size: 1.9rem; margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1.1rem; margin: 1.25rem 0 .5rem; }
p { margin: 0 0 1rem; }
.eyebrow {
  font-family: var(--font-body);
  font-size: .72rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--teal); margin: 0 0 .35rem;
}
.muted { color: var(--muted); }
.small { font-size: .85rem; }
a { color: var(--teal-dark); }

/* ---------- Layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 0 1.25rem; }
main { padding: 2rem 0 4rem; }

/* ---------- Header / footer ---------- */
.site-header {
  background: var(--navy); color: var(--white);
  border-bottom: 3px solid var(--gold);
}
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .85rem 0; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .75rem; color: var(--white); text-decoration: none; }
.brand img { height: 40px; width: 40px; }
.brand .name { font-family: var(--font-display); font-size: 1.05rem; letter-spacing: .02em; }
.brand .sub { display: block; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: #B9C6D2; }
.site-nav a {
  color: #DDE6EE; text-decoration: none; font-size: .85rem;
  margin-left: 1.1rem; padding: .3rem 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--white); border-bottom-color: var(--gold); }
.site-nav a[aria-current="page"] { color: var(--white); border-bottom-color: var(--teal); }

.site-footer {
  background: var(--navy-deep); color: #B9C6D2;
  font-size: .8rem; padding: 1.5rem 0; margin-top: 3rem;
}
.site-footer a { color: #DCE6EF; }
.site-footer .conf { color: var(--gold); }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.5rem; margin-bottom: 1.25rem;
}
.card-tight { padding: 1rem 1.25rem; }
.panel-title {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; border-bottom: 2px solid var(--navy); padding-bottom: .5rem; margin-bottom: 1rem;
}
.panel-title h2, .panel-title h3 { margin: 0; }

.notice {
  border-left: 4px solid var(--gold); background: #FBF6EA;
  padding: .8rem 1rem; font-size: .88rem; margin: 1rem 0; border-radius: var(--radius);
}
.notice-demo {
  border-left-color: var(--teal); background: #EAF4F4;
}
.notice-danger { border-left-color: var(--danger); background: #F9ECEC; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: 1px solid transparent; cursor: pointer;
  font: 600 .9rem var(--font-body); padding: .6rem 1.25rem;
  border-radius: var(--radius); text-decoration: none; text-align: center;
  transition: background .15s ease, color .15s ease;
}
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover, .btn-primary:focus-visible { background: var(--teal-dark); }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover, .btn-secondary:focus-visible { background: var(--navy); color: var(--white); }
.btn-ghost { background: transparent; color: var(--teal-dark); border-color: var(--line); }
.btn-ghost:hover, .btn-ghost:focus-visible { border-color: var(--teal); }
.btn-danger { background: var(--white); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--white); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; color: var(--navy); }
.req { color: var(--danger); }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"],
input[type="number"], input[type="url"], input[type="password"], select, textarea {
  width: 100%; padding: .55rem .7rem; font: 1rem var(--font-body); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--white);
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: 3px solid rgba(31,138,138,.25); }
textarea { min-height: 4.5rem; resize: vertical; }
.field { margin-bottom: 1.1rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1.5rem; }
.field-error { color: var(--danger); font-size: .82rem; margin-top: .25rem; display: none; }
.field.invalid .field-error { display: block; }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--danger); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 0 0 1.25rem; }
legend { font-weight: 700; color: var(--navy); padding: 0 .4rem; }

/* Response scale radios */
.scale-options { display: grid; gap: .4rem; margin-top: .5rem; }
.scale-option {
  display: flex; align-items: flex-start; gap: .6rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: .55rem .75rem; cursor: pointer; background: var(--white);
  font-weight: 400; font-size: .92rem; color: var(--ink); margin-bottom: 0;
}
.scale-option:hover { border-color: var(--teal); }
.scale-option input { margin-top: .2rem; accent-color: var(--teal); }
.scale-option.selected { border-color: var(--teal); background: #EAF4F4; }
.scale-option .num { font-weight: 700; color: var(--navy); min-width: 1.1rem; }

.question-block { border-bottom: 1px solid var(--line); padding: 1.4rem 0; }
.question-block:last-of-type { border-bottom: none; }
.question-id { font-size: .75rem; font-weight: 700; letter-spacing: .08em; color: var(--gold); }
.question-text { font-weight: 600; margin: .2rem 0 .4rem; color: var(--navy); }
.question-invalid { border-left: 4px solid var(--danger); padding-left: 1rem; }
.question-invalid-msg { color: var(--danger); font-size: .85rem; font-weight: 600; display: none; }
.question-invalid .question-invalid-msg { display: block; }

/* ---------- Progress ---------- */
.progress-shell { background: var(--line); height: 8px; border-radius: 4px; overflow: hidden; }
.progress-fill { background: var(--teal); height: 100%; width: 0; transition: width .25s ease; }
.stepper { display: flex; gap: .35rem; flex-wrap: wrap; margin: .75rem 0; }
.step-pill {
  font-size: .72rem; font-weight: 600; padding: .25rem .6rem;
  border-radius: 20px; border: 1px solid var(--line); background: var(--white); color: var(--muted);
}
.step-pill.active { background: var(--navy); border-color: var(--navy); color: var(--white); }
.step-pill.done { background: #EAF4F4; border-color: var(--teal); color: var(--teal-dark); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; background: var(--white); }
table.data th {
  background: var(--navy); color: var(--white); text-align: left;
  padding: .55rem .7rem; font-weight: 600; white-space: nowrap;
}
table.data td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:hover { background: #F6FAFA; }
table.data td input, table.data td select, table.data td textarea { font-size: .85rem; padding: .35rem .5rem; }

/* Dashboard client table: keep the row action visible even when the table
   scrolls horizontally, and make the client name an obvious way in. */
table.data th.col-action, table.data td.col-action {
  position: sticky; left: 0; z-index: 1;
  background: var(--white);
  box-shadow: 6px 0 6px -4px rgba(23, 50, 77, .18);
}
table.data th.col-action { background: var(--navy); }
table.data tbody tr:hover td.col-action { background: #F6FAFA; }
table.data td.col-action .btn { white-space: nowrap; }
a.client-link { font-weight: 600; color: var(--teal-dark); text-decoration: underline; }
a.client-link:hover, a.client-link:focus-visible { color: var(--navy); }
/* Allow the longest status label to wrap so it is not clipped by the pinned
   action column. Scoped to the dashboard table; badges elsewhere stay on one line. */
#client-table .badge-status { white-space: normal; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: .18rem .55rem; border-radius: 20px; white-space: nowrap;
}
.badge-gap, .badge-critical { background: #F6E3E3; color: var(--danger); }
.badge-developing, .badge-high { background: #F7EEDB; color: #8A6A1F; }
.badge-monitor, .badge-moderate { background: #E7ECF1; color: var(--navy); }
.badge-established { background: #E4EFF4; color: #1F5C8A; }
.badge-strength, .badge-low, .badge-ok { background: #E2F0E8; color: var(--ok); }
.badge-status { background: #EAF4F4; color: var(--teal-dark); }
.badge-missing { background: #EEE; color: var(--muted); }

/* ---------- Dashboard ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi {
  background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--teal);
  border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow);
}
.kpi .kpi-num { font-family: var(--font-display); font-size: 1.9rem; color: var(--navy); line-height: 1.1; }
.kpi .kpi-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kpi.kpi-gold { border-top-color: var(--gold); }
.kpi.kpi-navy { border-top-color: var(--navy); }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.chart-box { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); }
.chart-box h3 { margin-top: 0; }
.chart-canvas-wrap { position: relative; height: 300px; }

.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters .field { margin-bottom: 0; min-width: 150px; }

/* Score meter (report and record) */
.score-meter { position: relative; height: 26px; background: var(--line); border-radius: 13px; overflow: hidden; margin: .5rem 0 1rem; }
.score-meter .fill { height: 100%; background: linear-gradient(90deg, var(--teal), var(--navy)); }
.score-meter .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.7); }
.score-hero { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.score-hero .big { font-family: var(--font-display); font-size: 3.2rem; color: var(--navy); line-height: 1; }

/* Validation rows */
.validate-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: .9rem; background: var(--white); }
.validate-row.overridden { border-left: 4px solid var(--gold); }
.validate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem 1.25rem; margin-top: .6rem; }
.validate-grid .field { margin-bottom: 0; }
/* Reserve a two-line label area in consultant validation rows so every box in
   a row starts at the same height, even when one label wraps to two lines. */
.validate-row .validate-grid .field label {
  min-height: 3.1em; display: flex; align-items: flex-end; gap: 0 .3em;
}
.vr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }

/* Login */
.login-shell { max-width: 420px; margin: 3.5rem auto; }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--gold); color: var(--navy-deep);
  padding: .6rem 1rem; z-index: 100; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* Utility */
.hidden { display: none !important; }
.right { text-align: right; }
.mt-0 { margin-top: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

/* Toast */
.toast {
  position: fixed; bottom: 1.25rem; right: 1.25rem; background: var(--navy);
  color: var(--white); padding: .7rem 1.1rem; border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: .9rem; z-index: 50; opacity: 0;
  transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .chart-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.55rem; }
  .site-nav { width: 100%; display: flex; flex-wrap: wrap; }
  .site-nav a { margin: 0 1rem 0 0; }
}
@media (max-width: 520px) {
  .btn-row .btn { flex: 1 1 auto; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
