:root {
  --ink: #002138;
  --ink-2: #2a4454;
  --muted: #5c7380;
  --faint: #8a9aa3;
  --paper: #f4f1ea;
  --card: #ffffff;
  --line: #e4ddd2;
  --line-2: #d5cec2;
  --ocean: #006a92;
  --ocean-soft: #e6f2f6;
  --orange: #dc582a;
  --orange-soft: #fbece6;
  --grass: #4f9034;
  --grass-soft: #eaf4e4;
  --red: #b42318;
  --red-soft: #f8e8e6;
  --yellow: #b7791f;
  --yellow-soft: #f8efd9;
  --gray: #6b7280;
  --gray-soft: #eef0f2;
  --shadow: 0 1px 2px rgba(0, 33, 56, 0.06);
  --radius: 10px;
  --nav: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; }
a { color: var(--ocean); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: var(--nav) 1fr;
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  flex-direction: column;
  min-width: 210px;
  line-height: 1.1;
}
.brand small {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.brand strong { font-size: 16px; font-weight: 600; }

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
}
.nav a {
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
}
.nav a:hover { background: var(--paper); color: var(--ink); }
.nav a.active { background: var(--ocean-soft); color: var(--ocean); }

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.who select, .filters select, .search {
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 8px;
  padding: 7px 10px;
}
.save-dot {
  font-size: 12px;
  color: var(--faint);
  min-width: 72px;
  text-align: right;
}
.save-dot.saving { color: var(--yellow); }
.save-dot.saved { color: var(--grass); }
.save-dot.err { color: var(--red); }

.page {
  padding: 28px 28px 80px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
.lede { color: var(--muted); margin: 0 0 22px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
}
.kpi .n {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}
.kpi .l {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.kpi.warn .n { color: var(--orange); }
.kpi.bad .n { color: var(--red); }
.kpi.ok .n { color: var(--grass); }

.section { margin-bottom: 32px; }
.section h2 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 600;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.row, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.9fr 0.8fr 1.4fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
}
.row:hover { border-color: #c9dce4; }
.row .name { font-weight: 600; }
.row .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.yellow { background: var(--yellow-soft); color: var(--yellow); }
.pill.green { background: var(--grass-soft); color: var(--grass); }
.pill.gray { background: var(--gray-soft); color: var(--gray); }
.pill.unk { background: var(--orange-soft); color: var(--orange); }
.pill.ocean { background: var(--ocean-soft); color: var(--ocean); }

.dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--grass); }
.dot.gray { background: var(--gray); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
.search { min-width: 220px; flex: 1; }
.btn {
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 500;
}
.btn:hover { background: var(--paper); }
.btn.primary {
  background: var(--ocean);
  color: #fff;
  border-color: var(--ocean);
}
.btn.primary:hover { background: #00587a; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #ead2ce; }

.acct-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.field {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.field input, .field select, .field textarea, .inline {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  outline: none;
}
.field textarea { min-height: 64px; resize: vertical; }
.inline:focus, .field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
}

.proj-card {
  padding: 14px 16px;
  margin-bottom: 8px;
}
.proj-card .top-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.proj-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 16px;
  margin-top: 10px;
  font-size: 13px;
}
.proj-grid .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.proj-grid .v { margin-top: 2px; }
.proj-full { display: none; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.proj-card.open .proj-full { display: block; }
.proj-card.open { border-color: #c9dce4; }

.notes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.note {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.note .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}
.composer textarea {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.review-shell {
  max-width: 820px;
}
.progress {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}
.bar {
  height: 6px;
  background: #e8e2d8;
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 22px;
}
.bar > span { display: block; height: 100%; background: var(--ocean); }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.check input { margin-top: 4px; width: 16px; height: 16px; }
.review-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
  gap: 8px;
}

.bucket { margin-bottom: 22px; }
.empty {
  color: var(--muted);
  padding: 18px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.5);
}

.drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 33, 56, 0.28);
  display: none;
  z-index: 40;
}
.drawer.open { display: block; }
.drawer .panel {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: min(460px, 100%);
  background: #fff;
  padding: 22px;
  overflow: auto;
  box-shadow: -8px 0 24px rgba(0,33,56,0.08);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}
.table th {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  background: #faf8f4;
}
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #f7fbfc; }

.tiny { font-size: 12px; color: var(--muted); }
.warn-text { color: var(--orange); font-weight: 600; }
.lock {
  font-size: 12px;
  color: var(--muted);
  margin-top: 24px;
}

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .row { grid-template-columns: 1fr 1fr; }
  .meta-grid, .proj-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .page { padding: 16px 14px 80px; }
  .nav { overflow: auto; }
}
