:root {
  color-scheme: dark;
  --bg: #070b12;
  --bg-raised: #0b111b;
  --panel: #0f1723;
  --panel-2: #121d2b;
  --panel-3: #172436;
  --line: #223247;
  --line-bright: #334966;
  --text: #e8eef7;
  --muted: #8fa0b7;
  --faint: #64758b;
  --accent: #5be7b7;
  --accent-strong: #28c994;
  --accent-ink: #041611;
  --blue: #67a7ff;
  --amber: #ffcb6b;
  --red: #ff6f7d;
  --purple: #b9a4ff;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
  --radius: 14px;
  --radius-small: 9px;
  --sidebar-width: 248px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 72% -10%, rgba(64, 162, 142, 0.1), transparent 33rem),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: #a8ccff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: var(--radius-small);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: none;
}

.eyebrow {
  margin: 0 0 0.3rem;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.status-dot {
  display: inline-block;
  width: 0.52rem;
  height: 0.52rem;
  flex: 0 0 auto;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 203, 107, 0.09), 0 0 12px rgba(255, 203, 107, 0.35);
}

.status-dot-ok {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 231, 183, 0.09), 0 0 12px rgba(91, 231, 183, 0.35);
}

.status-dot-error {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 111, 125, 0.09), 0 0 12px rgba(255, 111, 125, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent);
  background: linear-gradient(145deg, #152b2d, #0d1c22);
  border: 1px solid rgba(91, 231, 183, 0.35);
  border-radius: 11px;
  box-shadow: inset 0 0 22px rgba(91, 231, 183, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.1rem;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: -0.015em;
}

.brand small {
  margin-top: 0.12rem;
  color: var(--faint);
  font-size: 0.7rem;
}

.button,
.icon-button,
.text-button,
.nav-item,
.select-item,
.file-item {
  border: 0;
  cursor: pointer;
}

.button {
  display: inline-flex;
  min-height: 2.35rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  background: var(--panel-3);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-small);
  font-size: 0.79rem;
  font-weight: 720;
  line-height: 1;
  text-decoration: none;
  transition: border-color 130ms ease, background 130ms ease, color 130ms ease, transform 130ms ease;
}

.button:hover:not(:disabled) {
  background: #1d2d42;
  border-color: #49637f;
  color: #fff;
}

.button:active:not(:disabled) {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

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

.button-primary:hover:not(:disabled) {
  color: #001a11;
  background: #7af0c7;
  border-color: #7af0c7;
}

.button-quiet {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.button-small {
  min-height: 1.95rem;
  padding: 0.38rem 0.62rem;
  font-size: 0.72rem;
}

.icon-button {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}

.text-button {
  padding: 0.15rem 0;
  color: var(--accent);
  background: transparent;
  font-size: 0.73rem;
  font-weight: 750;
}

.text-button:hover {
  color: #a5f6da;
}

.badge {
  display: inline-flex;
  min-height: 1.55rem;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.52rem;
  color: var(--muted);
  background: rgba(143, 160, 183, 0.08);
  border: 1px solid rgba(143, 160, 183, 0.18);
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.badge-safe,
.badge-success {
  color: var(--accent);
  background: rgba(91, 231, 183, 0.08);
  border-color: rgba(91, 231, 183, 0.25);
}

.badge-warning {
  color: var(--amber);
  background: rgba(255, 203, 107, 0.08);
  border-color: rgba(255, 203, 107, 0.25);
}

.badge-danger {
  color: var(--red);
  background: rgba(255, 111, 125, 0.08);
  border-color: rgba(255, 111, 125, 0.25);
}

.badge-info {
  color: var(--blue);
  background: rgba(103, 167, 255, 0.08);
  border-color: rgba(103, 167, 255, 0.25);
}

/* Login */

.login-page {
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(rgba(7, 11, 18, 0.9), rgba(7, 11, 18, 0.96)),
    repeating-linear-gradient(90deg, transparent 0, transparent 48px, rgba(91, 231, 183, 0.025) 49px, transparent 50px),
    repeating-linear-gradient(0deg, transparent 0, transparent 48px, rgba(91, 231, 183, 0.025) 49px, transparent 50px),
    radial-gradient(circle at 50% 5%, #17313a, var(--bg) 55%);
}

.login-shell {
  width: min(100%, 440px);
}

.login-panel {
  padding: 2rem;
  background: rgba(15, 23, 35, 0.94);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.46);
}

.brand-login {
  padding-bottom: 1.45rem;
  border-bottom: 1px solid var(--line);
}

.login-copy {
  padding: 1.65rem 0 1rem;
}

.login-copy h1 {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  letter-spacing: -0.045em;
}

.login-copy > p:last-child {
  margin: 0.65rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 0.58rem;
  margin-top: 0.75rem;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0.45rem;
}

.login-submit {
  width: 100%;
  margin-top: 0.8rem;
}

.login-security {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.45rem;
  padding-top: 1.15rem;
  color: var(--faint);
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
}

.notice {
  margin: 0.25rem 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-small);
  font-size: 0.82rem;
}

.notice-error {
  color: #ffc1c7;
  background: rgba(255, 111, 125, 0.09);
  border: 1px solid rgba(255, 111, 125, 0.25);
}

.field-hint {
  margin: 0.1rem 0 0;
  font-size: 0.7rem;
}

.warning-text {
  color: var(--amber);
}

/* Shell */

.app-page {
  overflow-x: hidden;
}

.sidebar {
  position: fixed;
  z-index: 50;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 1.35rem 1rem;
  background: rgba(9, 14, 22, 0.97);
  border-right: 1px solid var(--line);
}

.sidebar > .brand {
  padding: 0 0.45rem 1.35rem;
}

.nav-list {
  display: grid;
  gap: 0.27rem;
  margin-top: 0.55rem;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 2.55rem;
  align-items: center;
  gap: 0.72rem;
  padding: 0.55rem 0.7rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-size: 0.82rem;
  font-weight: 650;
  text-align: left;
  transition: color 130ms ease, background 130ms ease, border-color 130ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
}

.nav-item.is-active {
  color: #d8fff1;
  background: rgba(91, 231, 183, 0.08);
  border-color: rgba(91, 231, 183, 0.18);
}

.nav-glyph {
  display: grid;
  width: 1.3rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.nav-item.is-active .nav-glyph {
  color: var(--accent);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 0.4rem 0;
  border-top: 1px solid var(--line);
}

.safety-state {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.72rem;
}

.safety-state strong,
.safety-state small {
  display: block;
}

.safety-state small {
  margin-top: 0.12rem;
  color: var(--faint);
  font-size: 0.63rem;
}

.version-line {
  margin-top: 0.75rem;
  color: #48586d;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.61rem;
}

.page-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 3vw, 2rem);
  background: rgba(7, 11, 18, 0.86);
  border-bottom: 1px solid rgba(34, 50, 71, 0.8);
  backdrop-filter: blur(18px);
}

.topbar-left,
.topbar-actions,
.user-chip,
.system-state {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 0.8rem;
}

.topbar-left h1 {
  margin: 0;
  font-size: 1.13rem;
  letter-spacing: -0.025em;
}

.topbar-left .eyebrow {
  margin-bottom: 0.14rem;
  font-size: 0.59rem;
}

.topbar-actions {
  gap: 0.55rem;
}

.system-state {
  gap: 0.45rem;
  margin-right: 0.35rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.user-chip {
  gap: 0.48rem;
  margin-left: 0.25rem;
  padding: 0 0.55rem;
}

.user-chip strong,
.user-chip small {
  display: block;
}

.user-chip strong {
  font-size: 0.73rem;
}

.user-chip small {
  margin-top: 0.07rem;
  color: var(--faint);
  font-size: 0.61rem;
  text-transform: capitalize;
}

.avatar {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  color: var(--accent);
  background: #13272a;
  border: 1px solid #285255;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
}

.mobile-menu {
  display: none;
}

.main-content {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 2rem);
}

.view {
  animation: view-in 160ms ease-out;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.view-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.view-heading h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  letter-spacing: -0.04em;
}

.view-heading p:last-child:not(.eyebrow) {
  max-width: 780px;
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* Panels, metrics, tables */

.panel {
  min-width: 0;
  padding: 1rem;
  background: linear-gradient(145deg, rgba(17, 27, 41, 0.98), rgba(13, 21, 32, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.13);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.panel-heading h3,
.workspace-header h3,
.form-section h3 {
  margin: 0;
  font-size: 0.96rem;
  letter-spacing: -0.025em;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.metric-card {
  position: relative;
  min-width: 0;
  min-height: 116px;
  overflow: hidden;
  padding: 0.95rem;
  background: linear-gradient(145deg, #111b29, #0d1520);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-card::after {
  position: absolute;
  right: -18px;
  bottom: -35px;
  width: 86px;
  height: 86px;
  background: radial-gradient(circle, rgba(91, 231, 183, 0.08), transparent 68%);
  content: "";
}

.metric-danger::after {
  background: radial-gradient(circle, rgba(255, 111, 125, 0.1), transparent 68%);
}

.metric-card > span,
.metric-card small,
.metric-card strong {
  display: block;
}

.metric-card > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
}

.metric-card strong {
  margin: 0.45rem 0 0.32rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.75rem;
  line-height: 1;
  letter-spacing: -0.06em;
}

.metric-danger strong {
  color: var(--red);
}

.metric-card small {
  overflow: hidden;
  color: var(--faint);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-grid,
.research-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.panel-wide {
  grid-column: 1 / -1;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.table-tall {
  max-height: min(58vh, 650px);
}

table {
  width: 100%;
  border-spacing: 0;
  border-collapse: collapse;
  font-size: 0.72rem;
}

th,
td {
  padding: 0.68rem 0.62rem;
  border-bottom: 1px solid rgba(34, 50, 71, 0.75);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--faint);
  background: var(--panel);
  font-size: 0.59rem;
  font-weight: 780;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr[data-selectable="true"] {
  cursor: pointer;
}

tbody tr[data-selectable="true"]:hover,
tbody tr.is-selected {
  background: rgba(91, 231, 183, 0.045);
}

.cell-main,
.cell-sub {
  display: block;
}

.cell-main {
  color: var(--text);
  font-weight: 650;
}

.cell-sub {
  max-width: 340px;
  margin-top: 0.18rem;
  overflow: hidden;
  color: var(--faint);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.67rem;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  align-content: center;
  gap: 0.45rem;
  padding: 1.2rem;
  color: var(--faint);
  border: 1px dashed var(--line-bright);
  border-radius: var(--radius-small);
  font-size: 0.77rem;
  text-align: center;
}

.empty-state.compact {
  min-height: 92px;
}

.empty-icon {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.8rem;
}

.key-values {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(0, 1.2fr);
  gap: 0.6rem 0.85rem;
  margin: 0;
  font-size: 0.72rem;
}

.key-values dt {
  color: var(--faint);
}

.key-values dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

/* Forms */

label {
  display: grid;
  gap: 0.36rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 680;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: #0a111b;
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-small);
  outline: none;
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

input,
select {
  min-height: 2.55rem;
  padding: 0.58rem 0.7rem;
}

textarea {
  padding: 0.7rem;
  line-height: 1.5;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(91, 231, 183, 0.75);
  box-shadow: 0 0 0 3px rgba(91, 231, 183, 0.08);
}

input::placeholder,
textarea::placeholder {
  color: #46576d;
}

.stack-form {
  display: grid;
  gap: 0.85rem;
}

.compact-form {
  margin-bottom: 0.85rem;
  padding: 0.75rem;
  background: rgba(4, 9, 15, 0.35);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.form-message {
  min-height: 1.1rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
}

.form-message.is-error {
  color: var(--red);
}

.form-message.is-success {
  color: var(--accent);
}

.full-progress {
  width: 100%;
  height: 0.45rem;
  overflow: hidden;
  accent-color: var(--accent);
  border: 0;
  border-radius: 999px;
}

.file-drop {
  display: grid;
  min-height: 160px;
  place-items: center;
  align-content: center;
  gap: 0.35rem;
  padding: 1rem;
  color: var(--text);
  background: rgba(7, 13, 21, 0.46);
  border: 1px dashed var(--line-bright);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: background 130ms ease, border-color 130ms ease;
}

.file-drop:hover,
.file-drop:focus-within {
  background: rgba(91, 231, 183, 0.035);
  border-color: rgba(91, 231, 183, 0.5);
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.file-drop strong,
.file-drop small {
  display: block;
}

.file-drop small {
  color: var(--faint);
  font-size: 0.65rem;
}

.file-drop-icon {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  margin-bottom: 0.25rem;
  place-items: center;
  color: var(--accent);
  background: rgba(91, 231, 183, 0.07);
  border: 1px solid rgba(91, 231, 183, 0.19);
  border-radius: 50%;
  font-size: 1.1rem;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.step-list {
  display: grid;
  gap: 0.85rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.step-list li > span {
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--accent);
  background: rgba(91, 231, 183, 0.07);
  border: 1px solid rgba(91, 231, 183, 0.18);
  border-radius: 50%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.65rem;
}

.step-list strong,
.step-list small {
  display: block;
}

.step-list strong {
  font-size: 0.76rem;
}

.step-list small {
  margin-top: 0.16rem;
  color: var(--faint);
  font-size: 0.66rem;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.75rem;
}

.toolbar label {
  min-width: 185px;
}

.toolbar-summary {
  margin-left: auto;
  align-self: center;
  color: var(--faint);
  font-size: 0.68rem;
}

/* Traffic and triage */

.traffic-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.65fr);
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.inspector {
  overflow: hidden;
}

.inspector-block {
  margin-top: 0.8rem;
}

.inspector-block h4,
.finding h4 {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.evidence-preview {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  padding: 0.7rem;
  color: #c8d6e8;
  background: #070d15;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  display: inline-flex;
  padding: 0.23rem 0.42rem;
  color: var(--amber);
  background: rgba(255, 203, 107, 0.07);
  border: 1px solid rgba(255, 203, 107, 0.17);
  border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6rem;
}

.card-list {
  display: grid;
  gap: 0.85rem;
}

.analysis-card {
  padding: 1rem;
  background: linear-gradient(145deg, rgba(17, 27, 41, 0.98), rgba(13, 21, 32, 0.98));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

.analysis-head h3 {
  margin: 0;
  font-size: 1rem;
}

.analysis-summary {
  max-width: 1050px;
  margin: 0.75rem 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
}

.finding-list {
  display: grid;
  gap: 0.55rem;
}

.finding {
  padding: 0.75rem;
  background: rgba(5, 11, 18, 0.38);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}

.finding > summary {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) auto auto;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
}

.finding > summary::-webkit-details-marker {
  display: none;
}

.finding-title {
  min-width: 0;
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.risk-score {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  color: var(--red);
  background: rgba(255, 111, 125, 0.08);
  border: 1px solid rgba(255, 111, 125, 0.22);
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.67rem;
  font-weight: 800;
}

.finding-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.finding-body .span-all {
  grid-column: 1 / -1;
}

.guidance-list,
.unknown-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.55;
}

/* Codex analyst */

.codex-layout {
  display: grid;
  grid-template-columns: minmax(310px, 0.72fr) minmax(520px, 1.6fr);
  gap: 0.85rem;
}

.codex-compose-panel,
.codex-queue-panel {
  align-self: start;
}

.sample-intake {
  margin: 0 0 0.9rem;
  padding: 0 0 0.9rem;
  border-bottom: 1px solid var(--line);
}

.sample-intake > summary {
  padding: 0.55rem 0.65rem;
  color: var(--blue);
  background: rgba(103, 167, 255, 0.045);
  border: 1px solid rgba(103, 167, 255, 0.16);
  border-radius: var(--radius-small);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 720;
}

.sample-intake[open] > summary {
  margin-bottom: 0.65rem;
}

.sample-intake .compact-form {
  margin: 0;
}

.file-drop-compact {
  min-height: 112px;
  padding: 0.7rem;
}

.file-drop-compact .file-drop-icon {
  width: 2rem;
  height: 2rem;
  margin-bottom: 0;
  font-size: 0.8rem;
}

.task-hint {
  margin: -0.35rem 0 0;
  padding: 0.65rem 0.72rem;
  color: var(--muted);
  background: rgba(103, 167, 255, 0.05);
  border-left: 2px solid rgba(103, 167, 255, 0.55);
  border-radius: 0 7px 7px 0;
  font-size: 0.68rem;
  line-height: 1.5;
}

.field-counter {
  justify-self: end;
  margin-top: -0.18rem;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6rem;
}

.scope-notice {
  display: grid;
  gap: 0.25rem;
  padding: 0.72rem;
  color: var(--muted);
  background: rgba(91, 231, 183, 0.045);
  border: 1px solid rgba(91, 231, 183, 0.16);
  border-radius: var(--radius-small);
  font-size: 0.66rem;
  line-height: 1.5;
}

.scope-notice strong {
  color: var(--accent);
  font-size: 0.68rem;
}

.codex-queue-wrap {
  max-height: 505px;
}

.codex-detail-panel {
  margin-top: 0.85rem;
  padding: 0;
  overflow: hidden;
}

.codex-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem 0.85rem;
}

.codex-detail-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
}

.codex-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0 1.1rem 1rem;
  list-style: none;
}

.codex-progress-step {
  position: relative;
  display: grid;
  grid-template-columns: 1.55rem minmax(0, 1fr);
  gap: 0.48rem;
  align-items: start;
  min-width: 0;
  padding-right: 0.55rem;
}

.codex-progress-step:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 0.76rem;
  left: 1.55rem;
  right: 0;
  height: 1px;
  background: var(--line-bright);
  content: "";
}

.progress-marker {
  position: relative;
  z-index: 1;
  display: grid;
  width: 1.55rem;
  height: 1.55rem;
  place-items: center;
  color: var(--faint);
  background: var(--panel-2);
  border: 1px solid var(--line-bright);
  border-radius: 50%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.65rem;
  font-weight: 850;
}

.codex-progress-step strong,
.codex-progress-step small {
  display: block;
}

.codex-progress-step strong {
  margin-top: 0.08rem;
  font-size: 0.68rem;
}

.codex-progress-step small {
  margin-top: 0.18rem;
  color: var(--faint);
  font-size: 0.59rem;
  line-height: 1.4;
}

.codex-progress-step.is-complete .progress-marker {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.codex-progress-step.is-current .progress-marker {
  background: rgba(255, 203, 107, 0.12);
  border-color: var(--amber);
  box-shadow: 0 0 16px rgba(255, 203, 107, 0.15);
}

.codex-progress-step.is-current .progress-marker::after {
  width: 0.34rem;
  height: 0.34rem;
  background: var(--amber);
  border-radius: 50%;
  content: "";
}

.codex-progress-step.is-failed .progress-marker {
  color: var(--red);
  background: rgba(255, 111, 125, 0.1);
  border-color: rgba(255, 111, 125, 0.55);
}

.codex-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(270px, 0.7fr);
  border-top: 1px solid var(--line);
}

.codex-result-section {
  min-width: 0;
  padding: 1rem 1.1rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.codex-result-section:nth-child(2n),
.codex-result-section.span-all {
  border-right: 0;
}

.codex-result-section.span-all {
  grid-column: 1 / -1;
}

.codex-result-section h4,
.result-heading h4 {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.patch-preview {
  max-height: 520px;
  color: #d9e5f4;
}

.error-preview {
  color: #ffc1c7;
  border-color: rgba(255, 111, 125, 0.3);
}

.codex-finding-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.codex-finding-item {
  padding: 0.7rem;
  background: rgba(7, 13, 21, 0.45);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.codex-finding-item strong {
  font-size: 0.72rem;
}

.codex-finding-item p {
  margin: 0.38rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.result-label {
  display: block;
  margin-top: 0.62rem;
  color: var(--accent);
  font-size: 0.58rem;
  font-weight: 780;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.codex-finding-item .json-preview {
  max-width: none;
  max-height: 14rem;
  margin: 0.55rem 0 0;
}

.codex-result-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.codex-result-group {
  padding: 0.75rem;
  background: rgba(7, 13, 21, 0.4);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.codex-result-group h5 {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.approval-gate {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 0.9fr);
  gap: 1rem 1.25rem;
  align-items: center;
  padding: 1.05rem 1.1rem;
  background: linear-gradient(100deg, rgba(255, 203, 107, 0.08), rgba(15, 23, 35, 0.5));
  border-top: 1px solid rgba(255, 203, 107, 0.28);
}

.approval-gate h3 {
  margin: 0;
  font-size: 0.96rem;
}

.approval-gate p:not(.eyebrow):not(.form-message) {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.52;
}

.approval-check {
  display: flex;
  grid-column: 2;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.7rem;
  color: var(--text);
  background: rgba(7, 13, 21, 0.55);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius-small);
  font-size: 0.68rem;
  line-height: 1.4;
}

.approval-check input {
  width: 1rem;
  min-height: 1rem;
  flex: 0 0 auto;
  margin: 0.08rem 0 0;
  padding: 0;
}

.approval-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  align-items: end;
  gap: 0.65rem;
}

.reject-field {
  max-width: 620px;
  justify-self: end;
}

.approval-gate .form-message {
  grid-column: 1 / -1;
}

.approval-readonly {
  grid-template-columns: minmax(0, 1fr);
}

/* Workspaces */

.workspace-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0.85rem;
}

.workspace-list-panel {
  align-self: start;
}

.select-list,
.file-list {
  display: grid;
  gap: 0.32rem;
}

.select-item,
.file-item {
  display: block;
  width: 100%;
  padding: 0.62rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.select-item:hover,
.file-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
}

.select-item.is-selected,
.file-item.is-selected {
  color: var(--text);
  background: rgba(91, 231, 183, 0.06);
  border-color: rgba(91, 231, 183, 0.16);
}

.select-item strong,
.select-item small {
  display: block;
}

.select-item strong {
  overflow: hidden;
  font-size: 0.73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-item small {
  margin-top: 0.18rem;
  color: var(--faint);
  font-size: 0.61rem;
}

.workspace-editor-panel {
  min-height: 570px;
  padding: 0;
  overflow: hidden;
}

.workspace-placeholder {
  min-height: 568px;
  border: 0;
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.workspace-header p:last-child:not(.eyebrow) {
  max-width: 680px;
  margin: 0.38rem 0 0;
  color: var(--muted);
  font-size: 0.71rem;
  line-height: 1.45;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.editor-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 430px;
}

.file-browser {
  padding: 0.75rem;
  background: rgba(7, 12, 19, 0.48);
  border-right: 1px solid var(--line);
}

.file-browser-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  color: var(--muted);
  font-size: 0.68rem;
}

.file-item {
  overflow: hidden;
  padding: 0.45rem 0.52rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-editor {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: #070d15;
}

.editor-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto;
  align-items: end;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  background: #0c141f;
  border-bottom: 1px solid var(--line);
}

.path-field input {
  min-height: 2rem;
  padding: 0.38rem 0.55rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.65rem;
}

#workspace-file-digest {
  max-width: 180px;
  padding-bottom: 0.5rem;
  overflow: hidden;
  font-size: 0.57rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-area {
  min-height: 360px;
  flex: 1;
  padding: 1rem;
  color: #dce8f7;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.71rem;
  line-height: 1.58;
  resize: vertical;
  tab-size: 4;
}

.code-area:focus {
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(91, 231, 183, 0.32);
}

#workspace-action-message {
  padding: 0 1rem;
}

.artifact-section {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid var(--line);
}

.artifact-list {
  display: grid;
  gap: 0.45rem;
}

.artifact-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  background: rgba(7, 13, 21, 0.45);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.68rem;
}

.artifact-item small {
  display: block;
  margin-top: 0.14rem;
  overflow: hidden;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

/* Configuration, research, audit */

.config-form {
  padding: 0;
  overflow: hidden;
}

.form-section {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
}

.fact-list {
  display: grid;
  gap: 0.55rem;
}

.fact-item {
  padding: 0.72rem;
  background: rgba(7, 13, 21, 0.42);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}

.fact-item p {
  margin: 0;
  font-size: 0.73rem;
  line-height: 1.5;
}

.fact-item a {
  display: inline-block;
  margin-top: 0.38rem;
  font-size: 0.65rem;
}

.fact-caveat {
  margin-top: 0.45rem !important;
  color: var(--amber);
  font-size: 0.65rem !important;
}

#research-response {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.policy-block {
  padding: 0.75rem;
  background: rgba(7, 13, 21, 0.42);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}

.policy-block h4 {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.67rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tool-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.tool-row {
  display: grid;
  grid-template-columns: auto minmax(140px, 0.5fr) minmax(180px, 1fr);
  gap: 0.6rem;
  padding: 0.48rem 0.55rem;
  color: var(--muted);
  background: rgba(7, 13, 21, 0.32);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.63rem;
}

.json-preview {
  max-width: 360px;
  max-height: 5rem;
  overflow: auto;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.59rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  width: min(360px, calc(100vw - 2rem));
  gap: 0.5rem;
}

.toast {
  padding: 0.72rem 0.85rem;
  color: var(--text);
  background: #142131;
  border: 1px solid var(--line-bright);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-small);
  box-shadow: var(--shadow);
  font-size: 0.73rem;
  line-height: 1.4;
}

.toast.is-error {
  border-left-color: var(--red);
}

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

  .traffic-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .inspector {
    min-height: 180px;
  }
}

@media (max-width: 1000px) {
  .sidebar {
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 170ms ease;
  }

  .sidebar-open .sidebar {
    transform: none;
  }

  .sidebar-open::after {
    position: fixed;
    z-index: 40;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    content: "";
  }

  .page-shell {
    margin-left: 0;
  }

  .mobile-menu {
    display: grid;
  }

  .system-state,
  .user-chip span:not(.avatar) {
    display: none;
  }

  .workspace-layout {
    grid-template-columns: 235px minmax(0, 1fr);
  }

  .codex-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    padding: 0.7rem;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  #refresh-view,
  .user-chip {
    display: none;
  }

  .main-content {
    padding: 0.8rem;
  }

  .metric-grid,
  .dashboard-grid,
    .research-grid,
    .split-grid,
    .codex-detail-grid,
    .workspace-layout,
    .policy-grid,
    .approval-gate {
    grid-template-columns: minmax(0, 1fr);
  }

  .codex-detail-head {
    flex-direction: column;
  }

  .codex-progress {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
  }

  .codex-progress-step:not(:last-child)::after {
    top: 1.55rem;
    bottom: -0.55rem;
    left: 0.76rem;
    width: 1px;
    height: auto;
  }

  .codex-result-section,
  .codex-result-section:nth-child(2n) {
    grid-column: auto;
    border-right: 0;
  }

  .approval-check,
  .approval-actions,
  .approval-gate .form-message {
    grid-column: auto;
  }

  .approval-actions {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .codex-result-groups {
    grid-template-columns: minmax(0, 1fr);
  }

  .reject-field {
    max-width: none;
    justify-self: stretch;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-wide {
    grid-column: auto;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar label {
    min-width: 0;
  }

  .toolbar-summary {
    margin-left: 0;
  }

  .form-grid,
  .form-grid-3,
  .finding-body,
  .form-section {
    grid-template-columns: minmax(0, 1fr);
  }

  .span-2 {
    grid-column: auto;
  }

  .workspace-list-panel {
    max-height: 330px;
    overflow: auto;
  }

  .workspace-header {
    flex-direction: column;
  }

  .action-row {
    justify-content: flex-start;
  }

  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .file-browser {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .file-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #workspace-file-digest {
    display: none;
  }

  .finding > summary {
    grid-template-columns: auto minmax(100px, 1fr) auto;
  }

  .finding > summary .badge:last-child {
    display: none;
  }

  .tool-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .tool-row span:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 460px) {
  .login-page {
    padding: 0;
  }

  .login-panel {
    min-height: 100vh;
    padding: 1.25rem;
    border: 0;
    border-radius: 0;
  }

  .metric-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .view-heading {
    flex-direction: column;
  }

  .artifact-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .artifact-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .artifact-actions .button {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
