:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 28px;
  --space-7: 32px;
  --text-sm: 13px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 28px;
  --ink: #1d2b30;
  --muted: #3d5158;
  --teal: #299EB1;
  --teal-text: #136674;
  --line: #dde7ea;
  --bg: #f5f8f9;
  --card: #fff;
  --focus: #136674;
  --danger: #8d2a2a;
  --danger-bg: #fde2e2;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  overflow-wrap: break-word;
}
.app { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: #2b2f33;
  border-right: 3px solid var(--teal);
  color: #e7f3f5;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 20px;
  z-index: 20;
}
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar .brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.brand img { width: 120px; height: 32px; object-fit: contain; object-position: left center; }
.brand .logo-light { display: block; }
.brand .logo-dark { display: none; }
.brand b { color: var(--teal-text); font-size: var(--text-md); line-height: 1.2; }
.sidebar .brand .logo-light { display: none; }
.sidebar .brand .logo-dark { display: block; }
.sidebar .brand b { color: #fff; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.sidebar .side-nav a { color: #e7f3f5; }
.side-nav a.on { background: #e3f3f6; color: var(--teal-text); font-weight: 700; }
.sidebar .side-nav a.on { background: #299eb1; color: #1d2b30; font-weight: 700; border-left: 4px solid #7ec8d4; }
.nav-icon { width: 22px; height: 22px; flex: 0 0 22px; }
.icon-btn {
  width: 44px;
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: #fff;
  color: var(--teal-text);
  padding: 0;
  cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }
.sidebar .icon-btn { background: transparent; color: #fff; border-color: #7ec8d4; }
.nav-toggle { display: none; }
.drawer-backdrop { display: none; }
.workspace { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-4);
  padding: 12px var(--space-6);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar .who { margin-left: auto; }
html.sidebar-rail .sidebar { width: 72px; flex-basis: 72px; padding-left: 8px; padding-right: 8px; }
html.sidebar-rail .brand img,
html.sidebar-rail .brand b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
html.sidebar-rail .side-head { justify-content: center; }
html.sidebar-rail .nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
html.sidebar-rail .side-nav a { justify-content: center; padding-left: 0; padding-right: 0; }
.ex {
  background: #fff4d6;
  border: 1px solid #e6c870;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #5c4300;
}
.who { font-size: 14px; overflow-wrap: anywhere; }
main { padding: var(--space-6) var(--space-7); max-width: 1280px; margin: 0 auto; width: 100%; }
h1 { color: var(--teal-text); margin: 0 0 var(--space-4); font-size: var(--text-xl); line-height: 1.2; }
h2 { color: var(--teal-text); font-size: 22px; line-height: 1.25; }
h3 { margin-top: 0; color: var(--ink); font-size: 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: var(--space-5);
  margin-bottom: 18px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-5); }
.btn, .btn2, button.btn, button.btn2, a.btn, a.btn2 {
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  line-height: 1.2;
}
.btn, button.btn, a.btn {
  background: var(--teal-text);
  color: #fff;
  border: 0;
  padding: 10px 18px;
}
.btn2, button.btn2, a.btn2 {
  background: #fff;
  color: var(--teal-text);
  border: 1px solid var(--teal);
  padding: 8px 14px;
}
.small { min-height: 44px; padding: 8px 12px; font-size: var(--text-sm); }
button:disabled { opacity: 0.55; cursor: default; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 0 8px 0 0; }
input, textarea, select {
  width: 100%;
  min-height: 44px;
  padding: 10px;
  border: 1px solid #8aa3aa;
  border-radius: 6px;
  font: inherit;
  margin: var(--space-1) 0 14px;
  background: #fff;
  color: inherit;
}
textarea { min-height: 88px; }
label { font-weight: 700; font-size: 14px; display: inline-block; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 10px; border-bottom: 1px solid #e6eef0; text-align: left; vertical-align: top; }
th { color: var(--teal-text); font-size: var(--text-sm); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.review-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.with-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 18px; align-items: start; }
.grid > *, .review-grid > *, .admin-grid > *, .with-side > *, .card, .table-wrap { min-width: 0; }
.admin-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.side-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: var(--space-5);
  position: sticky;
  top: var(--space-4);
}
.prose { max-width: 70ch; }
.mk { color: var(--teal-text); font-weight: 700; font-size: 12px; }
.nv { background: var(--danger-bg); color: var(--danger); padding: 0 4px; border-radius: 3px; font-size: var(--text-sm); }
.product-link { color: #136674; text-decoration: underline; }
.product-link .cart { width: 0; height: 0; overflow: hidden; vertical-align: -2px; }
.product-link:hover .cart,
.product-link:focus .cart,
.product-link:focus-visible .cart { width: 16px; height: 16px; margin-left: 4px; }
pre {
  background: #f0f5f6;
  padding: var(--space-3);
  border-radius: 6px;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: var(--space-3) 0 0;
  max-width: 100%;
}
.hl { padding: 1px 2px; border-radius: 3px; }
.hl-on { outline: 2px solid var(--teal-text); box-shadow: 0 0 0 3px rgba(41, 158, 177, 0.45); }
.issue { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-top: 12px; }
.issue-on { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(41, 158, 177, 0.25); }
.issue-group h3 { margin-top: 16px; }
.risk-counts { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 0; list-style: none; }
.risk-counts b { color: var(--teal-text); font-size: 22px; margin-right: 4px; }
.prompt-label { display: block; font-size: 28px; line-height: 1.2; color: var(--teal-text); margin-bottom: 8px; }
.prompt textarea { min-height: 120px; font-size: 18px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.quick-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 88px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.quick-card b { color: var(--teal-text); }
.recent h2 { margin-top: 0; }
.s, .hl.type-voice, .tag.type-voice, .type-legend .type-voice { background: #fff3c4; color: #1d2b30; }
.a, .hl.type-fact, .tag.type-fact, .type-legend .type-fact { background: #fde2e2; color: #1d2b30; }
.o, .hl.type-seo, .tag.type-seo, .type-legend .type-seo { background: #d7f1f5; color: #1d2b30; }
.hl.type-clarity, .tag.type-clarity, .type-legend .type-clarity { background: #e7e4fb; color: #1d2b30; }
.hl.type-link, .tag.type-link, .type-legend .type-link { background: #e5f6d8; color: #1d2b30; }
.hl { cursor: pointer; }
.hl.decided { background: transparent; color: inherit; cursor: pointer; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.badge.sev-high { background: #6e1e1e; color: #fff; }
.badge.sev-medium { background: #6a4a00; color: #fff; }
.badge.sev-low, .badge.complete { background: #136674; color: #fff; }
.badge.progress { background: #e7eefc; color: #1d2b30; }
.badge.removed { background: #3d5158; color: #fff; }
.sev-toggles, .group-by, .type-legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sev-toggle { gap: 8px; }
.type-legend { list-style: none; padding: 0; margin: 0 0 12px; }
.type-legend li { padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.issue-popover {
  position: fixed;
  z-index: 40;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 480px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 52px 12px 12px;
  box-shadow: 0 8px 24px rgba(29, 43, 48, 0.16);
}
.pop-close { position: absolute; top: 8px; right: 8px; }
.callout { background: #f3f8f9; border-left: 3px solid var(--teal); padding: 8px 12px; font-weight: 700; }
.ba { font-size: var(--text-sm); margin: 6px 0; }
.finding { border-top: 1px solid #e6eef0; padding-top: 10px; margin-top: 10px; }
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e3f3f6;
  color: var(--teal-text);
  font-weight: 700;
}
.tag.v2 { background: #fff4d6; color: #5c4300; border: 1px solid #e6c870; }
.tag.role-admin { background: var(--teal-text); color: #fff; }
.tag.role-writer { background: #e7eefc; color: var(--ink); }
.banner {
  background: var(--danger-bg);
  border: 1px solid #e3b4b4;
  color: #7a2222;
  border-radius: 8px;
  padding: var(--space-3) var(--space-4);
  margin-bottom: 18px;
}
.crumb { font-size: 14px; margin-top: 0; }
a { color: var(--teal-text); }
.login-card { max-width: 420px; margin: 90px auto; }
.login-card .brand { margin-bottom: var(--space-2); }
.form-card { max-width: 760px; }
.fine { font-size: 12px; color: var(--muted); }
.err { color: var(--danger); font-size: var(--text-sm); }
.empty { color: var(--muted); }
.link-btn {
  background: none;
  border: 0;
  padding: 10px 0;
  min-height: 44px;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}
.table-wrap { overflow-x: auto; max-width: 100%; }
.meter {
  position: relative;
  background: #e6eef0;
  border-radius: 6px;
  height: 22px;
  margin: 12px 0 8px;
}
.meter-fill { background: var(--teal); height: 22px; border-radius: 6px; }
.meter-mark {
  position: absolute;
  top: -4px;
  width: 2px;
  height: 30px;
  background: #8d2a2a;
}
.drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  border: 2px dashed var(--teal);
  border-radius: 8px;
  padding: var(--space-6);
  text-align: center;
  color: var(--teal-text);
  cursor: pointer;
  margin-bottom: 14px;
}
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}
.decision { font-size: 12px; color: var(--teal-text); margin-left: 6px; }
ul { margin-top: 0; }
details.card > summary, .edit-brief > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--teal-text);
  min-height: 44px;
  display: flex;
  align-items: center;
}
.edit-brief { margin-bottom: 18px; }
.edit-brief > summary {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 var(--space-5);
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 0 0 18px;
  border-bottom: 2px solid var(--line);
  max-width: 100%;
}
.tabs a {
  margin: 0 0 -2px;
  padding: 8px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.tabs a.on { color: var(--teal-text); border-bottom-color: var(--teal); font-weight: 700; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.sidebar :focus-visible { outline: 3px solid #7ec8d4; outline-offset: 2px; }
.sidebar .side-nav a.on:focus-visible { box-shadow: inset 0 0 0 2px #1d2b30; }
@media (prefers-color-scheme: dark) {
  .brand .logo-light { display: none; }
  .brand .logo-dark { display: block; }
  .topbar, .icon-btn { background: #0f2c33; }
  .brand b, .icon-btn { color: #7ec8d4; }
  .side-nav a, .who, .link-btn { color: #e7f3f5; }
}
@media (max-width: 900px) {
  .quick-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  main { padding: 18px var(--space-4); }
  .grid, .review-grid, .admin-grid, .with-side { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .login-card { margin: 32px auto; }
  h1, .prompt-label { font-size: 24px; }
  .topbar { padding: 12px var(--space-4); }
  table.cards, table.cards tbody { display: block; width: 100%; }
  table.cards tr:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.cards tr { display: block; border: 1px solid var(--line); border-radius: 8px; margin: 0 0 var(--space-3); background: #fff; }
  table.cards td { display: block; border-bottom: 0; }
  table.cards td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--teal-text);
  }
}
@media (min-width: 769px) {
  .issue-panel {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overflow-x: hidden;
  }
}
@media (max-width: 767px) {
  .nav-toggle { display: inline-flex; }
  .rail-toggle { display: none; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    width: min(280px, 86vw);
    flex: none;
    visibility: hidden;
    transition: transform 160ms ease, visibility 0s linear 160ms;
  }
  body.drawer-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    transition: transform 160ms ease, visibility 0s linear 0s;
  }
  body.drawer-open .drawer-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 44, 51, 0.45); z-index: 15; }
  html.sidebar-rail .sidebar { width: min(280px, 86vw); flex-basis: auto; padding-left: 12px; padding-right: 12px; }
  html.sidebar-rail .brand img,
  html.sidebar-rail .brand b,
  html.sidebar-rail .nav-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
  }
  html.sidebar-rail .brand img { width: 120px; height: 32px; }
  html.sidebar-rail .side-nav a { justify-content: flex-start; padding: 8px 10px; }
  .topbar .who { margin-left: 0; }
  .issue-popover {
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
  }
}
.editor textarea { min-height: 220px; }
.outline {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.suggest {
  border-left: 4px solid #299eb1;
  padding: 0 0 0 12px;
  margin: 0 0 16px;
}
.suggest .actions { margin-bottom: 0; }
.suggest form { margin: 0; }
.version-list { list-style: none; padding: 0; margin: 0; }
.version-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.version-list form { margin: 0; }
mark.suggest-hit { background: #e7f6f8; }
@media (max-width: 768px) {
  .editor textarea { min-height: 160px; }
}
