/* Signoff v3: theme tokens (light and dark), app shell, and shared components. */
@import url('/image-attachments.css');

.image-attachments { --border: var(--line); --green: var(--brand); --green-soft: var(--brand-soft); --text-dim: var(--muted); --bg-muted: var(--surface2); }
.image-attachment-list { --text-dim: var(--muted); --bg-muted: var(--surface2); }
.image-attachment-open { padding: 0; width: 100%; border: 1px solid var(--line); border-radius: 6px; background: var(--surface2); cursor: pointer; overflow-wrap: anywhere; }
.image-attachment-open:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

:root {
  color-scheme: light;
  --bg: #f5f6f4; --surface: #ffffff; --surface2: #f5f6f4; --line: #e0e4e1;
  --ink: #16201a; --muted: #5b675f;
  --brand: #18794e; --brand-soft: #e2f1e8; --on-brand: #ffffff;
  --amber: #9a5b00; --amber-soft: #fcf0d6;
  --red: #b3261e; --red-soft: #fbe4e1;
  --blue: #1f58c7; --blue-soft: #e4ecfb;
  --nav-bg: #16201a; --nav-text: #ffffff; --nav-dim: #aeb9b2; --nav-active: rgba(255, 255, 255, 0.12);
  --scrim: rgba(22, 32, 26, 0.6);
  --shadow: 0 12px 32px rgba(22, 32, 26, 0.14);
  --radius: 12px; --radius-sm: 8px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1411; --surface: #171f1a; --surface2: #1e2822; --line: #2b362f;
    --ink: #eef2ef; --muted: #9aa79f;
    --brand: #3db37c; --brand-soft: #163425; --on-brand: #07130c;
    --amber: #e8b04f; --amber-soft: #3a2d12;
    --red: #f47f75; --red-soft: #3d1c19;
    --blue: #86aaf7; --blue-soft: #172646;
    --nav-bg: #09100c; --nav-text: #eef2ef; --nav-dim: #8a978f; --nav-active: rgba(255, 255, 255, 0.09);
    --scrim: rgba(0, 0, 0, 0.7);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1411; --surface: #171f1a; --surface2: #1e2822; --line: #2b362f;
  --ink: #eef2ef; --muted: #9aa79f;
  --brand: #3db37c; --brand-soft: #163425; --on-brand: #07130c;
  --amber: #e8b04f; --amber-soft: #3a2d12;
  --red: #f47f75; --red-soft: #3d1c19;
  --blue: #86aaf7; --blue-soft: #172646;
  --nav-bg: #09100c; --nav-text: #eef2ef; --nav-dim: #8a978f; --nav-active: rgba(255, 255, 255, 0.09);
  --scrim: rgba(0, 0, 0, 0.7);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { flex: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 0.9em; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* Shell */
.v3-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.v3-side {
  background: var(--nav-bg); color: var(--nav-text); padding: 18px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
}
.v3-side > * { flex-shrink: 0; }
.v3-logo { font-weight: 800; letter-spacing: 1px; font-size: 18px; padding: 4px 8px 16px; }
.v3-newtest { display: flex; align-items: center; gap: 8px; padding: 11px 12px; border-radius: 9px; background: var(--brand); color: var(--on-brand); font-weight: 700; }
.v3-newtest:hover { filter: brightness(1.08); }
.v3-nav { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--nav-dim); cursor: pointer; }
.v3-nav:hover { background: var(--nav-active); color: var(--nav-text); }
.v3-nav.is-active { background: var(--nav-active); color: var(--nav-text); font-weight: 600; }
.v3-nav .badge { margin-left: auto; background: var(--brand); color: var(--on-brand); border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
.v3-sub { padding: 7px 12px 7px 38px; border-radius: 8px; color: var(--nav-dim); font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v3-sub:hover { background: var(--nav-active); color: var(--nav-text); }
.v3-sub.is-active { background: var(--nav-active); color: var(--nav-text); font-weight: 600; }
.v3-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.v3-org { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 8px; background: var(--nav-active); }
.v3-account { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.v3-account #organization-switcher { min-width: 0; }
.v3-account #organization-switcher button, .v3-account #organization-switcher .cl-organizationPreviewMainIdentifier { color: var(--nav-text); }
.v3-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: none; }
.v3-theme { background: none; border: 0; color: var(--nav-dim); text-align: left; padding: 6px 12px; cursor: pointer; border-radius: 8px; font-size: 13px; }
.v3-theme:hover { color: var(--nav-text); background: var(--nav-active); }
.v3-main { padding: 34px 44px 80px; min-width: 0; max-width: 1360px; }
.v3-tabbar { display: none; }
.v3-mobile-bar { display: none; }
.v3-nav-select {
  appearance: auto; background: rgba(255, 255, 255, 0.1); color: var(--nav-text);
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 8px; padding: 6px 10px;
  font: 600 13px var(--font); max-width: 100%; min-width: 0; cursor: pointer;
}
.v3-nav-select option { background: var(--surface); color: var(--ink); }

/* Issue cards (clear separation when scrolling feedback) */
.v3-issue-list { display: flex; flex-direction: column; gap: 18px; }
.v3-issue-card {
  background: var(--surface); border: 1.5px solid var(--line); border-left: 5px solid var(--muted);
  border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 3px 10px rgba(22, 32, 26, 0.06);
}
.v3-issue-card.tier-unfixed { border-left-color: var(--red); }
.v3-issue-card.tier-partial { border-left-color: var(--amber); }
.v3-issue-card.tier-completed { border-left-color: var(--brand); }
.v3-issue-head {
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.v3-issue-num {
  font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 6px; background: var(--surface2); color: var(--muted); border: 1px solid var(--line);
}
.v3-issue-body {
  background: var(--surface2); border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; font-size: 14px;
}
.v3-tier-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 4px 6px;
  margin-top: 6px; border-bottom: 2px solid var(--line); font-weight: 700; font-size: 14px;
}

/* Page head */
.v3-crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.v3-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.v3-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.v3-head h1 { font-size: 30px; line-height: 1.15; font-weight: 700; }
.v3-sub-line { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface2); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 700; }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-danger { background: var(--red-soft); border-color: var(--red-soft); color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn-lg { padding: 14px 18px; font-size: 16px; border-radius: 12px; min-height: 52px; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface2); color: var(--ink); white-space: nowrap; }
.chip-green { background: var(--brand-soft); color: var(--brand); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-blue { background: var(--blue-soft); color: var(--blue); }
.chip-dim { background: var(--surface2); color: var(--muted); }
.chip-outline { background: var(--surface); border: 1px solid var(--line); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface2); color: var(--muted); font-size: 11px; font-weight: 600; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.v3-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.v3-row:hover { border-color: var(--muted); }
a.v3-row, .v3-row.is-link { cursor: pointer; }
.v3-row.is-selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.v3-row > .grow { flex: 1 1 220px; }
.v3-row .title { font-weight: 700; font-size: 14px; }
.v3-row .meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.v3-list { display: flex; flex-direction: column; gap: 10px; }
.v3-grid { display: grid; gap: 16px; }
.v3-two { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.v3-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v3-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.banner { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 10px; background: var(--surface2); font-size: 14px; }
.banner.red { background: var(--red-soft); } .banner.amber { background: var(--amber-soft); } .banner.green { background: var(--brand-soft); } .banner.blue { background: var(--blue-soft); }
.banner .grow strong { display: block; }

.v3-input, .v3-textarea, .v3-select { width: 100%; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; }
.v3-textarea { min-height: 96px; resize: vertical; }
.v3-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.v3-field { margin-bottom: 16px; }
.v3-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.v3-tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.v3-tab { padding: 10px 2px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 14px; white-space: nowrap; }
.v3-tab.is-active { color: var(--ink); font-weight: 700; border-bottom-color: var(--brand); }

.v3-seg { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.v3-pill { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; }
.v3-pill.is-on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.v3-pill.is-brand { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }

.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); }
.stat strong { display: block; font-size: 26px; line-height: 1.1; font-weight: 700; }
.stat span { font-size: 12px; color: var(--muted); }

.v3-skeleton { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--line), var(--surface2), var(--line)); background-size: 200% 100%; animation: v3shine 1.4s linear infinite; margin: 10px 0; }
@keyframes v3shine { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .v3-skeleton { animation: none; } }
.v3-empty { text-align: center; padding: 40px 20px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.v3-empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.v3-empty .btn { margin-top: 14px; }

/* Verdict buttons and focus-mode card */
.verdicts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.verdict { min-height: 56px; border-radius: 12px; border: 1px solid transparent; font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; }
.verdict.works { background: var(--brand); color: var(--on-brand); }
.verdict.partly { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.verdict.broken { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.verdict.is-chosen { box-shadow: 0 0 0 3px var(--ink); }
.focus-card { padding: 32px; }
.focus-card h2 { font-size: 28px; line-height: 1.2; }
.focus-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.v3-checks > summary { cursor: pointer; padding: 10px 12px; font-weight: 700; list-style: none; }
.v3-checks > summary::-webkit-details-marker { display: none; }
.check-nav { display: flex; flex-direction: column; gap: 4px; }
.check-nav button { text-align: left; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; border: 2px solid transparent; background: none; cursor: pointer; font-size: 13px; }
.check-nav button.is-current { background: var(--surface); border-color: var(--brand); font-weight: 700; }

/* Matrix */
.matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix th { font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted); padding: 10px 6px; text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; padding-left: 16px; }
.matrix td { padding: 6px; text-align: center; border-top: 1px solid var(--line); }
.cell { width: 22px; height: 22px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; border: 1px solid var(--line); background: var(--surface2); }
.cell.y { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.cell.p { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.cell.g { background: var(--red-soft); border-color: var(--red); color: var(--red); }

/* Dialog */
dialog.v3-modal { border: 0; padding: 28px; border-radius: 16px; background: var(--surface); color: var(--ink); width: min(900px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog.v3-modal::backdrop { background: var(--scrim); }
dialog.v3-modal.narrow { width: min(560px, calc(100vw - 32px)); }
.v3-modal h2 { font-size: 22px; margin-bottom: 4px; }
.v3-modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Palette */
.v3-palette { width: min(640px, calc(100vw - 32px)); padding: 0; }
.v3-palette input { width: 100%; padding: 18px 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 16px; outline: none; }
.v3-palette .results { max-height: 50vh; overflow: auto; padding: 8px; }
.v3-palette .result { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.v3-palette .result:hover, .v3-palette .result.is-on { background: var(--surface2); }
kbd, .kbd { font: 600 11px var(--font); padding: 2px 7px; border-radius: 6px; background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }

/* Toast */
#v3-toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.v3-toast { background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 14px; max-width: 360px; }
.v3-toast.error { background: var(--red); color: var(--on-brand); }

/* Responsive: phone layout swaps the sidebar for a bottom tab bar. */
.v3-test-layout { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) {
  .v3-two { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .v3-test-layout { grid-template-columns: minmax(0, 1fr); }
  .v3-three, .v3-four { grid-template-columns: 1fr; }
  .focus-cols { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 860px) {
  .v3-shell { display: block; }
  .v3-side { display: none; }
  .v3-mobile-bar {
    display: flex; position: sticky; top: 0; z-index: 25; background: var(--nav-bg); color: var(--nav-text);
    padding: 10px 14px; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  }
  .v3-mobile-bar .v3-logo { padding: 0 4px 0 0; font-size: 16px; }
  .v3-mobile-bar .v3-nav-select { flex: 1 1 130px; font-size: 12px; padding: 6px 8px; }
  .v3-main { padding: 18px 14px 110px; }
  .v3-head h1 { font-size: 24px; }
  .v3-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface);
    border-top: 1px solid var(--line); padding: 8px 8px calc(10px + env(safe-area-inset-bottom)); justify-content: space-between;
  }
  .v3-tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--muted); padding: 4px 0; min-height: 44px; justify-content: center; }
  .v3-tabbar a.is-active { color: var(--brand); font-weight: 700; }
  .v3-tabbar a.plus span.fab { width: 44px; height: 44px; border-radius: 22px; background: var(--brand); color: var(--on-brand); display: inline-flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; }
  .verdicts { gap: 8px; }
  .focus-card { padding: 20px; }
  .focus-card h2 { font-size: 22px; }
  .v3-row { padding: 12px; }
  .v3-issue-card { padding: 14px; }
  dialog.v3-modal { padding: 20px; }
}
