:root {
  --paper: #f4ede0;
  --paper-strong: #fff9ef;
  --ink: #141312;
  --ink-soft: #57514a;
  --accent: #d24d2f;
  --accent-dark: #8c2712;
  --olive: #475333;
  --line: rgba(20, 19, 18, 0.12);
  --panel-shadow: 0 20px 50px rgba(34, 28, 20, 0.14);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  background:
    radial-gradient(circle at top left, rgba(210, 77, 47, 0.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(71, 83, 51, 0.12), transparent 32%),
    linear-gradient(135deg, #e8dbc9 0%, #f7f1e5 52%, #efe5d8 100%);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

.auth-body {
  display: grid;
  place-items: center;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255,255,255,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20,19,18,0.03) 1px, transparent 1px);
  background-size: 19px 19px, 19px 19px;
  mix-blend-mode: multiply;
}

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 32px 26px;
  background: rgba(20, 19, 18, 0.93);
  color: #f9f1e7;
}

.brand-kicker,
.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: rgba(255, 244, 229, 0.65);
}

.brand h1,
.masthead h2,
.hero h3,
.panel h3 {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand h1 {
  font-size: 34px;
  line-height: 1.08;
}

.brand-copy {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 244, 229, 0.78);
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-link,
.pool-pill,
.ghost-button,
.primary-button {
  appearance: none;
  border: 0;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.nav-link {
  border-left: 3px solid transparent;
  padding: 14px 16px;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  color: #f8efe3;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(210, 77, 47, 0.18);
  border-left-color: #f6b68d;
  transform: translateX(2px);
}

.status-card {
  margin-top: auto;
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
}

.status-card p {
  margin: 4px 0 0;
  font-size: 13px;
  color: rgba(255, 244, 229, 0.68);
}

.status-dot {
  width: 11px;
  height: 11px;
  margin-top: 4px;
  border-radius: 999px;
  background: #7ed957;
  box-shadow: 0 0 0 5px rgba(126, 217, 87, 0.14);
}

.main {
  padding: 32px;
}

.masthead,
.hero,
.panel,
.table-card {
  background: rgba(255, 250, 242, 0.84);
  border: 1px solid var(--line);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(8px);
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding: 24px 26px;
}

.masthead h2 {
  font-size: 36px;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ghost-button {
  padding: 12px 18px;
  background: transparent;
  border: 1px solid rgba(20, 19, 18, 0.16);
  color: var(--ink);
}

.compact-button {
  padding: 8px 12px;
  font-size: 13px;
}

.ghost-button:hover {
  background: rgba(20, 19, 18, 0.06);
}

.view {
  margin-top: 24px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding: 28px;
}

.hero p {
  margin: 12px 0 0;
  max-width: 620px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.hero-badge {
  min-width: 168px;
  padding: 18px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff3ea;
  font-size: 13px;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.metric-card {
  padding: 20px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  box-shadow: var(--panel-shadow);
}

.metric-card .metric-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: 32px;
  font-family: "Georgia", "Times New Roman", serif;
}

.metric-card em {
  display: block;
  margin-top: 6px;
  font-style: normal;
  color: var(--ink-soft);
}

.panel-head,
.table-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.pool-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pool-pill {
  padding: 10px 14px;
  background: rgba(20,19,18,0.06);
  color: var(--ink);
}

.pool-pill.is-active,
.pool-pill:hover {
  background: var(--accent);
  color: #fff5ec;
}

.table-card,
.panel {
  padding: 24px;
  min-width: 0;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  margin-top: 16px;
}

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

.split > *,
.split-wide > *,
.stack > * {
  min-width: 0;
}

th, td {
  padding: 13px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(20,19,18,0.08);
  font-size: 14px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

th {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 20px;
}

.split-wide {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
}

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

.panel-copy,
.table-hint {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 32px));
}

.auth-card {
  padding: 32px;
  background: rgba(20, 19, 18, 0.93);
  color: #f9f1e7;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--panel-shadow);
}

.auth-card h1 {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 42px;
}

.auth-copy {
  margin: 14px 0 0;
  color: rgba(255, 244, 229, 0.78);
  line-height: 1.7;
}

.auth-form {
  margin-top: 26px;
}

.auth-card .field span {
  color: rgba(255, 244, 229, 0.7);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  font-size: 13px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(20, 19, 18, 0.12);
  background: rgba(255,255,255,0.8);
  color: var(--ink);
  font: inherit;
}

select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(20, 19, 18, 0.12);
  background: rgba(255,255,255,0.8);
  color: var(--ink);
  font: inherit;
}

textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid rgba(20, 19, 18, 0.12);
  background: rgba(255,255,255,0.8);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(210, 77, 47, 0.24);
  border-color: var(--accent);
}

.primary-button {
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff6ef;
  box-shadow: 0 14px 30px rgba(140, 39, 18, 0.18);
}

.primary-button:hover {
  transform: translateY(-1px);
}

pre {
  margin: 0;
  min-height: 280px;
  padding: 18px;
  background: #161513;
  color: #f9f2e8;
  overflow: auto;
  max-width: 100%;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.65;
}

.cell-scroll {
  max-width: 420px;
}

.cell-scroll > div {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.compact table {
  min-width: 720px;
}

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

.mini-button {
  appearance: none;
  border: 1px solid rgba(20, 19, 18, 0.14);
  background: rgba(20, 19, 18, 0.04);
  color: var(--ink);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease, border-color 140ms ease;
}

.mini-button:hover {
  transform: translateY(-1px);
  background: rgba(20, 19, 18, 0.08);
}

.mini-button.warn {
  border-color: rgba(210, 77, 47, 0.24);
  color: var(--accent-dark);
}

.mini-button.danger {
  background: rgba(210, 77, 47, 0.09);
  border-color: rgba(140, 39, 18, 0.28);
  color: var(--accent-dark);
}

.result-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(20, 19, 18, 0.06);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-pill.success,
.result-pill.healthy {
  background: rgba(71, 83, 51, 0.16);
  color: var(--olive);
}

.result-pill.error,
.result-pill.pending_delete,
.result-pill.quota {
  background: rgba(210, 77, 47, 0.14);
  color: var(--accent-dark);
}

.mono {
  font-family: "Cascadia Code", "Consolas", monospace;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 10px;
}

.toggle-field input {
  width: 18px;
  height: 18px;
}

.field-hint {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-soft);
}

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

  .sidebar {
    gap: 20px;
  }

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

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 20px;
  }

  .masthead,
  .hero {
    padding: 20px;
  }

  .masthead {
    align-items: start;
    flex-direction: column;
  }

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