:root {
    color-scheme: dark;
    --bg: #070a0f;
    --bg-soft: #0b1017;
    --panel: #10161f;
    --panel-2: #151d28;
    --panel-3: #0d131b;
    --line: #273240;
    --line-soft: rgba(255,255,255,.075);
    --text: #f5f7fa;
    --muted: #929dac;
    --muted-2: #667181;
    --gold: #d9ad55;
    --gold-bright: #f0ca78;
    --gold-dark: #8f6a27;
    --green: #76d6a2;
    --red: #ff8f8f;
    --topbar: 74px;
    --sidebar: 246px;
    --max: 1220px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { scroll-behavior: smooth; }
body {
    background:
        radial-gradient(circle at 16% -4%, rgba(41,57,79,.55), transparent 35%),
        radial-gradient(circle at 86% 11%, rgba(128,91,30,.10), transparent 28%),
        var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, select { font: inherit; }
button { color: inherit; }
.mono { font-family: "Cascadia Code", Consolas, monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Top navigation */
.topbar { position: sticky; top: 0; z-index: 60; height: var(--topbar); border-bottom: 1px solid var(--line-soft); background: rgba(7,10,15,.86); backdrop-filter: blur(18px); }
.topbar-inner { width: min(calc(100% - 44px), 1440px); height: 100%; margin: 0 auto; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 190px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.13); border-radius: 11px; background: linear-gradient(145deg,var(--gold-bright),#8a6727); color: #17120b; box-shadow: inset 0 1px 0 rgba(255,255,255,.34),0 7px 28px rgba(217,173,85,.11); font-size: 12px; font-weight: 900; }
.brand-copy { display: flex; flex-direction: column; line-height: 1; }
.brand-copy strong { font-size: 14px; letter-spacing: -.01em; }
.brand-copy small { margin-top: 5px; color: var(--gold-bright); font-size: 8px; font-weight: 900; letter-spacing: .23em; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.logout-form, .language-switcher { margin: 0; }
.language-select { max-width: 190px; padding: 9px 31px 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); font-size: 12px; cursor: pointer; }

/* Controls */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 10px 16px; border: 1px solid transparent; border-radius: 10px; background: transparent; font-size: 13px; font-weight: 800; white-space: nowrap; cursor: pointer; transition: transform .18s ease,border-color .18s ease,background .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { background: linear-gradient(135deg,var(--gold-bright),#b38636); color: #17120a; box-shadow: 0 12px 35px rgba(217,173,85,.14); }
.button-secondary { border-color: var(--line); background: var(--panel-2); color: var(--text); }
.button-ghost { border-color: var(--line); background: rgba(255,255,255,.025); color: #dce1e7; }
.button-disabled { border-color: #252d38; background: #171d25; color: #5d6877; cursor: not-allowed; }
.button-wide { width: 100%; min-height: 48px; }

/* Signed-in frame */
.portal-frame { width: min(calc(100% - 44px), 1440px); min-height: calc(100vh - var(--topbar)); margin: 0 auto; display: grid; grid-template-columns: var(--sidebar) minmax(0,1fr); }
.portal-sidebar { position: sticky; top: var(--topbar); align-self: start; height: calc(100vh - var(--topbar)); padding: 34px 22px 24px 0; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; }
.sidebar-heading { padding: 0 18px 24px; }
.sidebar-heading strong { display: block; margin-top: 7px; font-size: 18px; letter-spacing: -.02em; }
.sidebar-kicker { color: var(--gold-bright); font-size: 8px; font-weight: 900; letter-spacing: .2em; }
.portal-nav { display: grid; gap: 6px; }
.portal-nav-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid transparent; border-radius: 11px; color: var(--muted); font-size: 13px; font-weight: 700; transition: .18s ease; }
.portal-nav-link:hover { border-color: var(--line-soft); background: rgba(255,255,255,.025); color: var(--text); }
.portal-nav-link.active { border-color: rgba(217,173,85,.25); background: linear-gradient(90deg,rgba(217,173,85,.12),rgba(217,173,85,.025)); color: var(--text); }
.portal-nav-link.active::before { content: ""; position: absolute; left: -1px; top: 11px; bottom: 11px; width: 2px; border-radius: 2px; background: var(--gold-bright); box-shadow: 0 0 14px rgba(217,173,85,.45); }
.nav-icon { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--muted-2); font-family: "Cascadia Code",Consolas,monospace; font-size: 9px; }
.portal-nav-link.active .nav-icon { border-color: rgba(217,173,85,.35); color: var(--gold-bright); }
.sidebar-foot { margin-top: auto; padding: 16px 18px 0; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 9px; color: var(--muted-2); font-size: 10px; line-height: 1.4; }
.portal-content { min-width: 0; padding: 54px 0 78px 48px; }
.footer { display: none; }
.portal-public .footer { display: block; padding: 30px 22px; text-align: center; color: var(--muted-2); font-size: 11px; }

/* Shared page typography */
.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; color: var(--gold-bright); font-size: 10px; font-weight: 900; letter-spacing: .2em; text-transform: uppercase; }
.eyebrow-dot, .status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 16px rgba(118,214,162,.5); }
.page-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.page-hero.compact { padding: 8px 0 6px; }
.page-hero h1 { margin: 0 0 12px; font-size: clamp(36px,4vw,54px); line-height: 1.02; letter-spacing: -.045em; }
.page-hero p { max-width: 760px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.card-label { margin-bottom: 9px; color: #7f8b9d; font-size: 10px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.card-value { margin-bottom: 7px; font-size: 22px; font-weight: 760; letter-spacing: -.025em; overflow-wrap: anywhere; }
.subtle { color: var(--muted); font-size: 13px; line-height: 1.55; }
.micro { margin-top: 12px; color: #758194; font-size: 11px; line-height: 1.5; }
.status-pill, .count-badge { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid rgba(217,173,85,.30); border-radius: 999px; background: rgba(217,173,85,.09); color: var(--gold-bright); font-size: 11px; font-weight: 850; white-space: nowrap; }
.count-badge.large { min-width: 46px; min-height: 46px; justify-content: center; border-radius: 14px; font-size: 15px; }
.text-link { display: inline-flex; align-items: center; gap: 7px; margin-top: 18px; color: var(--gold-bright); font-size: 12px; font-weight: 800; }
.text-link span { transition: transform .18s ease; }
.text-link:hover span { transform: translateX(2px); }

/* Cards */
.content-card, .summary-card, .sync-card, .download-product-card { border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(145deg,rgba(21,29,40,.93),rgba(12,17,24,.95)); box-shadow: 0 18px 50px rgba(0,0,0,.14); }
.content-card { padding: 24px; }
.summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.summary-card { position: relative; min-height: 205px; padding: 24px; overflow: hidden; }
.summary-card::after { content: ""; position: absolute; right: -55px; bottom: -70px; width: 150px; height: 150px; border: 1px solid rgba(217,173,85,.08); border-radius: 50%; }
.summary-index { margin-bottom: 28px; color: var(--gold-dark); font-family: "Cascadia Code",Consolas,monospace; font-size: 10px; font-weight: 800; }
.section-card { margin-top: 17px; }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.section-title h2, .content-card h2, .sync-card h2 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.section-copy { max-width: 760px; margin-top: 10px; }
.accent-card { border-color: rgba(217,173,85,.30); box-shadow: inset 0 1px rgba(240,202,120,.05),0 18px 50px rgba(0,0,0,.14); }
.alert { margin: 0 0 18px; padding: 13px 15px; border-radius: 10px; font-size: 13px; }
.alert-error { border: 1px solid rgba(255,143,143,.35); background: rgba(255,143,143,.08); color: #ffc3c3; }
.alert-success { border: 1px solid rgba(118,214,162,.35); background: rgba(118,214,162,.08); color: #b9f3d0; }

/* Entitlements */
.entitlement-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin-top: 20px; }
.entitlement { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; background: #0b1017; font-size: 12px; overflow-wrap: anywhere; }
.entitlement-check { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; background: rgba(118,214,162,.09); color: var(--green); font-size: 11px; font-weight: 900; }

/* Membership */
.membership-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.identity-row { display: flex; align-items: center; gap: 14px; }
.identity-avatar { width: 45px; height: 45px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(217,173,85,.28); border-radius: 13px; background: rgba(217,173,85,.09); color: var(--gold-bright); font-weight: 900; }
.inline-form { margin-top: 15px; }
.channel-list { display: grid; gap: 9px; margin-top: 18px; }
.channel-option { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #0b1017; }
.channel-identity { min-width: 0; display: flex; align-items: center; gap: 12px; }
.channel-identity > div { min-width: 0; }
.channel-identity strong { display: block; margin-bottom: 4px; }
.channel-mark { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(255,143,143,.25); border-radius: 9px; background: rgba(255,143,143,.08); color: #ffb2b2; font-size: 9px; font-weight: 900; }
.sync-card { display: flex; align-items: flex-start; gap: 17px; padding: 24px; }
.sync-card p { max-width: 850px; margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.sync-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-3); }
.sync-card.ready { border-color: rgba(118,214,162,.22); }

/* License Application */
.license-application-card { border-color: rgba(217,173,85,.22); }
.license-application-form { display: flex; align-items: center; margin-top: 18px; }
.license-application-form .button { min-width: 190px; }
.application-pending-box { margin-top: 18px; padding: 16px; border: 1px solid rgba(217,173,85,.24); border-radius: 12px; background: rgba(217,173,85,.06); }
.application-pending-box p { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

/* License */
.license-summary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.status-value { display: flex; align-items: center; gap: 10px; }
.license-vault { border-color: rgba(217,173,85,.28); background: linear-gradient(145deg,rgba(27,26,22,.85),rgba(11,16,23,.96)); }
.vault-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.vault-badge { padding: 6px 8px; border: 1px solid rgba(217,173,85,.28); border-radius: 8px; color: var(--gold-bright); font-family: "Cascadia Code",Consolas,monospace; font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.license-row { display: flex; align-items: stretch; gap: 10px; }
.license-key { min-width: 0; flex: 1; display: flex; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #080c11; color: var(--text); font-size: 16px; letter-spacing: .06em; overflow-wrap: anywhere; }
.license-key.concealed { color: #a8b0bc; }
.license-actions { display: flex; gap: 8px; }
.muted { color: var(--muted); }

/* Machines */
.machine-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.machine-card { padding: 24px; }
.machine-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.device-heading { display: flex; align-items: center; gap: 13px; min-width: 0; }
.device-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(217,173,85,.25); border-radius: 11px; background: rgba(217,173,85,.08); color: var(--gold-bright); font-size: 9px; font-weight: 900; }
.detail-list { display: grid; grid-template-columns: 116px minmax(0,1fr); gap: 11px 18px; margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--line-soft); font-size: 12px; }
.detail-list dt { color: #7f8b9d; }
.detail-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }

/* Downloads */
.download-product-card { min-height: 160px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 22px; padding: 28px; border-color: rgba(217,173,85,.24); }
.download-product-icon { position: relative; width: 66px; height: 66px; display: grid; place-items: center; border: 1px solid rgba(217,173,85,.30); border-radius: 17px; background: linear-gradient(145deg,rgba(217,173,85,.16),rgba(217,173,85,.04)); color: var(--gold-bright); font-weight: 900; }
.download-product-icon small { position: absolute; right: 7px; bottom: 6px; color: var(--muted); font-size: 8px; }
.support-line { margin-top: 22px; text-align: center; color: var(--muted); font-size: 13px; }

/* Empty / error */
.empty-state { padding: 44px; color: var(--muted); text-align: center; }
.empty-state.inline-empty { margin-top: 20px; padding: 24px; border: 1px dashed var(--line); border-radius: 12px; background: #0b1017; }
.empty-state h1, .empty-state h2 { margin: 0 0 10px; color: var(--text); }
.empty-state p { max-width: 660px; margin: 0 auto 20px; line-height: 1.65; }
.empty-icon { width: 46px; height: 46px; margin: 0 auto 16px; display: grid; place-items: center; border: 1px solid rgba(217,173,85,.24); border-radius: 13px; background: rgba(217,173,85,.07); color: var(--gold-bright); font-size: 11px; font-weight: 900; }
.error-state { max-width: 760px; margin: 80px auto; }

/* Public sign-in */
.public-shell { width: min(calc(100% - 48px), var(--max)); margin: 0 auto; }
.signin-stage { min-height: calc(100vh - var(--topbar) - 80px); display: grid; grid-template-columns: minmax(0,1.2fr) minmax(390px,.8fr); gap: 70px; align-items: center; padding: 72px 0; }
.signin-copy h1 { max-width: 760px; margin: 0; font-size: clamp(48px,6vw,80px); line-height: .98; letter-spacing: -.055em; }
.hero-copy { max-width: 720px; margin: 24px 0 0; color: var(--muted); font-size: 17px; line-height: 1.72; }
.signin-proof { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 35px; }
.signin-proof > div { min-height: 76px; padding: 14px; border: 1px solid var(--line-soft); border-radius: 12px; background: rgba(255,255,255,.015); }
.signin-proof strong { display: block; margin-bottom: 5px; font-size: 12px; }
.signin-proof span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.signin-panel { padding: 28px; border: 1px solid #344150; border-radius: 20px; background: linear-gradient(155deg,rgba(22,30,41,.97),rgba(10,14,20,.98)); box-shadow: 0 45px 100px rgba(0,0,0,.32); }
.signin-panel-head { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--line-soft); }
.panel-logo { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg,var(--gold-bright),#8a6727); color: #17120b; font-size: 11px; font-weight: 900; }
.signin-panel-head div { display: flex; flex-direction: column; }
.signin-panel-head small { color: var(--gold-bright); font-size: 8px; font-weight: 900; letter-spacing: .18em; }
.signin-panel-head strong { margin-top: 5px; font-size: 14px; }
.signin-panel-copy { padding: 29px 0 22px; }
.signin-panel-copy h2 { margin: 0 0 9px; font-size: 26px; letter-spacing: -.03em; }
.signin-panel-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.signin-security { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; color: var(--muted-2); font-family: "Cascadia Code",Consolas,monospace; font-size: 9px; }
.signin-security .status-dot { width: 5px; height: 5px; }

@media (max-width: 1050px) {
    :root { --sidebar: 208px; }
    .portal-content { padding-left: 30px; }
    .summary-grid, .entitlement-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .summary-card:last-child { grid-column: 1 / -1; }
    .signin-stage { gap: 38px; }
}
@media (max-width: 820px) {
    .topbar-inner, .portal-frame { width: min(calc(100% - 32px), 1440px); }
    .portal-frame { display: block; }
    .portal-sidebar { position: static; height: auto; padding: 14px 0 0; border-right: 0; border-bottom: 1px solid var(--line-soft); }
    .sidebar-heading, .sidebar-foot { display: none; }
    .portal-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 13px; scrollbar-width: none; }
    .portal-nav::-webkit-scrollbar { display: none; }
    .portal-nav-link { flex: 0 0 auto; padding: 9px 11px; }
    .portal-nav-link.active::before { left: 10px; right: 10px; top: auto; bottom: -1px; width: auto; height: 2px; }
    .nav-icon { width: 24px; height: 24px; }
    .portal-content { padding: 38px 0 64px; }
    .membership-grid, .license-summary, .machine-list { grid-template-columns: 1fr; }
    .signin-stage { grid-template-columns: 1fr; max-width: 760px; margin: 0 auto; }
    .signin-panel { max-width: 520px; }
}
@media (max-width: 620px) {
    .topbar-inner { width: calc(100% - 24px); gap: 10px; }
    .brand { min-width: 0; }
    .brand-copy { display: none; }
    .language-select { max-width: 145px; }
    .logout-form .button { min-height: 38px; padding: 8px 10px; }
    .portal-frame { width: calc(100% - 24px); }
    .page-hero { flex-direction: column; }
    .page-hero h1 { font-size: 36px; }
    .summary-grid, .entitlement-grid, .signin-proof { grid-template-columns: 1fr; }
    .summary-card:last-child { grid-column: auto; }
    .license-row, .channel-option, .download-product-card { align-items: stretch; grid-template-columns: 1fr; flex-direction: column; }
    .license-application-form .button { width: 100%; }
    .license-row { display: flex; }
    .license-actions { width: 100%; }
    .license-actions .button { flex: 1; }
    .download-product-card { display: grid; }
    .download-action .button { width: 100%; }
    .detail-list { grid-template-columns: 1fr; gap: 5px; }
    .detail-list dt { margin-top: 9px; }
    .signin-stage { padding: 46px 0; }
    .signin-copy h1 { font-size: 46px; }
    .public-shell { width: calc(100% - 30px); }
}
