:root {
  --ink: #1b2733;
  --muted: #5d6b7a;
  --line: #e2e6ea;
  --bg: #f5f6f4;
  --card: #ffffff;
  --accent: #0d6b63;       /* deep teal */
  --accent-ink: #094e48;
  --danger: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,30,40,.06), 0 4px 16px rgba(20,30,40,.04);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent-ink); }
code { font: 14px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: #eef1f0; padding: .12em .4em; border-radius: 5px; }

/* Header */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 22px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 700; letter-spacing: .5px;
}
.wordmark { font-weight: 650; letter-spacing: .2px; }
.wordmark small { display: block; font-weight: 500; color: var(--muted); letter-spacing: 1.5px; font-size: 11px; }
.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topnav .who { color: var(--muted); font-variant-numeric: tabular-nums; }
.topnav a { text-decoration: none; color: var(--ink); }
.topnav a:hover { color: var(--accent-ink); }
.topnav .logout { color: var(--muted); }

/* Layout */
.wrap { max-width: 860px; margin: 0 auto; padding: 26px 20px 80px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.pagehead h1 { margin: 0 0 2px; font-size: 26px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h2 { font-size: 18px; margin: 0; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.guidance { color: var(--muted); margin: 0 0 14px; }

/* Entries */
.entry { border-top: 1px solid var(--line); padding: 14px 0; }
.entry:first-of-type { border-top: 0; }
.entry-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.entry-top h3 { margin: 0; font-size: 16px; }
.entry time { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry .body { margin: 8px 0; white-space: pre-wrap; }
.entry-actions { display: flex; justify-content: flex-end; gap: 14px; align-items: center; font-size: 14px; }

/* Media */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.media-grid img, .media-grid video { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #000; }
.att { display: flex; flex-direction: column; gap: 6px; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 550; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, textarea, select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row input { width: auto; flex: 1 1 180px; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border: 0; border-radius: 8px;
  padding: 10px 16px; background: var(--accent); color: #fff; text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-ink); }
.btn.ghost, .btn.ghost:hover { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.link-danger { background: none; color: var(--danger); padding: 0; font-weight: 600; }
.link-danger:hover { background: none; text-decoration: underline; }

/* Tables */
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.grid th { color: var(--muted); font-weight: 600; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--muted); font-size: 13px; box-shadow: var(--shadow); }
.stat .num { display: block; color: var(--ink); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

.srow { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.srow:first-of-type { border-top: 0; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; border-radius: 99px; margin-left: 6px; }

/* Misc */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-ok { background: #e6f4f1; color: var(--accent-ink); }
.flash-error { background: #fbe9e7; color: var(--danger); }
.empty { color: var(--muted); padding: 8px 0; }
.auth-card { max-width: 380px; margin: 8vh auto 0; }
.auth-card h1 { font-size: 24px; margin: 0 0 4px; }

@media (max-width: 560px) {
  .pagehead { flex-direction: column; }
  .entry-top { flex-direction: column; gap: 2px; }
}

/* Phase 2: notes, feedback, reviewer cards, auth helpers */
.note { background: #f6f8f8; border-left: 3px solid var(--accent); border-radius: 6px;
        padding: 9px 12px; margin: 8px 0; }
.note-meta { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.note-body { white-space: pre-wrap; font-size: 14px; }
.note-form { display: flex; gap: 8px; margin-top: 8px; }
.note-form input { flex: 1; }
.feedback { border-top: 3px solid var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.linkcard { display: block; text-decoration: none; color: var(--ink); }
.linkcard:hover { border-color: var(--accent); }
.rule { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.auth-card p { font-size: 14px; }

/* Phase 3: typed components, dashboard, data display */
.compnav { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 18px; font-size: 13px; }
.compnav a { text-decoration: none; color: var(--muted); }
.compnav a:hover { color: var(--accent-ink); }
.req { color: var(--danger); }
.help { font-weight: 400; color: var(--muted); font-size: 12px; }
dl.data { margin: 6px 0 0; }
.data-row { display: flex; gap: 10px; padding: 3px 0; font-size: 14px; }
.data-row dt { color: var(--muted); min-width: 150px; flex-shrink: 0; }
.data-row dd { margin: 0; white-space: pre-wrap; }
.chips { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11px; background: #eef1f0; border-radius: 99px; padding: 2px 9px; color: var(--accent-ink); }
.comp-pick { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.comp-pick legend { font-size: 13px; color: var(--muted); padding: 0 6px; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.comp-grid .check { font-size: 13px; align-items: flex-start; }
.status { font-size: 12px; padding: 2px 9px; border-radius: 99px; }
.status-notstarted { background: #f0f1f2; color: var(--muted); }
.status-inprogress { background: #fff3e0; color: #9a5b00; }
.status-demonstrated { background: #e6f4f1; color: var(--accent-ink); }
.component { border-top: 1px solid var(--line); padding: 12px 0; }
.component:first-of-type { border-top: 0; }
.fields td { padding: 4px 8px; }
.fieldadd { margin-top: 8px; gap: 6px; }
.fieldadd input, .fieldadd select { padding: 6px 8px; font-size: 13px; }

/* ===== Phase 1: sidebar app shell + main dashboard ===== */
.app { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.side { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; overflow-y: auto; flex: 1; }
.side a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
  text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 500; white-space: nowrap;
}
.side a:hover { background: #f0f3f2; }
.side a.on { background: #e6f1ef; color: var(--accent-ink); }
.side a i { font-size: 18px; color: var(--muted); width: 18px; text-align: center; }
.side a.on i { color: var(--accent); }
.side-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.side-foot a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 13px; }
.side-foot a:hover { background: #f0f3f2; }
.side-foot a i { font-size: 17px; width: 18px; text-align: center; }
.side-foot .who { margin: 6px 12px 2px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.content { flex: 1; max-width: 920px; margin: 0 auto; padding: 26px 28px 80px; width: 100%; }
.auth-wrap { max-width: 860px; margin: 0 auto; padding: 26px 20px 80px; }

/* dashboard tiles */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.tile h2 { font-size: 14px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.tile h2 i { font-size: 17px; color: var(--accent); }
.bigpct { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.bigpct small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.bar { height: 7px; border-radius: 5px; background: #eef1f0; overflow: hidden; margin: 10px 0; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.amber > span { background: #d68a1f; }
.metarow { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; border-top: 1px solid var(--line); }
.metarow:first-of-type { border-top: 0; }
.metarow .ok { color: var(--accent); }
.metarow .no { color: #b87514; }

/* readiness banner */
.readiness { border-radius: var(--radius); padding: 16px 20px; margin-bottom: 18px; border: 1px solid var(--line); }
.readiness h2 { margin: 0 0 6px; font-size: 17px; display: flex; align-items: center; gap: 9px; }
.readiness.ready { background: #e9f5ef; border-color: #bfe3d3; }
.readiness.ready h2 { color: var(--accent-ink); }
.readiness.near { background: #fff6e6; border-color: #f0dcae; }
.readiness.near h2 { color: #8a5b00; }
.readiness.risk { background: #fdecea; border-color: #f3c9c4; }
.readiness.risk h2 { color: var(--danger); }
.readiness ul { margin: 4px 0 0; padding-left: 20px; font-size: 13px; color: var(--muted); }
.pill { font-size: 11px; padding: 2px 9px; border-radius: 99px; background: #eef1f0; color: var(--muted); }

/* component page header */
.comp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.comp-head h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.01em; }
.stub { text-align: center; padding: 60px 20px; color: var(--muted); }
.stub i { font-size: 46px; color: var(--accent); opacity: .7; }
.stub h1 { color: var(--ink); margin: 14px 0 8px; }
.stub p { max-width: 460px; margin: 0 auto; }

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .side { flex-direction: row; flex-wrap: wrap; overflow-x: auto; }
  .side-foot { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .content { padding: 20px 16px 60px; }
}

/* Phase 2: EPA/CiP statuses */
.status-developing { background: #fff3e0; color: #9a5b00; }
.status-attarget { background: #e6f4f1; color: var(--accent-ink); }
