:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --panel: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #d9d9de;
  --control: #0071e3;
  --control-hover: #0077ed;
  --available: #248a3d;
  --limited: #b25a00;
  --full: #d70015;
  --danger: #d70015;
  --footer-blue-start: #08679f;
  --footer-blue-end: #00548d;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
.site-shell { width: min(1080px, calc(100% - 48px)); margin: 0 auto; }
.site-header { background: linear-gradient(180deg, #4a96d0 0%, #2d67aa 100%); box-shadow: inset 0 -1px rgba(0, 0, 0, 0.14); }
.site-header-content { display: flex; align-items: center; min-height: 60px; }
.site-logo { display: inline-flex; align-items: center; height: 52px; }
.site-logo img { display: block; width: 154px; height: 50px; object-fit: contain; }
.site-header-title { margin-left: 18px; padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, 0.3); color: rgba(255, 255, 255, 0.88); font-size: 14px; font-weight: 550; letter-spacing: 0.01em; text-shadow: 0 1px rgba(0, 0, 0, 0.14); }
main { width: min(1080px, calc(100% - 48px)); margin: 42px auto 64px; }
.portal-header { margin-bottom: 28px; }
h1 { margin: 0 0 7px; font-size: clamp(34px, 4vw, 42px); letter-spacing: -0.04em; line-height: 1.08; }
p { margin: 0; color: var(--muted); }

.panel { padding: 22px; border-radius: 16px; background: var(--panel); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.045); }
.request-panel__intro { display: grid; gap: 5px; }
.request-panel__intro h2 { margin: 0; font-size: 20px; letter-spacing: -0.015em; line-height: 1.25; }
.request-panel__copy { display: grid; gap: 3px; max-width: 760px; }
.request-panel__assurance { margin-top: 4px; color: var(--muted); font-size: 14px; font-weight: 400; }
#requestForm { max-width: 640px; }
form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 18px; }
#requestForm label { grid-column: 1 / -1; margin-bottom: -3px; color: var(--text); font-size: 14px; font-weight: 600; }
input, button { min-height: 44px; border-radius: 9px; font: inherit; }
input { width: 100%; padding: 0 12px; border: 1px solid var(--border); background: transparent; color: var(--text); }
button { border: 0; padding: 0 16px; background: var(--control); color: #fff; font-weight: 650; cursor: pointer; }
button:hover { background: var(--control-hover); }
button:disabled { cursor: default; opacity: 0.5; }
#requestButton { font-size: 15px; }
.message, .portal-message { margin-top: 14px; color: var(--muted); }
.message.success { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; padding: 13px 14px; border: 1px solid color-mix(in srgb, var(--available) 30%, var(--border)); border-radius: 10px; background: color-mix(in srgb, var(--available) 9%, var(--panel)); color: var(--text); }
.message-icon { display: none; width: 30px; height: 30px; padding: 6px; border-radius: 50%; background: color-mix(in srgb, var(--available) 16%, transparent); color: var(--available); }
.message.success .message-icon { display: block; }
.message-copy { display: grid; gap: 2px; padding-top: 1px; }
.message-copy strong { font-size: 14px; font-weight: 650; }
.message-copy span { color: var(--muted); font-size: 14px; }
.message.error, .portal-message.error { color: var(--danger); }

#licensesPanel { padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
.license-summary-label, .license-summary-email { display: block; }
#licenseSummary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; border: 1px solid color-mix(in srgb, var(--border) 84%, transparent); border-radius: 12px; background: var(--panel); box-shadow: 0 3px 12px rgba(34, 34, 34, 0.045); }
.license-summary-account { min-width: 0; }
.license-summary-label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.license-summary-email { overflow: hidden; margin-top: 2px; color: var(--text); font-size: 16px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.license-summary-count { flex: 0 0 auto; padding: 4px 9px; border-radius: 999px; background: color-mix(in srgb, var(--control) 9%, transparent); color: var(--control); font-size: 12px; font-weight: 650; }
.reinstall-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; margin-top: 24px; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--border) 88%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--muted) 3%, var(--panel)); }
.reinstall-card h2 { margin: 0 0 4px; color: var(--text); font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.reinstall-card p { max-width: 690px; font-size: 14px; }
.reinstall-card__links { display: flex; flex-wrap: wrap; gap: 7px 18px; margin-top: 8px; }
.reinstall-card__links a { color: var(--control); font-size: 13px; font-weight: 550; text-decoration: none; }
.reinstall-card__links a:hover { text-decoration: underline; text-underline-offset: 2px; }
.reinstall-card__actions { display: grid; gap: 8px; min-width: 174px; }
.primary-link-button, .secondary-link-button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 6px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; text-align: center; text-decoration: none; }
.primary-link-button { border: 1px solid color-mix(in srgb, var(--control) 62%, var(--border)); background: transparent; color: var(--control); }
.primary-link-button:hover { border-color: var(--control); background: color-mix(in srgb, var(--control) 8%, transparent); }
.secondary-link-button { border: 1px solid color-mix(in srgb, var(--control) 52%, var(--border)); background: transparent; color: var(--control); }
.secondary-link-button:hover { border-color: var(--control); background: color-mix(in srgb, var(--control) 8%, transparent); }
.license-toolbar { position: relative; margin-top: 24px; }
.license-toolbar svg { position: absolute; top: 11px; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.license-toolbar input { min-height: 38px; padding-left: 37px; border-color: color-mix(in srgb, var(--border) 76%, transparent); font-size: 13px; }
.search-feedback { display: block; margin-top: 7px; color: var(--muted); font-size: 13px; }

.license-list { display: grid; gap: 24px; margin-top: 18px; padding: 12px; border: 1px solid color-mix(in srgb, var(--border) 76%, transparent); border-radius: 20px; background: color-mix(in srgb, var(--muted) 5%, var(--bg)); }
.license-list:empty { display: none; }
.license-group { display: grid; gap: 14px; }
.license-group.filtered-out, .license.filtered-out { display: none; }
.license { overflow: hidden; border: 1px solid color-mix(in srgb, var(--border) 86%, transparent); border-radius: 16px; background: var(--panel); box-shadow: 0 4px 14px rgba(34, 34, 34, 0.07); transition: box-shadow 160ms ease; }
.license:hover { box-shadow: 0 7px 20px rgba(0, 0, 0, 0.06); }
.license > summary { display: grid; grid-template-columns: minmax(0, 1fr) 15px; align-items: start; gap: 18px; padding: 28px 34px; cursor: pointer; list-style: none; }
.license > summary::-webkit-details-marker { display: none; }
.license > summary::after { content: "›"; margin-top: 3px; color: var(--text); font-size: 28px; font-weight: 400; line-height: 1; transition: transform 160ms ease; }
.license[open] > summary::after { transform: rotate(90deg); }
.license-static { padding: 28px 34px; }
.license-summary-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 220px); gap: 34px; min-width: 0; }
.license-summary-info { display: grid; align-content: start; gap: 10px; min-width: 0; }
.license-summary-date { color: var(--muted); font-size: 16px; }
.key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); overflow-wrap: anywhere; }
.license-summary-key-row { position: relative; display: flex; align-items: center; min-width: 0; max-width: 620px; padding: 2px 5px 2px 14px; border: 1px dashed color-mix(in srgb, var(--border) 90%, transparent); border-radius: 8px; }
.license-summary-key { min-width: 0; flex: 1; font-size: 18px; letter-spacing: 0.015em; line-height: 1.35; }
.icon-button { position: relative; display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.icon-button::before { position: absolute; inset: 5px; border-radius: 7px; content: ""; transition: background 160ms ease; }
.icon-button:hover::before { background: color-mix(in srgb, var(--muted) 12%, transparent); }
.button-icon { position: relative; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.copy-popover { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 2; padding: 5px 8px; border-radius: 7px; background: var(--text); color: var(--panel); font-size: 12px; font-weight: 600; line-height: 1.2; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14); }

.activation-status { display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: center; align-items: center; column-gap: 10px; min-width: 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--border) 84%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--muted) 4%, var(--panel)); color: var(--muted); }
.activation-status-primary { grid-column: 2; color: var(--text); font-size: 14px; font-weight: 600; }
.activation-status-secondary { grid-column: 2; color: var(--muted); font-size: 13px; }
.status-dot { grid-column: 1; grid-row: 1 / span 2; width: 10px; height: 10px; border-radius: 50%; background: var(--available); box-shadow: 0 0 0 3px color-mix(in srgb, var(--available) 12%, transparent); }
.activation-status.limited .status-dot { background: var(--limited); box-shadow: 0 0 0 3px color-mix(in srgb, var(--limited) 12%, transparent); }
.activation-status.full .status-dot { background: var(--full); box-shadow: 0 0 0 3px color-mix(in srgb, var(--full) 12%, transparent); }
.badge { grid-column: 2; justify-self: start; margin-top: 4px; padding: 3px 7px; border-radius: 999px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 11px; font-weight: 700; }

.license-content { margin: 0 34px; padding: 22px 0 28px; border-top: 1px solid color-mix(in srgb, var(--border) 82%, transparent); animation: reveal-license-content 160ms ease-out; }
.activation-heading { margin: 0 0 12px; color: var(--text); font-size: 17px; font-weight: 650; }
.activation-list { overflow: hidden; border: 1px solid color-mix(in srgb, var(--border) 88%, transparent); border-radius: 10px; }
.activation { display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(150px, 0.7fr) auto; gap: 16px; align-items: center; padding: 14px 22px; }
.activation + .activation { border-top: 1px solid color-mix(in srgb, var(--border) 82%, transparent); }
.computer-icon { width: 48px; height: 40px; object-fit: contain; }
.activation-type { font-weight: 600; }
.activation-meta { color: var(--muted); font-size: 14px; }
.remove-button { min-height: 44px; padding: 4px 18px; border: 1px solid color-mix(in srgb, var(--danger) 50%, var(--border)); border-radius: 8px; background: transparent; color: var(--danger); font-size: 14px; font-weight: 500; }
.remove-button:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.activation-empty { margin-top: 12px; color: var(--muted); }
.management-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.reset-button { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 4px 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.reset-button:hover { background: transparent; color: var(--text); }
.reset-button .button-icon { width: 16px; height: 16px; }
.license-static .management-actions { margin-top: 18px; }

.help { margin-top: 28px; padding: 20px 0 4px; border-top: 1px solid color-mix(in srgb, var(--border) 82%, transparent); color: var(--muted); font-size: 13px; line-height: 1.5; }
.help strong { color: var(--text); }
.help a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.hidden { display: none; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--control) 55%, transparent); outline-offset: 3px; }

.activation-dialog { width: min(420px, calc(100% - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24); }
.activation-dialog::backdrop { background: rgba(0, 0, 0, 0.42); }
.activation-dialog form { display: block; margin: 0; padding: 24px; }
.activation-dialog h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -0.02em; }
.activation-dialog p { font-size: 14px; }
.activation-dialog__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dialog-cancel-button { min-height: 38px; border: 1px solid var(--border); background: transparent; color: var(--text); font-size: 14px; font-weight: 600; }
.dialog-cancel-button:hover { background: color-mix(in srgb, var(--muted) 10%, transparent); }
.activation-dialog .remove-button { min-height: 38px; }

.simple-footer { border-top: 1px solid rgba(255, 255, 255, 0.16); background: radial-gradient(circle at 24% 0%, rgba(125, 199, 255, 0.22), transparent 34%), linear-gradient(135deg, var(--footer-blue-start) 0%, var(--footer-blue-end) 100%); }
.simple-footer__content { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 76px; }
.simple-footer__copyright { color: rgba(255, 255, 255, 0.76); font-size: 13px; }
.simple-footer__links { display: flex; flex-wrap: wrap; gap: 18px; }
.simple-footer__links a { color: rgba(255, 255, 255, 0.86); font-size: 13px; text-decoration: none; }
.simple-footer__links a:hover { color: #fff; text-decoration: underline; text-underline-offset: 2px; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101112;
    --panel: #1c1c1e;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --border: #3a3a3c;
    --control: #0a84ff;
    --control-hover: #409cff;
    --available: #30d158;
    --limited: #ff9f0a;
    --full: #ff453a;
    --danger: #ff453a;
  }

  .panel { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22); }
  #licenseSummary { box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2); }
  .license { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24); }
  .license:hover { box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3); }
  .computer-icon { filter: grayscale(1) invert(1) brightness(1.5); opacity: 0.72; }
  .copy-popover { background: #f5f5f7; color: #1d1d1f; }
}

@keyframes reveal-license-content {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 760px) {
  .site-shell, main { width: min(100% - 24px, 640px); }
  .site-header-content { min-height: 56px; }
  .site-logo img { width: 130px; height: 42px; }
  .site-header-title { margin-left: 13px; padding-left: 13px; font-size: 12px; }
  main { margin: 28px auto 48px; }
  h1 { font-size: 34px; }
  form { grid-template-columns: 1fr; }
  .license > summary, .license-static { padding: 20px; }
  .license-list { padding: 8px; border-radius: 16px; }
  .reinstall-card { grid-template-columns: 1fr; gap: 18px; padding: 20px; }
  .reinstall-card__actions { display: flex; flex-wrap: wrap; min-width: 0; }
  .primary-link-button, .secondary-link-button { flex: 1 1 160px; }
  .license-summary-layout { grid-template-columns: 1fr; gap: 18px; }
  .license-content { margin: 0 20px; }
  .activation { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .computer-icon { width: 40px; height: 34px; }
  .activation-type, .activation-meta { grid-column: 2; }
  .remove-button { grid-column: 2; justify-self: start; }
  .management-actions { justify-content: flex-start; }
  .simple-footer__content { min-height: 88px; }
}

@media (max-width: 520px) {
  #licenseSummary { align-items: flex-start; flex-direction: column; gap: 10px; }
  .license-summary-email { width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .simple-footer__content { align-items: flex-start; flex-direction: column; justify-content: center; gap: 8px; min-height: 100px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
