/* App layer on top of the vendored AOS × Arcadia Glass tokens (design/).
   Ported from aeoseotool's web/src/styles.css so both internal tools share one
   operator grammar: the background is alive (.ds-field), the content is glass,
   the ink is solid. Dense data (tables, logs) sits on var(--solid). */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  min-height: 100vh;
  background: var(--field-base);
}
[hidden] { display: none !important; }

/* content sits above the fixed field — containers must be positioned with
   z-index > 0 or their plain text paints beneath the .ds-field layer */
.shell, .center { position: relative; z-index: 1; }

h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.9rem;
  letter-spacing: .01em;
  margin: .2em 0 .4em;
  overflow-wrap: anywhere;
}
h2 { font-size: 1.05rem; font-weight: 800; margin: 1.8em 0 .6em; }
h3 { font-size: .92rem; font-weight: 800; margin: 1.2em 0 .5em; }
code, .mono { font-family: var(--font-mono); font-size: .84em; }
.small { font-size: .83rem; }
.muted { color: var(--ink-faint); }

.shell { max-width: 1240px; margin: 0 auto; padding: 0 12px 80px; }
.narrow { max-width: 640px; }

/* ---- chrome: pill topbar on glass ---- */
nav.top {
  position: sticky; top: 12px; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 22px; margin: 12px 0 26px;
  background: var(--glass-strong);
  backdrop-filter: var(--blur-chrome); -webkit-backdrop-filter: var(--blur-chrome);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
}
nav.top .brand { font-size: 1.12rem; }
nav.top .brand:hover { text-decoration: none; }
nav.top a { color: var(--ink-soft); font-weight: 700; font-size: .86rem; }
nav.top a:hover { color: var(--ink); text-decoration: none; }
nav.top .spacer { flex: 1; }
nav.top .who { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; color: var(--ink-faint); }

/* theme toggle icon button */
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  background: var(--glass); color: var(--ink-soft);
  border: 1px solid var(--glass-border); border-radius: var(--radius-pill);
  box-shadow: none;
}
.iconbtn svg { width: 16px; height: 16px; }

/* ---- glass cards ---- */
.card {
  background: var(--glass);
  backdrop-filter: var(--blur-glass); -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.card.tight { padding: 14px 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.gate { border-color: var(--amber); }
.card.failed { border-color: var(--clay); }
.card.failed strong { color: var(--clay); }
.card.failed p { margin: 6px 0 0; font-size: .82rem; overflow-wrap: anywhere; }

/* ---- actions: pills, one solid action per region ---- */
button, .btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--action); color: var(--action-ink);
  border: none; border-radius: var(--radius-pill);
  padding: 10px 17px;
  font-family: var(--font-ui); font-size: .86rem; font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: filter .18s var(--ease), transform .18s var(--ease);
  text-decoration: none;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }
button.secondary, .btn.secondary {
  background: var(--glass); color: var(--ink);
  border: 1px solid var(--glass-border);
  box-shadow: none;
}
button.danger { background: var(--clay-soft); color: var(--clay); box-shadow: none; }
button.small, .btn.small { padding: 6px 13px; font-size: .78rem; }
.actions { margin-top: 20px; }

/* ---- forms ---- */
input, select, textarea {
  width: 100%;
  background: var(--solid); color: var(--ink);
  border: 1px solid var(--sand);
  border-radius: var(--radius-pill);
  padding: 10px 15px;
  font-size: .9rem; font-family: var(--font-ui);
  transition: border-color .18s var(--ease);
}
textarea { border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: .82rem; resize: vertical; }
select { border-radius: var(--radius-pill); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-glow); outline-offset: 2px; border-color: var(--sand-deep); }
input[type="checkbox"] { width: auto; accent-color: var(--brand-ink); }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
label { display: block; font-size: .76rem; color: var(--ink-soft); margin: 14px 0 6px; font-weight: 700; }
label .hint { font-weight: 500; color: var(--ink-faint); }
label.check {
  display: flex; align-items: center; gap: 9px;
  font-size: .86rem; color: var(--ink); font-weight: 600;
}
label.check input { width: auto; margin: 0; }
.field-note { margin: 6px 2px 0; color: var(--ink-faint); font-size: .76rem; line-height: 1.5; }
.field-note strong { color: var(--ink-soft); }
.row { display: flex; gap: 14px; } .row > * { flex: 1; min-width: 0; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
details { margin-top: 18px; }
details summary { cursor: pointer; color: var(--ink-faint); font-size: .82rem; font-weight: 600; }
details[open] summary { margin-bottom: 4px; }
.error-msg { color: var(--clay); font-size: .86rem; margin-top: 10px; font-weight: 600; }
.ok-msg { color: var(--ok); font-size: .86rem; margin-top: 10px; font-weight: 600; }
.error-msg:empty, .ok-msg:empty { display: none; }

/* ---- dense data: tables sit on solid, hairlines inside ---- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--solid);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: .88rem;
}
th {
  text-align: left;
  font-family: var(--font-mono); font-weight: 600;
  font-size: .62rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint);
  padding: 10px 12px;
  border-bottom: 1px solid var(--sand);
  white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--sand); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .18s var(--ease); }
tbody tr:hover { background: var(--paper); }
tr.rowlink { cursor: pointer; }
tr.rowlink .sub { color: var(--ink-faint); font-size: .76rem; font-weight: 400; }
td.progress-cell { min-width: 120px; }
td.cost { white-space: nowrap; }
td.row-actions { text-align: right; white-space: nowrap; }
.table-note { margin: 10px 4px 0; color: var(--ink-faint); font-size: .74rem; line-height: 1.5; }

/* ---- status + severity pills: tint-on-glass washes ---- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-family: var(--font-mono); font-size: .64rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  background: var(--paper); color: var(--ink-soft);
  white-space: nowrap;
}
.pill.queued, .pill.crawling, .pill.collecting, .pill.running_modules, .pill.rendering { background: var(--sea-soft); color: var(--sea); }
.pill.awaiting_confirmation, .pill.high, .pill.partial { background: var(--amber-soft); color: var(--amber); }
.pill.complete, .pill.succeeded { background: var(--ok-soft); color: var(--ok); }
.pill.failed, .pill.critical { background: var(--clay-soft); color: var(--clay); }
.pill.medium { background: var(--violet-soft); color: var(--violet); }
.pill.low, .pill.info, .pill.archived, .pill.skipped { background: var(--paper); color: var(--ink-soft); }
/* pulsing dot inside a running-status pill */
.pill .livedot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 1.2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }

/* ---- progress ---- */
.progressbar { height: 8px; background: var(--paper); border-radius: var(--radius-pill); overflow: hidden; }
.progressbar > div { height: 100%; background: var(--brand-lift); border-radius: var(--radius-pill); transition: width .6s var(--ease); }
.progressbar.live > div {
  background: linear-gradient(90deg, var(--brand-lift) 0%, var(--brand-glow) 50%, var(--brand-lift) 100%);
  background-size: 200% 100%;
  animation: ds-shimmer 1.6s linear infinite;
}
#progress-card .bar { margin-bottom: 8px; }
.time-row { display: flex; gap: 24px; margin-top: 9px; font-size: .78rem; font-family: var(--font-mono); }

/* ---- run header ---- */
.run-bar { flex-wrap: wrap; }
.run-bar h1 { margin: 4px 0 0; }
.meta { font-size: .74rem; margin: 0 0 8px; overflow-wrap: anywhere; }
.meta + .card, .meta + .meta + .card { margin-top: 16px; }

/* ---- run log: dense data on solid, mono ink ---- */
.logbox {
  background: var(--solid);
  border: 1px solid var(--sand);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--font-mono); font-size: .74rem; line-height: 1.7;
  max-height: 340px; overflow-y: auto;
  white-space: pre-wrap;
  color: var(--ink-soft);
}
.logbox .t { color: var(--ink-faint); margin-right: 8px; }
.logbox .stage { color: var(--sea); }
.logbox .warn { color: var(--amber); }
.logbox .error { color: var(--clay); }

/* ---- gate ---- */
.gate-table { margin: 4px 0 10px; }
.gate-table td:first-child { width: 34px; }
.gate-table tr.added td { color: var(--ink-soft); }
.addrow { margin-top: 8px; }
.addrow input { flex: 1; }

/* ---- findings ---- */
.sev { font-family: var(--font-mono); font-weight: 600; text-transform: uppercase; font-size: .64rem; letter-spacing: .08em; }
.sev.critical, .sev.high { color: var(--clay); }
.sev.medium { color: var(--amber); }
.sev.low, .sev.info { color: var(--ink-faint); }
.findings-table td strong { font-weight: 700; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 6px; margin: 4px 0 14px; flex-wrap: wrap; }
.tabs button {
  background: transparent; color: var(--ink-soft); border: 1px solid transparent;
  box-shadow: none; padding: 8px 16px; font-size: .84rem;
}
.tabs button.active { background: var(--action); color: var(--action-ink); }

.bar { display: flex; align-items: center; gap: 10px; }
.bar .grow { flex: 1; }
.center { max-width: 420px; margin: 12vh auto 0; padding: 0 12px; }
.center .card { padding: 28px 30px; border-radius: var(--radius-lg); background: var(--glass-strong); }
.center .eyebrow { margin-bottom: 10px; }
.login-title { margin-top: 0; }
.login-switch { margin: 14px 0 0; text-align: center; }
button.linklike {
  background: none; border: 0; box-shadow: none; padding: 0;
  color: var(--ink-soft); font-size: .8rem; font-weight: 600; text-decoration: underline;
}
button.linklike:hover { color: var(--brand-ink); filter: none; }
.code-input {
  font-family: var(--font-mono); font-size: 1.25rem; letter-spacing: .34em;
  text-align: center;
}

/* ---- prose (rendered internal brief) ---- */
.prose { font-size: .92rem; }
.prose h1 { font: 800 1.05rem/1.3 var(--font-ui); margin: 18px 0 6px; }
.prose h2, .prose h3 { margin: 18px 0 6px; }
.prose table { margin: 10px 0; }
.prose code { padding: 2px 5px; border-radius: 5px; background: var(--paper); }
.prose pre { overflow-x: auto; padding: 12px; border-radius: var(--radius-sm); background: var(--solid); }

/* ---- artifacts ---- */
.artifact-list { margin: 0; padding: 0; list-style: none; }
.artifact-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--sand); }
.artifact-list li:last-child { border-bottom: 0; }
.artifact-list .size { color: var(--ink-faint); font-family: var(--font-mono); font-size: .7rem; white-space: nowrap; }

/* ---- share ---- */
.share-findings { margin-top: 16px; }
.share-findings th:first-child, .share-findings td:first-child { width: 88px; text-align: center; }
.share-findings input[type="checkbox"] { transform: scale(1.1); }
.share-confirm { max-width: 760px; margin-top: 16px; }
.share-result {
  margin-top: 14px; padding: 12px 14px; border: 1px solid var(--ok); border-radius: var(--radius-sm);
  background: var(--ok-soft);
}
.share-result strong, .share-result a { display: block; }
.share-result a { margin-top: 5px; overflow-wrap: anywhere; }

/* ---- roadmap: shared glass tokens, a quieter editing surface ---- */
.roadmap-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; padding: 18px 20px; margin: 22px 0 14px; border: 1px solid var(--glass-border); border-radius: var(--radius); background: var(--glass); }
.roadmap-toolbar label { flex: 1 1 220px; margin: 0; max-width: 340px; }
.roadmap-toolbar button { margin-bottom: 1px; }
#tab-roadmap > h3 { font: italic 500 1.6rem/1.2 var(--font-display); margin: 12px 0 10px; }
#tab-roadmap > p { max-width: 82ch; color: var(--ink-soft); line-height: 1.7; }
#tab-roadmap > p.muted { font-size: .82rem; }
.roadmap-phase { margin: 16px 0; padding: 0 18px 18px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--glass-border); }
.roadmap-phase > summary { padding: 18px 4px; font: 700 1.05rem/1.5 var(--font-ui); color: var(--ink); }
.roadmap-task { padding: 0; margin: 12px 0; overflow: hidden; border-radius: var(--radius); background: var(--solid); border: 1px solid var(--sand); }
.roadmap-task > h4 { padding: 18px 22px; margin: 0; font: 700 .95rem/1.5 var(--font-ui); border-bottom: 1px solid var(--sand); background: var(--paper); }
.roadmap-task > .roadmap-selection { margin: 16px 22px 0; color: var(--ink-soft); font-weight: 500; }
.roadmap-selection input { width: 17px; height: 17px; accent-color: var(--brand-ink); }
.roadmap-task form { padding: 0 22px 22px; }
.roadmap-task form > p { color: var(--ink-soft); font-size: .88rem; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-line; }
.roadmap-task textarea { min-height: 112px; font: .92rem/1.6 var(--font-ui); }
.roadmap-task input, .roadmap-task select { min-height: 44px; }
.roadmap-task form > button { margin-top: 8px; }
.roadmap-task [data-save-message]:empty, #roadmap-message:empty { display: none; }
.roadmap-task [data-save-message], #roadmap-message { color: var(--sea); }
.assessment-limitations { overflow-wrap: anywhere; }
.assessment-limitations article { padding: 10px 0; border-top: 1px solid var(--sand); }
.assessment-limitations article p { margin: 4px 0; color: var(--ink-soft); font-size: .88rem; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--brand-glow); outline-offset: 3px; }

/* ---- responsive ---- */
@media (max-width: 760px) {
  nav.top { gap: 12px; padding: 10px 16px; }
  nav.top .who { display: none; }
  .row, .grid.two, .grid.three { display: block; }
  .roadmap-task .grid.two { grid-template-columns: 1fr; }
  .run-bar h1 { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .progressbar.live > div, .pill .livedot { animation: none !important; }
  .progressbar > div { transition: none; }
}
