:root {
  --ink: #102033;
  --muted: #607087;
  --line: #d9e1e8;
  --surface: #ffffff;
  --canvas: #f4f7f9;
  --nav: #172238;
  --nav-hover: #25334f;
  --brand: #06705a;
  --brand-strong: #045442;
  --blue: #2668d8;
  --red: #bc2e2e;
  --amber: #a46106;
  --green-soft: #e8f6f1;
  --blue-soft: #eaf1ff;
  --red-soft: #fbecec;
  --amber-soft: #fff3df;
  --radius: 6px;
  --shadow: 0 8px 24px rgba(16, 32, 51, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.sr-only,
.skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 2px solid var(--blue);
  border-radius: var(--radius);
}

.app-shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 238px;
  flex-direction: column;
  overflow-y: auto;
  background: var(--nav);
  color: white;
}

.brand-lockup,
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-lockup {
  min-height: 76px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-lockup strong,
.brand-lockup small,
.sidebar-footer strong,
.sidebar-footer small {
  display: block;
}

.brand-lockup small,
.sidebar-footer small {
  margin-top: 2px;
  color: #b9c5d5;
  font-size: 11px;
}

.brand-mark,
.user-avatar {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.sidebar nav {
  flex: 1;
  padding: 12px 10px;
}

.nav-link {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: #dce5ef;
  font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
  background: var(--nav-hover);
  color: white;
  text-decoration: none;
}

.nav-link.active {
  box-shadow: inset 3px 0 var(--brand);
}

.nav-dot {
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.nav-section {
  display: block;
  margin: 18px 12px 7px;
  color: #8fa0b7;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-footer {
  min-height: 72px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-footer > div {
  min-width: 0;
  flex: 1;
}

.sidebar-footer strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  grid-column: 2;
  min-width: 0;
}

.topbar,
.mobile-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  min-height: 64px;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 28px;
}

.mobile-bar {
  display: none;
}

.global-search {
  display: flex;
  width: min(520px, 68%);
  height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
}

.global-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
}

.main-content {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px 28px 48px;
}

.page-header {
  display: flex;
  min-height: 68px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.page-header h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.page-header p {
  max-width: 780px;
  margin: 5px 0 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button,
button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
}

.button:hover {
  text-decoration: none;
}

.button.primary,
button.primary {
  background: var(--brand);
  color: white;
}

.button.primary:hover,
button.primary:hover {
  background: var(--brand-strong);
}

.button.secondary,
button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button.danger,
button.danger {
  border-color: #efb9b9;
  background: var(--red-soft);
  color: var(--red);
}

.button.compact,
button.compact {
  min-height: 34px;
  padding: 6px 10px;
}

.icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.icon-button.inverse {
  border-color: rgba(255, 255, 255, 0.2);
  color: white;
}

.metrics-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

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

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 22px;
}

.metric small {
  margin-top: 4px;
  color: var(--muted);
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.75fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-header {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f8fafb;
}

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

.table-primary {
  font-weight: 750;
}

.table-secondary {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nowrap {
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.badge.success,
.flash.success {
  background: var(--green-soft);
  color: var(--brand-strong);
}

.badge.info,
.flash.info {
  background: var(--blue-soft);
  color: #174b9c;
}

.badge.warning,
.flash.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.danger,
.flash.danger {
  background: var(--red-soft);
  color: var(--red);
}

.badge.neutral,
.flash.neutral {
  background: #eef1f4;
  color: #526172;
}

.flash {
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: var(--radius);
  font-weight: 650;
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  overflow-x: auto;
}

.pipeline-step {
  min-width: 130px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.pipeline-step:last-child {
  border-right: 0;
}

.pipeline-step strong,
.pipeline-step span {
  display: block;
}

.pipeline-step strong {
  font-size: 20px;
}

.pipeline-step span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.activity-list,
.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list li,
.check-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.activity-list li:last-child,
.check-list li:last-child {
  border-bottom: 0;
}

.activity-list p,
.check-list p {
  margin: 0;
}

.activity-list small,
.check-list small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

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

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

.field {
  min-width: 0;
}

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

.field label,
.field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cbd5df;
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
}

.field textarea {
  min-height: 108px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.global-search:focus-within {
  border-color: var(--blue);
  outline: 3px solid rgba(38, 104, 216, 0.15);
}

.field small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(140px, 0.35fr)) auto;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.filters input,
.filters select {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.4fr);
  gap: 18px;
}

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

.definition-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.definition-grid dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.empty-state {
  max-width: 700px;
  margin: 60px auto;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.empty-state h1,
.empty-state h2 {
  margin-top: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px;
}

.auth-shell {
  display: grid;
  place-items: center;
  background: #edf2f5;
}

.auth-main {
  width: min(460px, calc(100% - 32px));
}

.auth-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.auth-header {
  padding: 26px;
  background: var(--nav);
  color: white;
}

.auth-header .brand-lockup {
  min-height: 0;
  padding: 0;
  border: 0;
}

.auth-copy {
  padding: 26px;
}

.auth-copy h1 {
  margin: 0 0 5px;
  font-size: 23px;
}

.auth-copy > p {
  margin: 0 0 20px;
  color: var(--muted);
}

.auth-copy .field {
  margin-bottom: 14px;
}

.auth-copy .button {
  width: 100%;
  margin-top: 4px;
}

.auth-links {
  margin-top: 18px;
  text-align: center;
}

.file-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef2;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--brand);
}

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

  .metric:nth-child(3) {
    border-right: 0;
  }

  .metric:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

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

  .filters .button {
    width: fit-content;
  }

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .workspace {
    display: block;
  }

  .mobile-bar {
    position: sticky;
    z-index: 25;
    top: 0;
    display: flex;
    min-height: 56px;
    gap: 10px;
    padding: 8px 14px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-weight: 800;
  }

  .mobile-brand:hover {
    text-decoration: none;
  }

  .mobile-brand .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 29;
    inset: 0;
    background: rgba(6, 15, 28, 0.45);
  }

  .topbar {
    position: static;
    padding: 10px 14px;
  }

  .global-search {
    width: 100%;
  }

  .topbar > .button {
    display: none;
  }

  .main-content {
    padding: 18px 14px 40px;
  }

  .page-header {
    display: block;
  }

  .page-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .metrics-band,
  .split-grid,
  .detail-grid,
  .form-grid,
  .form-grid.three,
  .definition-grid {
    grid-template-columns: 1fr;
  }

  .metric,
  .metric:nth-child(3) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(n + 4) {
    border-top: 0;
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 18px -16px -16px;
    padding: 12px 16px;
    background: white;
  }
}

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

