* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f2ee;
  --surface: #fffefa;
  --surface-muted: #f8f6f0;
  --ink: #24231f;
  --muted: #68645b;
  --line: #ddd8cc;
  --line-strong: #c8c0b1;
  --accent: #416a58;
  --accent-soft: #e7f0ea;
  --danger: #9d3d32;
  --warning: #9a6b19;
  --shadow: 0 18px 48px rgba(63, 55, 43, 0.08);
  --mono: "SFMono-Regular", "Cascadia Code", "Liberation Mono", Consolas, monospace;
  --sans: "Geist", "Aptos", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(65, 106, 88, 0.08), transparent 30rem),
    linear-gradient(180deg, #f8f7f2 0%, var(--bg) 46rem);
  color: var(--ink);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  transform: translateY(-140%);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 8px 10px;
}

.skip-link:focus {
  transform: translateY(0);
}

.nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(221, 216, 204, 0.9);
  background: rgba(255, 254, 250, 0.88);
  padding: 12px max(20px, calc((100vw - 1280px) / 2));
  backdrop-filter: blur(18px);
}

.nav[hidden] {
  display: none !important;
}

.nav strong {
  min-width: max-content;
  margin-right: auto;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0;
}

.nav button,
button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 560;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(65, 106, 88, 0.22);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.nav button {
  position: relative;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.nav button:hover:not(.active) {
  background: var(--surface-muted);
  color: var(--ink);
}

.nav button.active {
  border-color: var(--line);
  background: var(--accent-soft);
  color: var(--accent);
}

.nav button.active::after {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -13px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  content: "";
}

.nav .logout-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--danger);
}

.nav .logout-button:hover:not(:disabled) {
  border-color: var(--danger);
  background: #fdf1ef;
}

.session-status {
  max-width: 220px;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  width: min(1280px, calc(100% - 40px));
  min-width: 0;
  margin: 0 auto;
  padding: 28px 0 48px;
}

header {
  margin-bottom: 20px;
}

.page-hero {
  display: grid;
  gap: 8px;
  max-width: 900px;
  margin-bottom: 22px;
}

.page-hero span {
  max-width: 620px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

header p,
.panel > p,
.skill-pick-panel p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

h1,
h2,
h3 {
  margin: 0;
  text-wrap: balance;
}

h1 {
  max-width: 820px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.04;
  font-weight: 720;
}

h2 {
  font-size: 21px;
  line-height: 1.18;
  font-weight: 680;
}

h3 {
  font-size: 15px;
  line-height: 1.28;
  font-weight: 650;
}

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

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 254, 250, 0.92);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(63, 55, 43, 0.04), 0 14px 36px -22px rgba(63, 55, 43, 0.32);
}

.panel-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title > span {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--accent);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 650;
}

.primary-action {
  border-color: rgba(65, 106, 88, 0.45);
  background: var(--accent);
  color: #fffefa;
}

.primary-action:hover:not(:disabled) {
  border-color: var(--accent);
  background: #315342;
}

/* Destructive actions: semantic danger color, visually separated */
.danger-action {
  border-color: rgba(157, 61, 50, 0.4);
  background: var(--surface);
  color: var(--danger);
  font-weight: 600;
}

.danger-action:hover:not(:disabled) {
  border-color: var(--danger);
  background: #fdf1ef;
}

/* Workbench action group */
.workbench-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Confirm modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(36, 35, 31, 0.5);
  backdrop-filter: blur(2px);
  animation: auth-fade 160ms ease both;
}

.modal-card {
  width: min(440px, 100%);
  border: 1px solid rgba(255, 254, 250, 0.7);
  border-radius: 14px;
  background: var(--surface);
  padding: 24px;
  box-shadow: 0 24px 60px -20px rgba(36, 35, 31, 0.5);
  animation: auth-rise 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 19px;
}

.modal-card p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions button {
  min-height: 40px;
  min-width: 88px;
}

.modal-card .modal-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-extra {
  margin: 0 0 18px;
}

.bulk-assign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .bulk-assign-grid { grid-template-columns: 1fr; }
}

.bulk-assign-group {
  border: 1px solid rgba(36, 35, 31, 0.18);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0;
}

.bulk-assign-group legend {
  font-size: 13px;
  font-weight: 600;
  padding: 0 4px;
}

.bulk-assign-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(36, 35, 31, 0.12);
  cursor: pointer;
}

.bulk-assign-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.bulk-assign-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* Reset global input sizing for compact dialog checkboxes and radios. */
.modal-extra input[type="checkbox"],
.modal-extra input[type="radio"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--accent);
  cursor: pointer;
}

.modal-extra input[type="radio"] {
  border-radius: 50%;
}

.bulk-assign-row span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-owner-group {
  padding: 8px 10px;
}

.export-owner-list {
  max-height: 220px;
}

.export-owner-row {
  min-height: 28px;
}

.bulk-assign-preview {
  margin: 14px 0 0 !important;
  font-size: 13px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-card { animation: none; }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-grid,
.team-grid {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
}

.auth-panel {
  max-width: 720px;
}

body.auth-only {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(120% 90% at 12% -10%, rgba(65, 106, 88, 0.18), transparent 46%),
    radial-gradient(90% 80% at 100% 110%, rgba(154, 107, 25, 0.08), transparent 50%),
    linear-gradient(180deg, #fbfaf5 0%, var(--bg) 100%);
}

body.auth-only .nav {
  display: none !important;
}

/* Soft ambient grid behind the auth card */
body.auth-only::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(65, 106, 88, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(65, 106, 88, 0.035) 1px, transparent 1px);
  background-size: 60px 60px;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 40%, #000 0%, transparent 78%);
  mask-image: radial-gradient(70% 70% at 50% 40%, #000 0%, transparent 78%);
  content: "";
}

body.auth-only main {
  display: grid;
  align-items: center;
  width: min(1040px, calc(100% - 40px));
  min-height: 100dvh;
  padding: 40px 0 56px;
}

/* Single elevated shell holding brand panel + form */
.auth-shell {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(380px, 1.08fr);
  align-items: stretch;
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 254, 250, 0.7);
  border-radius: 18px;
  background: rgba(255, 254, 250, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 254, 250, 0.9),
    0 1px 2px rgba(63, 55, 43, 0.06),
    0 32px 72px -24px rgba(63, 55, 43, 0.28);
  backdrop-filter: blur(20px) saturate(140%);
  animation: auth-rise 460ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-shell-single {
  grid-template-columns: minmax(300px, 0.92fr) minmax(380px, 1fr);
}

/* ---------- Brand panel (left) ---------- */
.auth-copy {
  position: relative;
  display: grid;
  align-content: space-between;
  gap: 18px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(95, 140, 118, 0.28), transparent 55%),
    linear-gradient(160deg, #2c3a32 0%, var(--ink) 62%);
  color: var(--surface);
  padding: 34px 32px;
}

.auth-copy::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 254, 250, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 254, 250, 0.04) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(90% 80% at 30% 10%, #000, transparent 80%);
  mask-image: radial-gradient(90% 80% at 30% 10%, #000, transparent 80%);
  pointer-events: none;
  content: "";
}

.auth-copy > * {
  position: relative;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-brand .auth-logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 254, 250, 0.22);
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(255, 254, 250, 0.16), rgba(255, 254, 250, 0.04));
  color: #cfe3d6;
}

.auth-brand .auth-logo svg {
  width: 20px;
  height: 20px;
}

.auth-brand span {
  font: 700 13px/1 var(--mono);
  letter-spacing: 0.06em;
  color: #e7efe9;
}

.auth-copy-body {
  display: grid;
  gap: 14px;
  align-content: start;
}

.auth-copy-body p {
  margin: 0;
  color: #aebfb4;
  font: 650 12px var(--mono);
  letter-spacing: 0.04em;
}

.auth-copy h1 {
  max-width: 420px;
  color: var(--surface);
  font-size: 30px;
  line-height: 1.14;
  font-weight: 720;
}

.auth-copy h1 + span {
  display: block;
  max-width: 360px;
  color: #c6cfc5;
  font-size: 14px;
  line-height: 1.65;
}

.auth-points {
  display: grid;
  gap: 12px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.auth-points li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  color: #d6ded5;
  font-size: 13.5px;
  line-height: 1.5;
}

.auth-points svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: #8fc0a6;
}

.auth-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 254, 250, 0.12);
  color: #9fb1a5;
  font: 600 11.5px var(--mono);
  letter-spacing: 0.03em;
}

.auth-foot svg {
  width: 14px;
  height: 14px;
  color: #8fc0a6;
}

/* ---------- Form panel (right) ---------- */
.auth-panel-form {
  display: grid;
  align-content: start;
  gap: 20px;
  background: linear-gradient(180deg, rgba(255, 254, 250, 0.92), rgba(255, 254, 250, 0.78));
  padding: 38px 36px;
}

/* Segmented tab switcher */
.auth-tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-muted);
  padding: 4px;
}

.auth-tabs[data-tabs="1"] {
  grid-template-columns: 1fr;
}

.auth-tab {
  position: relative;
  z-index: 1;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  transition: color 180ms ease;
}

.auth-tab[aria-selected="true"] {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(63, 55, 43, 0.06), 0 6px 16px -8px rgba(63, 55, 43, 0.2);
}

.auth-tab:hover:not([aria-selected="true"]) {
  color: var(--ink);
}

/* Tab panels: crossfade, no layout jump */
.auth-pane {
  display: grid;
  gap: 16px;
}

.auth-pane[hidden] {
  display: none;
}

.auth-card {
  display: grid;
  gap: 16px;
  border: none;
  background: none;
  padding: 0;
  box-shadow: none;
  animation: auth-fade 240ms ease both;
}

.auth-card-head {
  display: grid;
  gap: 4px;
}

.auth-card-head p {
  margin: 0;
  color: var(--accent);
  font: 650 12px var(--mono);
  letter-spacing: 0.04em;
}

.auth-card-head h2 {
  font-size: 22px;
}

.auth-card-head h1 {
  font-size: 30px;
}

.auth-card-head .auth-sub {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.auth-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
}

/* Fields inside auth: floating-ish label + leading icon + larger target */
.auth-card .field {
  display: grid;
  gap: 6px;
}

.auth-card .field > span {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}

.auth-input {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input > svg.auth-field-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
  transition: color 160ms ease;
}

.auth-card input {
  min-height: 46px;
  padding: 0 12px 0 38px;
  border-color: var(--line-strong);
  background: rgba(255, 254, 250, 0.9);
}

.auth-card .auth-input.no-icon input {
  padding-left: 12px;
}

.auth-card .auth-input.has-toggle input {
  padding-right: 44px;
}

.auth-card input:hover {
  border-color: var(--line-strong);
}

.auth-input:focus-within > svg.auth-field-icon {
  color: var(--accent);
}

.auth-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(65, 106, 88, 0.14);
  outline: none;
}

/* Password show/hide toggle */
.auth-pw-toggle {
  position: absolute;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.auth-pw-toggle:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.auth-pw-toggle svg {
  width: 18px;
  height: 18px;
}

.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

/* Primary CTA spans full width, single focus per pane */
.auth-actions button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  border-color: var(--accent);
  background: linear-gradient(180deg, #4c7965, var(--accent));
  color: var(--surface);
  font-size: 14.5px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(36, 35, 31, 0.18), 0 10px 24px -12px rgba(65, 106, 88, 0.6);
}

.auth-actions button[type="submit"]:hover:not(:disabled) {
  background: linear-gradient(180deg, #527f6b, #3c6451);
  border-color: #3c6451;
}

.auth-actions button[type="submit"]:disabled {
  opacity: 0.7;
}

/* Inline spinner */
.auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 254, 250, 0.45);
  border-top-color: var(--surface);
  border-radius: 50%;
  animation: auth-spin 640ms linear infinite;
}

/* Message with leading icon */
.auth-card .message {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

.auth-card .message svg {
  flex: none;
  width: 15px;
  height: 15px;
}

.auth-card .message:empty {
  display: none;
}

.auth-switch-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.auth-switch-hint button {
  min-height: auto;
  padding: 0 2px;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

@keyframes auth-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes auth-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@media (prefers-reduced-motion: reduce) {
  .auth-shell,
  .auth-card { animation: none; }
  .auth-spinner { animation-duration: 1200ms; }
  .failure-row,
  .report-kpi-strip div { transition: none; }
  .failure-row:hover { transform: none; }
}

.table-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.table-row,
.summary-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  padding: 10px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease;
}

.table-row:hover,
.summary-row:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.summary-row {
  width: 100%;
  min-height: 44px;
}

.table-row > *,
.summary-row > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

.false-positive-table {
  display: grid;
  margin-top: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.false-positive-row-grid {
  display: grid;
  grid-template-columns: 84px minmax(180px, 1fr) 92px minmax(360px, 1.8fr) minmax(460px, 2.2fr) 120px 168px 190px 112px;
  min-width: 1766px;
  align-items: start;
}

.false-positive-row-grid > span {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding: 10px;
  overflow-wrap: anywhere;
}

.false-positive-header > span {
  border-top: 0;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.false-positive-record:hover > span {
  background: var(--surface-muted);
}

.false-positive-long {
  overflow-wrap: break-word;
  white-space: pre-line;
  word-break: normal;
}

.collaboration-box {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  border: 1px solid rgba(65, 106, 88, 0.22);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(231, 240, 234, 0.66), rgba(248, 246, 240, 0.9));
  padding: 12px;
}

.collaboration-head,
.note-row,
.owner-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.collaboration-head {
  justify-content: space-between;
}

.collaboration-head span {
  border: 1px solid #9fb9a8;
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.72);
  color: var(--accent);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 650;
}

.collaboration-actions select,
.owner-filter select,
.note-row input {
  min-height: 36px;
  min-width: 140px;
}

.note-row input {
  flex: 1 1 220px;
}

.note-preview {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.summary-group {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.summary-problem {
  border-left: 3px solid var(--accent);
  background: var(--surface-muted);
  padding: 10px;
}

.panel .toolbar {
  margin-top: 14px;
  margin-bottom: 0;
}

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

.loading-panel {
  max-width: 720px;
}

.skeleton-lines {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.skeleton-lines span {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, #ebe6db, #f7f4ec, #ebe6db);
  background-size: 220% 100%;
  animation: skeleton-sheen 1.4s ease-in-out infinite;
}

.skeleton-lines span:nth-child(2) {
  width: 72%;
}

.skeleton-lines span:nth-child(3) {
  width: 44%;
}

@keyframes skeleton-sheen {
  from {
    background-position: 120% 0;
  }

  to {
    background-position: -120% 0;
  }
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e1d8;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #71917e);
}

.progress-stage {
  margin-top: 10px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.hint-text {
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.preview-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

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

.preview-meta div,
.failure-meta div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 9px;
}

.preview-meta dt,
.failure-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.preview-meta dd,
.failure-meta dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.message {
  min-height: 20px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 560;
}

.message.error {
  color: var(--danger);
}

.message.ok {
  color: var(--accent);
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 520px;
  resize: vertical;
  padding: 12px;
  font: 13px var(--mono);
}

.compact-textarea {
  min-height: 132px;
  line-height: 1.45;
}

select,
input {
  min-height: 40px;
  padding: 0 11px;
}

/* Custom dropdown chevron for consistent cross-browser look */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2368645b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
}

select:hover,
select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23416a58' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

textarea:hover,
select:hover,
input:hover {
  border-color: var(--accent);
}

textarea:focus,
select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(65, 106, 88, 0.14);
  outline: none;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.check-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.check-control input {
  min-height: 0;
  width: 16px;
  height: 16px;
  padding: 0;
}

pre {
  max-width: 100%;
  max-height: 420px;
  overflow: auto;
  border: 1px solid #3a3d33;
  border-radius: 10px;
  background: #252820;
  color: #f0efe8;
  padding: 14px;
  font: 13px/1.5 var(--mono);
  box-shadow: inset 0 1px 0 rgba(255, 254, 250, 0.04);
}

.report-grid {
  grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 1.22fr);
  align-items: start;
}

.report-hero {
  position: relative;
}

.report-summary-panel {
  position: sticky;
  top: 82px;
}

.report-kpi-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 16px;
}

.report-kpi-strip div {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(221, 216, 204, 0.85);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.92), rgba(248, 246, 240, 0.94));
  padding: 12px 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.report-kpi-strip div::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--line-strong);
  content: "";
}

/* Accent the actionable metrics: 未处理 (2nd) warning, 受阻 (4th) danger */
.report-kpi-strip div:nth-child(2)::before { background: var(--warning); }
.report-kpi-strip div:nth-child(4)::before { background: var(--danger); }

.report-kpi-strip div:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 22px -12px rgba(63, 55, 43, 0.3);
}

.report-kpi-strip dt {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.report-kpi-strip dd {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 26px;
  font-weight: 720;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.report-kpi-strip div:nth-child(2) dd { color: var(--warning); }
.report-kpi-strip div:nth-child(4) dd { color: var(--danger); }

.report-workbench {
  padding: 0;
  overflow: hidden;
}

.report-workbench > .panel-title {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.96), rgba(248, 246, 240, 0.82));
  padding: 18px;
}

.wizard-grid {
  grid-template-columns: minmax(360px, 0.95fr) minmax(440px, 1.05fr);
  align-items: start;
}

.wizard-form-panel,
.wizard-output-panel {
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.96), rgba(255, 254, 250, 0.88));
}

.wizard-section {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 0 0 18px;
}

.wizard-section + .wizard-section {
  padding-top: 18px;
}

.wizard-section-head {
  display: flex;
  align-items: start;
  gap: 10px;
}

.wizard-section-head > span {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 1px solid #9fb9a8;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 720;
}

.wizard-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.compact-grid {
  grid-template-columns: minmax(180px, 0.6fr) minmax(160px, 0.4fr);
}

.wizard-toolbar {
  padding-top: 4px;
}

.wizard-output-panel {
  position: sticky;
  top: 82px;
  min-width: 0;
  overflow: hidden;
}

.wizard-output-panel textarea {
  min-height: 440px;
  border-color: rgba(65, 106, 88, 0.35);
  background: #fffdf7;
  box-shadow: inset 0 1px 0 rgba(255, 254, 250, 0.8);
}

.schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  align-items: start;
}

.schedule-config-panel {
  grid-column: 1 / -1;
}

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

.schedule-actions {
  margin: 14px 0 0;
}

.schedule-actions .message {
  flex: 1 1 220px;
  min-width: 180px;
}

.schedule-next-card {
  display: grid;
  gap: 4px;
  margin: 2px 0 14px;
  border: 1px solid rgba(65, 106, 88, 0.28);
  border-radius: 10px;
  background: linear-gradient(180deg, #f3f8f5 0%, var(--accent-soft) 100%);
  padding: 14px;
}

.schedule-next-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.schedule-next-card strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 720;
  overflow-wrap: anywhere;
}

.schedule-plan-panel,
.schedule-cleanup-panel {
  min-height: 100%;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-grid .field {
  margin-bottom: 0;
}

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

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.scan-rules-editor {
  display: grid;
  gap: 10px;
}

.rules-editor-head,
.scan-rule-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rules-editor-head > div {
  display: grid;
  gap: 3px;
}

.rules-editor-head span {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.scan-rule-list {
  display: grid;
  gap: 10px;
}

.scan-rule-row {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(221, 216, 204, 0.95);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.72);
  padding: 12px;
}

.scan-rule-row.active {
  border-color: rgba(65, 106, 88, 0.45);
  box-shadow: 0 0 0 3px rgba(65, 106, 88, 0.08);
}

.scan-rule-title strong {
  color: var(--accent);
  font-size: 13px;
}

.scan-rule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.scan-rule-actions button,
.rules-editor-head button {
  min-height: 32px;
  padding: 6px 10px;
}

.preflight-panel,
.skill-pick-panel {
  min-width: 0;
  margin-top: 14px;
}

.skill-pick-panel {
  border: 1px solid rgba(221, 216, 204, 0.88);
  border-radius: 10px;
  background: rgba(248, 246, 240, 0.72);
  padding: 14px;
}

.skill-pick-panel p {
  margin-bottom: 8px;
}

.skill-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.skill-chip {
  display: grid;
  height: auto;
  min-height: 58px;
  align-content: center;
  border-color: rgba(65, 106, 88, 0.22);
  background: rgba(255, 254, 250, 0.84);
  text-align: left;
}

.skill-chip:hover:not(:disabled) {
  border-color: rgba(65, 106, 88, 0.55);
  background: var(--accent-soft);
}

.skill-chip span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.preflight-summary {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 650;
}

.preflight-summary.ok {
  border-color: #9fb9a8;
  background: var(--accent-soft);
  color: var(--accent);
}

.preflight-summary.error {
  border-color: #d4aaa3;
  background: #fbefed;
  color: var(--danger);
}

.check-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.check-row {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 9px;
  background: var(--surface);
  padding: 12px 14px;
  box-shadow: 0 8px 22px rgba(63, 55, 43, 0.04);
}

.check-row.pass {
  border-left-color: var(--accent);
}

.check-row.warn {
  border-left-color: var(--warning);
}

.check-row.error {
  border-left-color: var(--danger);
}

.check-row p,
.failure-row p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.check-row pre {
  width: 100%;
  max-height: 180px;
  margin-bottom: 0;
}

.preflight-repair {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.preflight-repair p {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.repair-button {
  justify-self: start;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-muted);
  padding: 14px;
  color: var(--muted);
}

.failure-group {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(248, 246, 240, 0.86), rgba(255, 254, 250, 0.9));
  padding: 12px;
}

.failure-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.failure-group-head p {
  margin: 2px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.failure-group-head strong {
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  padding: 3px 11px;
  color: var(--accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.failure-group-list {
  display: grid;
  gap: 10px;
}

.failure-row {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  padding: 15px 16px;
  box-shadow: 0 1px 2px rgba(63, 55, 43, 0.04), 0 10px 26px -16px rgba(63, 55, 43, 0.3);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.failure-row:hover {
  box-shadow: 0 1px 2px rgba(63, 55, 43, 0.06), 0 16px 34px -16px rgba(63, 55, 43, 0.4);
  transform: translateY(-1px);
}

.failure-row.triage-resolved {
  border-color: #c8d7cd;
  border-left-color: #9fb9a8;
  background: #fbfdfa;
  box-shadow: none;
}

.failure-row.triage-resolved:hover {
  transform: none;
}

.failure-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.failure-head strong {
  max-width: 760px;
  font-size: 15px;
  line-height: 1.45;
}

.failure-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.severity-badge,
.triage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 9px 2px 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

/* Status dot so meaning is not conveyed by color alone */
.severity-badge::before,
.triage-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.severity-badge.severity-error {
  border-color: #c78379;
  background: #ffe4df;
  color: var(--danger);
}

.severity-badge.severity-warning {
  border-color: #d8c594;
  background: #fff6d7;
  color: var(--warning);
}

.severity-badge.severity-info {
  border-color: #b8c4d6;
  background: #eef4fb;
  color: #31506f;
}

.failure-row.severity-error {
  border-left-color: var(--danger);
}

.failure-row.severity-warning {
  border-left-color: var(--warning);
}

.failure-row.severity-info {
  border-left-color: #6c86a3;
}

.triage-badge.open {
  border-color: #d8c594;
  background: #fff6d7;
  color: var(--warning);
}

.triage-badge.in_progress {
  border-color: #9db8cf;
  background: #edf6ff;
  color: #31506f;
}

.triage-badge.blocked {
  border-color: #c78379;
  background: #ffe4df;
  color: var(--danger);
}

.triage-badge.resolved {
  border-color: #9fb9a8;
  background: var(--accent-soft);
  color: var(--accent);
}

.failure-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.repair-hint {
  color: var(--accent);
  font-weight: 650;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  padding: 7px 8px;
}

.pagination button {
  min-height: 36px;
}

.pagination-step {
  flex: 0 0 auto;
}

.pagination-info {
  flex: 1 1 auto;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pagination-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.pagination-page {
  min-width: 36px;
  padding: 0 8px;
  border-color: var(--line);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

.pagination-page:hover:not(.active):not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.pagination-page.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
  cursor: default;
}

.pagination-gap {
  min-width: 20px;
  color: var(--muted);
  text-align: center;
  font-weight: 650;
  user-select: none;
}

.pagination span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.report-actions {
  display: grid;
  gap: 12px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 246, 240, 0.72);
  padding: 14px 18px;
}

.report-actions > div {
  display: grid;
  gap: 7px;
}

.filter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.report-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.report-filter button {
  min-height: 36px;
  border-color: var(--line);
  background: var(--surface-muted);
  font-weight: 600;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.report-filter button:hover:not(.active):not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface);
}

.report-filter button.active {
  border-color: #9fb9a8;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(65, 106, 88, 0.18);
}

.report-workbench .pagination {
  margin: 14px 18px;
}

#failureList {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.report-workbench > .message {
  display: block;
  padding: 0 18px 18px;
}

.failure-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.failure-detail {
  display: grid;
  gap: 10px;
}

.failure-detail:empty {
  display: none;
}

.detail-loading,
.log-path-detail {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
  color: var(--muted);
}

.log-path-detail {
  display: grid;
  gap: 6px;
  border-style: solid;
}

.log-path-detail span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.log-path-detail code {
  overflow-wrap: anywhere;
  color: var(--ink);
  font: 13px var(--mono);
}

@media (max-width: 900px) {
  .nav {
    position: static;
    align-items: stretch;
    flex-direction: column;
    padding: 14px 20px;
  }

  .nav strong {
    margin-right: 0;
  }

  main {
    width: min(100% - 28px, 1280px);
    padding-top: 20px;
  }

  body.auth-only main {
    width: min(100% - 28px, 720px);
    min-height: 100dvh;
    padding: 24px 0 34px;
  }

  .grid,
  .report-grid,
  .wizard-grid,
  .schedule-layout,
  .field-grid,
  .schedule-form-grid,
  .skill-picker,
  .preview-meta,
  .preview-meta.progress-meta,
  .failure-meta,
  .auth-shell,
  .auth-shell-single,
  .auth-form-grid {
    grid-template-columns: 1fr;
  }

  .auth-copy,
  .auth-panel-form {
    padding: 24px 20px;
  }

  .auth-copy {
    gap: 14px;
  }

  .auth-points {
    display: none;
  }

  .auth-copy h1 {
    font-size: 26px;
  }

  .report-summary-panel,
  .wizard-output-panel {
    position: static;
  }

  .report-workbench > .panel-title,
  .report-actions,
  #failureList,
  .report-workbench > .message {
    padding-right: 14px;
    padding-left: 14px;
  }

  .report-kpi-strip,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .panel-title {
    flex-direction: column;
  }
}

.config-profile-bar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.compact-field {
  margin: 0;
}

@media (max-width: 760px) {
  .config-profile-bar {
    grid-template-columns: 1fr;
  }
}

/* ---------- Configuration Center ---------- */
.config-profile-panel {
  margin-bottom: 16px;
}

.config-help {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.config-path-meta {
  margin-bottom: 0;
}

.config-path-meta dd {
  font: 600 12.5px/1.4 var(--mono);
  overflow-wrap: anywhere;
}

.config-editor-panel {
  display: flex;
  flex-direction: column;
}

.config-editor-meta {
  font: 650 12px var(--mono);
}

.config-editor {
  min-height: 640px;
  flex: 1 1 auto;
  padding: 16px;
  font: 13.5px/1.65 var(--mono);
  tab-size: 2;
}

@media (min-height: 920px) {
  .config-editor {
    min-height: 70vh;
  }
}

.config-editor-help {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.config-actions {
  margin-top: 16px;
}

.config-actions .message {
  flex: 1 1 200px;
  min-width: 160px;
}

