:root {
  --blue: #185fa5;
  --blue-dark: #0c447c;
  --blue-soft: #e6f1fb;
  --ink: #111827;
  --text: #334155;
  --muted: #64748b;
  --border: #dbe5f0;
  --surface: #ffffff;
  --page: #f4f7fb;
  --green: #3b6d11;
  --green-soft: #eaf3de;
  --red: #b42318;
  --red-soft: #fef3f2;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}
button {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 15px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.portal-shell {
  width: min(1160px, 92vw);
  margin: 0 auto;
  padding: 22px 0 60px;
}
.portal-header {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 0 22px;
  border-bottom: 1px solid var(--border);
}
.brand {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.brand span {
  color: var(--blue);
  font-weight: 500;
}
.portal-header nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
}
.portal-header nav a {
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}
.portal-intro {
  padding: 54px 0 30px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
h1,
h2,
p {
  margin-top: 0;
}
h1 {
  margin-bottom: 12px;
  color: var(--ink);
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.03em;
}
.portal-intro > p:not(.eyebrow) {
  max-width: 650px;
  line-height: 1.6;
}
#identity {
  color: var(--muted);
  font-size: 13px;
}
.notice {
  margin-bottom: 20px;
  border: 1px solid #b9d9f6;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  padding: 13px 15px;
  font-size: 13px;
}
.notice.error {
  border-color: #fecdca;
  background: var(--red-soft);
  color: var(--red);
}
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.summary article,
.client-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.summary article {
  padding: 18px;
}
.summary strong {
  display: block;
  color: var(--ink);
  font-size: 25px;
}
.summary span {
  color: var(--muted);
  font-size: 12px;
}
.client-list {
  display: grid;
  gap: 16px;
}
.client-card {
  padding: 20px;
}
.client-heading,
.actions,
.metric-row,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.client-heading h2 {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 20px;
}
.client-heading p,
.metric-row {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.badge {
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  padding: 6px 9px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge.test {
  background: var(--blue-soft);
  color: var(--blue-dark);
}
.usage-track {
  height: 7px;
  margin: 18px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}
.usage-track span {
  display: block;
  width: var(--usage);
  height: 100%;
  background: var(--blue);
}
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 20px;
}
.details-grid section {
  border-top: 1px solid var(--border);
  padding-top: 15px;
}
.section-title h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}
.alert,
.invoice {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.alert p,
.invoice p {
  margin: 0;
}
.alert small,
.invoice small {
  color: var(--muted);
}
.alert button,
.invoice button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}
.empty {
  color: var(--muted);
  font-size: 12px;
}
.actions {
  margin-top: 18px;
  justify-content: flex-start;
}
.actions button:first-child {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}
dialog {
  width: min(560px, 92vw);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0;
}
dialog::backdrop {
  background: rgb(15 23 42 / 0.55);
}
dialog form {
  position: relative;
  padding: 24px;
}
.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  padding: 0;
  font-size: 24px;
}
pre {
  overflow: auto;
  padding: 14px;
  border-radius: 8px;
  background: #0f172a;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 720px) {
  .portal-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .portal-header nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }
  .summary,
  .details-grid {
    grid-template-columns: 1fr;
  }
  .portal-intro {
    padding-top: 38px;
  }
  .client-card {
    padding: 16px;
  }
}
