:root {
  --brand-primary: #0b66c3;
  --brand-secondary: #0ea5e9;
  --brand-accent: #22c55e;
  --brand-dark: #0b1736;
  --brand-muted: #64748b;
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --border-soft: rgba(148, 163, 184, 0.25);
  --header-gradient: linear-gradient(130deg, var(--brand-dark), var(--brand-primary) 55%, var(--brand-secondary));
  --font-base: 'Inter', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-base);
  background: var(--bg-page);
  color: #0f172a;
  line-height: 1.55;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 700px at 90% 10%, rgba(14, 165, 233, 0.16), transparent 70%),
              radial-gradient(1000px 720px at 5% 95%, rgba(34, 197, 94, 0.14), transparent 70%),
              var(--bg-page);
}

.app-header {
  position: relative;
  z-index: 40;
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  background: var(--header-gradient);
  color: white;
  box-shadow: 0 18px 36px rgba(11, 23, 54, 0.28);
}

.app-logo {
  width: 56px;
  height: 56px;
  display: block;
  object-fit: contain;
}

.app-header-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.app-brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.app-subtitle {
  font-size: 0.95rem;
  opacity: 0.8;
  margin-top: 2px;
}

.app-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.app-link,
.portal-trigger {
  font-family: inherit;
  border: none;
  outline: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  color: white;
  background: rgba(255, 255, 255, 0.16);
}

.app-link:hover,
.portal-trigger:hover,
.app-link:focus,
.portal-trigger:focus {
  background: rgba(255, 255, 255, 0.26);
  text-decoration: none;
}

.app-user {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  display: flex;
  gap: 8px;
  align-items: center;
}

.app-user a {
  color: white;
  text-decoration: none;
  font-weight: 600;
}

.app-user a:hover,
.app-user a:focus {
  text-decoration: underline;
}

.app-content {
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1 1 auto;
  padding: 32px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: stretch;
}

.app-content > * {
  width: 100%;
}

.app-card {
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16);
  border: 1px solid var(--border-soft);
  width: 100%;
}

.app-card--narrow {
  max-width: 520px;
  margin: 0 auto;
}

.app-card--wide {
  max-width: none;
}

.app-main-centered {
  display: flex;
  justify-content: center;
  width: 100%;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-dropdown {
  position: relative;
}

.portal-trigger {
  background: rgba(255, 255, 255, 0.1);
}

.portal-trigger:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.portal-trigger::after {
  content: '\25BE';
  font-size: 0.75rem;
  opacity: 0.85;
}

.portal-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 10px;
  min-width: 210px;
  background: white;
  color: #0f172a;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
  padding: 10px 0;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.portal-menu::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

.portal-dropdown:hover .portal-menu,
.portal-dropdown:focus-within .portal-menu,
.portal-menu:hover,
.portal-menu:focus-within {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.portal-menu a {
  display: block;
  padding: 9px 18px;
  color: #0f172a;
  text-decoration: none;
  font-size: 0.95rem;
}

.portal-menu a:hover,
.portal-menu a:focus {
  background: rgba(11, 102, 195, 0.12);
  outline: none;
}

.portal-map {
  display: block;
  width: 100%;
  min-height: 68vh;
  height: clamp(420px, 70vh, 900px);
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 20px 42px rgba(15, 23, 42, 0.18);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-surface);
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.app-table thead {
  background: var(--brand-primary);
  color: white;
}

/* What's New */
.whats-new-content {
  max-width: 960px;
  margin: 0 auto;
}

.whats-new-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.whats-new-hero {
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 12px;
}

.whats-new-list {
  display: grid;
  gap: 24px;
}

.whats-new-entry {
  background: linear-gradient(140deg, rgba(11, 102, 195, 0.08), rgba(14, 165, 233, 0.04));
  border: 1px solid rgba(11, 102, 195, 0.18);
  border-left: 6px solid var(--brand-primary);
  border-radius: 18px;
  padding: 20px 24px;
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
  display: grid;
  gap: 14px;
}

.whats-new-entry__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
}

.whats-new-entry__version {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.whats-new-entry__date {
  font-size: 0.95rem;
  color: var(--brand-muted);
}

.whats-new-entry__highlights {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.whats-new-entry__highlights li {
  margin: 0;
}

.whats-new-entry__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.whats-new-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(11, 102, 195, 0.12);
  color: var(--brand-dark);
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.whats-new-link:hover,
.whats-new-link:focus {
  background: rgba(11, 102, 195, 0.22);
  transform: translateY(-1px);
}

.empty-state {
  margin: 0;
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.05);
  color: var(--brand-muted);
}

.app-table th,
.app-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
}

.app-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.04);
}

.app-table a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
}

.app-table a:hover {
  text-decoration: underline;
}

.app-alert {
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(254, 226, 226, 0.7);
  color: #b91c1c;
}

.app-muted {
  color: var(--brand-muted);
}

@media (max-width: 768px) {
  .app-content {
    padding: 24px 18px 32px;
  }

  .app-header {
    align-items: flex-start;
  }

  .app-nav {
    margin-left: 0;
  }

  .portal-menu {
    left: auto;
    right: 0;
  }
}

/* Guide template */
.guide-shell {
  background: var(--bg-page);
}

.guide-content {
  max-width: 1200px;
  margin: 0 auto;
}

.guide-card {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.guide-hero h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 3vw, 2.4rem);
}

.guide-hero p {
  margin: 0;
  color: var(--brand-muted);
  font-size: 1.05rem;
}

.guide-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) 1fr;
  gap: 28px;
}

.guide-toc {
  position: sticky;
  top: 24px;
  align-self: start;
  background: rgba(14, 165, 233, 0.08);
  border-radius: 16px;
  padding: 20px 22px;
  border: 1px solid rgba(14, 165, 233, 0.18);
}

.guide-toc__title {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand-dark);
}

.guide-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.guide-toc a {
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
}

.guide-toc a:hover,
.guide-toc a:focus {
  text-decoration: underline;
}

.guide-body {
  display: grid;
  gap: 32px;
}

.guide-section h2 {
  margin-top: 0;
  font-size: 1.6rem;
}

.guide-section ul,
.guide-section p {
  margin-top: 10px;
}

.guide-section ul {
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.guide-filters {
  display: grid;
  gap: 16px;
  margin: 18px 0;
  padding: 18px 20px;
  background: rgba(11, 102, 195, 0.08);
  border-radius: 14px;
  border: 1px solid rgba(11, 102, 195, 0.18);
}

.guide-filters dt {
  font-weight: 700;
  color: var(--brand-dark);
}

.guide-filters dd {
  margin: 4px 0 0;
  color: var(--brand-muted);
}

.guide-app-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding-left: 20px;
}

.guide-app-list a {
  font-weight: 600;
  color: var(--brand-primary);
  text-decoration: none;
}

.guide-app-list a:hover,
.guide-app-list a:focus {
  text-decoration: underline;
}

@media (max-width: 1024px) {
  .guide-layout {
    grid-template-columns: 1fr;
  }

  .guide-toc {
    position: static;
  }
}

@media (max-width: 640px) {
  .guide-card {
    padding: 20px 18px;
  }

  .guide-section h2 {
    font-size: 1.4rem;
  }
}
