:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-muted: #eef2f6;
  --text: #111827;
  --text-strong: #050816;
  --muted: #667085;
  --muted-strong: #475467;
  --border: #d9e1ea;
  --border-soft: #e8edf3;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --success: #177245;
  --error: #b42318;
  --warning: #9a6700;
  --shadow: 0 16px 42px rgba(16, 24, 40, 0.08);
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

a:hover {
  color: var(--accent-strong);
  text-decoration: none;
}

code {
  background: #f2f4f7;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: #27364a;
  display: inline-block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 4px 7px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.site-sidebar {
  background: #fcfdff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 26px;
  min-width: 0;
  min-height: 100vh;
  padding: 24px 18px;
  position: sticky;
  top: 0;
}

.brand {
  align-items: center;
  color: var(--text-strong);
  display: flex;
  gap: 12px;
  min-height: 44px;
}

.brand:hover {
  color: var(--text-strong);
}

.brand-mark {
  align-items: center;
  background: var(--text-strong);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 42px;
  font-size: 13px;
  font-weight: 800;
  height: 42px;
  justify-content: center;
}

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

.brand strong {
  font-size: 16px;
  letter-spacing: 0;
  line-height: 1.2;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav a {
  align-items: center;
  border-radius: 7px;
  color: var(--muted-strong);
  display: flex;
  font-size: 14px;
  font-weight: 720;
  gap: 10px;
  min-height: 40px;
  padding: 9px 10px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav a span {
  color: #98a2b3;
  font-size: 11px;
  font-weight: 800;
  min-width: 22px;
}

.nav a:hover,
.nav a.is-active {
  background: #edf7f6;
  color: var(--accent-strong);
}

.nav a:hover {
  transform: translateX(2px);
}

.sidebar-footer {
  border-top: 1px solid var(--border-soft);
  margin-top: auto;
  padding-top: 16px;
}

.sidebar-footer span,
.topbar-label,
.eyebrow {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-footer strong {
  color: var(--text-strong);
  display: block;
  font-size: 14px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
}

.site-header {
  align-items: center;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header strong {
  color: var(--text-strong);
  display: block;
  font-size: 15px;
}

.logout-form {
  margin: 0;
}

.page {
  margin: 0 auto;
  max-width: 1320px;
  min-width: 0;
  padding: 32px;
  width: 100%;
}

.auth-page {
  max-width: none;
  min-height: 100vh;
  padding: 24px;
}

.page-title {
  align-items: flex-end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-title h1 {
  color: var(--text-strong);
  font-size: 31px;
  font-weight: 780;
  line-height: 1.12;
  margin: 0;
}

h2 {
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 760;
  line-height: 1.2;
  margin: 0;
}

p {
  color: var(--muted);
  margin: 7px 0 0;
}

button,
.button {
  align-items: center;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 14px;
  font-weight: 760;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

button:hover,
.button:hover {
  background: var(--accent-strong);
  color: #fff;
  text-decoration: none;
}

button:focus-visible,
.button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.16);
  outline: 0;
}

.button-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.button-secondary:hover {
  background: var(--surface-muted);
  border-color: #cbd5e1;
  color: var(--text-strong);
}

.button-danger {
  background: #fff;
  border-color: #f4b4ad;
  color: var(--error);
}

.button-danger:hover {
  background: #fff1f0;
  border-color: #f29990;
  color: #8f1d14;
}

.button-small {
  font-size: 12px;
  min-height: 32px;
  padding: 6px 10px;
}

.page-actions,
.form-actions,
.row-actions,
.inline-check-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.page-actions {
  justify-content: flex-end;
}

.inline-check-form {
  justify-content: flex-end;
}

.compact-check-form {
  margin-top: 0;
}

.row-actions {
  min-width: 190px;
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat-card,
.panel,
.auth-panel,
.form-panel,
.table-wrap,
.operations-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px 18px 16px;
  position: relative;
}

.stat-card::before {
  background: var(--accent);
  border-radius: 999px;
  content: "";
  height: 6px;
  left: 18px;
  position: absolute;
  top: 15px;
  width: 6px;
}

.stat-card span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-left: 14px;
  text-transform: uppercase;
}

.stat-card strong {
  color: var(--text-strong);
  display: block;
  font-size: 34px;
  font-weight: 780;
  line-height: 1;
  margin-top: 14px;
}

.operations-strip {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 17px 18px;
}

.operations-strip strong {
  color: var(--text-strong);
  display: block;
  font-size: 18px;
  line-height: 1.2;
  margin-top: 3px;
}

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

.settings-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.status-stack {
  display: grid;
  gap: 18px;
}

.status-panel {
  margin-top: 20px;
}

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

.collapsible-panel {
  overflow: hidden;
  padding: 0;
}

.panel-summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  list-style: none;
  padding: 18px 20px;
}

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

.panel-summary strong {
  color: var(--text-strong);
  display: block;
  font-size: 18px;
  font-weight: 760;
  line-height: 1.2;
}

.panel-summary small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 750;
  margin-top: 4px;
}

.summary-icon {
  border: solid var(--muted);
  border-width: 0 2px 2px 0;
  flex: 0 0 9px;
  height: 9px;
  transform: rotate(45deg);
  transition: transform 160ms ease, border-color 160ms ease;
  width: 9px;
}

.panel-summary:hover .summary-icon {
  border-color: var(--accent-strong);
}

.collapsible-panel[open] .summary-icon {
  transform: rotate(225deg);
}

.collapsible-body {
  border-top: 1px solid var(--border-soft);
  padding: 16px 20px 20px;
}

.panel-link-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.panel-link-row a {
  font-size: 13px;
  font-weight: 760;
}

.panel-heading {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-heading-stacked {
  align-items: flex-start;
}

.panel-heading a {
  font-size: 13px;
  font-weight: 760;
}

.list {
  display: grid;
  gap: 0;
}

.list-row {
  border-top: 1px solid var(--border-soft);
  padding: 13px 0;
}

.list-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.list-row:last-child {
  padding-bottom: 0;
}

.list-row strong,
.list-row span {
  display: block;
}

.list-row strong {
  color: var(--text-strong);
  font-size: 14px;
}

.list-row span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.list-row p {
  font-size: 13px;
  margin-top: 6px;
}

.empty {
  background: var(--surface-subtle);
  border: 1px dashed #cbd5e1;
  border-radius: 7px;
  color: var(--muted);
  padding: 16px;
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap-flat {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  margin: 0 -2px -2px;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 780px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--border-soft);
  padding: 13px 15px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

td {
  color: #27364a;
  font-size: 13px;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: #fbfcfd;
}

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

.status {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 820;
  min-height: 24px;
  padding: 4px 9px;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-success {
  background: #e8f6ee;
  color: var(--success);
}

.status-error {
  background: #fff0ee;
  color: var(--error);
}

.status-running {
  background: #e8f5f4;
  color: var(--accent-strong);
}

.status-skipped,
.status-pending {
  background: #fff6df;
  color: var(--warning);
}

.pagination {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 18px;
}

.pagination span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-shell {
  align-items: center;
  display: grid;
  min-height: calc(100vh - 48px);
  place-items: center;
}

.auth-panel {
  max-width: 430px;
  padding: 30px;
  width: 100%;
}

.auth-panel h1 {
  color: var(--text-strong);
  font-size: 30px;
  line-height: 1.12;
  margin: 0;
}

.auth-panel form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

label {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 760;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 7px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  min-height: 42px;
  padding: 9px 11px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  width: 100%;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #aebdcc;
}

.form-control-small {
  max-width: 170px;
}

.form-control-tiny {
  max-width: 70px;
}

.form-panel {
  max-width: 760px;
}

.settings-grid .form-panel {
  max-width: none;
}

.stacked-form {
  display: grid;
  gap: 17px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field-checkbox {
  gap: 0;
}

.checkbox-label {
  align-items: center;
  display: inline-flex;
  gap: 10px;
}

.form-checkbox {
  accent-color: var(--accent);
  min-height: 18px;
  width: 18px;
}

.help-text {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.field-error {
  color: var(--error);
  font-size: 12px;
  font-weight: 760;
}

.form-error,
.message {
  background: #fff0ee;
  border: 1px solid #fac7c0;
  border-radius: 7px;
  color: var(--error);
  font-size: 13px;
  font-weight: 720;
  padding: 10px 12px;
}

.message-success {
  background: #e8f6ee;
  border-color: #b8e2c8;
  color: var(--success);
}

.message-info {
  background: #e8f5f4;
  border-color: #b9ddda;
  color: var(--accent-strong);
}

.messages {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.detail-list div {
  border-top: 1px solid var(--border-soft);
  display: grid;
  gap: 10px;
  grid-template-columns: 130px minmax(0, 1fr);
  padding: 12px 0;
}

.detail-list div:first-child {
  border-top: 0;
  padding-top: 0;
}

.detail-list div:last-child {
  padding-bottom: 0;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
}

.detail-list dd {
  color: var(--text);
  font-size: 13px;
  margin: 0;
  min-width: 0;
}

.command-panel {
  display: grid;
  gap: 12px;
}

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

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .site-sidebar {
    min-height: auto;
    position: static;
  }

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

  .sidebar-footer {
    display: none;
  }

  .site-header {
    top: 0;
  }

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

@media (max-width: 760px) {
  .site-sidebar {
    gap: 14px;
    padding: 18px 14px;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 -2px;
    max-width: 100%;
    overflow-x: visible;
    padding: 0 2px 4px;
  }

  .nav a {
    flex: 1 1 108px;
    min-height: 36px;
    padding: 8px 11px;
  }

  .nav a span {
    display: none;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    position: static;
  }

  .page {
    padding: 20px 14px;
  }

  .page-title,
  .operations-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-title h1 {
    font-size: 27px;
  }

  .stats-grid,
  .split-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .form-panel,
  .auth-panel {
    padding: 18px;
  }

  .inline-check-form,
  .page-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .inline-check-form button,
  .page-actions .button {
    width: 100%;
  }

  .form-control-small,
  .form-control-tiny {
    max-width: none;
  }

  .detail-list div {
    grid-template-columns: 1fr;
  }
}
