:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eaf1fa;
  --text: #101828;
  --muted: #5d6a7d;
  --line: #d7e0ea;
  --accent: #1769e0;
  --accent-hover: #1058bf;
  --success: #137a52;
  --danger: #b42318;
  --shadow: 0 22px 60px rgba(30, 60, 96, .12);
  --radius: 16px;
  font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.portal-header { min-height: 72px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: rgba(244,247,251,.92); border-bottom: 1px solid var(--line); }
.portal-brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; font-size: 15px; font-weight: 780; letter-spacing: -.02em; text-decoration: none; }
.portal-mark { width: 32px; height: 32px; padding: 7px 6px; display: flex; align-items: flex-end; gap: 3px; background: #0d1726; border-radius: 8px; }
.portal-mark i { width: 5px; display: block; background: #f3f7fc; border-radius: 2px; }
.portal-mark i:nth-child(1) { height: 9px; }
.portal-mark i:nth-child(2) { height: 17px; background: #4c8ff0; }
.portal-mark i:nth-child(3) { height: 13px; }
.portal-account { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }

.portal-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 64px 0 96px; }
.auth-layout { min-height: 620px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .75fr); align-items: center; gap: clamp(54px, 9vw, 120px); }
.auth-copy { max-width: 620px; }
.kicker, .step-label { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 720px; margin-bottom: 20px; font-size: clamp(42px, 5vw, 68px); line-height: .98; letter-spacing: -.06em; }
h2 { margin-bottom: 9px; font-size: 24px; letter-spacing: -.035em; }
.auth-copy > p:not(.kicker), .auth-panel p, .section-heading p, .workspace-panel p, .empty-state p { color: var(--muted); line-height: 1.6; }
.auth-copy > p:not(.kicker) { max-width: 560px; font-size: 17px; }
.auth-facts { margin: 42px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.auth-facts div { padding: 22px 24px 22px 0; }
.auth-facts div + div { padding-left: 24px; border-left: 1px solid var(--line); }
.auth-facts dt { margin-bottom: 5px; font-size: 24px; font-weight: 800; letter-spacing: -.04em; }
.auth-facts dd { margin: 0; color: var(--muted); font-size: 12px; }

.auth-panel, .workspace-panel { padding: 30px; display: grid; gap: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-panel label, .workspace-panel label { display: grid; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
input { width: 100%; min-height: 48px; padding: 0 14px; color: var(--text); background: var(--surface); border: 1px solid #b9c6d5; border-radius: 10px; outline: none; }
input::placeholder { color: #8491a3; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23,105,224,.14); }

.primary-button, .secondary-button, .text-button { border: 0; cursor: pointer; }
.primary-button, .secondary-button { min-height: 48px; padding: 0 18px; border-radius: 10px; font-size: 13px; font-weight: 780; white-space: nowrap; transition: transform 140ms ease, background-color 160ms ease; }
.primary-button { color: #fff; background: var(--accent); }
.primary-button:hover { background: var(--accent-hover); }
.secondary-button { color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.primary-button:active, .secondary-button:active { transform: scale(.98); }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: wait; }
.text-button { padding: 0; color: var(--accent); background: transparent; font-size: 12px; font-weight: 750; }
.align-left { justify-self: start; }
.form-status { min-height: 20px; margin: -8px 0 0; font-size: 12px; }
.form-status.error, .system-notice.error { color: var(--danger); }
.form-status.success { color: var(--success); }

.dashboard { display: grid; gap: 28px; }
.dashboard-heading { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 32px; padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.dashboard-heading h1 { margin-bottom: 12px; }
.dashboard-heading p { margin-bottom: 0; color: var(--muted); }
.price-block { min-width: 180px; padding: 22px; color: #f5f8fc; background: #0d1726; border-radius: var(--radius); }
.price-block span, .price-block small, .price-block strong { display: block; }
.price-block span { color: #94a3b8; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.price-block strong { margin: 7px 0 2px; font-size: 30px; letter-spacing: -.05em; }
.price-block small { color: #b7c3d2; }
.system-notice { padding: 14px 16px; color: #174f91; background: #e6f0ff; border: 1px solid #bfd5f4; border-radius: 10px; font-size: 13px; line-height: 1.5; }

.workspace-section { padding: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.section-heading { margin-bottom: 22px; display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.section-heading h2 { margin-bottom: 6px; }
.section-heading p { margin-bottom: 0; font-size: 13px; }
.license-list, .payment-list { display: grid; }
.license-row { padding: 20px 0; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, .8fr) auto; align-items: center; gap: 24px; border-top: 1px solid var(--line); }
.license-row:last-child { padding-bottom: 0; }
.license-name strong, .license-meta strong { display: block; margin-bottom: 5px; font-size: 15px; }
.license-name span, .license-meta span { color: var(--muted); font-size: 12px; }
.license-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.payment-method-control { min-width: 188px; display: grid; gap: 6px; }
.payment-method-state { color: var(--muted); font-size: 11px; text-align: center; }
.payment-method-state.is-active { color: var(--success); font-weight: 700; }
.payment-method-button { min-height: 40px; }
.payment-method-button:disabled { cursor: not-allowed; }
.status-badge { width: fit-content; margin-top: 8px; padding: 5px 8px; color: #175c3e; background: #e5f4ed; border-radius: 7px; font-size: 10px; font-weight: 800; }
.status-badge.warn { color: #84520e; background: #fff1d8; }
.status-badge.bad { color: #8e2118; background: #fde9e7; }
.workspace-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.workspace-panel { box-shadow: none; }
.workspace-panel .step-label { margin-bottom: 8px; display: block; }
.consent-row { grid-template-columns: auto 1fr !important; align-items: start; }
.consent-row input { width: 18px; min-height: 18px; margin-top: 2px; }
.consent-row a { color: var(--accent); }
.payment-method-choice { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; }
.payment-method-choice[hidden] { display: none; }
.payment-method-choice legend { margin-bottom: 8px; font-weight: 700; }
.payment-method-option { display: flex !important; align-items: center; gap: 10px; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.payment-method-option:has(input:checked) { border-color: var(--accent); background: rgba(27, 103, 224, .06); }
.payment-method-option input { width: 18px; min-height: 18px; margin: 0; }
.empty-state { padding: 30px 0 4px; text-align: center; border-top: 1px solid var(--line); }
.empty-state strong { font-size: 17px; }
.empty-state p { margin: 7px 0 0; font-size: 13px; }
.payment-row { padding: 15px 0; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 18px; border-top: 1px solid var(--line); font-size: 12px; }
.payment-row strong { display: block; margin-bottom: 3px; font-size: 13px; }
.payment-row span { color: var(--muted); }
.payment-row b { font-size: 13px; }
.muted { margin: 0; color: var(--muted); font-size: 13px; }

.portal-footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 26px 0 40px; display: flex; flex-wrap: wrap; gap: 22px; color: var(--muted); border-top: 1px solid var(--line); font-size: 12px; }
.portal-footer a { color: inherit; }

.recurring-dialog { width: min(520px, calc(100% - 32px)); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 30px 90px rgba(13, 23, 38, .3); }
.recurring-dialog::backdrop { background: rgba(13, 23, 38, .62); backdrop-filter: blur(3px); }
.recurring-dialog form { position: relative; padding: 32px; display: grid; gap: 20px; }
.recurring-dialog h2 { margin: 0; }
.recurring-dialog p { margin: 0; color: var(--muted); line-height: 1.55; }
.dialog-close { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; color: var(--muted); background: transparent; border: 0; border-radius: 8px; font-size: 25px; line-height: 1; cursor: pointer; }
.dialog-close:hover { color: var(--text); background: var(--surface-soft); }
.dialog-consent { padding: 15px; background: var(--surface-soft); border-radius: 10px; color: var(--text) !important; font-size: 12px !important; font-weight: 600 !important; line-height: 1.5; }

button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(23,105,224,.3); outline-offset: 3px; }

@media (max-width: 820px) {
  .portal-header { padding-inline: 20px; }
  .portal-shell, .portal-footer { width: min(100% - 32px, 680px); }
  .portal-shell { padding-top: 38px; }
  .auth-layout, .workspace-grid { grid-template-columns: 1fr; }
  .auth-layout { gap: 34px; }
  .dashboard-heading { grid-template-columns: 1fr; }
  .price-block { width: 100%; }
  .license-row { grid-template-columns: 1fr; gap: 14px; }
  .license-actions { justify-content: flex-start; flex-wrap: wrap; }
  .payment-method-control { width: 100%; }
  .payment-row { grid-template-columns: 1fr auto; }
  .payment-row > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .portal-account > span { display: none; }
  .portal-shell { width: min(100% - 24px, 480px); }
  h1 { font-size: 40px; }
  .auth-facts { grid-template-columns: 1fr; }
  .auth-facts div + div { padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .auth-panel, .workspace-panel, .workspace-section { padding: 22px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .secondary-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
