/* Fiberklaar application design system */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

:root {
  --fk-cyan: #41c3ff;
  --fk-cyan-soft: #d9f3ff;
  --fk-cyan-border: #c6edff;
  --fk-coral: #ff5064;
  --fk-coral-soft: #ffdce0;
  --fk-black: #000000;
  --fk-body: #414b59;
  --fk-ink: #404448;
  --fk-muted: #929ca0;
  --fk-light: #efefef;
  --fk-light-2: #f5f5f5;
  --fk-border: #d9d9d9;
  --fk-input-border: #dedede;
  --fk-success: #77c552;
  --fk-success-soft: #d4edda;
  --fk-warning: #fff3cd;
  --fk-warning-text: #664d03;
  --fk-form-focus: #a0e1ff;
  --fk-focus-ring: rgba(65, 195, 255, .25);

  --bg: var(--fk-light-2);
  --surface: #ffffff;
  --border: var(--fk-border);
  --text: var(--fk-body);
  --text-muted: var(--fk-muted);
  --primary: var(--fk-cyan);
  --primary-hover: var(--fk-black);
  --accent: var(--fk-cyan);
  --muted: var(--fk-muted);
  --danger: var(--fk-coral);
  --pass: #2f7b1f;
  --pass-bg: var(--fk-success-soft);
  --fail: var(--fk-coral);
  --fail-bg: var(--fk-coral-soft);
  --error: var(--fk-coral);
  --error-bg: var(--fk-coral-soft);
  --skip: var(--fk-muted);
  --skip-bg: var(--fk-light);
  --radius: .25rem;
  --shadow-sm: 0 .125rem .25rem rgba(0, 0, 0, .075);
  --shadow-md: 0 .5rem 1rem rgba(0, 0, 0, .15);
  --font: "Steradian", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --transition-fast: .2s ease-in-out;
  --container: 1320px;
}

html {
  min-height: 100%;
  background: var(--bg);
  color-scheme: light;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
canvas {
  max-width: 100%;
}

a {
  color: var(--fk-black);
  text-decoration: underline;
  text-decoration-color: var(--fk-cyan);
  text-decoration-thickness: 2px;
  text-underline-offset: .18em;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover {
  color: var(--fk-coral);
  text-decoration-color: currentColor;
}

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

button {
  border: 0;
}

::selection {
  background: var(--fk-cyan);
  color: var(--fk-black);
}

:focus-visible {
  outline: 3px solid var(--fk-focus-ring);
  outline-offset: 2px;
}

nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--fk-black);
  border-bottom: 4px solid var(--fk-cyan);
  color: #ffffff;
}

.nav-inner {
  width: min(100%, var(--container));
  min-height: 76px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: #ffffff;
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.logo-mark {
  display: block;
  width: 2.3rem;
  height: 2.3rem;
  object-fit: contain;
  border-radius: 2px;
}

.logo:hover {
  color: var(--fk-cyan);
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .25rem;
  flex-wrap: wrap;
}

.nav-links a,
.nav-user {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: .45rem .7rem;
  border-radius: var(--radius);
  color: #ffffff;
  font-size: .95rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--fk-cyan);
  background: rgba(255, 255, 255, .08);
}

.nav-links a.nav-cta {
  margin-left: .25rem;
  background: var(--fk-coral);
  border: 2px solid var(--fk-coral);
  color: #ffffff;
}

.nav-links a.nav-cta:hover,
.nav-links a.nav-cta.active {
  background: #ffffff;
  color: var(--fk-coral);
}

.nav-user {
  gap: .45rem;
  color: var(--fk-light);
  font-size: .875rem;
  font-weight: 500;
}

main {
  width: min(100%, var(--container));
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  justify-items: center;
  min-width: 0;
}

main > * {
  min-width: 0;
  max-width: 100%;
}

.card {
  width: min(100%, 1180px);
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, .125);
  border-radius: var(--radius);
  padding: 2rem;
}

.upload-card {
  width: min(100%, 880px);
  margin: 0 auto;
}

.card > h1,
.card > .subtitle {
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

.card > form:not(.ticket-status-form) {
  width: min(100%, 720px);
  margin-right: auto;
  margin-left: auto;
}

.upload-card .docs-callout {
  max-width: 720px;
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

.card > .filter-bar,
.card > .table-wrap,
.summary-grid,
.result-block,
.docs-diagram-frame {
  min-width: 0;
  width: 100%;
}

.results-card {
  overflow: hidden;
}

.page-header,
.action-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1,
.action-row h1 {
  margin-bottom: .25rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--fk-black);
  font-family: var(--font);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

h1 {
  max-width: 18ch;
  margin-bottom: .5rem;
  font-size: clamp(2.25rem, 5vw, 2.875rem);
}

h2 {
  margin: 2rem 0 .9rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
  margin: 1.25rem 0 .65rem;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
}

h4 {
  margin: 1rem 0 .5rem;
  font-size: 1.125rem;
}

.subtitle {
  max-width: 72ch;
  margin-bottom: 1.5rem;
  color: var(--fk-ink);
  font-size: 1rem;
  line-height: 1.65;
}

.empty {
  padding: 1rem;
  background: var(--fk-light-2);
  border: 1px solid var(--fk-light);
  border-radius: var(--radius);
  color: var(--fk-muted);
  font-style: italic;
}

.mono {
  font-family: var(--mono);
  font-size: .92em;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-group label,
.ticket-status-form label,
.filter-bar label {
  display: block;
  color: var(--fk-black);
  font-size: .875rem;
  font-weight: 700;
}

.form-group label {
  margin-bottom: .45rem;
}

input[type="text"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--fk-input-border);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--fk-body);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

input[type="text"],
input[type="password"],
select,
textarea {
  padding: .72rem .85rem;
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

input[type="file"] {
  padding: .55rem;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  margin-right: .8rem;
  padding: .45rem .85rem;
  border: 2px solid var(--fk-black);
  border-radius: var(--radius);
  background: var(--fk-black);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

input[type="file"]::file-selector-button:hover {
  background: var(--fk-cyan);
  border-color: var(--fk-cyan);
  color: var(--fk-black);
}

input::placeholder,
textarea::placeholder {
  color: var(--fk-muted);
}

input[readonly],
input:disabled,
select:disabled,
textarea:disabled {
  background: var(--fk-light);
  color: var(--fk-muted);
  cursor: not-allowed;
}

input[type="text"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--fk-form-focus);
  box-shadow: 0 0 0 4px var(--fk-focus-ring);
  outline: none;
}

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

.form-wide,
.form-wide input,
.form-wide textarea,
.form-wide select {
  max-width: none;
}

.btn,
button.btn,
a.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1.25rem;
  border: 2px solid var(--fk-cyan);
  border-radius: var(--radius);
  background: var(--fk-cyan);
  color: var(--fk-black);
  cursor: pointer;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn:hover {
  background: #ffffff;
  border-color: var(--fk-black);
  color: var(--fk-black);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[disabled] {
  border-color: var(--fk-input-border);
  background: var(--fk-light);
  color: var(--fk-muted);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  border-color: var(--fk-coral);
  background: var(--fk-coral);
  color: #ffffff;
}

.btn-secondary:hover {
  background: #ffffff;
  color: var(--fk-coral);
  border-color: var(--fk-coral);
}

.btn-black {
  border-color: var(--fk-black);
  background: var(--fk-black);
  color: #ffffff;
}

.btn-black:hover {
  background: #ffffff;
  color: var(--fk-black);
}

.btn-danger {
  border-color: var(--fk-coral);
  background: var(--fk-coral);
  color: #ffffff;
}

.btn-danger:hover {
  background: #ffffff;
  color: var(--fk-coral);
}

.btn-neutral {
  border-color: var(--fk-black);
  background: #ffffff;
  color: var(--fk-black);
}

.btn-neutral:hover {
  background: var(--fk-black);
  color: #ffffff;
}

.btn-small {
  min-height: 36px;
  padding: .4rem .8rem;
  font-size: .875rem;
}

.btn-row,
.stack-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.stack-actions {
  margin-bottom: 1rem;
}

.stack-actions .ticket-status-form {
  margin-bottom: 0;
}

.btn-align-right {
  margin-left: auto;
}

.mt-lg {
  margin-top: 2rem;
}

.btn.mt-lg {
  display: flex;
  width: max-content;
}

.link-btn {
  background: none;
  border: 0;
  color: var(--fk-black);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: var(--fk-cyan);
  text-decoration-thickness: 2px;
  text-underline-offset: .18em;
}

.link-btn:hover {
  color: var(--fk-coral);
  text-decoration-color: currentColor;
}

.alert {
  margin-bottom: 1rem;
  padding: .9rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .95rem;
}

.alert p + p {
  margin-top: .35rem;
}

.alert-error {
  background: var(--fk-coral-soft);
  border-color: #ffcbd1;
  color: #99303c;
}

.alert-success {
  background: var(--fk-success-soft);
  border-color: #bfe5c7;
  color: #186429;
}

.secret-reveal {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--fk-light-2);
  border: 1px solid var(--fk-light);
  border-left: 6px solid var(--fk-cyan);
  border-radius: var(--radius);
}

.secret-reveal code {
  display: block;
  margin-top: .35rem;
  color: var(--fk-black);
  font-family: var(--mono);
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(120px, 1fr) auto;
  gap: .5rem;
  align-items: center;
  min-width: 420px;
}

.admin-inline-form input[type="password"] {
  min-height: 36px;
  padding: .45rem .6rem;
  font-size: .875rem;
}

.error-page {
  min-height: 420px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  overflow: hidden;
}

.error-copy {
  max-width: 680px;
}

.error-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-bottom: 1rem;
  padding: .25rem .7rem;
  background: var(--fk-cyan);
  border-radius: var(--radius);
  color: var(--fk-black);
  font-size: .8125rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.error-reference {
  width: min(100%, 620px);
  margin: 1.25rem 0 1.5rem;
  padding: .9rem 1rem;
  background: var(--fk-light-2);
  border-left: 6px solid var(--fk-coral);
}

.error-reference dt {
  margin-bottom: .25rem;
  color: var(--fk-black);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.error-reference dd {
  color: var(--fk-ink);
  word-break: break-word;
}

.error-code {
  min-height: 240px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, var(--fk-cyan) 0 18px, transparent 18px),
    var(--fk-black);
  border-radius: var(--radius);
  color: #ffffff;
}

.error-code span {
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 700;
  line-height: 1;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-item {
  position: relative;
  min-height: 104px;
  padding: 1rem;
  background: var(--fk-light-2);
  border: 1px solid var(--fk-light);
  border-radius: var(--radius);
}

.summary-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--fk-cyan);
}

.summary-label {
  display: block;
  margin-bottom: .25rem;
  color: var(--fk-muted);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-value {
  color: var(--fk-black);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.result-block {
  min-width: 0;
  max-width: 100%;
  margin-bottom: 1rem;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid var(--fk-light);
  border-left: 4px solid var(--fk-cyan);
  border-radius: var(--radius);
}

.result-block.status-pass {
  border-left-color: var(--fk-success);
}

.result-block.status-fail,
.result-block.status-error {
  border-left-color: var(--fk-coral);
}

.result-block.status-warn {
  border-left-color: var(--fk-warning-text);
}

.result-block.status-skip {
  border-left-color: var(--fk-muted);
}

.result-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  min-width: 0;
  color: var(--fk-black);
  font-weight: 700;
}

.utac {
  font-family: var(--mono);
  color: var(--fk-ink);
  overflow-wrap: anywhere;
}

.reasons {
  margin-top: .55rem;
  color: var(--fk-ink);
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.inline-note {
  margin: 0 0 .65rem;
  color: var(--fk-ink);
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.inline-gap {
  margin-left: .5rem;
}

.micro-meta {
  color: var(--fk-muted);
  font-size: .8rem;
}

details {
  margin-top: .8rem;
  border-top: 1px solid var(--fk-light);
}

details summary {
  padding: .8rem 0 .25rem;
  color: var(--fk-black);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--fk-cyan);
  text-decoration-thickness: 2px;
  text-underline-offset: .18em;
}

details summary:hover {
  color: var(--fk-coral);
  text-decoration-color: currentColor;
}

details pre,
pre {
  margin-top: .6rem;
  padding: 1rem;
  overflow-x: auto;
  background: var(--fk-light-2);
  border: 1px solid var(--fk-light);
  border-radius: var(--radius);
  color: var(--fk-ink);
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: .2rem .55rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: .75rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-pass {
  background: var(--fk-success);
  color: var(--fk-black);
}

.badge-fail,
.badge-error {
  background: var(--fk-coral);
  color: #ffffff;
}

.badge-warn {
  background: var(--fk-warning);
  border-color: #ffecb5;
  color: var(--fk-warning-text);
}

.badge-skip,
.badge-muted {
  background: var(--fk-light);
  color: var(--fk-muted);
}

.badge-type {
  background: var(--fk-cyan-soft);
  border-color: var(--fk-cyan-border);
  color: var(--fk-black);
}

.warn-icon {
  display: inline-flex;
  margin-left: .35rem;
  color: var(--fk-warning-text);
  cursor: default;
  font-size: .95rem;
  vertical-align: middle;
}

.table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-wrap > table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--fk-body);
  font-size: .9rem;
}

th,
td {
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--fk-light);
  text-align: left;
  vertical-align: top;
  overflow-wrap: break-word;
  word-break: break-word;
}

th {
  background: var(--fk-light-2);
  color: var(--fk-black);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

tbody tr {
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

tbody tr:hover {
  background: #fafdff;
}

tr.status-fail,
tr.status-error {
  background: #fff4f5;
}

tr.status-warn {
  background: #fffbeb;
}

.clickable-row {
  -webkit-tap-highlight-color: transparent;
}

.clickable-row:hover {
  background: var(--fk-cyan-soft);
  box-shadow: inset 4px 0 0 var(--fk-cyan);
}

.clickable-row:active {
  background: var(--fk-cyan-border);
}

.event-type {
  display: inline-flex;
  align-items: center;
  padding: .18rem .45rem;
  background: #ffffff;
  border: 1px solid var(--fk-border);
  border-radius: var(--radius);
  color: var(--fk-ink);
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 700;
}

.reasons-cell {
  max-width: 240px;
  color: var(--fk-ink);
  font-size: .82rem;
  word-break: break-word;
}

.mirror-col {
  color: var(--fk-black);
  font-weight: 700;
}

.mirror-match-card,
.chars-card,
.docs-table-card,
.docs-stage-card {
  min-width: 0;
  max-width: 100%;
  background: var(--fk-light-2);
  border: 1px solid var(--fk-light);
  border-radius: var(--radius);
}

.mirror-match-card {
  margin: 1rem 0;
  padding: 1rem;
}

.mirror-match-card h4,
.chars-card h4 {
  margin: 0 0 .75rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--fk-border);
  color: var(--fk-black);
  font-size: .875rem;
  font-weight: 700;
  text-transform: uppercase;
}

.chars-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
  min-width: 0;
}

.chars-card {
  padding: 1rem;
}

.chars-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: .85rem;
}

.chars-table td {
  padding: .28rem 0;
  border: 0;
}

.chars-table td:first-child {
  padding-right: .75rem;
  color: var(--fk-ink);
}

.chars-table td:last-child {
  text-align: right;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.kv-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1rem;
  margin: .85rem 0;
  min-width: 0;
}

.kv-grid-spaced {
  margin-bottom: 1rem;
}

.kv {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  min-width: 0;
  max-width: 100%;
  color: var(--fk-body);
  font-size: .92rem;
}

.kv-k {
  color: var(--fk-muted);
  font-weight: 700;
}

.kv-v {
  color: var(--fk-black);
  font-family: var(--mono);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.warn-text {
  color: var(--fk-warning-text);
  font-weight: 700;
}

.pass-text {
  color: #2f7b1f;
  font-weight: 700;
}

.fail-text {
  color: var(--fk-coral);
  font-weight: 700;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  align-items: end;
  gap: .9rem;
  margin-bottom: 1rem;
  padding: 1rem;
  min-width: 0;
  background: var(--fk-light-2);
  border: 1px solid var(--fk-light);
  border-top: 4px solid var(--fk-cyan);
  border-radius: var(--radius);
}

.filter-bar label {
  display: grid;
  gap: .35rem;
}

.filter-bar select,
.filter-bar input[type="text"],
.filter-bar input[type="email"] {
  min-height: 42px;
  padding: .55rem .65rem;
  font-size: .92rem;
}

.checks-cell {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  min-width: 220px;
  max-width: 420px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: .18rem .45rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
  white-space: normal;
  overflow-wrap: anywhere;
}

.check-pass {
  background: var(--fk-success-soft);
  border-color: #bfe5c7;
  color: #186429;
}

.check-fail {
  background: var(--fk-coral-soft);
  border-color: #ffcbd1;
  color: #99303c;
}

.spinner {
  display: none;
  width: 22px;
  height: 22px;
  border: 3px solid var(--fk-border);
  border-top-color: var(--fk-cyan);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner.active,
.btn-row .spinner.active {
  display: inline-block;
}

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

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

main {
  animation: fadeIn .25s ease-out;
}

.card,
.result-block,
.summary-item,
.chars-card,
.mirror-match-card,
.ticket-message {
  animation: fadeUp .28s ease-out both;
}

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

.badge-ticket-open {
  background: var(--fk-cyan-soft);
  border-color: var(--fk-cyan-border);
  color: var(--fk-black);
}

.badge-ticket-in_progress {
  background: var(--fk-warning);
  border-color: #ffecb5;
  color: var(--fk-warning-text);
}

.badge-ticket-resolved {
  background: var(--fk-success);
  color: var(--fk-black);
}

.badge-ticket-blocked {
  background: var(--fk-coral);
  color: #ffffff;
}

.badge-ticket-rejected {
  background: var(--fk-light);
  color: var(--fk-muted);
}

.badge-priority-low {
  background: var(--fk-light);
  color: var(--fk-muted);
}

.badge-priority-normal {
  background: var(--fk-cyan-soft);
  color: var(--fk-black);
}

.badge-priority-high {
  background: var(--fk-coral);
  color: #ffffff;
}

.ticket-thread {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ticket-message {
  padding: 1rem;
  background: #ffffff;
  border: 1px solid var(--fk-light);
  border-left: 4px solid var(--fk-cyan);
  border-radius: var(--radius);
}

.msg-contractor {
  margin-right: 2rem;
  border-left-color: var(--fk-cyan);
}

.msg-admin {
  margin-left: 2rem;
  border-left-color: var(--fk-success);
}

.msg-system {
  background: var(--fk-light-2);
  border-left-color: var(--fk-muted);
  color: var(--fk-ink);
}

.msg-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .45rem;
  font-size: .9rem;
}

.msg-body {
  color: var(--fk-ink);
  font-size: .98rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticket-status-form {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: .65rem;
  background: var(--fk-light-2);
  border: 1px solid var(--fk-light);
  border-radius: var(--radius);
}

.ticket-status-form select {
  width: auto;
  min-width: 160px;
  min-height: 38px;
  padding: .4rem .65rem;
  font-size: .9rem;
}

.drop-zone {
  margin-bottom: 1rem;
  padding: 2rem 1.5rem;
  background: #ffffff;
  border: 2px dashed var(--fk-cyan);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.drop-zone:hover,
.drop-zone.dragover {
  background: var(--fk-cyan-soft);
  border-color: var(--fk-black);
  box-shadow: inset 0 0 0 2px var(--fk-cyan);
}

.drop-zone-prompt {
  margin: 0;
  color: var(--fk-black);
  font-size: 1rem;
  font-weight: 700;
}

.drop-zone-hint {
  margin: .3rem 0 0;
  color: var(--fk-muted);
  font-size: .875rem;
}

.file-list {
  max-height: 220px;
  margin: 1rem 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  text-align: left;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .55rem .65rem;
  border-bottom: 1px solid var(--fk-light);
  color: var(--fk-ink);
  font-size: .9rem;
}

.file-list li:last-child {
  border-bottom: 0;
}

.file-list .remove-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--fk-light);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--fk-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.file-list .remove-btn:hover {
  border-color: var(--fk-coral);
  color: var(--fk-coral);
}

.file-count {
  margin-top: .5rem;
  color: var(--fk-muted);
  font-size: .875rem;
}

.docs-callout {
  margin: -.25rem 0 1.5rem;
  padding: 1rem;
  background: var(--fk-cyan-soft);
  border: 1px solid var(--fk-cyan-border);
  border-left: 4px solid var(--fk-cyan);
  border-radius: var(--radius);
  color: #1a4e66;
  font-size: .95rem;
}

.docs-callout a {
  color: var(--fk-black);
  font-weight: 700;
}

.docs-hero {
  background: var(--fk-black);
  border-color: var(--fk-black);
  color: #ffffff;
}

.docs-hero h1 {
  color: #ffffff;
}

.docs-hero .subtitle,
.docs-hero .docs-note {
  color: #ffffff;
}

.docs-eyebrow {
  display: inline-flex;
  margin-bottom: .8rem;
  padding: .28rem .6rem;
  background: var(--fk-cyan);
  border-radius: var(--radius);
  color: var(--fk-black);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.docs-anchor-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  margin: 1.25rem 0;
}

.docs-anchor-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: .45rem .8rem;
  border: 2px solid var(--fk-cyan);
  border-radius: var(--radius);
  background: transparent;
  color: #ffffff;
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
}

.docs-anchor-nav a:hover {
  background: var(--fk-cyan);
  color: var(--fk-black);
}

.docs-note {
  padding: .85rem 1rem;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius);
  font-size: .9rem;
}

.docs-section {
  scroll-margin-top: 6rem;
}

.docs-diagram-frame {
  margin-top: .75rem;
  padding: 1rem;
  background: var(--fk-light-2);
  border: 1px solid var(--fk-light);
  border-radius: var(--radius);
  overflow-x: auto;
}

.docs-diagram {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

/* Pipeline HTML diagram */
.pipeline-diagram {
  margin-top: .75rem;
  padding: 1.25rem;
  background: var(--fk-light-2);
  border: 1px solid var(--fk-light);
  border-radius: var(--radius);
}

.pipeline-header {
  margin-bottom: 1.25rem;
}

.pipeline-title {
  margin: 0 0 .25rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--fk-black);
}

.pipeline-subtitle {
  margin: 0 0 .75rem;
  color: var(--fk-muted);
  font-size: .9rem;
}

.pipeline-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}

.pipeline-pill {
  display: inline-block;
  padding: .3rem .75rem;
  background: var(--fk-cyan);
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--fk-black);
}

.pipeline-pill-note {
  font-size: .8rem;
  color: var(--fk-muted);
}

.pipeline-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}

.pipeline-stages {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.pipeline-stage {
  padding: .85rem 1rem;
  background: #ffffff;
  border: 2px solid #929ca0;
  border-radius: 6px;
}

.pipeline-stage--accent {
  background: #d9f3ff;
  border-color: var(--fk-cyan);
}

.pipeline-stage-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--fk-black);
  margin-bottom: .35rem;
}

.pipeline-stage p {
  margin: 0;
  font-size: .85rem;
  color: var(--fk-body);
  line-height: 1.45;
}

.pipeline-stage-meta {
  margin-top: .4rem;
  font-size: .78rem;
  color: var(--fk-muted);
}

.pipeline-arrow {
  position: relative;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pipeline-arrow::after {
  content: "";
  width: 3px;
  height: 100%;
  background: #404448;
}

.pipeline-arrow::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #404448;
}

.pipeline-checks {
  background: #ffffff;
  border: 2px solid #d9d9d9;
  border-radius: 6px;
  padding: 1rem;
}

.pipeline-checks-title {
  margin: 0 0 .2rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fk-black);
}

.pipeline-checks-subtitle {
  margin: 0 0 .85rem;
  font-size: .8rem;
  color: var(--fk-muted);
}

.pipeline-check-box {
  background: #ffffff;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  padding: .75rem .85rem;
  margin-bottom: .75rem;
}

.pipeline-check-box h4 {
  margin: 0 0 .4rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--fk-black);
}

.pipeline-check-box ul {
  margin: 0;
  padding-left: 1rem;
  font-size: .8rem;
  color: var(--fk-body);
  line-height: 1.55;
}

.pipeline-check-box li + li {
  margin-top: .2rem;
}

.pipeline-legend {
  margin-top: .5rem;
}

.pipeline-legend h4 {
  margin: 0 0 .4rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--fk-black);
}

.pipeline-legend-items {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.pipeline-legend-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .8rem;
  color: var(--fk-body);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot--pass { background: #77c552; }
.legend-dot--warn { background: #fff3cd; border: 2px solid #664d03; }
.legend-dot--fail { background: #ff5064; }
.legend-dot--info { background: var(--fk-cyan); }

.docs-stage-grid,
.docs-table-grid,
.docs-config-stack {
  display: grid;
  gap: 1rem;
}

.docs-stage-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.docs-table-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.docs-table-grid:first-of-type {
  margin-top: 0;
}

.docs-config-stack {
  grid-template-columns: 1fr;
}

.docs-stage-card,
.docs-table-card {
  padding: 1rem;
  min-width: 0;
  overflow: hidden;
}

.docs-table-card-wide {
  grid-column: span 2;
}

.docs-stage-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}

.docs-stage-head h3,
.docs-table-card h3 {
  margin: 0;
  font-size: 1.125rem;
}

.docs-stage-card h4 {
  margin: 1rem 0 .45rem;
  color: var(--fk-black);
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.docs-stage-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  background: var(--fk-cyan);
  border-radius: 50%;
  color: var(--fk-black);
  font-size: .9rem;
  font-weight: 700;
}

.docs-list {
  margin: 0;
  padding-left: 1.1rem;
}

.docs-list li + li {
  margin-top: .4rem;
}

.docs-list-compact li + li {
  margin-top: .25rem;
}

.docs-subhead {
  margin-top: 1rem;
}

.docs-formula {
  margin: 0 0 .85rem;
  background: #ffffff;
  border-left: 4px solid var(--fk-cyan);
}

.docs-table-card td.mono,
.docs-table-card .mono {
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.docs-disclaimer {
  margin-top: 1rem;
  padding: .85rem 1rem;
  background: #fffbeb;
  border: 1px solid #f0d060;
  border-radius: var(--radius);
  font-size: .875rem;
  color: var(--fk-body);
}

.docs-mini-note {
  margin-top: .8rem;
  color: var(--fk-muted);
  font-size: .875rem;
}

.login-wrapper {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 2rem;
  overflow: hidden;
  background: var(--fk-black);
}

.login-wrapper::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 38vh;
  min-height: 240px;
  background: var(--fk-cyan);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  box-shadow: var(--shadow-md);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
  color: var(--fk-black);
  font-size: 1rem;
  font-weight: 700;
}

.login-brand-mark {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
  border-radius: 2px;
}

.login-card h1 {
  margin-right: auto;
  margin-left: auto;
  text-align: center;
}

.login-card .subtitle {
  text-align: center;
}

.login-card input[type="text"],
.login-card input[type="password"],
.login-card .btn {
  width: 100%;
}

.fiber-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: .7;
}

.fiber-bg canvas {
  display: block;
  width: 100%;
  height: 100%;
}

@media (min-width: 1400px) {
  :root {
    --container: 1320px;
  }
}

@media (max-width: 900px) {
  .nav-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: .75rem;
    min-height: auto;
    padding: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-links a,
  .nav-user {
    min-height: 36px;
    padding: .4rem .55rem;
    font-size: .875rem;
  }

  main {
    padding: 1rem;
  }

  .card {
    padding: 1.25rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  h2 {
    font-size: 1.5rem;
  }

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

  .docs-table-grid {
    grid-template-columns: 1fr;
  }

  .docs-table-card-wide {
    grid-column: auto;
  }

  .pipeline-body {
    grid-template-columns: 1fr;
  }

  .error-page {
    grid-template-columns: 1fr;
  }

  .error-code {
    min-height: 160px;
  }
}

@media (max-width: 600px) {
  .file-row,
  .summary-grid,
  .chars-section,
  .docs-stage-grid {
    grid-template-columns: 1fr;
  }

  .btn,
  a.btn,
  button.btn {
    width: 100%;
  }

  .btn.mt-lg {
    width: 100%;
  }

  .btn-align-right {
    margin-left: 0;
  }

  .action-row,
  .page-header,
  .btn-row,
  .stack-actions,
  .ticket-status-form {
    align-items: stretch;
    flex-direction: column;
  }

  .ticket-status-form select {
    width: 100%;
  }

  .msg-contractor,
  .msg-admin {
    margin-left: 0;
    margin-right: 0;
  }

  .table-wrap th,
  .table-wrap td {
    padding: .55rem .6rem;
  }

  .chars-table td,
  .chars-table th {
    white-space: normal;
  }

  .mono {
    word-break: break-word;
    white-space: normal;
  }

  .docs-anchor-nav a {
    width: 100%;
    justify-content: center;
  }

  .docs-diagram {
    min-width: 560px;
  }

  .admin-inline-form {
    grid-template-columns: 1fr;
    min-width: 260px;
  }

  .login-wrapper {
    padding: 1rem;
  }
}
