/* KeyStone SkeletonKey web — blacks, reds, oranges, rust.
   Warm bone light mode, near-black dark mode. No external assets. */
:root {
  --radius: 14px;
}
html[data-theme="light"] {
  --bg: #f5efe4;
  --surface: #fffaf0;
  --surface-2: #efe6d3;
  --border: #d8cbb2;
  --text: #241a12;
  --muted: #7a6a58;
  --accent: #c2410c;
  --accent-ink: #fff7ed;
  --green: #15803d;
  --red: #b91c1c;
  --amber: #b45309;
  --blue: #1d4ed8;
  --banner-bg: #2b1512;
  --banner-text: #fde8d8;
}
html[data-theme="dark"] {
  --bg: #14100d;
  --surface: #1e1712;
  --surface-2: #2a2019;
  --border: #453729;
  --text: #f2e9dc;
  --muted: #b09a80;
  --accent: #ea580c;
  --accent-ink: #1a0e05;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --blue: #93c5fd;
  --banner-bg: #3a130c;
  --banner-text: #ffd9c2;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 6px 0 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 110px; resize: vertical; }
label { font-size: 14px; color: var(--muted); display: block; margin-top: 10px; }
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 22px 0 8px; }
h3 { font-size: 16px; margin: 16px 0 6px; }
p { margin: 6px 0 10px; }
small, .muted { color: var(--muted); font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.hidden { display: none !important; }

.app { max-width: 720px; margin: 0 auto; padding: 16px 16px 96px; min-height: 100vh; }

/* Permanent banner — report only, code only, never a certification. */
.cert-banner {
  background: var(--banner-bg);
  color: var(--banner-text);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
}

header.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 2px 14px; border-bottom: 1px solid var(--border); margin-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--accent);
  color: var(--accent-ink); font-weight: 800; font-size: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 800; letter-spacing: .04em; font-size: 18px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn {
  display: inline-block; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); border-radius: 10px; padding: 11px 16px; cursor: pointer;
  text-decoration: none; text-align: center; font-weight: 600;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { background: #3a1620; border-color: #6b2233; color: #ffb3b3; }
.btn-ghost { background: transparent; }
.btn-block { display: block; width: 100%; margin: 8px 0; }
.btn-small { padding: 7px 10px; font-size: 14px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin: 12px 0;
}
.notice {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 14px; margin: 12px 0; font-size: 14px;
}
.notice.red { background: #33161c; border-color: #6b2233; color: #f3c1c1; }
html[data-theme="light"] .notice.red { background: #fbe4e4; color: #7f1d1d; }
.notice.green { background: #122b20; border-color: #1f5c40; color: #b7e8cd; }
html[data-theme="light"] .notice.green { background: #dcf5e5; color: #14532d; }
.inline-status { font-size: 14px; margin: 6px 0; min-height: 20px; }
.ok { color: var(--green); } .bad { color: var(--red); } .warn { color: var(--amber); }

.tab-nav {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0;
}
.tab-nav button {
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 8px 13px; cursor: pointer; font-size: 14px; font-weight: 600;
}
.tab-nav button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 14px; margin: 10px 0;
}
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-title { font-weight: 700; }
.item-meta { font-size: 13px; color: var(--muted); word-break: break-word; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tag {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 7px; color: var(--muted); margin-left: 6px; vertical-align: middle;
  white-space: nowrap;
}
.tag.critical { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
.tag.high { background: #9a3412; border-color: #c2410c; color: #ffedd5; }
.tag.medium { background: #78350f; border-color: #b45309; color: #fef3c7; }
.tag.low { background: var(--surface-2); color: var(--muted); }
.tag.note { background: transparent; color: var(--muted); }
.tag.open { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
.tag.in_progress { background: #78350f; border-color: #b45309; color: #fef3c7; }
.tag.fixed { background: #14532d; border-color: #15803d; color: #bbf7d0; }
.tag.wont_fix { background: var(--surface-2); color: var(--muted); }
.tag.pass { background: #14532d; border-color: #15803d; color: #bbf7d0; }
.tag.fail { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
.tag.review { background: #78350f; border-color: #b45309; color: #fef3c7; }
.tag.not_checked { background: var(--surface-2); color: var(--muted); }

.sev-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sev-count {
  font-size: 13px; font-weight: 700; border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 9px; background: var(--surface-2);
}
.sev-count.critical { color: var(--red); }
.sev-count.high { color: var(--accent); }
.sev-count.medium { color: var(--amber); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.kv:last-child { border-bottom: none; }

.check-row {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 14px; margin: 10px 0;
}
.check-row .mark { font-size: 20px; flex-shrink: 0; line-height: 1.2; }
.check-row b { display: block; }
.check-row p { margin: 3px 0 0; font-size: 14px; color: var(--muted); }
.check-row .row-actions { margin-left: auto; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.check-row select { width: auto; min-width: 110px; margin: 0; padding: 7px 8px; font-size: 14px; }

.group-head {
  margin: 20px 0 4px; padding-bottom: 6px; border-bottom: 2px solid var(--accent);
  font-size: 17px; font-weight: 800;
}
.group-head span { color: var(--muted); font-weight: 600; font-size: 13px; }

.stepper-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper span { min-width: 22px; text-align: center; font-weight: 800; font-size: 18px; }

.tier-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.tier-card.current { border-color: var(--accent); border-width: 2px; }
.tier-price { font-size: 26px; font-weight: 800; }
.tier-price small { font-size: 14px; color: var(--muted); font-weight: 600; }

.plan-strip { font-size: 14px; }
.plan-strip b { color: var(--accent); }

details { margin: 8px 0; }
details summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.history-list { font-size: 13px; color: var(--muted); margin: 8px 0 0; padding-left: 18px; }
.history-list li { margin: 3px 0; }

.fix-plan {
  white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; font-size: 14px; margin-top: 10px;
}
.edit-form { margin-top: 10px; }

@media (min-width: 560px) {
  .app { padding-left: 24px; padding-right: 24px; }
  .tier-grid { grid-template-columns: 1fr 1fr; }
}
