:root {
  color-scheme: light;
  --bg: #f7f2f8;
  --card: #ffffff;
  --ink: #1d0f25;
  --muted: #5c4d66;
  --line: #e1ded0;
  --accent: #46256a;
  --action: #f0a300;
  --action-hover: #ebb100;
  --pass: #0c4937;
  --pass-bg: #e5f1ec;
  --fail: #9c3018;
  --fail-bg: #f8e8e4;
  --warn: #772f4d;
  --warn-bg: #f8e8ee;
  --review: #46256a;
  --review-bg: #f3eef6;
  --shadow: 0 1px 2px rgba(29, 15, 37, 0.04), 0 12px 32px rgba(29, 15, 37, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(82deg, #efefef 3%, #deddf3 19%, #ecdcef 31%, #ffebff 44%, #f7ece5 57%, #f6ecea 70%, #f4e7ec 84%);
  background-attachment: fixed;
  color: var(--ink);
  font: 15px/1.5 "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
}

h1, h2, h3, p { margin: 0; }

h1 { font-size: 1.2rem; font-weight: 500; letter-spacing: -0.02em; color: #fff; }
h2, h3.section-title { font-size: 1.15rem; font-weight: 500; letter-spacing: -0.02em; text-transform: none; color: var(--ink); }
h4 { font-size: 0.78rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
h2, h3, h4, :focus { scroll-margin-top: 8rem; }

.app { 
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  gap: 0.75rem;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  width: min(1140px, calc(100% - 2.5rem));
  margin: 0.75rem auto 0;
  padding: 1.15rem 2rem;
  background: var(--ink);
  color: #f2f2f2;
  border-radius: 9999px;
}

.brand { display: flex; align-items: center; gap: 0.75rem; min-width: 14rem; }
.mark { width: 2.15rem; height: 2.15rem; color: var(--action); flex: none; }
.profile-mark {
  display: block;
  background: var(--action);
  -webkit-mask: url("/static/rolodex-profile.png") center / contain no-repeat;
  mask: url("/static/rolodex-profile.png") center / contain no-repeat;
}

.eyebrow {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar .eyebrow { color: var(--action); }

.disclaimer { max-width: 42rem; color: #e1ded0; font-size: 0.82rem; }

.workspace {
  width: min(1140px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 1.25rem 0 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.command, .kpi, .region, .panel, .empty {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.command-main label, .visitor-field label, .option-label, legend { font-size: 0.78rem; font-weight: 650; color: var(--muted); }

.url-row { display: flex; gap: 0.5rem; margin-top: 0.35rem; }

input[type="url"] {
  flex: 1;
  min-width: 0;
  border: 2px solid var(--muted);
  background: #fff;
  border-radius: 40px;
  padding: 0.7rem 1rem;
  font: inherit;
  color: inherit;
}

input::placeholder { color: var(--muted); opacity: 1; }

.scan-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
  align-items: start;
  margin-top: 1rem;
}
.visitor-field { min-width: 0; }
.field-label { display: flex; align-items: center; gap: 0.35rem; }
.option-label { display: block; }
.field-label .option-label { display: inline; }
.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}
.help:hover,
.help[aria-expanded="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.visitor-field .note { margin-top: 0.4rem; }
.visitor-field .check { width: fit-content; margin-top: 0.35rem; }
.visitor-field select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  min-width: 0;
  border: 2px solid var(--muted);
  border-radius: 40px;
  padding: 0.55rem 2.6rem 0.55rem 1rem;
  font: inherit;
  color: inherit;
  appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235c4d66' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 0.75rem auto;
}

.visitor-field select:disabled { opacity: 0.55; }

button { font: inherit; cursor: pointer; }

button[type="submit"], #scan-button {
  border: 2px solid var(--action);
  border-radius: 40px;
  padding: 0.7rem 1.25rem;
  background: var(--action);
  color: var(--ink);
  font-weight: 600;
}

button[type="submit"]:hover, #scan-button:hover {
  background: var(--action-hover);
  border-color: var(--action-hover);
}

button:disabled { opacity: 0.55; cursor: wait; }

.logout {
  border: 2px solid #f2f2f2;
  background: transparent;
  color: #f2f2f2;
  border-radius: 40px;
  padding: 0.45rem 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

.logout:hover { background: var(--action); color: var(--ink); border-color: var(--action); }

.login-card { max-width: 28rem; margin: 1rem auto 0; }
.login-card h2 { margin-bottom: 0.35rem; }
.login-note { color: var(--muted); }
.login-card label { display: block; margin-top: 0.9rem; font-size: 0.78rem; font-weight: 650; color: var(--muted); }
.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  margin-top: 0.35rem;
  border: 2px solid var(--muted);
  background: #fff;
  border-radius: 40px;
  padding: 0.7rem 1rem;
  font: inherit;
  color: inherit;
}
.login-card button { margin-top: 1rem; }
.login-error { margin-top: 0.9rem; color: var(--fail); }

fieldset { border: 0; margin: 0.9rem 0 0; padding: 0; }

.regions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }

.check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  color: var(--muted);
}

.check:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
  color: #f2f2f2;
}

.check input { accent-color: var(--action); width: 1.05rem; height: 1.05rem; }

.status-line { min-height: 1.25rem; margin-top: 0.65rem; color: var(--muted); font-size: 0.88rem; }
#action-copy {
  width: 100%;
  margin-top: 0.75rem;
  border: 2px solid var(--muted);
  border-radius: 12px;
  padding: 0.75rem;
  font: inherit;
  color: inherit;
  background: #fff;
}
.status-line:empty { display: none; }

.scan-progress {
  height: 0.45rem;
  margin-top: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: #f2f2f2;
}
.scan-progress-bar {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: scan-progress 1.35s ease-in-out infinite;
}
@keyframes scan-progress {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(340%); }
}

.empty h2 { margin: 0.3rem 0 0.4rem; font-size: 1.35rem; }
.empty p:last-child { color: var(--muted); }

.report-head { margin-bottom: 0.85rem; }

.report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.report-actions form { margin: 0; }

.version-notice {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.version-notice.pending { display: flex; align-items: center; gap: 0.65rem; }

.spinner,
#check-versions button.is-loading::before {
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  flex: none;
  animation: spin 0.7s linear infinite;
}

#check-versions button.is-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

#check-versions button.is-loading::before { content: ""; }

.report-actions button.is-loading:disabled { opacity: 1; cursor: progress; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner,
  #check-versions button.is-loading::before { animation: none; }
}

.version-notice p { font-weight: 650; }

.version-notice ul { margin: 0; padding-left: 1.1rem; }

.version-notice li + li { margin-top: 0.2rem; }

.report-actions button {
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  border-radius: 40px;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.report-actions button:hover {
  background: var(--action);
  border-color: var(--action);
}

.report-actions button:disabled { opacity: 0.45; cursor: not-allowed; }

.note, .cite { color: var(--muted); font-size: 0.85rem; }
.fix {
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.fix-label {
  margin-bottom: 0.2rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.fix summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; }
.fix details p { margin-top: 0.35rem; }

.kpis, .counts, .stat-row, .evidence-grid {
  display: grid;
  gap: 0.75rem;
}

.kpis { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 0.85rem; }

.kpi .figure {
  display: flex;
  align-items: baseline;
  gap: 0.15rem;
  margin: 0.35rem 0 0.15rem;
  font-variant-numeric: tabular-nums;
}
.num { font-size: 2.15rem; font-weight: 680; letter-spacing: -0.04em; line-height: 1; }
.unit { color: var(--muted); font-weight: 600; }
.kpi[data-label="High risk"] .num { color: var(--fail); }
.kpi[data-label="Needs attention"] .num { color: var(--warn); }
.kpi[data-label="Looks reasonable"] .num { color: var(--pass); }

.meter {
  display: flex;
  height: 0.45rem;
  margin: 0.7rem 0 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: #f2f2f2;
}
.seg-pass { background: var(--pass); }
.seg-fail { background: var(--fail); }
.seg-warning { background: var(--warn); }
.seg-review { background: #6e6578; }

.counts { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 0.75rem; }
.pill {
  background: var(--bg);
  border-radius: 10px;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.pill strong { display: block; font-size: 1.05rem; }

.region, .panel { margin-top: 0.75rem; }

.region-head, .panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.finding {
  display: grid;
  grid-template-columns: 7.2rem 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.status {
  display: inline-block;
  height: fit-content;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-pass { background: var(--pass-bg); color: var(--pass); }
.status-fail { background: var(--fail-bg); color: var(--fail); }
.status-warning { background: var(--warn-bg); color: var(--warn); }
.status-review { background: var(--review-bg); color: var(--review); }

.evidence-grid { grid-template-columns: 1.15fr 0.85fr; margin-top: 0.85rem; }
.evidence-grid > *, .kpis > * { min-width: 0; }
.span-2 { grid-column: 1 / -1; }

.stat-row { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 0.75rem; }
.stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: var(--bg);
}
.stat span { display: block; color: var(--muted); font-size: 0.75rem; }
.stat strong { font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; margin-top: 0.45rem; }
table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--muted); font-size: 0.75rem; font-weight: 650; white-space: nowrap; }
td:last-child { overflow-wrap: anywhere; }
tr:hover td { background: var(--bg); }
tr.details-row td,
tr.details-row:hover td { background: var(--bg); padding-top: 0.15rem; padding-bottom: 0.9rem; }

.origin {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}
.origin-auto { background: var(--pass-bg); color: var(--pass); }
.origin-manual { background: var(--review-bg); color: var(--review); }

.version-field { display: flex; align-items: center; gap: 0.45rem; }
.version-field input { flex: 1; min-width: 0; }

.row-actions { white-space: normal; overflow-wrap: normal; }
.row-actions a { display: inline-block; }

.details-toggle {
  display: block;
  margin: 0.15rem 0 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

button.site-details.details-toggle {
  display: inline;
  margin: 0;
  font: inherit;
  font-weight: 600;
}

.suggestion-list {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.suggestion-list li,
.suggestion-list form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
}

.suggestion-list input {
  border: 2px solid var(--muted);
  background: #fff;
  border-radius: 40px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  color: inherit;
  min-width: 12rem;
}

.suggestion-list button,
.suggestion-list button.danger {
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  border-radius: 40px;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.suggestion-list button.danger {
  border-color: var(--fail);
  color: var(--fail);
}

.suggestion-list button:hover { background: var(--action); border-color: var(--action); }

.suggestion-list button.danger:hover {
  background: var(--fail-bg);
  border-color: var(--fail);
  color: var(--fail);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 1.5rem;
  margin: 0.35rem 0 0;
}
.detail-grid .span-2 { grid-column: 1 / -1; }
.detail-grid dt {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.detail-grid dd { margin: 0.1rem 0 0; }
.detail-notes { white-space: pre-wrap; }
.detail-urls { list-style: none; margin: 0.15rem 0 0; padding: 0; }
.detail-urls li + li { margin-top: 0.2rem; }

#site-urls { margin-top: 0.35rem; }
#site-url-rows { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.45rem; }
.url-repeat { display: flex; gap: 0.5rem; align-items: center; }
.url-repeat input { flex: 1; min-width: 0; margin-top: 0; }
#add-site-url,
.url-repeat .remove-url {
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  border-radius: 40px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}
.url-repeat .remove-url { border-color: var(--fail); color: var(--fail); }
#add-site-url { margin-top: 0.55rem; }
#add-site-url:hover { background: var(--action); border-color: var(--action); }
.url-repeat .remove-url:hover { background: var(--fail-bg); }

@media (max-width: 800px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .span-2 { grid-column: auto; }
}

blockquote {
  margin: 0.55rem 0 0;
  color: var(--muted);
  white-space: pre-wrap;
  font-size: 0.88rem;
}
img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 10px; }
a { color: var(--accent); text-underline-offset: 0.15em; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input:focus-visible, button:focus-visible, .check:focus-within, a:focus-visible, summary:focus-visible, h2:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #fff;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scan-progress-bar {
    width: 100%;
    animation: none;
    opacity: 0.85;
  }
}

@media (max-width: 800px) {
  .topbar, .url-row, .finding { display: block; }
  .scan-options { grid-template-columns: 1fr; }
  .topbar { position: static; margin-top: 0.75rem; border-radius: 20px; }
  .disclaimer { margin-top: 0.75rem; }
  #scan-button { margin-top: 0.55rem; }
  .report-actions { width: fit-content; max-width: 100%; }
  .evidence-grid { grid-template-columns: 1fr; }
  .counts { grid-template-columns: 1fr 1fr; }
}

.list-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.list-head h2,
.site-form h2,
.delete-card h2 { margin-bottom: 0.2rem; }

.workspace .panel { margin-top: 0; }

.filters {
  display: grid;
  grid-template-columns: minmax(12rem, 1.6fr) minmax(8rem, 1fr) auto;
  gap: 0.75rem 1rem;
  align-items: end;
}

.filter-submit {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.field label,
.site-form .option-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
}

.field input:not([type="checkbox"]),
.field select,
.field textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  border: 2px solid var(--muted);
  background: #fff;
  border-radius: 40px;
  padding: 0.7rem 1rem;
  font: inherit;
  color: inherit;
}

.field select {
  appearance: none;
  padding-right: 2.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%235c4d66' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 0.75rem auto;
}

.field textarea {
  border-radius: 20px;
  min-height: 8rem;
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1.25rem;
}

.site-form h3 {
  margin: 1.4rem 0 0.15rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field .check { margin-top: 0.55rem; width: fit-content; }

.stamp { margin-top: 0.35rem; }

.errors {
  margin: 0.9rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  background: var(--fail-bg);
  color: var(--fail);
}

.errors ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 1.25rem;
}

.form-actions form { margin: 0; }
.form-actions .danger-link { margin-left: auto; }

a.button,
button.danger[type="submit"] {
  display: inline-block;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  border-radius: 40px;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

a.button.primary {
  background: var(--action);
  border-color: var(--action);
  color: var(--ink);
}

a.button.primary:hover,
a.button:hover {
  background: var(--action);
  border-color: var(--action);
  color: var(--ink);
}

a.button.primary:hover { background: var(--action-hover); border-color: var(--action-hover); }

a.button.danger,
button.danger[type="submit"] {
  background: #fff;
  border-color: var(--fail);
  color: var(--fail);
}

a.button.danger:hover,
button.danger[type="submit"]:hover {
  background: var(--fail-bg);
  border-color: var(--fail);
  color: var(--fail);
}

.people { list-style: none; margin: 0; padding: 0; }
.role { color: var(--muted); font-size: 0.75rem; margin-right: 0.25rem; }
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; }
td.nowrap { white-space: nowrap; }
td.wrap { max-width: 16rem; overflow-wrap: anywhere; }
.delete-card { max-width: 36rem; }
.delete-card p { margin-top: 0.6rem; overflow-wrap: anywhere; }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #fff;
}

@media (max-width: 800px) {
  .filters,
  .form-grid { grid-template-columns: 1fr; }
  .list-head { display: block; }
  .list-head .report-actions { margin-top: 0.75rem; }
  .form-actions .danger-link { margin-left: 0; }
}
