:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000;
  color: #e7eff7;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: #000; }
a { color: inherit; }
button { font: inherit; }
.is-hidden { display: none !important; }

.portal-header {
  height: 74px;
  display: flex;
  align-items: center;
  gap: 27px;
  padding: 0 max(28px, calc((100% - 1416px) / 2));
  border-bottom: 1px solid #26333e;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: #e7eff7; font-size: 17px; line-height: 1.08; text-decoration: none; }
.brand svg { width: 46px; height: 46px; flex: 0 0 auto; }
.crumb { color: #7890a1; font-size: 12px; }
.portal-header nav { display: flex; height: 100%; align-items: center; gap: 28px; margin-left: auto; }
.portal-header nav a { max-width: 78px; color: #7890a1; font-size: 13px; line-height: 1.35; text-align: center; text-decoration: none; }
.portal-header nav a:hover, .portal-header nav a:focus-visible, .portal-header nav a.active { color: #d8e7f1; }
.avatar { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #164c82; color: #e7eff7; font-size: 10px; }

.portal-main { width: min(1080px, calc(100% - 48px)); margin: 44px auto 60px; }
.loading { min-height: 200px; display: grid; place-items: center; color: #91a9b9; font-size: 14px; }
.page-heading { min-height: 60px; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 16px; }
.page-heading h1, .load-error h1 { margin: 3px 0 4px; color: #e7eef5; font-size: 26px; font-weight: 720; letter-spacing: -.45px; line-height: 1.2; }
.page-heading p { margin: 0; color: #859daf; font-size: 12px; line-height: 1.45; }
.manage-account { min-width: 195px; min-height: 58px; display: grid; place-items: center; padding: 0 15px; border: 1px solid #243b4e; border-radius: 7px; background: #0a1118; color: #c7d8e4; font-size: 12px; text-decoration: none; }
.manage-account::first-line { border-bottom: 1px solid #274158; }
.manage-account:hover, .manage-account:focus-visible { border-color: #1676c8; }
.notice { min-height: 45px; display: flex; align-items: center; gap: 11px; margin-bottom: 19px; padding: 10px 15px; border: 1px solid #164365; border-radius: 6px; background: #061d2c; color: #acd1e4; font-size: 12px; }
.notice > span { color: #87b7d1; font-size: 14px; }
.notice p { margin: 0; line-height: 1.45; }

.product-list { display: grid; gap: 15px; }
.product-card { min-height: 112px; display: grid; grid-template-columns: minmax(230px, .75fr) minmax(255px, .95fr) minmax(370px, 1.3fr); align-items: center; gap: 18px; padding: 16px 20px; border: 1px solid #203442; border-radius: 11px; background: #080f15; }
.product-identity { min-width: 0; display: flex; align-items: center; gap: 13px; }
.product-icon { width: 43px; height: 46px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 8px; background: #112d4a; color: #23b7e9; }
.product-icon svg { width: 23px; height: 23px; }
.product-identity h2 { margin: 0 0 6px; color: #e5edf4; font-size: 15px; font-weight: 680; line-height: 1.2; }
.product-identity p { max-width: 190px; margin: 0; color: #829bae; font-size: 12px; line-height: 1.4; }
.usage-panel { min-width: 0; }
.usage-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: #849bad; font-size: 11px; }
.usage-label strong { color: #e3edf4; font-size: 13px; font-weight: 650; text-align: right; }
.usage-track { height: 5px; overflow: hidden; border-radius: 6px; background: #233443; }
.usage-track span { width: 0; height: 100%; display: block; background: #17b8e2; }
.quota-list { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 7px; color: #7890a2; font-size: 10px; line-height: 1.35; }
.quota-list span::before { content: "· "; color: #1bb3dd; }
.product-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.action-group { min-width: 0; display: grid; align-content: start; gap: 7px; }
.action-button { min-height: 46px; display: grid; place-items: center; padding: 7px 10px; border: 1px solid #294356; border-radius: 6px; background: #0b1721; color: #bed0dd; font-size: 11px; font-weight: 600; line-height: 1.25; text-align: center; }
.action-button.primary { border-color: #2687ec; background: #1679ee; color: #f5faff; }
.action-button:disabled { opacity: .78; cursor: not-allowed; }
.action-hint { margin: -3px 2px 0; color: #7890a1; font-size: 10px; line-height: 1.25; text-align: center; }

.billing-card { margin-top: 25px; padding: 20px 18px 15px; border: 1px solid #203442; border-radius: 10px; background: #080f15; }
.billing-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 13px; }
.billing-heading h2 { margin: 0; color: #e2eaf1; font-size: 15px; font-weight: 680; line-height: 1.5; }
.quiet-state { padding-top: 14px; color: #138be9; font-size: 12px; text-decoration: none; }
.quiet-state:hover, .quiet-state:focus-visible { color: #62b8ff; }
.billing-row { min-height: 65px; display: flex; justify-content: space-between; align-items: center; gap: 18px; border-bottom: 1px solid #1b2a35; }
.billing-row:last-child { border-bottom: 0; }
.billing-product strong, .billing-product span { display: block; }
.billing-product strong { margin-bottom: 6px; color: #dfe9f0; font-size: 13px; font-weight: 630; }
.billing-product span { color: #8299a9; font-size: 12px; }
.billing-link { max-width: 230px; color: #138be9; font-size: 12px; text-align: right; }
.payment-history { color: #7890a1; font-size: 11px; }
.payment-history:not(:empty) { padding-top: 12px; border-top: 1px solid #1b2a35; }
.payment-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; }
.prototype-note { margin: 11px 0 0; color: #70899a; font-size: 10px; line-height: 1.5; }
.account-card { min-height: 116px; display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 165px; padding: 18px 20px; border: 1px solid #203442; border-radius: 9px; background: #080f15; }
.account-card h2 { margin: 0 0 8px; font-size: 14px; }
.account-card p { margin: 4px 0 0; color: #8299a9; font-size: 12px; }
.text-action { border: 0; background: none; color: #1991ed; font-size: 12px; cursor: pointer; }
.device-manager { margin-top: 14px; border: 1px solid #203442; border-radius: 9px; background: #080f15; }
.device-manager > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 70px; padding: 14px 20px; cursor: pointer; list-style: none; }
.device-manager > summary::-webkit-details-marker { display: none; }
.device-manager > summary:focus-visible { outline: 2px solid #1687ff; outline-offset: 3px; border-radius: 8px; }
.device-manager > summary strong, .device-manager > summary small { display: block; }
.device-manager > summary strong { color: #e2eaf1; font-size: 14px; }
.device-manager > summary small { margin-top: 5px; color: #8299a9; font-size: 11px; }
.device-manager-chevron { color: #138be9; font-size: 20px; transition: transform .15s ease; }
.device-manager[open] .device-manager-chevron { transform: rotate(180deg); }
.device-manager-body { padding: 0 20px 18px; }
.device-manager-note { margin: 0 0 12px; padding: 10px 12px; border: 1px solid #443514; border-radius: 6px; background: #1c170d; color: #ffe0a1; font-size: 11px; line-height: 1.5; }
.device-manager-feedback { margin: 0 0 10px; color: #8cddb1; font-size: 11px; }
.device-manager-feedback.is-error { color: #ffabb1; }
.device-list { display: grid; gap: 10px; }
.device-empty { margin: 0; padding: 16px; border: 1px dashed #284052; border-radius: 7px; color: #8299a9; font-size: 12px; line-height: 1.5; }
.device-item { display: grid; gap: 13px; padding: 14px; border: 1px solid #203442; border-radius: 7px; background: #050b10; }
.device-item-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.device-item-heading h3 { margin: 0; color: #e5edf4; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.device-item-heading p { margin: 5px 0 0; color: #8299a9; font-size: 11px; line-height: 1.45; }
.device-state { flex: none; padding: 4px 8px; border-radius: 20px; background: #0b281d; color: #40dca1; font-size: 10px; }
.device-state.revoked, .device-state.transferred { background: #18232b; color: #9db1c0; }
.device-item-meta { color: #7890a1; font-size: 10px; line-height: 1.5; }
.device-item-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; }
.device-item-form label { display: grid; gap: 5px; color: #a8bdce; font-size: 10px; }
.device-item-form input { width: 100%; min-width: 0; height: 37px; border: 1px solid #1c303c; border-radius: 6px; background: #070d12; color: #d7e1eb; padding: 0 10px; font: inherit; font-size: 11px; }
.device-item-form input:focus-visible, .device-item button:focus-visible { outline: 2px solid #1687ff; outline-offset: 2px; }
.device-item-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.device-item button { min-height: 35px; border: 1px solid #294356; border-radius: 6px; background: #0b1721; color: #c7d8e4; padding: 0 12px; font-size: 11px; cursor: pointer; }
.device-item .device-deactivate { border-color: #58333a; color: #ffabb1; }
.device-item button:disabled { opacity: .6; cursor: wait; }
.load-error { max-width: 500px; margin: 150px auto 0; padding: 30px; border: 1px solid #203442; border-radius: 10px; background: #080f15; text-align: center; }
.load-error h1 { font-size: 21px; }
.load-error p { color: #8299a9; font-size: 13px; line-height: 1.5; }
.load-error a { color: #1991ed; font-size: 13px; }

@media (max-width: 900px) {
  .portal-header { padding: 0 22px; gap: 18px; }
  .portal-header nav { gap: 17px; }
  .portal-main { width: min(720px, calc(100% - 36px)); margin-top: 32px; }
  .product-card { grid-template-columns: minmax(185px, 1fr) minmax(220px, 1fr); gap: 16px 20px; }
  .product-actions { grid-column: 2; grid-row: 2; }
}
@media (max-width: 600px) {
  .portal-header { height: 66px; padding: 0 15px; gap: 10px; }
  .brand { gap: 5px; font-size: 13px; }
  .brand svg { width: 36px; height: 36px; }
  .crumb { font-size: 10px; }
  .portal-header nav { gap: 11px; }
  .portal-header nav a { max-width: 54px; font-size: 10px; }
  .avatar { width: 24px; height: 24px; font-size: 9px; }
  .portal-main { width: calc(100% - 28px); margin: 28px auto 42px; }
  .page-heading { min-height: 0; align-items: center; margin-bottom: 14px; }
  .page-heading h1 { font-size: 22px; }
  .page-heading p { max-width: 220px; font-size: 11px; }
  .manage-account { min-width: 0; min-height: 42px; padding: 0 10px; font-size: 10px; text-align: center; }
  .notice { align-items: flex-start; gap: 8px; padding: 11px; font-size: 11px; }
  .product-card { grid-template-columns: minmax(0, 1fr); gap: 13px; padding: 16px; }
  .product-identity { gap: 11px; }
  .product-identity p { max-width: none; }
  .usage-label { font-size: 10px; }
  .product-actions { grid-column: auto; grid-row: auto; }
  .action-button { min-height: 43px; }
  .billing-card { margin-top: 20px; padding: 16px 13px 12px; }
  .billing-heading h2 { font-size: 14px; }
  .billing-row { min-height: 70px; gap: 8px; }
  .billing-product strong { font-size: 12px; }
  .billing-product span, .billing-link { font-size: 10px; }
  .billing-link { max-width: 128px; }
  .prototype-note { font-size: 9px; }
  .account-card { align-items: flex-start; margin-top: 30px; padding: 15px; }
  .device-manager > summary { min-height: 62px; padding: 13px 15px; }
  .device-manager-body { padding: 0 12px 13px; }
  .device-manager-note { font-size: 10px; }
  .device-item { padding: 11px; }
  .device-item-form { grid-template-columns: minmax(0, 1fr); }
  .device-item-form button { width: 100%; }
  .device-item-actions { justify-content: stretch; }
  .device-item-actions button { flex: 1 1 100%; }
  .load-error { margin-top: 90px; padding: 23px 16px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
