:root {
  --font-ui: Calibri, "Segoe UI", Candara, system-ui, sans-serif;
  --font-table: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --font-table-head: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --brand-teal: #00a99a;
  --brand-lime: #b7dd35;
  --brand-dark: #14271f;
  --brand-soft: rgba(0, 169, 154, 0.12);
  --color-text: #17221d;
  --color-text-muted: #68756e;
  --color-border: #dfe7e1;
  --color-accent-soft: var(--brand-soft);
  --surface-page: #f3f6f3;
  --sidebar-width: 248px;
  --sidebar-collapsed: 72px;
  --header-height: 70px;
  --radius-card: 14px;
  --radius-control: 9px;
  --shadow-card: 0 14px 36px rgba(20, 39, 31, 0.08);
}

body {
  margin: 0;
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 16px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid rgba(148, 163, 184, 0.35);
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 0.9rem;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.5rem;
}

.nav-item,
.profile-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 40px;
  padding: 0 0.7rem;
  border-radius: var(--radius-control);
  color: inherit;
  text-decoration: none;
}

.nav-item[aria-current="page"],
.nav-item:hover,
.profile-link:hover {
  background: var(--brand-soft);
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1d4e89;
  color: #fff;
  font-weight: 700;
}

.profile-link small {
  display: block;
  color: #64748b;
  font-size: 12px;
}

.sidebar-footer button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-height);
  padding: 0 1rem;
}

.study-menu {
  display: flex;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
  overflow-x: auto;
}

.study-menu .job-tabs {
  margin: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: inherit;
  text-decoration: none;
}

.header-action:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.45);
}

.content {
  padding: 1rem 1.25rem 2rem;
}

.data-surface {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 0.9rem 1rem;
}

.data-table,
table.registry {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-table);
}

.data-table th {
  font-weight: 600;
}

.table-th-sort {
  color: inherit;
  font: inherit;
  text-decoration: none;
}

.table-row-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  min-height: 32px;
}

.table-row-actions a,
.table-row-actions button,
.action-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  border-radius: 999px;
  padding: 0 0.35rem;
}

.badge-success { background: #f0fff4; color: #22543d; border: 1px solid #9ae6b4; }
.badge-warn { background: #fffff0; color: #744210; border: 1px solid #f6e05e; }
.badge-cancel { background: #fafafa; color: #718096; border: 1px solid #e2e8f0; }
.badge-error { background: #fff5f5; color: #742a2a; border: 1px solid #fc8181; }

.filter-panel,
.narrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: end;
  margin-bottom: 0.8rem;
}

.field-group {
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  margin: 0 0 0.8rem;
  padding: 0.8rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

input,
select,
button {
  font: inherit;
  min-height: 36px;
}

button,
.choice {
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius-control);
  background: #fff;
  cursor: pointer;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.choice {
  text-align: left;
  padding: 0.45rem 0.7rem;
}

.choice[aria-pressed="true"] {
  border-color: #1d4e89;
  background: #edf3ff;
}

.choice span,
.choice strong {
  display: block;
}

.facts {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.fact {
  display: flex;
  flex-direction: column;
}

.inspector {
  margin-top: 0.8rem;
}

.updates-home {
  min-height: calc(100vh - var(--header-height) - 2rem);
}

.panel-title {
  font-weight: 700;
  color: inherit;
}

.update {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.6rem;
  padding: 0.4rem 0;
}

.scale {
  display: flex;
  gap: 0.1rem;
}

.settings-tabs {
  display: flex;
  gap: 0.2rem;
  padding: 0.2rem;
  background: #f1f4f8;
  border-radius: 10px;
}

.settings-tabs a {
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

.settings-tabs a[aria-selected="true"] {
  background: #fff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(20, 30, 50, 0.08);
}

.preview {
  display: grid;
  gap: 0.6rem;
  margin: 0.8rem 0;
}

.preview-header,
.preview-page {
  min-height: 64px;
  border-radius: 10px;
  padding: 0.8rem;
}

.nav-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  background: #fff;
}

@media (max-width: 1024px) {
  body.nav-open .sidebar {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shell,
  .sidebar {
    transition: none;
  }
}

.job-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 0.85rem 1rem 1rem;
}

.job-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.job-hero strong {
  font-size: 1.05rem;
}

.edit-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.9rem;
  min-height: 36px;
  padding: 0 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: var(--radius-control);
  background: #fff;
  color: inherit;
  text-decoration: none;
}

.job-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem 1rem;
  margin: 0.85rem 0 0;
}

.job-facts dt {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.job-facts dd {
  margin: 0.15rem 0 0;
}

.job-tabs {
  display: flex;
  gap: 0.2rem;
  width: fit-content;
  margin: 0.75rem 0;
  padding: 0.2rem;
  background: #f1f4f8;
  border-radius: 10px;
}

.job-tabs a {
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}

.job-tabs a[aria-selected="true"] {
  background: #fff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(20, 30, 50, 0.08);
}

.job-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.job-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: start;
  padding: 6px 0;
}

.quality-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.quality-list .job-row {
  grid-template-columns: 20px minmax(0, 1fr);
}

.pdf-frame {
  width: 100%;
  height: 78vh;
  min-height: 640px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fff;
}

.job-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  background: var(--brand-teal);
  color: #fff;
}

.job-dot[data-status="failed"] {
  background: #c53030;
}

.job-dot[data-status="running"] {
  background: #d69e2e;
  color: #1a202c;
}

.job-dot[data-status="pending"] {
  background: #a0aec0;
}

.job-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.job-note,
.job-meta {
  font-size: 12px;
  color: #64748b;
}

.job-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.job-error {
  color: #9b2c2c;
  margin: 0.6rem 0 0;
}

.job-issues {
  margin: 0.7rem 0 0;
  padding-left: 1.1rem;
}

.job-figure {
  margin: 0.8rem 0 0;
}

.job-graph {
  width: 100%;
  height: auto;
}

.job-figure figcaption {
  margin-top: 0.35rem;
  font-size: 15px;
  color: #526070;
}

.report-doc {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: 15px;
}

.report-section h2 {
  margin: 0 0 0.35rem;
  color: var(--brand-dark);
  font-size: 20px;
  font-weight: 700;
}

.report-lead {
  margin: 0 0 0.7rem;
  color: var(--color-text-muted);
}

.report-figure {
  margin: 0.8rem 0 0;
}

.report-graph {
  width: 80%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.report-figure figcaption {
  margin-top: 0.35rem;
  font-size: 15px;
  text-align: center;
}

.report-doc .data-table {
  font-size: 15px;
}

.doc-preview {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 1.1rem 1.6rem;
  background: #fff;
  color: #21455b;
  font-family: "DejaVu Sans", "Noto Sans", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.doc-preview h1 {
  margin: 0 0 0.6rem;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
}

.doc-preview h2 {
  margin: 1.2rem 0 0.45rem;
  font-size: 25px;
  line-height: 1.25;
  font-weight: 700;
}

.doc-preview h3 {
  margin: 0.9rem 0 0.4rem;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
}

.doc-preview h4 {
  margin: 0.8rem 0 0.35rem;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 700;
}

.doc-kicker,
.doc-preview p {
  margin: 0 0 0.45rem;
}

.doc-figure {
  margin: 0.8rem 0 1rem;
}

.doc-preview .report-graph,
.doc-preview svg {
  width: 80%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.doc-figure figcaption {
  margin-top: 0.35rem;
  font-size: 15px;
  text-align: center;
}

.doc-table-wrap {
  overflow: visible;
}

.doc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
  line-height: 1.35;
  border: 1px solid #d5e0e6;
  border-radius: 12px;
}

.doc-table th,
.doc-table td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid #e4edf1;
  text-align: left;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.doc-table tr:last-child td {
  border-bottom: none;
}

.doc-table th {
  font-weight: 700;
}

@media (max-width: 820px) {
  .doc-preview .report-graph,
  .doc-preview svg {
    width: 100%;
  }

  .doc-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .doc-table,
  .doc-table tbody,
  .doc-table tr,
  .doc-table td {
    display: block;
    width: auto;
  }

  .doc-table tr {
    padding: 0.35rem 0;
    border-bottom: 1px solid #e4edf1;
  }

  .doc-table td {
    border-bottom: none;
    padding: 0.15rem 0.55rem;
  }

  .doc-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
  }
}
