@font-face {
  font-family: 'Onest';
  src: url('/Onest.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --bg: #090a0f;
  --surface: #10121a;
  --surface-raised: #181b26;
  --surface-hover: #1f2331;
  --line: #222738;
  --line-strong: #333a52;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --good: #10b981;
  --good-soft: rgba(16, 185, 129, 0.12);
  --bad: #ef4444;
  --bad-soft: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 'Onest', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

button:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

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

button.danger {
  color: var(--bad);
  border-color: rgba(239, 68, 68, 0.3);
  background: var(--bad-soft);
}

button.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--bad);
}

input, select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: 0;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

/* Header */
header.portal-header {
  height: 68px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--surface);
}

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

.brand-wrap svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.partner-profile {
  display: flex;
  align-items: center;
  gap: 16px;
}

.partner-company {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.tier-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.tier-badge.gov {
  background: var(--good-soft);
  color: var(--good);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Main Container */
main.portal-main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
}

/* Login View */
.login-view {
  max-width: 440px;
  margin: 80px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
}

.login-header {
  margin-bottom: 28px;
  text-align: center;
}

.login-header svg {
  width: 36px;
  height: 36px;
  color: var(--accent);
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.login-header p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-note {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.alert-message {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-message.error {
  background: var(--bad-soft);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.alert-message.success {
  background: var(--good-soft);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #86efac;
}

/* Dashboard View */
.dashboard-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.portal-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 24px;
}

.portal-tabs button {
  justify-content: flex-start;
  min-height: 44px;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.portal-tabs button svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex-shrink: 0;
}

.portal-tabs button:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.portal-tabs button.is-active {
  background: var(--surface-raised);
  color: #ffffff;
  border: 1px solid var(--line);
}

.portal-tabs button.is-active svg {
  color: var(--accent);
}

/* Cards & Sections */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.card-head h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.card-head p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Metrics Row */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.metric-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.metric-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* Tables */
table.portal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

table.portal-table th {
  padding: 10px 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
}

table.portal-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}

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

/* Code Snippets */
.code-box {
  background: #050608;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #cbd5e1;
  overflow-x: auto;
  position: relative;
  white-space: pre-wrap;
  word-break: break-all;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.code-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.copy-button {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 11px;
  background: var(--surface-raised);
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}

.status-pill.active {
  background: var(--good-soft);
  color: var(--good);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-pill.suspended {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  padding: 28px;
}

/* Footer */
footer.portal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

footer.portal-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

footer.portal-footer a:hover {
  color: var(--text);
}

@media (max-width: 840px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .portal-tabs {
    flex-direction: row;
    overflow-x: auto;
    position: static;
  }
  .metrics-row {
    grid-template-columns: 1fr 1fr;
  }
  header.portal-header {
    padding: 0 16px;
  }
  main.portal-main {
    padding: 16px;
  }
}
