.paper-card,
.radar-panel,
.tools-discovery,
.empty-state,
.toc,
.article-section {
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  border: 0;
  border-radius: var(--radius-md);
  background:
    linear-gradient(rgba(255, 252, 244, 0.72), rgba(255, 252, 244, 0.58)),
    var(--paper-fibers);
  box-shadow: inset 0 0 0 1px rgba(93, 82, 61, 0.24);
}

.paper-card::before,
.radar-panel::before,
.tools-discovery::before,
.empty-state::before,
.toc::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    var(--rough-line-image) left top / 180px 8px repeat-x,
    var(--rough-line-image) left bottom / 180px 8px repeat-x,
    var(--rough-vline-image) left top / 8px 180px repeat-y,
    var(--rough-vline-image) right top / 8px 180px repeat-y;
  pointer-events: none;
}

.paper-card::after,
.tools-discovery::after,
.empty-state::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid transparent;
  border-radius: inherit;
  border-image: var(--rough-border-image) 8 stretch;
  opacity: 0.38;
  pointer-events: none;
}

.radar-panel::after,
.tool-card::after,
.toc::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-top: 0;
  border-right: 0;
  background: repeating-linear-gradient(135deg, rgba(146, 137, 119, 0.32) 0 1px, transparent 1px 7px);
  opacity: 0.45;
  pointer-events: none;
}

.kicker,
.radar-eyebrow,
.section-kicker {
  margin: 0;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ornament {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  width: min(420px, 100%);
  margin: 16px auto;
  color: var(--accent);
}

.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.ornament span {
  font-size: 24px;
  line-height: 1;
}

.ink-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 1;
}

.ink-icon[class*="glyph-"] {
  position: relative;
  flex: 0 0 auto;
  font-size: 0;
}

.ink-icon[class*="glyph-"]::before,
.ink-icon[class*="glyph-"]::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
  color: inherit;
}

.glyph-malware::before {
  inset: 17px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow:
    0 -13px 0 -5px currentColor,
    0 13px 0 -5px currentColor,
    13px 0 0 -5px currentColor,
    -13px 0 0 -5px currentColor;
}

.glyph-malware::after {
  inset: 8px;
  border-width: 2px 0 0 2px;
  border-style: solid;
  border-color: currentColor;
  border-radius: 50%;
  transform: rotate(42deg);
  opacity: 0.72;
}

.glyph-shield::before {
  inset: 7px 13px 6px;
  border: 2px solid currentColor;
  border-radius: 46% 46% 50% 50%;
  clip-path: polygon(50% 0, 92% 14%, 84% 70%, 50% 100%, 16% 70%, 8% 14%);
}

.glyph-shield::after {
  top: 14px;
  bottom: 14px;
  left: 50%;
  width: 2px;
  background: currentColor;
  transform: translateX(-50%);
  opacity: 0.65;
}

.glyph-mail::before {
  inset: 11px 7px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.glyph-mail::after {
  inset: 16px 8px auto;
  height: 18px;
  background:
    linear-gradient(32deg, transparent 46%, currentColor 47% 52%, transparent 53%),
    linear-gradient(-32deg, transparent 46%, currentColor 47% 52%, transparent 53%);
}

.glyph-cubes::before {
  inset: 9px 16px auto;
  width: 17px;
  height: 17px;
  border: 2px solid currentColor;
  transform: rotate(45deg);
  box-shadow:
    13px 13px 0 -2px var(--paper),
    13px 13px 0 0 currentColor,
    -13px 13px 0 -2px var(--paper),
    -13px 13px 0 0 currentColor;
}

.glyph-report::before,
.glyph-file::before {
  inset: 7px 13px;
  border: 2px solid currentColor;
  border-radius: 2px;
  background:
    linear-gradient(135deg, transparent 0 12px, rgba(22, 24, 23, 0.13) 12px 14px, transparent 14px),
    repeating-linear-gradient(180deg, transparent 0 9px, currentColor 9px 10px, transparent 10px 14px);
}

.glyph-report::after,
.glyph-file::after {
  top: 7px;
  right: 13px;
  width: 11px;
  height: 11px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  background: var(--paper);
}

.glyph-globe::before {
  inset: 7px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 47%, currentColor 48% 52%, transparent 53%),
    linear-gradient(0deg, transparent 47%, currentColor 48% 52%, transparent 53%);
}

.glyph-globe::after {
  inset: 10px 16px;
  border: 1px solid currentColor;
  border-radius: 50%;
}

.glyph-network::before {
  left: 8px;
  right: 8px;
  top: 23px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -10px 0 -0.5px currentColor, 0 10px 0 -0.5px currentColor;
}

.glyph-network::after {
  inset: 8px;
  background:
    radial-gradient(circle at 50% 10%, currentColor 0 4px, transparent 5px),
    radial-gradient(circle at 17% 72%, currentColor 0 4px, transparent 5px),
    radial-gradient(circle at 83% 72%, currentColor 0 4px, transparent 5px);
}

.glyph-link::before {
  inset: 14px 8px;
  border: 2px solid currentColor;
  border-radius: 14px;
  transform: rotate(-38deg);
}

.glyph-link::after {
  inset: 14px 8px;
  border: 2px solid currentColor;
  border-radius: 14px;
  transform: rotate(38deg);
}

.glyph-chef::before {
  left: 7px;
  right: 7px;
  top: 15px;
  height: 24px;
  border: 2px solid currentColor;
  border-radius: 20px 20px 8px 8px;
  background:
    radial-gradient(circle at 24% 0, var(--paper) 0 10px, transparent 11px),
    radial-gradient(circle at 50% -8%, var(--paper) 0 15px, transparent 16px),
    radial-gradient(circle at 76% 0, var(--paper) 0 10px, transparent 11px);
}

.glyph-chef::after {
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 9px;
  border: 2px solid currentColor;
  border-top: 0;
}

.glyph-orbit::before {
  inset: 12px 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transform: rotate(-24deg);
}

.glyph-orbit::after {
  left: 18px;
  top: 18px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 15px 2px 0 -3px currentColor;
}

.glyph-diamond::before {
  inset: 10px;
  border: 2px solid currentColor;
  transform: rotate(45deg);
}

.glyph-diamond::after {
  inset: 18px;
  border: 2px solid currentColor;
  transform: rotate(45deg);
}

.glyph-triangle::before {
  left: 8px;
  top: 8px;
  width: 32px;
  height: 32px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(135deg);
}

.glyph-triangle::after {
  left: 18px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(135deg);
}

.ink-illustration {
  position: relative;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  min-height: 204px;
  overflow: hidden;
  border: 2px solid transparent;
  border-image: var(--rough-border-image) 8 stretch;
  background:
    linear-gradient(180deg, rgba(22, 24, 23, 0.04), transparent 44%),
    repeating-linear-gradient(-12deg, rgba(22, 24, 23, 0.12), rgba(22, 24, 23, 0.12) 1px, transparent 1px, transparent 8px),
    var(--paper-2);
  color: rgba(22, 24, 23, 0.72);
  font-size: 0;
}

.ink-illustration::before {
  content: "";
  position: absolute;
  inset: 28px 42px 30px;
  border-top: 10px double rgba(22, 24, 23, 0.62);
  border-bottom: 2px solid rgba(22, 24, 23, 0.4);
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(22, 24, 23, 0.62) 8% 10%, transparent 10% 28%, rgba(22, 24, 23, 0.62) 28% 30%, transparent 30% 50%, rgba(22, 24, 23, 0.62) 50% 52%, transparent 52% 72%, rgba(22, 24, 23, 0.62) 72% 74%, transparent 74%),
    repeating-linear-gradient(170deg, transparent 0 10px, rgba(22, 24, 23, 0.14) 10px 11px);
  opacity: 0.78;
}

.ink-illustration::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: 26px;
  left: 28px;
  height: 54px;
  border-top: 1px solid rgba(22, 24, 23, 0.34);
  background: repeating-linear-gradient(168deg, transparent 0 9px, rgba(22, 24, 23, 0.18) 9px 10px);
  opacity: 0.72;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 26px;
}

.metric-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 16px;
  align-items: center;
  min-height: 118px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  background:
    linear-gradient(rgba(255, 252, 244, 0.66), rgba(255, 252, 244, 0.5)),
    var(--paper-fibers);
  box-shadow: inset 0 0 0 1px rgba(93, 82, 61, 0.22);
}

.metric-card::before,
.metric-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    var(--rough-line-image) left top / 180px 8px repeat-x,
    var(--rough-line-image) left bottom / 180px 8px repeat-x,
    var(--rough-vline-image) left top / 8px 180px repeat-y,
    var(--rough-vline-image) right top / 8px 180px repeat-y;
  pointer-events: none;
}

.metric-card::after {
  inset: 3px;
  border-width: 1px;
  opacity: 0.34;
}

.metric-card .ink-icon {
  position: relative;
  grid-row: span 3;
  width: 54px;
  height: 54px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 0;
}

.metric-card .ink-icon::before,
.metric-card .ink-icon::after {
  content: "";
  position: absolute;
  inset: 13px;
  border: 1px solid currentColor;
  opacity: 0.78;
}

.metric-card.status-report .ink-icon {
  border-radius: 0;
}

.metric-card.status-report .ink-icon::before {
  inset: 9px 14px;
  border-radius: 2px;
}

.metric-card.status-report .ink-icon::after {
  inset: 18px 19px auto;
  height: 16px;
  border-width: 1px 0;
}

.metric-card.status-malware .ink-icon {
  border: 0;
}

.metric-card.status-malware .ink-icon::before {
  inset: 18px;
  border-radius: 50%;
  box-shadow:
    0 -14px 0 -4px currentColor,
    0 14px 0 -4px currentColor,
    14px 0 0 -4px currentColor,
    -14px 0 0 -4px currentColor;
}

.metric-card.status-vulnerability .ink-icon {
  border-radius: 4px;
}

.metric-card.status-vulnerability .ink-icon::before {
  inset: 9px 15px;
  border-radius: 50% 50% 46% 46%;
  transform: rotate(45deg);
}

.metric-card.status-vulnerability .ink-icon::after {
  inset: 17px 25px 11px;
  border-width: 0 1px 1px 0;
}

.metric-card.status-blockchain .ink-icon {
  border: 0;
}

.metric-card.status-blockchain .ink-icon::before,
.metric-card.status-blockchain .ink-icon::after {
  inset: auto;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
}

.metric-card.status-blockchain .ink-icon::before {
  left: 9px;
  top: 9px;
  box-shadow: 18px 18px 0 -1px var(--paper), 18px 18px 0 0 currentColor;
}

.metric-card.status-blockchain .ink-icon::after {
  right: 9px;
  top: 9px;
  box-shadow: -18px 18px 0 -1px var(--paper), -18px 18px 0 0 currentColor;
}

.metric-card span {
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.2;
}

.metric-card strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
}

.metric-card p {
  margin: 0;
  color: var(--gold-dark);
  font-size: 14px;
  line-height: 1.2;
}

.severity,
.confidence,
.chip,
.badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  border-image: var(--rough-border-image) 8 stretch;
  padding: 2px 8px;
  background: rgba(255, 252, 244, 0.62);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.severity::before {
  content: "";
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--muted-2);
}

.severity.critical,
.severity.critical::before {
  color: var(--red);
  border-color: rgba(157, 47, 31, 0.38);
}

.severity.critical::before {
  background: var(--red);
}

.severity.high,
.severity.high::before {
  color: var(--orange);
  border-color: rgba(199, 101, 37, 0.42);
}

.severity.high::before {
  background: var(--orange);
}

.severity.medium,
.severity.medium::before {
  color: var(--yellow);
  border-color: rgba(183, 137, 30, 0.42);
}

.severity.medium::before {
  background: var(--yellow);
}

.report-meta,
.tag-row,
.cluster,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button,
button,
.tool-card-action,
.article-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 0;
  border-bottom: 1px solid var(--gold);
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.button:hover,
button:hover,
.tool-card-action:hover,
.article-link:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
  text-decoration: none;
}

.button::after,
.tool-card-action::after,
.article-link::after {
  content: " ->";
  margin-left: 14px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) repeat(2, minmax(160px, 0.34fr));
  gap: 14px;
  margin: 26px 0 30px;
}

.filter-bar label {
  display: none;
}

input,
select,
textarea {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 252, 244, 0.64);
  color: var(--ink);
  font-family: var(--font-serif);
}

input,
select {
  min-height: 44px;
  padding: 0 14px;
}

.data-table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-serif);
}

.data-table th {
  border-bottom: 0;
  background-image: var(--rough-line-image);
  background-repeat: repeat-x;
  background-position: left bottom;
  background-size: 180px 8px;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 12px 10px;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  border-bottom: 0;
  background-image: var(--rough-line-image);
  background-repeat: repeat-x;
  background-position: left bottom;
  background-size: 180px 8px;
  color: var(--ink);
  padding: 11px 10px;
  vertical-align: top;
}

.recent-row .severity,
.data-table .severity,
.sidebar-list .severity {
  min-height: 0;
  border: 0;
  padding: 0;
  background: transparent;
}

.data-table code {
  color: var(--ink-soft);
  font-size: 12px;
  word-break: break-all;
}

.mini-bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 42px;
  gap: 14px;
  align-items: center;
  color: var(--ink);
  font-size: 14px;
}

.bar-track {
  height: 5px;
  border: 0;
  background-image: var(--rough-line-image);
  background-repeat: repeat-x;
  background-position: left center;
  background-size: 180px 8px;
}

.bar-fill {
  display: block;
  height: 3px;
  margin-top: 1px;
  background: linear-gradient(90deg, var(--accent-dark), var(--gold));
}

.w-5 {
  width: 5%;
}

.w-8 {
  width: 8%;
}

.w-17 {
  width: 17%;
}

.w-23 {
  width: 23%;
}

.w-28 {
  width: 28%;
}

.w-42 {
  width: 42%;
}

.w-48 {
  width: 48%;
}

.w-74 {
  width: 74%;
}

.w-82 {
  width: 82%;
}

.big-number {
  display: inline-block;
  margin-right: 8px;
  font-size: 36px;
  font-weight: 500;
  line-height: 1;
}

@media (max-width: 1040px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .metric-grid,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .ink-illustration {
    min-height: 150px;
  }
}

/* Institute UI: quiet, structural surfaces replace the former sketch treatment. */
.paper-card,
.radar-panel,
.tools-discovery,
.empty-state,
.toc,
.article-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: none;
}

.paper-card::before,
.paper-card::after,
.radar-panel::before,
.radar-panel::after,
.tools-discovery::before,
.tools-discovery::after,
.empty-state::before,
.empty-state::after,
.toc::before,
.toc::after {
  display: none;
}

.bar-track {
  height: 4px;
  background: var(--line-soft);
}

.button,
button,
.tool-card-action,
.article-link {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-ui);
  font-weight: 600;
}

.button::after,
.tool-card-action::after,
.article-link::after { content: none; }

input,
select,
textarea {
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  font-family: var(--font-mono);
}

/* V3 interaction contract: controls remain quiet until they are used. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 0;
  border-color: var(--gold);
  box-shadow: var(--focus-ring);
}

.button,
button,
.tool-card-action,
.article-link {
  border-color: var(--line-container);
  border-radius: var(--radius-control);
}

input,
select,
textarea {
  border-color: var(--line-emphasis);
  border-radius: var(--radius-control);
  background: var(--surface-panel);
}

/* Result workbenches share one hierarchy: summary first, evidence separated by
   hairlines, and actions attached to the output they affect. */
[class*="analysis-"][class*="-summary-card"] {
  border-color: var(--line-hairline);
  border-radius: var(--radius-panel);
  background: var(--surface-panel);
  box-shadow: none;
}

[class*="analysis-"][class*="-result"] {
  border-color: var(--line-hairline);
}

[class*="analysis-"] .output-field {
  min-width: 0;
  border: 0;
  border-top: 1px solid var(--line-hairline);
  border-radius: 0;
  padding-top: 16px;
  background: transparent;
  box-shadow: none;
}

[class*="analysis-"] .output-toolbar button {
  min-height: 40px;
  border-color: var(--line-container);
  background: transparent;
}

@media (max-width: 640px) {
  [class*="analysis-"] .output-toolbar button {
    min-height: 48px;
  }
}
