:root {
  --bg: #f8f9fa;
  --panel: #ffffff;
  --ink: #1f2429;
  --muted: #68737d;
  --line: #e4e7ea;
  --line-dark: #d7dce0;
  --accent: #3ecf8e;
  --accent-strong: #249f6d;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: #f4f6f7;
}

.auth-panel,
.modal-card {
  width: min(440px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 18px 50px rgba(31, 36, 41, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark,
.rail-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--accent);
  color: #063b29;
  font-weight: 800;
  text-decoration: none;
}

.brand span,
.auth-form p,
.muted,
small {
  color: var(--muted);
}

.auth-brand {
  margin-bottom: 26px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: #424b54;
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-dark);
  border-radius: 7px;
  background: #fff;
  padding: 8px 10px;
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(62, 207, 142, 0.28);
  border-color: var(--accent-strong);
}

.primary,
.ghost-button,
.filter-button,
.copy-button,
.oauth-button {
  min-height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line-dark);
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  font-weight: 600;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #053b2a;
}

.oauth-button {
  display: grid;
  place-items: center;
  text-decoration: none;
  background: #fff;
}

.oauth-button:hover,
.ghost-button:hover,
.filter-button:hover,
.copy-button:hover {
  border-color: #aeb8c2;
  background: #f7f9fa;
}

.small {
  min-height: 32px;
  font-size: 13px;
}

.auth-error {
  margin-top: 14px;
  color: var(--danger);
  background: #fff5f5;
  border: 1px solid #ffd1d1;
  border-radius: 7px;
  padding: 10px;
}

.auth-panel {
  border-top: 3px solid var(--accent);
}

.console {
  min-height: 100vh;
}

.global-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.crumbs a,
.crumbs strong {
  color: var(--ink);
  text-decoration: none;
}

.bolt {
  color: var(--accent-strong) !important;
  font-weight: 800;
}

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

.feedback,
.current-user {
  color: var(--muted);
  font-size: 13px;
}

.search-pill {
  min-width: 160px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fff;
}

kbd {
  color: #8a949e;
  font-size: 11px;
}

.console-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}

.side-nav {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 14px 12px;
}

.side-nav.compact {
  width: 48px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 12px;
  padding: 12px 6px;
}

.console-body:has(.side-nav.compact) {
  grid-template-columns: 48px minmax(0, 1fr);
}

.rail-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.rail-icon.active,
.side-links a.active {
  background: #eef1f3;
  color: var(--ink);
}

.side-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 4px 16px;
}

.side-head strong,
.side-head span {
  display: block;
}

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

.side-links {
  display: grid;
  gap: 3px;
}

.side-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  color: #49525b;
  text-decoration: none;
}

.side-links span {
  width: 32px;
  color: #717b85;
  font-size: 12px;
}

.side-links hr {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 10px 0;
}

.main-content {
  min-width: 0;
}

.center-page {
  width: min(900px, calc(100vw - 120px));
  margin: 70px auto;
}

.ops-page {
  width: min(1180px, calc(100vw - 140px));
}

.wide-center {
  width: min(1120px, calc(100vw - 140px));
}

.page-head,
.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.search-input {
  max-width: 330px;
  margin-bottom: 16px;
}

.search-input.short {
  max-width: 220px;
}

.org-grid,
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

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

.ops-card {
  position: relative;
  min-height: 250px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: #e8fbf3;
  color: #087f5b;
  font-weight: 800;
}

.ops-card h2 {
  margin-bottom: 8px;
}

.ops-card p {
  color: var(--muted);
  min-height: 54px;
}

.ops-card ul {
  margin: 16px 0 0;
  padding-left: 18px;
  color: #45505a;
}

.ops-card li + li {
  margin-top: 6px;
}

.org-card,
.project-card,
.table-card,
.setup-card,
.topology-card,
.overview-metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.org-card {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  cursor: pointer;
  text-align: left;
}

.org-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 11px;
}

.org-card strong,
.org-card small {
  display: block;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.toolbar .search-input {
  margin: 0;
}

.project-card {
  position: relative;
  min-height: 170px;
  padding: 24px;
  cursor: pointer;
}

.project-card:hover,
.org-card:hover {
  border-color: #b7c0c8;
  box-shadow: 0 12px 32px rgba(31, 36, 41, 0.06);
}

.project-card h3 {
  margin-bottom: 10px;
}

.project-card p {
  color: var(--muted);
}

.card-menu {
  position: absolute;
  top: 18px;
  right: 18px;
  color: var(--muted);
}

.plan-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: 18px;
  padding: 0 7px;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  color: #68737d;
  font-size: 11px;
  text-transform: uppercase;
}

.table-card {
  overflow: hidden;
}

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

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

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

.table-foot {
  padding: 14px 16px;
  color: var(--muted);
}

.member-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
}

.project-overview {
  width: min(1440px, calc(100vw - 280px));
  margin: 54px auto;
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(420px, 1.05fr);
  gap: 28px;
}

.overview-main,
.topology-card,
.request-strip,
.setup-card {
  min-width: 0;
}

.project-heading {
  margin: 44px 0 28px;
}

.project-heading h1 {
  margin-bottom: 12px;
}

.url-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

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

.overview-metric {
  min-height: 92px;
  padding: 16px;
}

.overview-metric span,
.overview-metric small {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
}

.overview-metric strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.topology-card {
  min-height: 420px;
  display: grid;
  place-items: center;
  background-image: radial-gradient(#d8dde1 1px, transparent 1px);
  background-size: 18px 18px;
}

.db-node {
  width: 260px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 38px rgba(31, 36, 41, 0.08);
}

.db-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--accent);
  color: #053b2a;
  font-size: 11px;
  font-weight: 800;
  margin-right: 8px;
}

.db-node strong,
.db-node small {
  display: block;
  margin-top: 6px;
}

.node-stats {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.request-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
}

.setup-card {
  grid-column: 1 / -1;
  padding: 18px;
}

.setup-card p {
  color: var(--muted);
  margin-top: 4px;
}

pre {
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: #11181d;
  color: #eaf7f1;
  border-radius: 8px;
  padding: 14px;
  font-size: 12px;
  line-height: 1.5;
}

.proxy-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.proxy-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

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

.proxy-list span {
  color: var(--muted);
  margin-top: 4px;
}

.empty-state {
  border: 1px dashed var(--line-dark);
  border-radius: 8px;
  color: var(--muted);
  padding: 24px;
  background: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(18, 24, 30, 0.36);
}

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

.wide {
  grid-column: 1 / -1;
}

@media (max-width: 1100px) {
  .project-overview,
  .request-strip,
  .proxy-list {
    grid-template-columns: 1fr;
  }

  .project-overview {
    width: calc(100vw - 280px);
  }
}

@media (max-width: 760px) {
  .global-bar,
  .console-body {
    display: block;
  }

  .side-nav {
    display: none;
  }

  .center-page,
  .wide-center,
  .project-overview {
    width: calc(100vw - 32px);
    margin: 28px auto;
  }

  .org-grid,
  .project-grid,
  .ops-grid,
  .status-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
