/* Dewberry Agile Portal. Colors follow the Dewberry corporate template (navy, teal, maroon, gold). */
:root {
  --navy: #304E65;
  --teal: #3B7691;
  --maroon: #7A1341;
  --gold: #D8A446;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --border: #d8dfe5;
  --text: #1d2833;
  --text-2: #4a5866;
  --muted: #66727e;
  --accent: #2c6683;
  --accent-ink: #ffffff;
  --link: #255f7c;
  --header-bg: #304E65;
  --header-ink: #ffffff;
  --danger: #a3123f;
  --notice-bg: #e6f2ec;
  --notice-ink: #1d5a3a;
  --callout-bg: #fbf3e2;
  --callout-ink: #6b4a10;

  --data: #1F7AA8;
  --track: #e3e9ee;
  --good: #2b7a4b;
  --warn: #9a6500;
  --bad: #b3261e;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 2px 8px rgba(16, 32, 48, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12181d; --surface: #1a2229; --surface-2: #222c35; --border: #33414d;
    --text: #e6ebef; --text-2: #b9c4cd; --muted: #93a0ab;
    --accent: #3d95c4; --accent-ink: #0d1418; --link: #7cc0e3;
    --header-bg: #1d3446; --danger: #f08aa5;
    --notice-bg: #183527; --notice-ink: #a8e0bf; --callout-bg: #3a2e14; --callout-ink: #f1d79c;
    --data: #3D95C4; --track: #2b3742; --good: #6fcf97; --warn: #f2b84b; --bad: #ff8a80;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12181d; --surface: #1a2229; --surface-2: #222c35; --border: #33414d;
  --text: #e6ebef; --text-2: #b9c4cd; --muted: #93a0ab;
  --accent: #3d95c4; --accent-ink: #0d1418; --link: #7cc0e3;
  --header-bg: #1d3446; --danger: #f08aa5;
  --notice-bg: #183527; --notice-ink: #a8e0bf; --callout-bg: #3a2e14; --callout-ink: #f1d79c;
  --data: #3D95C4; --track: #2b3742; --good: #6fcf97; --warn: #f2b84b; --bad: #ff8a80;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 "Segoe UI", Arial, system-ui, sans-serif; }
a { color: var(--link); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; color: var(--text); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .9em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 40px; }
.lede { font-size: 1.05rem; color: var(--text-2); max-width: 70ch; }
.muted { color: var(--muted); }
.fine { font-size: .85rem; color: var(--muted); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }

/* Header */
.topbar { background: var(--header-bg); color: var(--header-ink); border-bottom: 3px solid var(--gold); }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; line-height: 1.2; }
.brand small { display: block; font-size: .75rem; opacity: .8; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--gold); color: var(--navy); display: grid; place-items: center; font-weight: 800; }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; }
.nav a { color: inherit; text-decoration: none; padding: 8px 10px; border-radius: 6px; font-size: .93rem; opacity: .9; }
.nav a:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); opacity: 1; font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .25); }
.who { color: inherit; text-decoration: none; font-size: .9rem; line-height: 1.2; }
.who small { display: block; opacity: .75; font-size: .75rem; }
.userbox .linkbtn { color: inherit; opacity: .85; }
.menu-toggle { display: none; margin-left: auto; background: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, .4); border-radius: 6px; padding: 6px 12px; font: inherit; }
@media (max-width: 960px) {
  .menu-toggle { display: block; }
  .topbar-right { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
  .topbar-right.open { display: flex; }
  .nav { flex-direction: column; }
  .userbox { border-left: 0; padding-left: 0; border-top: 1px solid rgba(255, 255, 255, .25); padding-top: 10px; justify-content: space-between; }
}

/* Layout */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.grid > .card { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: .5rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .lede { margin-bottom: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 520px; }
.more { display: inline-block; margin-top: .5rem; font-weight: 600; font-size: .92rem; }
.footer { color: var(--muted); font-size: .82rem; padding-top: 8px; padding-bottom: 32px; }

/* Hero */
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--maroon); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.hero h1 { font-size: 1.9rem; }
.hero .lede { margin-bottom: 0; }
.hero-meter { min-width: 200px; display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 4px 8px; }
.hero-meter .big { font-size: 1.6rem; font-weight: 700; }
.hero-meter progress { grid-column: 1 / -1; }
.hero-meter.small { min-width: 160px; }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 5px; background: var(--track); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--track); border-radius: 5px; }
progress::-webkit-progress-value { background: var(--data); border-radius: 5px; }
progress::-moz-progress-bar { background: var(--data); border-radius: 5px; }

/* Messages */
.notice { background: var(--notice-bg); color: var(--notice-ink); padding: 10px 14px; border-radius: 8px; }
.callout { background: var(--callout-bg); color: var(--callout-ink); padding: 10px 14px; border-radius: 8px; }
.reminder { background: var(--callout-bg); color: var(--callout-ink); border-left: 5px solid var(--gold); padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; }
.reminder ul { margin: .4rem 0; padding-left: 1.2rem; }
.reminder a { color: inherit; font-weight: 600; }

/* Lists */
.list { list-style: none; padding: 0; margin: 0 0 .5rem; }
.list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list.compact li { padding: 4px 0; }
.date-chip { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--text-2); background: var(--surface-2); border-radius: 6px; padding: 1px 8px; white-space: nowrap; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge-muted { opacity: .8; }
.badge-warn { background: var(--callout-bg); color: var(--callout-ink); border-color: transparent; }
.note { padding: 12px 0; border-bottom: 1px solid var(--border); }
.note:last-child { border-bottom: 0; }
.note.pinned h3 { color: var(--maroon); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .note.pinned h3 { color: var(--gold); } }
.card-list { list-style: none; padding: 0; margin: 0; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; font-size: .95rem; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-small { padding: 5px 11px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-size: .88rem; color: var(--link); cursor: pointer; text-decoration: underline; }
.linkbtn.danger { color: var(--danger); }
form.inline, .inline-form { display: inline; }
.inline-form { display: flex; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 600; color: var(--text-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input, select, textarea { font: inherit; font-size: .95rem; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; width: 100%; min-width: 0; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid .span-2, .form-grid .span-3 { grid-column: 1 / -1; } }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 600; padding: 0 4px; }
details > summary { cursor: pointer; font-weight: 600; color: var(--link); }
details[open] > summary { margin-bottom: 12px; }
.admin-panel { border-style: dashed; }
.admin-edit { margin-top: 8px; }
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.subnav a { padding: 8px 12px; text-decoration: none; color: var(--text-2); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subnav a[aria-current="page"] { color: var(--text); border-color: var(--maroon); font-weight: 600; }

/* Training */
.sessions { list-style: none; margin: 0; padding: 0; }
.session { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.session .time { font-weight: 700; }
.session .time span { display: block; font-weight: 400; color: var(--muted); font-size: .9rem; }
.session h3 { margin-bottom: .2rem; }
.session.past { opacity: .6; }
.session.mine .time { color: var(--maroon); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .session.mine .time { color: var(--gold); } }
@media (max-width: 560px) { .session { grid-template-columns: 1fr; gap: 4px; } }

/* Documents */
.doc-list { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.doc-list li:first-child { border-top: 0; }
.doc-body { flex: 1; min-width: 0; }
.doc-body a { font-weight: 600; }
.doc-body p { margin: 2px 0 0; }
.doc-type { flex: none; width: 46px; text-align: center; font-size: .72rem; font-weight: 700; padding: 6px 0; border-radius: 6px; color: #fff; background: var(--navy); }
.doc-type.t-pdf { background: var(--maroon); }
.doc-type.t-ppt { background: #9a5a14; }
.doc-type.t-doc { background: var(--teal); }
.doc-type.t-link { background: #4E5B35; }

/* Courses */
.lessons { list-style: none; margin: 0; padding: 0; }
.lesson { display: flex; gap: 16px; align-items: flex-start; }
.lesson .num { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.lesson.done .num { background: var(--good); color: #fff; }
.lesson h2 { margin-bottom: .2rem; }
.lesson .body p { margin-bottom: .2rem; }
.player { width: 100%; max-height: 70vh; background: #000; border-radius: var(--radius); margin-bottom: 16px; }
.embed { position: relative; aspect-ratio: 16 / 9; margin-bottom: 16px; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--radius); }
.lesson-actions { margin-bottom: 24px; }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 12px; padding: 0; overflow: hidden; }
.chat-log { height: min(60vh, 560px); overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 80%; background: var(--surface-2); border-radius: 12px 12px 12px 4px; padding: 8px 12px; }
.msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border-radius: 12px 12px 4px 12px; }
.msg header { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: .85rem; }
.msg .team, .msg time { color: var(--muted); font-size: .78rem; }
.msg p { margin: 2px 0 0; }
.chat-form { display: flex; gap: 8px; padding: 0 20px; align-items: flex-end; }
.chat-form textarea { resize: vertical; }
.chat .fine { padding: 0 20px 12px; margin: 0; min-height: 1.4em; }
@media (max-width: 560px) { .msg { max-width: 95%; } .chat-log { padding: 12px; } .chat-form { padding: 0 12px; } }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.tile .label { font-size: .82rem; color: var(--text-2); font-weight: 600; }
.tile .value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data thead th { font-size: .8rem; color: var(--text-2); font-weight: 600; white-space: nowrap; }
table.data tbody th { font-weight: 600; }
table.data .r { text-align: right; font-variant-numeric: tabular-nums; }
table.data.compact th, table.data.compact td { padding: 5px 8px; }
table.data .notes-row td { border-top: 0; padding-top: 0; font-size: .88rem; color: var(--text-2); }
table.data tr:has(+ .notes-row) th, table.data tr:has(+ .notes-row) td { border-bottom: 0; }
.code { display: inline-block; min-width: 26px; font-size: .75rem; color: var(--muted); }
.bar-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.bar-cell .num { font-variant-numeric: tabular-nums; min-width: 3ch; }
.bar-track { fill: var(--track); }
.bar-fill { fill: var(--data); }
.status { white-space: nowrap; font-weight: 600; font-size: .88rem; color: var(--text); }
.status > span { margin-right: 2px; }
.s-green > span { color: var(--good); }
.s-amber > span { color: var(--warn); }
.s-red > span { color: var(--bad); }
.s-done > span { color: var(--good); }
.s-plain > span { color: var(--muted); }
.chart { width: 100%; max-width: 720px; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .series { fill: none; stroke: var(--data); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--data); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .pt:hover .dot { r: 6.5; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.timeline li:first-child { border-top: 0; }
.timeline .date-chip { justify-self: start; }
.milestone-form { display: grid; grid-template-columns: 1fr 150px 130px; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border); }
.milestone-form .span-all { grid-column: 1 / -1; }
.milestone-form.add { grid-template-columns: 1fr 150px auto; }
@media (max-width: 560px) { .milestone-form, .milestone-form.add, .timeline li { grid-template-columns: 1fr; } }

/* Surveys */
.survey .q { margin: 0; }
.survey legend { font-weight: 600; font-size: 1rem; padding: 0; margin-bottom: 8px; }
.qn { color: var(--muted); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale label { flex-direction: column; align-items: center; text-align: center; font-weight: 400; font-size: .82rem; gap: 6px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.scale label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
@media (max-width: 560px) { .scale { grid-template-columns: 1fr; } .scale label { flex-direction: row; justify-content: flex-start; } }
.choices { display: flex; flex-direction: column; gap: 6px; }
.choices label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.quotes { margin: 0; padding-left: 1.1rem; }
.quotes li { padding: 4px 0; }

/* Sign-in */
body.bare { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, var(--navy), #1d3446); }
body.bare .main { padding: 24px 16px; width: 100%; }
.login-card { max-width: 440px; margin: 0 auto; background: var(--surface); border-radius: 14px; padding: 32px; border-top: 5px solid var(--gold); box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.login-card h1 { font-size: 1.45rem; }
.login-card .btn-block { margin: 12px 0; padding: 12px; }
.dev-note { font-size: .88rem; background: var(--callout-bg); color: var(--callout-ink); padding: 8px 12px; border-radius: 8px; }

@media print {
  .topbar, .footer, .no-print, .admin-panel, .menu-toggle { display: none !important; }
  body { background: #fff; }
  .card, .tile { box-shadow: none; break-inside: avoid; }
}
.admin-panel-inner { margin-top: 16px; border-top: 1px dashed var(--border); padding-top: 12px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 8px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.survey-section { font-size: 1.05rem; margin: 18px 0 2px; padding-bottom: 6px; border-bottom: 2px solid var(--gold); color: var(--text); }
.quotes li + li { margin-top: 8px; }
.survey .q legend { float: left; width: 100%; margin-bottom: 8px; }
.survey .q legend + * { clear: both; }
.confidence { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.confidence-label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.confidence-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.confidence-options label { flex-direction: row; justify-content: center; align-items: center; gap: 6px; font-weight: 400; font-size: .82rem; padding: 6px 4px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.confidence-options label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); font-weight: 600; }
@media (max-width: 560px) { .confidence-options { gap: 4px; } .confidence-options label { flex-direction: column; gap: 2px; font-size: .72rem; padding: 6px 2px; text-align: center; } }
.tile .value .of { font-size: .9rem; color: var(--muted); font-weight: 500; margin-left: 2px; }
.rhythm { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.rhythm dt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rhythm dd { margin: 0; }
.demo-banner { background: var(--gold); color: #1d2833; text-align: center; font-size: .85rem; font-weight: 600; padding: 6px 16px; }
.demo-accounts { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.demo-pick { flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; }
.demo-pick span { font-weight: 400; font-size: .82rem; color: var(--muted); }
.sub-line { display: block; margin-top: 2px; }
