body.portal-shell { --ui-sidebar-portal: 268px; min-width: 0; padding-left: var(--ui-sidebar-portal) !important; }
body:is(.portal-shell, .portal-auth-shell) { font-size: 16px; line-height: 1.6; }
body.portal-shell .setup-summary { margin-top: 16px; color: var(--ui-text-secondary); }
/* Reference-driven portal shell and account overview. */
body.portal-shell { background: #fff !important; }
body.portal-shell .portal-brand { min-height: 172px; padding: 36px 32px 24px; border: 0; }
body.portal-shell .portal-brand strong { font-size: 30px; display: flex; align-items: center; gap: 12px; }
body.portal-shell .portal-brand .portal-brand-mark { color: #0071e3; margin: 0; display: inline-flex; }
body.portal-shell .portal-brand-mark .ui-icon { width: 36px; height: 36px; flex-basis: 36px; stroke-width: 3; }
body.portal-shell .portal-brand span { margin-top: 14px; font-size: 15px; }
body.portal-shell .portal-nav { padding: 18px 14px; }
body.portal-shell .portal-nav-group { margin-bottom: 0; }
body.portal-shell .portal-nav-group-title { display: none; }
body.portal-shell .portal-nav-link { position: relative; min-height: 60px; gap: 16px; margin: 8px 0; padding: 14px 24px; font-size: 18px; font-weight: 500; }
body.portal-shell .portal-nav-link .ui-icon { width: 25px; height: 25px; flex-basis: 25px; }
body.portal-shell button.portal-logout { color: #646469 !important; background: transparent !important; border-color: transparent !important; font-weight: 500; }
body.portal-shell .portal-nav-link.active::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 4px; border-radius: 2px; background: #0071e3; }
body.portal-shell .portal-sidebar-footer { border: 0; padding: 18px 24px 28px; }
body.portal-shell .portal-privacy-link { display: none; }
body.portal-shell[data-ui-page="account"] > header { display: none; }
body.portal-shell[data-ui-page="account"] > main.wrap { container-type: inline-size; max-width: 1360px !important; width: 100%; padding: 20px 44px 48px !important; }
.overview-topbar { display: flex; justify-content: flex-end; min-height: 48px; align-items: center; margin-bottom: 18px; }
.overview-topbar a { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; color: #292929; text-decoration: none; max-width: 100%; overflow-wrap: anywhere; }
.overview-topbar .ui-icon { width: 28px; height: 28px; flex: 0 0 28px; }
.overview-title { font-size: 30px; margin: 0 0 30px; }
.overview-subscription { display: grid; grid-template-columns: 1fr 1.2fr 1fr auto; align-items: center; gap: 24px; background: #f2f7ff; padding: 28px 30px; border-radius: 8px; margin-bottom: 24px; }
.subscription-identity { display: flex; gap: 18px; align-items: center; min-width: 0; }
.subscription-identity strong { display: block; font-size: 21px; }
.subscription-identity div > span { display: block; color: #646469; margin-top: 3px; }
.subscription-symbol { width: 56px; height: 56px; display: grid; place-items: center; flex-shrink: 0; border-radius: 50%; background: #0071e3; color: white; }
.subscription-symbol .ui-icon { width: 28px; height: 28px; }
.subscription-detail { display: flex; align-items: center; gap: 16px; padding-left: 26px; border-left: 1px solid #dce2eb; min-width: 0; }
.subscription-detail > div { min-width: 0; display: grid; gap: 4px; }
.subscription-detail > .ui-icon { width: 28px; height: 28px; flex: 0 0 28px; color: #646469; }
.subscription-detail strong { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
#overview-days { color: #197132; font-size: 26px; }
body.portal-shell .overview-renew { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 22px; background: #0071e3; color: #fff; text-decoration: none; border-radius: 5px; text-align: center; }
.overview-section { padding: 20px 24px 12px; margin-bottom: 24px; border: 1px solid #e4e7ec; border-radius: 8px; }
.overview-section h2 { margin: 0 0 12px; font-size: 20px; }
.overview-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.overview-section-heading h2 { margin: 0; }
.overview-section-heading a { font-size: 14px; text-decoration: none; min-height: 28px; display: inline-flex; align-items: center; gap: 12px; }
.overview-step { position: relative; display: grid; grid-template-columns: 30px 190px minmax(0,1fr) 84px 20px; align-items: center; gap: 18px; min-height: 70px; text-decoration: none; color: #1d1d1f; }
.overview-step:hover { color: #0071e3; background: #fafcff; }
.overview-step:not(:last-child)::after { content: ''; position: absolute; left: 50px; bottom: 0; right: 0; border-bottom: 1px solid #e8e8ed; }
.overview-step:not(:last-child)::before { content: ''; position: absolute; left: 14px; top: 51px; bottom: -23px; width: 1px; background: #d2d2d7; }
.overview-step.done::before { background: #5dad83; }
.overview-step-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid #8a8a8e; color: #646469; background: #fff; z-index: 1; }
.done .overview-step-mark { background: #16864d; border-color: #16864d; color: #fff; }
.current .overview-step-mark { color: #0071e3; border-color: #0071e3; }
.overview-step-description { color: #646469; font-size: 16px; }
.overview-step strong { font-size: 16px; font-weight: 550; }
.overview-badge { padding: 3px 12px; background: #f2f2f3; color: #646469; border-radius: 20px; font-size: 14px; text-align: center; white-space: nowrap; }
.done .overview-badge { color: #197132; background: #e7f5ed; }
.current .overview-badge { color: #0064c9; background: #e8f1ff; }
.overview-chevron { font-size: 24px; color: #646469; text-align: right; }
.overview-device { display: grid; grid-template-columns: minmax(220px,2fr) minmax(120px,1fr) minmax(80px,.7fr) minmax(80px,.7fr) auto; gap: 20px; align-items: center; padding: 10px 0; }
.overview-device + .overview-device { border-top: 1px solid #e8e8ed; }
.overview-device-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.overview-device-identity > div { min-width: 0; }
.overview-device-identity h3 { font-size: 18px; margin-bottom: 8px; overflow-wrap: anywhere; }
.overview-device-symbol { display: grid; place-items: center; width: 52px; height: 70px; flex-shrink: 0; color: #0071e3; background: #f2f7ff; border-radius: 8px; }
.overview-device-symbol .ui-icon { width: 30px; height: 30px; }
.overview-device-id { font-size: 12px; color: #646469; overflow-wrap: anywhere; margin: 4px 0 0; }
.overview-device-detail { display: grid; gap: 8px; border-left: 1px solid #e8e8ed; padding-left: 20px; font-size: 14px; overflow-wrap: anywhere; }
.overview-device a { min-height: 44px; display: flex; align-items: center; text-decoration: none; }
.overview-announcement { display: grid; grid-template-columns: 48px minmax(0,1fr) auto auto; gap: 24px; align-items: center; padding: 8px 0; }
.overview-news-symbol { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #eef5ff; color: #0071e3; }
.overview-news-symbol .ui-icon { width: 24px; height: 24px; }
.overview-announcement h3 { font-size: 16px; margin-bottom: 8px; }
.overview-announcement-copy { color: #646469; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; margin: 0; }
.overview-announcement time { color: #646469; font-size: 14px; }
.overview-announcement a { display: flex; align-items: center; min-height: 44px; text-decoration: none; font-size: 14px; }
.overview-settings { border-top: 1px solid #e8e8ed; padding-top: 12px; }
.overview-settings > summary { cursor: pointer; padding: 12px 0; color: #646469; }
body.portal-shell #account-settings .panel { padding-inline: 0 !important; }
@media (max-width: 1250px) {
  .overview-subscription { grid-template-columns: 1fr 1fr; }
  .overview-step { grid-template-columns: 30px 160px minmax(0,1fr) 80px 12px; gap: 12px; }
  .overview-device { grid-template-columns: minmax(200px,2fr) 1fr 1fr; }
  .overview-device-detail { padding-left: 12px; }
}
@media (max-width: 860px) {
  body.portal-shell .portal-sidebar .portal-brand { min-height: 136px; padding-top: 36px; }
  body.portal-shell[data-ui-page="account"] > main.wrap { padding: 16px 20px 36px !important; }
  .overview-topbar { margin-bottom: 12px; }
  .overview-title { font-size: 26px; margin-bottom: 24px; }
}
@container (max-width: 650px) {
  .overview-subscription { grid-template-columns: minmax(0,1fr) minmax(0,1fr); padding: 20px; gap: 20px 12px; }
  .subscription-identity { grid-column: 1 / -1; }
  .subscription-detail { padding-left: 0; border: 0; }
  .subscription-detail strong { font-size: 16px; }
  .subscription-detail .muted { font-size: 13px; }
  .overview-renew { grid-column: 1 / -1; }
  .overview-section { padding: 18px 16px; margin-bottom: 16px; }
  .overview-section-heading { align-items: flex-start; gap: 8px; flex-wrap: wrap; }
  .overview-section-heading a { min-height: 30px; }
  .overview-step { grid-template-columns: 28px minmax(0,1fr) 72px; padding: 15px 0; gap: 8px 10px; }
  .overview-step strong { font-size: 15px; }
  .overview-step-description { grid-column: 2 / -1; grid-row: 2; font-size: 14px; }
  .overview-badge { grid-column: 3; grid-row: 1; padding: 3px 8px; font-size: 13px; }
  .overview-chevron { display: none; }
  .overview-step:not(:last-child)::before { top: 42px; bottom: -16px; }
  .overview-step:not(:last-child)::after { left: 38px; }
  .overview-device { grid-template-columns: 1fr 1fr; gap: 16px 12px; }
  .overview-device-identity { grid-column: 1 / -1; }
  .overview-device-detail { border: 0; padding: 0; }
  .overview-announcement { grid-template-columns: 1fr auto; gap: 10px; }
  .overview-announcement > div { grid-column: 1 / -1; }
  .overview-news-symbol { display: none; }
}
body.portal-shell #current { border: 0; background: transparent; padding: 0; }
body.portal-shell #current .status { border: 0; background: transparent; padding: 0; }
body.portal-shell details.setup-step { display: block; }
body.portal-shell details.setup-step summary { min-height: 44px; padding: 10px 0; font-weight: 600; cursor: pointer; }
body.portal-shell details.setup-step[open] .setup-step-copy { margin-bottom: 12px; }
.portal-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1000; width: var(--ui-sidebar-portal); display: flex; flex-direction: column; background: var(--ui-surface); border-right: 1px solid var(--ui-separator-soft); }
.portal-brand { min-height: 88px; padding: 20px 22px; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--ui-separator-soft); }
.portal-brand strong { font-size: 21px; font-weight: 700; }
.portal-brand span { margin-top: 3px; color: var(--ui-text-secondary); font-size: 12px; }
.portal-nav { flex: 1; min-height: 0; padding: 18px 12px; overflow-y: auto; scrollbar-width: thin; }
.portal-nav-group { margin: 0 0 22px; }
.portal-nav-group-title { display: block; padding: 0 10px 8px; color: var(--ui-text-tertiary); font-size: 11px; font-weight: 650; }
.portal-nav-link { display: flex; align-items: center; gap: 10px; min-height: 42px; margin: 2px 0; padding: 10px; color: var(--ui-text-secondary) !important; border-radius: var(--ui-radius-control); font-size: 14px; font-weight: 550; text-decoration: none !important; }
.portal-nav-link:hover { color: var(--ui-text) !important; background: var(--ui-bg); }
.portal-nav-link.active { color: var(--ui-accent) !important; background: var(--ui-accent-soft); font-weight: 650; }
.portal-sidebar-footer { padding: 14px 16px 18px; border-top: 1px solid var(--ui-separator-soft); }
.portal-privacy-link { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px; color: var(--ui-text-secondary) !important; font-size: 12px; font-weight: 600; text-decoration: none !important; }
.portal-logout { display: flex !important; align-items: center; justify-content: flex-start; gap: 9px; width: 100% !important; margin: 4px 0 0 !important; color: var(--ui-text-secondary) !important; background: transparent !important; border-color: transparent !important; }
.portal-logout:hover { color: var(--ui-text) !important; background: var(--ui-bg) !important; border-color: var(--ui-bg) !important; }
.portal-nav-toggle, .portal-nav-overlay, .shell-nav-checkbox, .portal-mobile-title { display: none; }
body.portal-shell > header .wrap, body.portal-shell > main.wrap { max-width: 1080px !important; }
body.portal-shell > main.wrap { background: var(--ui-surface); }
body.portal-shell > header a { display: none !important; }
body.portal-shell section[id] { scroll-margin-top: 20px; }
body.portal-shell .panel { padding: 28px !important; }
body.portal-shell #account-overview, body.portal-shell #subscription { border-bottom-color: #d9eaff !important; }
body.portal-shell .agreements { margin-top: 16px; padding: 14px 16px; background: var(--ui-surface-subtle); border: 1px solid var(--ui-separator-soft); border-radius: var(--ui-radius-control); }
body.portal-shell .agreements label { margin: 8px 0 !important; font-weight: 500 !important; }
body.portal-shell .progress { height: 6px; overflow: hidden; background: var(--ui-separator-soft); border-radius: 3px; }
body.portal-shell .progress > span { display: block; height: 100%; background: var(--ui-accent); border-radius: inherit; }
body.portal-shell .setup-progress { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; height: auto; margin: 0 0 20px; overflow: visible; }
body.portal-shell .setup-marker { min-width: 0; min-height: 68px; padding: 11px 12px; color: var(--ui-text-secondary); background: var(--ui-surface-subtle); border: 1px solid var(--ui-separator-soft); border-radius: var(--ui-radius-control); font-size: 13px; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; }
body.portal-shell .setup-marker.done { color: var(--ui-success); background: var(--ui-success-soft); border-color: rgba(36,138,61,.22); }
body.portal-shell .setup-marker.current { color: var(--ui-accent); background: var(--ui-accent-soft); border-color: rgba(0,113,227,.24); }
body.portal-shell .setup-marker.pending { color: var(--ui-warning); background: var(--ui-warning-soft); border-color: rgba(178,80,0,.22); }
body.portal-shell .setup-marker.optional { color: var(--ui-accent); background: var(--ui-accent-soft); border-color: rgba(0,113,227,.18); }
body.portal-shell .setup-marker.locked { color: var(--ui-text-tertiary); background: var(--ui-bg); }
body.portal-shell .record-time { color: var(--ui-text-secondary); font-variant-numeric: tabular-nums; }
body.portal-shell .record-preview { width: 100%; margin-top: 12px; }
body.portal-shell .step-card { margin-top: 16px; padding: 20px; border: 1px solid var(--ui-separator-soft); border-radius: var(--ui-radius-panel); }
body.portal-shell[data-ui-page="setup"] a.button { display: inline-flex; align-items: center; justify-content: center; max-width: 100%; min-height: 44px; vertical-align: middle; white-space: normal; overflow-wrap: anywhere; }
body.portal-shell .setup-step { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 20px; white-space: normal; }
body.portal-shell .setup-step-copy { min-width: 0; }
body.portal-shell .setup-step-title { margin: 0 0 6px; font-size: 16px; }
body.portal-shell .setup-step-description { margin: 0; color: var(--ui-text-secondary); white-space: pre-wrap; }
body.portal-shell .setup-step > a.button { margin: 0 !important; justify-self: start; }
@media (max-width: 700px) {
  body.portal-shell .setup-step { grid-template-columns: minmax(0, 1fr); }
}
body.portal-auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 32px 16px !important; background: var(--ui-bg) !important; }
body.portal-auth-shell .portal-auth-main { width: min(460px, 100%); }
body.portal-auth-shell header, body.portal-auth-shell .portal-sidebar, body.portal-auth-shell .portal-nav-toggle, body.portal-auth-shell .portal-mobile-title { display: none !important; }
body.portal-auth-shell main.wrap { padding: 0 !important; }
body.portal-auth-shell #auth.panel { margin: 0 !important; padding: 32px !important; }
.portal-auth-brand { margin: 0 0 22px; }
.portal-auth-brand strong { display: block; color: var(--ui-text); font-size: 28px; font-weight: 700; }
.portal-auth-brand span { display: block; margin-top: 6px; color: var(--ui-text-secondary); font-size: 13px; }
body.portal-auth-shell #auth .auth-login-view > .grid:first-of-type { grid-template-columns: 1fr; }
body.portal-auth-shell #login { width: 100%; }
.auth-segments { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: 0 0 22px; padding: 2px; background: var(--ui-bg); border-radius: var(--ui-radius-control); }
/* Keep tab selection colors above the shared button and hover theme. */
body.portal-auth-shell .auth-segment,
body.portal-auth-shell .auth-segment:hover:not(:disabled) { min-height: 40px !important; margin: 0 !important; padding: 8px 12px !important; color: var(--ui-text) !important; background: var(--ui-surface) !important; border-color: var(--ui-separator-soft) !important; }
body.portal-auth-shell .auth-segment.active,
body.portal-auth-shell .auth-segment.active:hover:not(:disabled) { color: #fff !important; background: var(--ui-accent) !important; border-color: var(--ui-accent) !important; }
body.portal-auth-shell #auth .auth-register-view { display: none; }
body.portal-auth-shell #auth[data-auth-mode="register"] .auth-login-view { display: none; }
body.portal-auth-shell #auth[data-auth-mode="register"] .auth-register-view { display: block; }
body.portal-auth-shell #auth[data-auth-mode="register"] .auth-register-view > details { display: block; margin: 0; padding: 0; border: 0 !important; }
body.portal-auth-shell #auth[data-auth-mode="register"] .auth-register-view > details > summary { display: none; }
/* Avoid focus-triggered zoom on mobile without disabling pinch zoom. */
@media (max-width: 860px), (hover: none) and (pointer: coarse) {
  body:is(.portal-auth-shell, .portal-shell) input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  body:is(.portal-auth-shell, .portal-shell) select,
  body:is(.portal-auth-shell, .portal-shell) textarea {
    font-size: 16px;
    min-width: 0;
  }
}
@media (max-width: 860px) {
  body.portal-shell { padding: 58px 0 0 !important; }
  .portal-sidebar { width: min(84vw, 290px); transform: translateX(-100%); transition: transform var(--ui-motion) ease; box-shadow: 14px 0 36px rgba(0,0,0,.12); }
  .portal-sidebar .portal-brand { padding-left: 62px; }
  .shell-nav-checkbox:checked ~ .portal-sidebar { transform: translateX(0); }
  .shell-nav-checkbox:checked ~ .portal-nav-overlay { display: block; position: fixed; inset: 0; z-index: 998; background: rgba(0,0,0,.34); }
  .portal-nav-toggle { display: grid; place-items: center; position: fixed; z-index: 1002; left: 10px; top: 9px; width: 40px; height: 40px; padding: 0 !important; margin: 0 !important; color: var(--ui-text) !important; background: var(--ui-surface) !important; border-color: var(--ui-separator-soft) !important; }
  .portal-mobile-title { display: flex; align-items: center; position: fixed; z-index: 997; inset: 0 0 auto 0; height: 58px; padding: 0 16px 0 62px; color: var(--ui-text); background: rgba(255,255,255,.94); border-bottom: 1px solid var(--ui-separator-soft); font-size: 14px; font-weight: 650; backdrop-filter: blur(16px); }
  body.portal-shell .panel { padding: 20px !important; }
  body.portal-shell .setup-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  body.portal-auth-shell { padding: 0 !important; background: var(--ui-surface) !important; place-items: start center; }
  body.portal-auth-shell .portal-auth-main { width: 100%; }
  body.portal-auth-shell #auth.panel { min-height: 100vh; padding: 28px 20px !important; border: 0 !important; border-radius: 0 !important; }
  body.portal-shell .setup-progress { grid-template-columns: 1fr; gap: 6px; }
  body.portal-shell .setup-marker { min-height: 52px; padding: 8px 11px; }
}
#cloneConsentDialog {
  box-sizing: border-box;
  width: min(520px, calc(100% - 24px));
  max-height: 85vh;
  overflow: auto;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  padding: 20px !important;
}
#cloneConsentDialog h2 { margin: 0 0 12px; font-size: 20px; }
#cloneConsentDialog label { font-size: 14px; line-height: 1.6; min-height: 44px; }
#cloneConsentDialog button { min-height: 44px; }
#avatar { scroll-margin-top: 76px; }
#overview-guide { scroll-margin-top: 110px; }
.legal-agreement label { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; line-height: 1.6; }
.legal-agreement input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 4px; }
.legal-agreement > a { display: inline-block; margin-left: 12px; }
.portal-error-dialog [data-portal-error-message] { font-size: 16px; font-weight: 400; line-height: 1.6; }
body[data-ui-page="profile"] #assigned-device,
body[data-ui-page="profile"] #subscription,
body[data-ui-page="profile"] #announcements-preview,
body[data-ui-page="profile"] #required-legal,
body[data-ui-page="account"] #account-overview,
body[data-ui-page="account"] #contact-management,
body[data-ui-page="account"] #password-management,
body[data-ui-page="account"] #trusted-devices,
body[data-ui-page="account"] #account-deletion { display: none !important; }
