:root {
  --bg: #e7dfd2;
  --card: #fbf8f3;
  --ink: #1b1612;
  --muted: #645c52;
  --line: #d8d0c4;
  --seal: #9d2c2c;
  --shadow: 0 16px 40px rgba(70, 48, 24, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(157, 44, 44, 0.08), transparent 55%),
    linear-gradient(180deg, #efe7db 0%, #e4dccf 100%);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button, input, select { font: inherit; color: inherit; }

.page {
  max-width: 1160px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 72px 24px 16px;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.brand { display: flex; gap: 14px; align-items: center; }

.seal {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #c45555, var(--seal) 55%, #6e1c1c);
  color: #f7f3ec;
  font-family: Fraunces, Georgia, serif;
  font-size: 32px;
  box-shadow: inset 0 0 0 4px rgba(247, 243, 236, 0.18);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--seal);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-weight: 560;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  white-space: nowrap;
}

.intro {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  white-space: nowrap;
}

.desk {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), var(--shadow);
  overflow: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #f3eee6;
  border-bottom: 1px solid var(--line);
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 14px 10px;
  font-weight: 650;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--seal);
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  min-width: 0;
}

.panel[hidden] { display: none; }

.index {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  color: var(--seal);
  letter-spacing: 0.14em;
  font-size: 13px;
}

.card-copy, .hint, .quiet { color: var(--muted); }

.card-copy, .hint { margin: 0; font-size: 14px; white-space: nowrap; }

.quiet { font-size: 12px; }

label { font-size: 13px; font-weight: 650; }

form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

input[type="text"], input[type="url"], select {
  width: 100%;
  border: 1px solid #cfc6b8;
  background: #fffdf9;
  border-radius: 10px;
  padding: 10px 12px;
}

#address-form input[type="url"] { flex: none; height: 44px; }

.terminals {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 20px;
  min-height: 0;
}

.os {
  flex: none;
  width: 4.5rem;
  color: #71717a;
  font-size: 13px;
  font-weight: 650;
}

.terminal {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  background: #f4f4f5;
  border: 1px solid #e4e4e7;
  border-radius: 12px;
  padding: 0 6px 0 16px;
}

pre.cmd {
  flex: 1;
  min-width: 0;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
  color: #3f3f46;
  border-radius: 0;
  padding: 0;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 14px;
  line-height: 1.4;
  min-height: 0;
}

.copy-icon {
  flex: none;
  appearance: none;
  border: 0;
  background: transparent;
  color: #71717a;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.copy-icon:hover { background: #e4e4e7; color: #18181b; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; justify-content: flex-end; }

.btn {
  appearance: none;
  border: 0;
  background: var(--ink);
  color: #f7f3ec;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}

.btn.small { padding: 0.45rem 0.75rem; font-size: 13px; }

.btn:disabled { opacity: 0.55; cursor: progress; }

.btn:hover { transform: translateY(-1px); }

details { font-size: 14px; }
summary { cursor: pointer; color: var(--muted); }

.drop {
  position: relative;
  flex: 1;
  display: grid;
  gap: 4px;
  align-content: center;
  justify-items: center;
  min-height: 120px;
  border: 1.5px dashed #c3b8a8;
  border-radius: 12px;
  padding: 18px 12px;
  background: #f7f2ea;
  cursor: pointer;
  text-align: center;
}

.drop.hot { border-color: var(--seal); background: #f8ecec; }

.drop input, .text-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-title { font-weight: 650; }

.file-row { display: flex; justify-content: space-between; gap: 8px; align-items: start; }

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}

.text-btn {
  position: relative;
  border-bottom: 1px solid var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.error { min-height: 0; margin: 0; color: var(--seal); font-size: 13px; }
.error:empty { display: none; }

.ledger {
  margin-top: 18px;
}

#report-list {
  height: calc(5 * 58px);
  overflow-y: auto;
}

.ledger-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.ledger-head p { margin: 0; color: var(--muted); font-size: 14px; }

.empty {
  border-top: 1px solid var(--line);
  padding: 18px 0;
  color: var(--muted);
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  height: 58px;
  box-sizing: border-box;
  border-top: 1px solid var(--line);
  padding: 0 4px;
}

.row.active { background: rgba(255, 255, 255, 0.45); border-radius: 12px; }

.row-open {
  display: flex;
  gap: 12px;
  align-items: center;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  min-width: 0;
}

.row-open:hover { background: rgba(255, 255, 255, 0.7); }

.who { display: grid; min-width: 0; }
.who strong, .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--muted); }

.ghost {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
}

.detail {
  margin-top: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 18px 8px;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.detail h3 { margin: 0 0 6px; font-size: 22px; overflow-wrap: anywhere; }
.score { margin: 0; font-family: Fraunces, Georgia, serif; font-size: 28px; }

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 14px 0;
  padding: 0;
}

.meta div { min-width: 0; }
.meta dt { color: var(--muted); font-size: 12px; }
.meta dd { margin: 0; overflow-wrap: anywhere; }

.counts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }

.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.chip.critical { background: #fde2e4; color: #9f1239; }
.chip.high { background: #ffedd5; color: #9a3412; }
.chip.medium { background: #fef3c7; color: #92400e; }
.chip.low { background: #ecfccb; color: #3f6212; }
.chip.info { background: #f5f5f4; color: #57534e; }
.chip.clean { background: #e7f6ec; color: #166534; }

.finding { border-top: 1px solid var(--line); padding: 14px 0 12px; }
.finding h4 { margin: 6px 0; font-size: 17px; }
.finding p { margin: 0 0 8px; }
.rec { color: var(--ink); }
.loc { color: var(--muted); font-size: 13px; }

code.snip {
  display: block;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 12.5px;
  background: #f3eee6;
  padding: 8px 10px;
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre-wrap;
}

.note { color: var(--muted); font-size: 13px; }

footer {
  margin: 18px -24px -16px;
  padding: 18px 24px;
  background: #1b1612;
  color: #f7f3ec;
  font-size: 16px;
}
footer p { margin: 0; white-space: nowrap; }
footer a { color: #f7f3ec; }

.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #1b1612;
  color: #f7f3ec;
  padding: 10px 14px;
  border-radius: 999px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: none; }

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
}

::selection { background: #f0c7c7; }

@media (max-width: 980px) {
  .top, .meta { grid-template-columns: 1fr; }
  .tab { font-size: 14px; padding: 12px 6px; }
  .lede, .card-copy, .hint, .intro, footer p { white-space: normal; }
  h1 { font-size: 32px; }
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .ghost { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
