/* NetSpecForge License Portal — portal.css
   Dark theme, blue accent #2563EB, glassmorphism, mobile-first, accessible. */
:root {
  --navy: #0B1B33;
  --charcoal: #141C2B;
  --card: #0F172A;
  --blue: #2563EB;
  --blue-hover: #3B82F6;
  --blue-glass: rgba(37, 99, 235, 0.16);
  --green: #16A34A;
  --amber: #D97706;
  --red: #DC2626;
  --slate: #475569;
  --paper: #FFFFFF;
  --muted: #9AA7BC;
  --line: #2E3B52;
  --line-strong: #46546E;
  --glass-bg: rgba(20, 28, 43, 0.55);
  --glass-border: rgba(255, 255, 255, 0.06);
  --shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5);
  --radius: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--navy);
  color: var(--paper);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--blue); color: var(--paper); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 24px); }

/* Focus-visible — accessible keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

/* Buttons — min 44px touch target */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: var(--paper); }
.btn-primary:hover { background: var(--blue-hover); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--paper);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { border-color: var(--blue); background: var(--blue-glass); }
.btn-sm { padding: 6px 14px; font-size: 0.875rem; min-height: 40px; }

/* Form controls */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  color: var(--paper);
}
input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--navy);
  color: var(--paper);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input::placeholder { color: var(--muted); opacity: 0.8; }
input:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
textarea { resize: vertical; min-height: 96px; }

/* Feedback */
.error,
.success {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  margin-top: 10px;
  animation: fadeIn 0.2s ease;
}
.error { background: rgba(220, 38, 38, 0.15); border: 1px solid var(--red); color: #FCA5A5; }
.success { background: rgba(22, 163, 74, 0.15); border: 1px solid var(--green); color: #86EFAC; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.hidden { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

/* Glass card */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 28px; }

/* Header */
header.site {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 27, 51, 0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 12px 0;
}
.brand-block { display: flex; flex-direction: column; gap: 4px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
}
.wordmark { font-size: 18px; }
.parent { font-size: 12px; color: var(--muted); }
.parent a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.parent a:hover { color: var(--paper); }
nav.primary { margin-left: auto; overflow-x: auto; max-width: 100%; }
nav.primary ul { display: flex; gap: 6px; list-style: none; }
nav.primary a {
  display: block;
  padding: 8px 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 40px;
}
nav.primary a:hover { color: var(--paper); background: var(--charcoal); border-color: var(--line-strong); }

/* Hero — marketing state */
.hero {
  position: relative;
  padding: 64px 0 40px;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(ellipse 60% 40% at 20% -10%, rgba(37, 99, 235, 0.18), transparent 60%),
              radial-gradient(ellipse 50% 50% at 100% 0%, rgba(217, 119, 6, 0.10), transparent 50%);
}
.hero > .container { position: relative; z-index: 2; }
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}
.hero-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero-title {
  margin: 0 0 16px;
  font-size: clamp(32px, 5.5vw, 48px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero-lede {
  margin: 0 0 24px;
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 48ch;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.preview-card {
  width: 100%;
  max-width: 320px;
  height: 220px;
  background: var(--charcoal);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.preview-chip {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--navy);
}

/* Pricing — marketing state */
.pricing { padding: 64px 0; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 28px; }
.kicker { margin: 0 0 8px; color: var(--blue); font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; }
.section-head h2 { margin: 0 0 12px; font-size: clamp(24px, 3.6vw, 34px); font-weight: 800; letter-spacing: -0.01em; }
.section-lede { margin: 0; color: var(--muted); max-width: 60ch; font-size: 1.05rem; }
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.pricing .card { position: relative; overflow: hidden; }
.pricing .card.popular {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue-glass), var(--shadow);
}
.pricing .card.popular::after {
  content: "Most popular";
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: var(--blue); color: var(--paper); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 14px; border-radius: 999px;
}
.tier-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.tier-title { font-size: 1.25rem; font-weight: 800; color: var(--paper); }
.tier-price { font-size: 2rem; font-weight: 800; color: var(--paper); margin: 6px 0 2px; }
.tier-price span { font-size: 1rem; font-weight: 500; color: var(--muted); }
.tier-note { font-size: 0.875rem; color: var(--muted); margin-bottom: 16px; }
.tier-list { list-style: none; padding: 0; margin: 12px 0 20px; display: grid; gap: 10px; }
.tier-list li { position: relative; padding-left: 22px; font-size: 0.95rem; color: var(--muted); }
.tier-list li::before {
  content: ""; position: absolute; left: 0; top: 0.55em; width: 8px; height: 8px; background: var(--blue); border-radius: 50%;
}
.tier-actions { margin-top: 8px; }

/* Page sections (dashboard state) */
.page-section { padding: 56px 0; border-bottom: 1px solid var(--line); }
.page-section.last { border-bottom: 0; }
.panel { padding: 24px; }
.panel h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.lede { margin: 0 0 20px; color: var(--muted); max-width: 60ch; }

/* Tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tab {
  flex: 1; padding: 0.6rem 0.9rem; border-radius: 8px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--muted); font-weight: 600; font-size: 0.9rem; cursor: pointer;
  text-align: center; min-height: 44px;
}
.tab.active { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.tab[role="tab"] { min-width: 110px; }
@media (min-width: 640px) { .tab { flex: 0 0 auto; } }

/* Form group / actions */
.form-group { margin-bottom: 1.125rem; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.full { width: 100%; }
.notice {
  margin: 20px 0 0; padding: 14px 18px; border-left: 3px solid var(--amber);
  background: rgba(217, 119, 6, 0.10); border-radius: 0 10px 10px 0; font-size: 0.95rem; color: var(--paper);
}

/* Result box */
.result {
  margin-top: 1.5rem; padding: 1rem; border-radius: 10px; font-size: 0.95rem; display: none;
  border: 1px solid transparent;
}
.result.valid { display: block; background: rgba(22, 163, 74, 0.15); border-color: var(--green); color: #86EFAC; }
.result.invalid { display: block; background: rgba(220, 38, 38, 0.15); border-color: var(--red); color: #FCA5A5; }
.result h3 { font-weight: 600; margin-bottom: 0.5rem; }
.result .detail { font-size: 0.875rem; opacity: 0.9; word-break: break-word; margin-top: 6px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 10px 12px; background: var(--navy); color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--line-strong);
  white-space: nowrap; font-weight: 600;
}
table.data th[scope="col"] { position: sticky; top: 0; background: var(--navy); z-index: 2; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Mobile table */
@media (max-width: 640px) {
  table.data, table.data tbody, table.data tr, table.data td { display: block; }
  table.data thead { display: none; }
  table.data tr { padding: 12px; border-bottom: 1px solid var(--line); }
  table.data tr:last-child { border-bottom: 0; }
  table.data td { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 4px 0; border-bottom: 0; }
  table.data td::before { content: attr(data-label); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; width: 100%; text-align: left; }
}

/* Modals */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal.hidden { display: none !important; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(6px); }
.modal-content {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 2.25rem; width: 100%; max-width: 460px;
  box-shadow: var(--shadow); color: var(--paper); animation: modalPop 0.25s ease;
}
@keyframes modalPop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-header h2 { font-size: 1.25rem; font-weight: 800; }
.modal-close {
  background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--muted);
  line-height: 1; min-height: 44px; width: 44px; padding: 0;
}
.modal-close:hover { color: var(--paper); }
.key-link {
  background: none; border: 0; color: var(--blue); font-family: var(--mono); font-size: inherit;
  cursor: pointer; text-decoration: underline; padding: 0;
}
.key-link:hover { color: var(--blue-hover); }
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.detail-row:last-child { border-bottom: 0; }
.detail-row .label { color: var(--muted); }
.detail-row .value { color: var(--paper); text-align: right; word-break: break-word; }
.detail-list { margin: 12px 0; padding: 0; list-style: none; }
.detail-list li { padding: 4px 0; font-size: 0.95rem; }
.detail-list li::before { content: "• "; color: var(--blue); }
.detail-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

/* Checksum / version history */
.checksum { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); margin-top: 6px; word-break: break-all; }
.version-history { margin-top: 14px; font-size: 0.9rem; }

/* Dashboard state grid */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 900px) { .dash-grid { grid-template-columns: 1fr 300px; } }

/* Downloads panel */
.downloads-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .downloads-grid { grid-template-columns: repeat(2, 1fr); } }

/* Admin panels */
.admin-wrap { display: none; }
.admin-wrap.visible { display: block; }
.admin-tabs { margin-bottom: 1rem; }
.admin-panel { margin-bottom: 20px; }

/* Footer */
footer.site-footer { background: var(--charcoal); padding: 48px 0 56px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
footer.site-footer p { margin: 0 0 8px; }
.footer-brand { color: var(--paper); font-size: 14px; font-weight: 600; }
footer.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
footer.site-footer a:hover { color: var(--paper); }
.fine { font-size: 12px; }

/* Utilities */
.mono { font-family: var(--mono); }
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
  .modal-content { animation: none; }
  .hero-bg { transition: none; }
}

/* Mobile */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  header.site .header-inner { padding-top: 10px; padding-bottom: 10px; gap: 8px 16px; }
  .panel { padding: 18px; }
  .card { padding: 22px; }
  .hero { padding: 48px 0 32px; }
  .pricing { padding: 48px 0; }
  .page-section { padding: 44px 0; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .tab { flex: 0 0 auto; white-space: nowrap; min-width: 120px; }
  nav.primary { order: 3; margin-left: 0; width: 100%; }
  nav.primary ul { justify-content: center; gap: 4px; }
  .brand-block { width: 100%; text-align: center; }
  .brand { justify-content: center; }
  .parent { text-align: center; }
}
@media (max-width: 480px) {
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }
  .tier-actions .btn { width: 100%; }
  .footer-brand { display: block; text-align: center; margin-bottom: 8px; }
}
/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 20px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat-card h3 { font-size: 0.875rem; font-weight: 500; color: var(--muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-card .value { font-size: 2rem; font-weight: 800; color: var(--paper); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions .btn-sm { min-height: auto; padding: 6px 12px; font-size: 0.85rem; }
