:root {
  --ink: #172033;
  --muted: #687386;
  --line: #dce1e7;
  --paper: #ffffff;
  --surface: #f3f5f7;
  --green: #146b5c;
  --green-dark: #0d5146;
  --coral: #c85b45;
  --danger: #b42318;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; }
body { margin: 0; color: var(--ink); background: var(--surface); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input, select { font: inherit; }
button, .button { min-height: 44px; border: 1px solid var(--ink); padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); background: white; text-decoration: none; font-weight: 750; cursor: pointer; }
button:hover, .button:hover { background: #eef1f4; }
.primary { color: white; border-color: var(--green); background: var(--green); }
.primary:hover { background: var(--green-dark); }
.quiet { border-color: var(--line); }
.danger { color: var(--danger); border-color: #efc8c4; }
button:disabled { opacity: .55; cursor: wait; }

.portal-header { min-height: 70px; padding: 0 clamp(18px, 5vw, 68px); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: white; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 850; }
.brand-mark { width: 32px; height: 32px; display: inline-grid; place-items: center; color: white; background: var(--ink); }
.portal-nav { display: flex; align-items: center; gap: 10px; }
.portal-nav a { color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: none; }

.auth-shell { min-height: calc(100vh - 70px); display: grid; grid-template-columns: minmax(300px, .85fr) minmax(420px, 1.15fr); }
.auth-intro { padding: clamp(44px, 8vw, 110px); color: white; background: #172033; display: flex; flex-direction: column; justify-content: space-between; }
.auth-intro h1 { max-width: 650px; margin: 16px 0 20px; font-size: clamp(42px, 5vw, 72px); line-height: 1.02; letter-spacing: 0; }
.auth-intro p { max-width: 510px; color: #c9d0da; font-size: 17px; }
.eyebrow { color: #75c2b4 !important; font-size: 12px !important; font-weight: 850; text-transform: uppercase; }
.plan-note { margin-top: 50px; padding-top: 18px; border-top: 1px solid #465063; color: #dce2e9; font-size: 13px; }
.auth-panel { padding: clamp(36px, 8vw, 105px); display: flex; align-items: center; background: white; }
.auth-content { width: min(100%, 520px); margin: auto; }
.auth-content h2 { margin: 0 0 6px; font-size: 30px; letter-spacing: 0; }
.auth-content > p { margin: 0 0 28px; color: var(--muted); }
.mode-switch { height: 45px; margin-bottom: 28px; padding: 4px; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line); }
.mode-switch button { min-height: 35px; padding: 0 12px; border: 0; background: transparent; }
.mode-switch button[aria-selected="true"] { color: white; background: var(--ink); }
.auth-form { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 800; }
.field input, .field select { width: 100%; height: 48px; border: 1px solid #b9c1cc; padding: 0 13px; color: var(--ink); background: white; }
.field input:focus, .field select:focus { outline: 3px solid rgba(20, 107, 92, .14); border-color: var(--green); }
.consent { display: grid; grid-template-columns: 19px 1fr; gap: 10px; align-items: start; color: #4d596b; font-size: 13px; }
.consent input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--green); }
.form-error { min-height: 20px; color: var(--danger); font-size: 13px; }
.form-success { color: var(--green); }
.honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; }

.account-main { width: min(1180px, calc(100% - 40px)); margin: 44px auto 80px; }
.account-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.account-heading p { margin: 0 0 7px; color: var(--green); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.account-heading h1 { margin: 0; font-size: 38px; letter-spacing: 0; }
.account-heading .button { flex: 0 0 auto; }
.account-summary { margin-bottom: 34px; display: grid; grid-template-columns: 1.35fr 1fr 1fr; background: white; border: 1px solid var(--line); }
.summary-cell { min-height: 126px; padding: 24px; border-right: 1px solid var(--line); }
.summary-cell:last-child { border-right: 0; }
.summary-cell span { display: block; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.summary-cell strong { font-size: 26px; }
.usage-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.usage-track { height: 8px; margin-top: 15px; background: #e5e9ed; overflow: hidden; }
.usage-track i { width: 0; height: 100%; display: block; background: var(--coral); transition: width .25s ease; }
.section-heading { margin-bottom: 13px; display: flex; justify-content: space-between; align-items: baseline; }
.section-heading h2 { margin: 0; font-size: 20px; }
.section-heading span { color: var(--muted); font-size: 13px; }
.project-list { display: grid; border-top: 1px solid var(--line); }
.project { min-height: 112px; padding: 18px 20px; display: grid; grid-template-columns: minmax(190px, 1.4fr) 120px minmax(260px, auto); align-items: center; gap: 20px; background: white; border: 1px solid var(--line); border-top: 0; }
.project-title strong, .project-title a { display: block; overflow-wrap: anywhere; }
.project-title a { margin-top: 5px; color: var(--green); font-size: 13px; text-decoration: none; }
.project-title small { display: block; margin-top: 7px; color: var(--muted); }
.status { width: fit-content; padding: 5px 8px; color: #5a6474; background: #edf0f3; font-size: 11px; font-weight: 850; text-transform: uppercase; }
.status.done { color: #0d5b4c; background: #dcefe9; }
.status.error, .status.edit_error { color: #8d1d15; background: #fbe3e0; }
.project-actions { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.project-actions .button { min-height: 38px; padding: 0 11px; font-size: 12px; }
.empty-state { padding: 54px 24px; text-align: center; background: white; border: 1px solid var(--line); }
.empty-state h3 { margin: 0 0 8px; }
.empty-state p { margin: 0 0 20px; color: var(--muted); }

.text-action {
  width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: #176f60;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#email-status {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-intro { min-height: 300px; padding: 42px 24px; }
  .auth-intro h1 { font-size: 44px; }
  .auth-panel { padding: 42px 24px 70px; }
  .account-summary { grid-template-columns: 1fr; }
  .summary-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-cell:last-child { border-bottom: 0; }
  .project { grid-template-columns: 1fr; gap: 12px; }
  .project-actions { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .portal-header { min-height: 62px; }
  .portal-nav .generator-link { display: none; }
  .account-main { width: calc(100% - 28px); margin-top: 30px; }
  .account-heading { align-items: flex-start; flex-direction: column; }
  .account-heading h1 { font-size: 31px; }
  .account-heading .button { width: 100%; }
}
