:root {
  --landing-bg: #eef2f8;
  --landing-bg-accent: #dbe7ff;
  --landing-surface: rgba(255, 255, 255, 0.86);
  --landing-surface-border: rgba(15, 23, 42, 0.1);
  --landing-text: #16223a;
  --landing-text-soft: #5b6881;
  --landing-primary: #2f6dff;
  --landing-primary-2: #1e56dc;
  --landing-chip-bg: rgba(255, 255, 255, 0.9);
  --landing-chip-border: rgba(15, 23, 42, 0.14);
  --landing-chip-text: #5b6881;
  --landing-input-bg: #ffffff;
  --landing-input-border: rgba(15, 23, 42, 0.14);
  --landing-glow: 0 22px 55px rgba(52, 90, 171, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", "Segoe UI", sans-serif;
  color: var(--landing-text);
  background:
    radial-gradient(980px 520px at 10% -8%, rgba(127, 173, 255, 0.24), transparent 64%),
    radial-gradient(900px 480px at 110% 0%, rgba(126, 148, 255, 0.22), transparent 62%),
    linear-gradient(180deg, var(--landing-bg) 0%, var(--landing-bg-accent) 100%);
  min-height: 100vh;
}

.landing-theme-corner {
  position: fixed !important;
  top: 1px !important;
  right: 2px !important;
  left: auto !important;
  z-index: 1200;
}

/* Compatibility guard: hide stale legacy logo container on landing if cached html slips through */
.brand-corner {
  display: none !important;
}

.landing-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 27px 18px 38px;
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.landing-auth-panel,
.landing-content-panel {
  background: var(--landing-surface);
  border: 1px solid var(--landing-surface-border);
  border-radius: 26px;
  box-shadow: var(--landing-glow);
  backdrop-filter: blur(8px);
}

.landing-auth-panel {
  padding: 14px;
  width: 100%;
  max-width: 340px;
}

.landing-content-panel {
  padding: 18px;
  height: fit-content;
  align-self: start;
}

.landing-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.landing-topline #landingLogoutBtn {
  margin-right: 10px;
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 36, 0.12);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 4px 12px rgba(15, 23, 36, 0.06);
  text-decoration: none;
}

.landing-brand-img {
  height: 24px;
  width: auto;
  display: block;
}

.landing-theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--landing-chip-border) 72%, transparent);
  background: var(--landing-chip-bg);
}

.landing-theme-dot {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(15, 23, 42, 0.3);
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.landing-theme-dot:hover {
  transform: translateY(-1px);
}

.landing-theme-dot.active {
  border-color: rgba(47, 109, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(47, 109, 255, 0.16);
}

.landing-theme-dot-light {
  background: linear-gradient(135deg, #ffffff 0%, #d7e5ff 100%);
}

.landing-theme-dot-nordic {
  background: linear-gradient(135deg, #d2f4ff 0%, #8ecbf6 100%);
}

.landing-theme-dot-matrix-blue {
  background: linear-gradient(135deg, #072341 0%, #2a68cf 100%);
}

.landing-theme-dot-matrix {
  background: linear-gradient(135deg, #042217 0%, #0d5b35 100%);
}

.landing-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(47, 109, 255, 0.3);
  background: rgba(233, 241, 255, 0.86);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.landing-auth-panel h1 {
  margin: 0 0 14px;
  font-size: clamp(17px, 1.55vw, 25px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.landing-muted {
  margin: 0;
  color: var(--landing-text-soft);
  line-height: 1.58;
}

.landing-auth-mode {
  display: inline-flex;
  gap: 8px;
  margin: 0 0 0 auto;
  justify-content: flex-end;
}

.landing-chip {
  border: 1px solid var(--landing-chip-border);
  border-radius: 999px;
  background: var(--landing-chip-bg);
  color: var(--landing-chip-text);
  padding: 4px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
}

.landing-chip.active {
  color: var(--landing-primary);
  border-color: rgba(47, 109, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(47, 109, 255, 0.14);
}

.landing-auth-form {
  display: grid;
  gap: 10px;
}

.landing-authorized-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  flex: 0 0 auto;
}

.landing-authorized-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.landing-authorized-row .landing-identity-card {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.landing-identity-card {
  margin: 4px 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--landing-chip-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--landing-surface) 88%, #ffffff 12%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.landing-identity-main {
  min-width: 0;
  flex: 1 1 auto;
}

.landing-user-name {
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 20px;
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.landing-user-email {
  margin-top: 4px;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 9px;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--landing-text-soft);
}

.landing-auth-form label {
  font-size: 14px;
  font-weight: 700;
  color: color-mix(in srgb, var(--landing-text) 84%, #6c778f 16%);
}

.landing-auth-form input {
  width: 100%;
  border: 1px solid var(--landing-input-border);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--landing-text);
  background: var(--landing-input-bg);
}

.landing-auth-form input:focus {
  outline: none;
  border-color: rgba(47, 109, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(47, 109, 255, 0.13);
}

.landing-auth-form button {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--landing-primary) 0%, var(--landing-primary-2) 100%);
  box-shadow: 0 12px 22px rgba(35, 83, 181, 0.26);
  cursor: pointer;
}

.landing-auth-form button:disabled {
  opacity: 0.66;
  cursor: not-allowed;
}

.landing-legal-consent-wrap {
  margin-top: 2px;
}

.landing-auth-form .landing-legal-consent-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--landing-text-soft);
}

.landing-legal-consent-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  box-shadow: none;
  background: transparent;
}

.landing-legal-consent-row span {
  white-space: nowrap;
}

.landing-legal-consent-row a {
  color: var(--landing-primary);
  text-decoration: underline;
}

.landing-open-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  border-radius: 12px;
  border: 1px solid rgba(47, 109, 255, 0.35);
  background: rgba(227, 237, 255, 0.72);
  color: #1f56dc;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 14px;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.landing-open-app:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(46, 90, 181, 0.2);
}

.landing-logout-btn {
  flex: 0 0 132px;
  border-radius: 12px;
  border: 1px solid var(--landing-chip-border);
  background: var(--landing-chip-bg);
  color: var(--landing-chip-text);
  font: inherit;
  font-weight: 700;
  padding: 9px 12px;
  cursor: pointer;
}

.landing-logout-btn:hover {
  border-color: rgba(193, 56, 56, 0.35);
  color: #b42330;
}

.landing-icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--landing-chip-border);
  background: var(--landing-chip-bg);
  color: var(--landing-chip-text);
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.landing-icon-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.landing-icon-btn:hover {
  transform: translateY(-1px);
}

.landing-icon-btn-primary {
  border-color: rgba(47, 109, 255, 0.4);
  background: rgba(227, 237, 255, 0.82);
  color: #1f56dc;
}

.landing-open-app-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: auto;
}

.landing-content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.landing-kb-link {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--landing-primary);
  text-decoration: none;
  white-space: nowrap;
  padding: 5px 12px;
  border: 1px solid rgba(47, 109, 255, 0.25);
  border-radius: 999px;
  transition: background 0.15s, border-color 0.15s;
}

.landing-kb-link:hover {
  background: rgba(47, 109, 255, 0.07);
  border-color: rgba(47, 109, 255, 0.5);
}

.landing-kb-guest {
  font-size: 0.88rem;
  color: var(--landing-text-soft);
  white-space: nowrap;
  padding: 5px 12px;
  border: 1px solid var(--landing-chip-border);
  border-radius: 999px;
  background: var(--landing-chip-bg);
}

.landing-kb-guest-hint {
  font-style: italic;
}

.landing-content-panel h2 {
  margin: 0;
  font-size: clamp(22px, 2.2vw, 32px);
  line-height: 1;
  letter-spacing: -0.03em;
}

.landing-content-head .landing-muted {
  margin-top: 10px;
  font-size: 16px;
}

.landing-materials-list {
  display: grid;
  gap: 12px;
}

.landing-material-card {
  border: 1px solid var(--landing-surface-border);
  border-radius: 16px;
  padding: 14px;
  background: color-mix(in srgb, var(--landing-surface) 92%, #ffffff 8%);
}

.landing-material-link {
  text-decoration: none;
  color: inherit;
}

.landing-material-card h3 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.1;
  color: #2559d6;
}

.landing-news-article h1 {
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.2;
}

.landing-task-article h1,
.landing-module-article h1 {
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.15;
}

.landing-kb-article h1 {
  font-size: clamp(16px, 1.6vw, 20px);
  line-height: 1.15;
}

.landing-material-link:hover h3 {
  text-decoration: underline;
}

.landing-material-card p {
  margin: 0 0 8px;
  line-height: 1.64;
  color: color-mix(in srgb, var(--landing-text) 82%, #64748b 18%);
}

.legal-page-panel .card h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.15;
}

.legal-page-panel .section h2 {
  margin: 0 0 8px;
  font-size: clamp(18px, 2.1vw, 24px);
  line-height: 1.2;
}

.landing-material-excerpt {
  line-height: 1.64;
  max-height: calc(1.64em * 5);
  overflow: hidden;
}

.landing-material-excerpt > * {
  margin-top: 0;
}

.landing-read-more {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  padding: 6px 12px;
  border: 1px solid rgba(47, 109, 255, 0.25);
  border-radius: 999px;
  background: rgba(47, 109, 255, 0.08);
  color: var(--landing-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s;
}

.landing-read-more:hover {
  background: rgba(47, 109, 255, 0.14);
  border-color: rgba(47, 109, 255, 0.48);
}

.landing-material-card img,
.section img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--landing-surface-border) 90%, transparent);
}

.hidden {
  display: none !important;
}

body[data-theme="nordic"] {
  --landing-bg: #edf7ff;
  --landing-bg-accent: #dceeff;
  --landing-surface: rgba(255, 255, 255, 0.92);
  --landing-surface-border: rgba(42, 90, 145, 0.18);
  --landing-text: #14213d;
  --landing-text-soft: #4f627f;
  --landing-primary: #2186d8;
  --landing-primary-2: #1766b8;
  --landing-chip-bg: #f5fbff;
  --landing-chip-border: rgba(39, 110, 179, 0.24);
  --landing-chip-text: #506584;
  --landing-input-bg: #ffffff;
  --landing-input-border: rgba(50, 117, 173, 0.22);
  --landing-glow: 0 18px 40px rgba(84, 156, 214, 0.2);
}

body[data-theme="matrix"] {
  --landing-bg: #050b08;
  --landing-bg-accent: #0d1913;
  --landing-surface: rgba(8, 15, 12, 0.92);
  --landing-surface-border: rgba(46, 102, 71, 0.52);
  --landing-text: #a8f1ca;
  --landing-text-soft: #6fa98b;
  --landing-primary: #18b56c;
  --landing-primary-2: #0f8e55;
  --landing-chip-bg: rgba(6, 19, 13, 0.92);
  --landing-chip-border: rgba(57, 126, 92, 0.62);
  --landing-chip-text: #91cdaf;
  --landing-input-bg: rgba(5, 18, 12, 0.94);
  --landing-input-border: rgba(52, 115, 84, 0.66);
  --landing-glow: 0 18px 38px rgba(6, 40, 24, 0.36);
}

body[data-theme="matrix"] .landing-status-pill {
  border-color: rgba(24, 181, 108, 0.52);
  background: rgba(9, 33, 20, 0.85);
  color: #8ae7b7;
}

body[data-theme="matrix"] .landing-material-card h3 {
  color: #7cf0af;
}

body[data-theme="matrix"] .landing-brand {
  border-color: rgba(57, 126, 92, 0.62);
  background: rgba(6, 19, 13, 0.9);
}

body[data-theme="matrix"][data-matrix-variant="blue"] .landing-brand {
  border-color: rgba(131, 165, 224, 0.42);
  background: rgba(8, 17, 33, 0.9);
}

body[data-theme="matrix"] .landing-brand-img,
body[data-theme="matrix"][data-matrix-variant="blue"] .landing-brand-img {
  filter: invert(1) brightness(1.12);
}

body[data-theme="matrix"] .landing-identity-card {
  border-color: rgba(57, 126, 92, 0.62);
  background: rgba(6, 19, 13, 0.9);
}

body[data-theme="matrix"] .landing-open-app {
  border-color: rgba(36, 167, 105, 0.52);
  background: rgba(6, 40, 24, 0.78);
  color: #8be8b8;
}

body[data-theme="matrix"] .landing-icon-btn {
  border-color: rgba(57, 126, 92, 0.62);
  background: rgba(6, 19, 13, 0.9);
  color: #8cd5aa;
}

body[data-theme="matrix"] .landing-icon-btn-primary {
  border-color: rgba(36, 167, 105, 0.52);
  background: rgba(6, 40, 24, 0.78);
  color: #8be8b8;
}

body[data-theme="matrix"] .landing-theme-dot.active {
  border-color: rgba(24, 181, 108, 0.9);
  box-shadow: 0 0 0 3px rgba(24, 181, 108, 0.18);
}

body[data-theme="matrix"][data-matrix-variant="blue"] {
  --landing-bg: #030916;
  --landing-bg-accent: #081329;
  --landing-surface: rgba(6, 16, 34, 0.92);
  --landing-surface-border: rgba(65, 112, 173, 0.58);
  --landing-text: #9dccff;
  --landing-text-soft: #6f93be;
  --landing-primary: #3c89ff;
  --landing-primary-2: #2f69d3;
  --landing-chip-bg: rgba(7, 18, 37, 0.92);
  --landing-chip-border: rgba(78, 129, 196, 0.58);
  --landing-chip-text: #8fb2de;
  --landing-input-bg: rgba(6, 15, 30, 0.94);
  --landing-input-border: rgba(69, 121, 191, 0.6);
  --landing-glow: 0 18px 38px rgba(9, 35, 72, 0.4);
}

body[data-theme="matrix"][data-matrix-variant="blue"] .landing-status-pill {
  border-color: rgba(74, 143, 246, 0.6);
  background: rgba(12, 28, 54, 0.86);
  color: #99c5ff;
}

body[data-theme="matrix"][data-matrix-variant="blue"] .landing-identity-card {
  border-color: rgba(78, 129, 196, 0.58);
  background: rgba(7, 18, 37, 0.9);
}

body[data-theme="matrix"][data-matrix-variant="blue"] .landing-open-app {
  border-color: rgba(74, 143, 246, 0.58);
  background: rgba(14, 30, 57, 0.86);
  color: #9fc9ff;
}

body[data-theme="matrix"][data-matrix-variant="blue"] .landing-icon-btn {
  border-color: rgba(78, 129, 196, 0.58);
  background: rgba(7, 18, 37, 0.9);
  color: #8fb2de;
}

body[data-theme="matrix"][data-matrix-variant="blue"] .landing-icon-btn-primary {
  border-color: rgba(74, 143, 246, 0.58);
  background: rgba(14, 30, 57, 0.86);
  color: #9fc9ff;
}

body[data-theme="matrix"][data-matrix-variant="blue"] .landing-theme-dot.active {
  border-color: rgba(74, 143, 246, 0.92);
  box-shadow: 0 0 0 3px rgba(74, 143, 246, 0.2);
}

@media (max-width: 980px) {
  .landing-shell {
    grid-template-columns: 1fr;
  }

  .landing-auth-panel > .landing-muted {
    font-size: 18px;
  }
}

@media (max-width: 620px) {
  .landing-shell {
    padding: 27px 12px 12px;
    gap: 14px;
  }

  .landing-auth-panel,
  .landing-content-panel {
    border-radius: 20px;
    padding: 14px;
  }

  .landing-theme-switch {
    gap: 5px;
    padding: 3px 6px;
  }

  .landing-theme-corner {
    top: 1px;
    right: 2px;
  }

  .landing-brand {
    padding: 6px 11px;
  }

  .landing-brand-img {
    height: 22px;
  }

  .landing-theme-dot {
    width: 16px;
    height: 16px;
  }

  .landing-authorized-row {
    flex-wrap: nowrap;
  }
}

.premium-locked-msg { background: #fff8e1; border-left: 4px solid #f59e0b; padding: 16px 20px; border-radius: 6px; color: #92400e; font-size: 15px; }

.landing-content-panel pre {
  display: block;
  margin: 18px 0 26px;
  padding: 18px 22px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 18px;
  background: #f8fbff;
  color: #334155;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

.landing-content-panel pre code {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: inherit;
}

.landing-content-panel :not(pre) > code {
  padding: 0.08em 0.32em;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.16);
  color: #334155;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

body[data-theme="matrix"] .landing-content-panel pre {
  border-color: rgba(24, 181, 108, 0.32);
  background: rgba(6, 20, 14, 0.92);
  color: #d6ffe9;
  box-shadow: inset 0 0 0 1px rgba(24, 181, 108, 0.08);
}

body[data-theme="matrix"] .landing-content-panel :not(pre) > code {
  background: rgba(24, 181, 108, 0.14);
  color: #d6ffe9;
}

body[data-theme="matrix"][data-matrix-variant="blue"] .landing-content-panel pre {
  border-color: rgba(74, 143, 246, 0.34);
  background: rgba(7, 18, 37, 0.92);
  color: #d8eaff;
  box-shadow: inset 0 0 0 1px rgba(74, 143, 246, 0.08);
}

body[data-theme="matrix"][data-matrix-variant="blue"] .landing-content-panel :not(pre) > code {
  background: rgba(74, 143, 246, 0.14);
  color: #d8eaff;
}

.landing-content-panel table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 18px 0 26px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.88);
}

.landing-content-panel th,
.landing-content-panel td {
  min-width: 88px;
  padding: 10px 12px;
  border-right: 1px solid rgba(148, 163, 184, 0.24);
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  vertical-align: top;
}

.landing-content-panel th:last-child,
.landing-content-panel td:last-child {
  border-right: 0;
}

.landing-content-panel tr:last-child td {
  border-bottom: 0;
}

.landing-content-panel th {
  background: rgba(37, 99, 235, 0.08);
  color: #162031;
  font-weight: 800;
}

.landing-content-panel blockquote {
  margin: 18px 0 26px;
  padding: 14px 18px;
  border-left: 4px solid rgba(37, 99, 235, 0.42);
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.06);
}

.landing-content-panel img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px 0 26px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.landing-content-panel [data-align="left"] {
  text-align: left;
}

.landing-content-panel [data-align="center"] {
  text-align: center;
}

.landing-content-panel [data-align="right"] {
  text-align: right;
}

.landing-content-panel [data-align="justify"] {
  text-align: justify;
}
