:root {
  color-scheme: light;
  --background: #f4f1e9;
  --surface: #fbfaf6;
  --surface-strong: #ffffff;
  --ink: #151515;
  --muted: #66645f;
  --border: #d9d5cb;
  --border-strong: #bbb6aa;
  --accent: #111111;
  --positive: #1e6b42;
  --warning: #8a5a09;
  --danger: #8f2d2d;
  --shadow: 0 22px 60px rgba(19, 18, 15, 0.08);
  --radius-large: 26px;
  --radius-medium: 18px;
  --radius-small: 12px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

button {
  cursor: pointer;
}

.portal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  background: rgba(251, 250, 246, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.sidebar-label {
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 11px;
  text-decoration: none;
  color: #3c3a35;
  font-size: 14px;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #eae6dc;
  color: var(--ink);
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-account {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.sidebar-account strong,
.sidebar-account span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account strong {
  font-size: 13px;
}

.sidebar-account span {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

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

.topbar {
  min-height: 74px;
  padding: 16px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(244, 241, 233, 0.9);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.page {
  padding: 34px;
  max-width: 1440px;
  margin: 0 auto;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.page-heading h2,
.hero h1 {
  margin: 0;
  letter-spacing: -0.045em;
}

.page-heading h2 {
  font-size: clamp(30px, 4vw, 48px);
}

.page-heading p {
  margin: 10px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 750;
  letter-spacing: 0.11em;
  color: var(--muted);
  margin-bottom: 10px;
}

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

.button {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  min-height: 40px;
  padding: 9px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  background: transparent;
  color: var(--ink);
  font-weight: 650;
  font-size: 13px;
}

.button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.button.danger {
  color: var(--danger);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

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

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: var(--surface);
  padding: 22px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
}

.card.flush {
  padding: 0;
  overflow: hidden;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.metric-value {
  margin-top: 14px;
  font-size: 36px;
  font-weight: 760;
  letter-spacing: -0.05em;
}

.metric-detail {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 34px 0 14px;
}

.section-header h3 {
  margin: 0;
  font-size: 18px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--muted);
}

td {
  font-size: 13px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f1eee6;
  font-size: 11px;
  font-weight: 700;
}

.badge.positive {
  color: var(--positive);
  background: #e9f3ed;
  border-color: #c8ddcf;
}

.badge.warning {
  color: var(--warning);
  background: #f8f0dc;
  border-color: #ead8ac;
}

.badge.danger {
  color: var(--danger);
  background: #f7e8e8;
  border-color: #e7c3c3;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

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

.list-item strong {
  display: block;
  font-size: 14px;
}

.list-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: white;
  color: var(--ink);
  border-radius: 11px;
  padding: 11px 12px;
  outline: none;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #55524b;
  box-shadow: 0 0 0 3px rgba(21, 21, 21, 0.06);
}

.notice {
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  padding: 14px 16px;
  background: #efece4;
  font-size: 13px;
  line-height: 1.5;
}

.notice.warning {
  border-color: #e5cf9d;
  background: #f8f0dc;
}

.notice.danger {
  border-color: #e7c3c3;
  background: #f7e8e8;
}

.public-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.95), rgba(255,255,255,0) 42%),
    var(--background);
}

.public-nav {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.public-nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
}

.public-nav-links a {
  text-decoration: none;
  color: var(--muted);
}

.hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: 110px 30px 70px;
}

.hero h1 {
  max-width: 900px;
  font-size: clamp(54px, 8vw, 104px);
  line-height: 0.94;
}

.hero p {
  max-width: 720px;
  margin: 30px 0;
  color: #4f4d48;
  font-size: 20px;
  line-height: 1.55;
}

.public-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 30px 90px;
}

.public-card {
  min-height: 240px;
  background: rgba(255,255,255,0.5);
}

.public-card h3 {
  margin-top: 0;
  font-size: 22px;
}

.public-card p {
  color: var(--muted);
  line-height: 1.55;
}

.callout {
  margin-top: 32px;
  padding: 34px;
  border-radius: var(--radius-large);
  background: #161616;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.callout h3 {
  margin: 0 0 8px;
  font-size: 26px;
}

.callout p {
  margin: 0;
  color: #c8c8c8;
}

.empty-state {
  padding: 38px;
  text-align: center;
  color: var(--muted);
}

.loading-screen,
.error-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
}

.loading-panel,
.error-panel {
  width: min(620px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  padding: 36px;
  box-shadow: var(--shadow);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.38);
  display: grid;
  place-items: center;
  padding: 24px;
}

.dialog {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface-strong);
  border-radius: var(--radius-large);
  padding: 28px;
  box-shadow: var(--shadow);
}

.dialog h3 {
  margin: 0 0 18px;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 1050px) {
  .grid.metrics,
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .portal-shell {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sidebar-spacer,
  .sidebar-account {
    display: none;
  }
  .topbar {
    position: static;
    padding: 14px 20px;
  }
  .page {
    padding: 24px 20px;
  }
  .page-heading,
  .callout {
    align-items: flex-start;
    flex-direction: column;
  }
  .grid.metrics,
  .grid.two,
  .grid.three,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
  .public-nav-links a:not(.button) {
    display: none;
  }
  .hero {
    padding-top: 74px;
  }
}

.coming-soon-card {
  border-style: dashed;
  opacity: 0.82;
}
