:root {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --panel-soft: #f6f8fa;
  --text: #1f2328;
  --muted: #59636e;
  --line: #d0d7de;
  --brand: #0969da;
  --brand-strong: #0550ae;
  --success: #1a7f37;
  --warning: #9a6700;
  --shadow: 0 8px 24px rgba(31, 35, 40, 0.06);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #f6f8fa 0%, #ffffff 100%);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.6;
}

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

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
}

.container-wide,
.workspace-container {
  width: min(1680px, calc(100% - 32px));
  margin: 0 auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(208, 215, 222, 0.8);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.nav a:hover,
.nav a.active {
  background: var(--panel-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  background: var(--brand);
  color: #fff;
}

.button.primary:hover {
  background: var(--brand-strong);
  text-decoration: none;
}

.button.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.button.secondary:hover {
  background: var(--panel-soft);
  text-decoration: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.eyebrow.success {
  color: var(--success);
  border-color: rgba(26, 127, 55, 0.2);
  background: rgba(26, 127, 55, 0.06);
}

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

.dashboard-home {
  padding: 20px 0 40px;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 272px;
  gap: 24px;
  align-items: start;
}

body[data-page]:not([data-page="rate-workspace"]):not([data-page="gath-rate"]) .dashboard-shell {
  grid-template-columns: 248px minmax(0, 1fr);
}

body[data-page]:not([data-page="rate-workspace"]):not([data-page="gath-rate"]) .dash-rail {
  grid-column: 2;
  position: static;
  top: auto;
  padding: 0;
}

.dash-sidebar,
.dash-rail {
  position: sticky;
  top: 96px;
  padding: 20px;
}

.dash-main {
  display: grid;
  gap: 20px;
}

.dash-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
}

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

.dash-link {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}

.dash-link:hover,
.dash-link.active {
  background: var(--panel-soft);
  border-color: var(--line);
  text-decoration: none;
}

.dash-link strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.dash-link span {
  color: var(--muted);
  font-size: 13px;
}

.home-hero-card,
.feed-card,
.rail-card {
  padding: 24px;
}

.home-hero-card h1 {
  margin: 14px 0 12px;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.home-hero-card p {
  margin: 0 0 18px;
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
}

.feed-card h2,
.feed-card h3,
.rail-card h3 {
  margin: 0 0 12px;
  line-height: 1.15;
}

.feed-card p,
.feed-card li {
  color: var(--muted);
}

.feed-card ul {
  margin: 0;
  padding-left: 18px;
}

.feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.feed-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

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

.ops-card,
.status-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.ops-card h3,
.status-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.ops-card p,
.status-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.timeline-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.timeline-item h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.timeline-item p {
  margin: 0;
  color: var(--muted);
}

.rail-stack,
.rail-list {
  display: grid;
  gap: 14px;
}

.rail-item {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.rail-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.rail-item strong,
.rail-item a {
  display: block;
  font-size: 14px;
}

.rail-item a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rail-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
}

.stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.12);
}

.form-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.form-action-row .button {
  flex: 1 1 220px;
}

.callout {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 14px;
}

.callout strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.form-status {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 14px;
}

.form-status.success {
  color: var(--success);
  background: rgba(26, 127, 55, 0.08);
  border-color: rgba(26, 127, 55, 0.2);
}

.form-status.error {
  color: #b42318;
  background: rgba(207, 34, 46, 0.08);
  border-color: rgba(207, 34, 46, 0.2);
}

.form-status.info {
  color: var(--brand-strong);
  background: rgba(9, 105, 218, 0.08);
  border-color: rgba(9, 105, 218, 0.2);
}

.result-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.result-card h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

.result-meta {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

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

.result-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.result-item strong {
  font-size: 14px;
}

.icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.icon-inline svg {
  width: 16px;
  height: 16px;
}

.utility-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.utility-link:hover,
.utility-link.active {
  background: var(--panel-soft);
  border-color: var(--line);
  text-decoration: none;
}

.language-switch {
  min-width: 92px;
}

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

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

.metric-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.metric-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 28px;
  line-height: 1.05;
  font-weight: 800;
}

.metric-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.activity-list {
  display: grid;
  gap: 12px;
}

.activity-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.activity-item strong {
  font-size: 15px;
}

.activity-meta {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge.success {
  color: var(--success);
  border-color: rgba(26, 127, 55, 0.2);
  background: rgba(26, 127, 55, 0.08);
}

.badge.warning {
  color: var(--warning);
  border-color: rgba(154, 103, 0, 0.2);
  background: rgba(154, 103, 0, 0.08);
}

.summary-note,
.empty-state {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.admin-toolbar .field {
  min-width: 240px;
  flex: 1 1 320px;
}

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

.table-actions .button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.dashboard-split {
  display: grid;
  gap: 20px;
}

.button:disabled {
  opacity: 0.7;
  cursor: wait;
}

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

.workspace-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.workspace-copy {
  display: grid;
  gap: 4px;
  max-width: 560px;
}

.workspace-copy strong {
  font-size: 15px;
}

.workspace-copy span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.workspace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.workspace-frame-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.workspace-frame {
  display: block;
  width: 100%;
  min-height: 960px;
  border: 0;
  background: #fff;
}

.workspace-page {
  min-height: 100vh;
}

.immersive-workspace-page {
  background:
    radial-gradient(circle at top, rgba(9, 105, 218, 0.08), transparent 26%),
    linear-gradient(180deg, #eef4fb 0%, #f8fbff 28%, #f4f8fc 100%);
}

.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(208, 215, 222, 0.8);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.workspace-topbar-inner {
  width: min(1680px, calc(100% - 24px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workspace-topbar-copy {
  display: grid;
  gap: 2px;
}

.workspace-topbar-copy strong {
  font-size: 18px;
  line-height: 1.1;
}

.workspace-topbar-eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workspace-page-main {
  padding-top: 10px;
  padding-bottom: 12px;
}

.workspace-layout {
  display: grid;
  gap: 10px;
}

.gath-rate-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.gath-rate-panel {
  padding: 18px;
}

.gath-rate-panel h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.gath-rate-copy {
  margin: 0 0 16px;
  color: var(--muted);
}

.gath-rate-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.gath-rate-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.gath-rate-toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.gath-rate-toolbar-group-right {
  justify-content: flex-end;
}

.search-input,
.sort-select {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.search-input {
  min-width: min(420px, 72vw);
}

.sort-select {
  min-width: 190px;
}

.gath-rate-results {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

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

.gath-rate-page-status {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.table-head-select,
.table-cell-select {
  width: 48px;
  text-align: center;
}

.table-cell-note {
  min-width: 260px;
  white-space: normal;
}

.table-cell-actions {
  white-space: nowrap;
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.table-sort-button:hover {
  color: var(--brand);
}

.table-sort-button.is-active {
  color: var(--brand);
}

.table-sort-indicator {
  color: var(--muted);
  font-size: 12px;
}

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

.workspace-stage {
  display: grid;
  gap: 0;
  padding: 12px;
}

.workspace-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workspace-page .workspace-copy {
  max-width: none;
}

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

.workspace-page .form-status {
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.workspace-page .workspace-frame-shell {
  min-height: calc(100vh - 126px);
  border-radius: 16px;
  border-color: rgba(208, 215, 222, 0.9);
  box-shadow: 0 18px 50px rgba(31, 35, 40, 0.08);
}

.workspace-page .workspace-frame {
  height: calc(100vh - 128px);
  min-height: 940px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

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

th {
  font-size: 13px;
  background: var(--panel-soft);
}

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

.footer {
  display: none;
}

@media (max-width: 1024px) {
  .dashboard-shell,
  .ops-grid,
  .status-grid,
  .form-grid,
  .metric-grid,
  .gath-rate-grid {
    grid-template-columns: 1fr;
  }

  .workspace-actions {
    width: 100%;
  }

  .workspace-actions .button {
    width: 100%;
  }

  .search-input,
  .sort-select {
    width: 100%;
    min-width: 0;
  }

  .gath-rate-actions-bar,
  .gath-rate-pagination {
    justify-content: stretch;
  }

  .gath-rate-toolbar-group,
  .gath-rate-toolbar-group-right {
    width: 100%;
  }

  .workspace-topbar-inner {
    width: min(100%, calc(100% - 16px));
    padding: 10px 0;
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-page .workspace-frame-shell {
    min-height: 78vh;
  }

  .workspace-page .workspace-frame {
    height: 78vh;
    min-height: 720px;
  }

  .dash-sidebar,
  .dash-rail {
    position: static;
  }
}

@media (max-width: 720px) {
  .workspace-container {
    width: min(100%, calc(100% - 16px));
  }

  .workspace-stage {
    padding: 10px;
  }

  .workspace-page .workspace-frame-shell {
    min-height: 74vh;
  }

  .workspace-page .workspace-frame {
    height: 74vh;
    min-height: 560px;
  }
}
