:root {
  --workspace-sidebar-width: 292px;
  --workspace-navy-950: #102a43;
  --workspace-navy-900: #143a5b;
  --workspace-navy-800: #194b72;
  --workspace-blue-500: #4d94f6;
  --workspace-line: #dce3eb;
  --workspace-surface: #ffffff;
  --workspace-muted: #687586;
  --workspace-float-shadow: 0 18px 46px rgba(18, 42, 67, 0.18);
}

.skip-link {
  position: fixed;
  z-index: 120;
  top: 10px;
  left: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--workspace-navy-950);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--workspace-sidebar-width) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: rgba(255, 255, 255, 0.92);
  background:
    radial-gradient(circle at 10% -10%, rgba(81, 156, 224, 0.3), transparent 36%),
    linear-gradient(165deg, var(--workspace-navy-800), var(--workspace-navy-950));
  z-index: 20;
}

.sidebar .brand {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 26px 22px 19px;
  color: #ffffff;
  text-decoration: none;
}

.sidebar .brand:hover .brand-mark { transform: translateY(-1px); }

.sidebar .brand:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.46);
  outline-offset: -5px;
}

.sidebar .brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: var(--workspace-navy-900);
  background: #ffffff;
  font-size: 22px;
  font-weight: 780;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.18);
  transition: transform 150ms ease;
}

.sidebar .brand-title {
  display: block;
  color: #ffffff;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.sidebar .brand-subtitle {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  line-height: 1.4;
}

.mode-navigation {
  margin: 0 12px 9px;
  padding: 12px 9px 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(3, 18, 31, 0.16);
}

.mode-navigation-label {
  padding: 0 6px 8px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.12em;
}

.mode-navigation-list {
  display: grid;
  gap: 5px;
}

.mode-link {
  min-height: 62px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.mode-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.mode-link:active { transform: translateY(1px); }

.mode-link:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.4);
  outline-offset: 2px;
}

.mode-link.active {
  color: var(--workspace-navy-950);
  border-color: rgba(255, 255, 255, 0.88);
  background: #ffffff;
  box-shadow: 0 9px 22px rgba(2, 20, 34, 0.2);
}

.mode-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
}

.mode-link.active .mode-icon {
  color: #2563eb;
  background: #edf4ff;
}

.mode-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  line-height: 1.35;
}

.mode-copy strong { font-size: 13px; font-weight: 730; }
.mode-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255, 255, 255, 0.48); font-size: 10px; }
.mode-link.active .mode-copy small { color: #6d7b8a; }

.mode-meta {
  padding: 2px 6px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.54);
  background: rgba(255, 255, 255, 0.08);
  font-size: 10px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mode-link.active .mode-meta {
  color: #42607b;
  background: #eef3f8;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px 9px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0.08em;
}

.workspace-subnav {
  flex: 1;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 4px 12px 18px;
}

.workspace-subnav a {
  min-height: 46px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 12px;
  font-weight: 620;
}

.workspace-subnav a:hover { color: #ffffff; background: rgba(255, 255, 255, 0.08); }
.workspace-subnav a:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.4); outline-offset: 2px; }
.workspace-subnav span { color: rgba(255, 255, 255, 0.42); font-size: 10px; font-variant-numeric: tabular-nums; }

.sidebar-footer {
  margin: 0 18px 18px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
}

.data-summary { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 620; }
.summary-dot { width: 7px; height: 7px; border-radius: 50%; background: #62d59b; box-shadow: 0 0 0 4px rgba(98, 213, 155, 0.12); }
.summary-dot.preparing { background: #7ab8ff; box-shadow: 0 0 0 4px rgba(122, 184, 255, 0.13); }
.summary-dot.offline { background: #f0b64d; box-shadow: 0 0 0 4px rgba(240, 182, 77, 0.13); }
.summary-dot.unavailable { background: #9eabb9; box-shadow: 0 0 0 4px rgba(158, 171, 185, 0.12); }
.source-note { margin-top: 5px; color: rgba(255, 255, 255, 0.46); font-size: 10px; }

.install-app-button {
  width: 100%;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 11px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
}

.install-app-button:hover { border-color: rgba(255, 255, 255, 0.34); background: rgba(255, 255, 255, 0.17); }
.install-app-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.install-help { margin: 9px 0 0; padding: 9px 10px; border-radius: 9px; color: rgba(255, 255, 255, 0.74); background: rgba(3, 18, 31, 0.2); font-size: 11px; line-height: 1.55; }

.main-area { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 32px;
  border-bottom: 1px solid rgba(213, 222, 233, 0.92);
  background: rgba(255, 255, 255, 0.91);
  backdrop-filter: blur(16px);
  z-index: 10;
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.breadcrumb { max-width: min(58vw, 680px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--workspace-muted); font-size: 11px; }
.page-title { margin-top: 1px; color: #17212b; font-size: 18px; font-weight: 730; line-height: 1.25; }

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--workspace-line);
  border-radius: 11px;
  color: #3b4856;
  background: var(--workspace-surface);
  cursor: pointer;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mobile-menu { display: none; }
.mobile-overlay { position: fixed; inset: 0; background: rgba(16, 42, 67, 0.45); backdrop-filter: blur(2px); z-index: 15; }

.pwa-update-bar {
  position: fixed;
  right: 24px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px 10px 15px;
  border: 1px solid #bfd1e7;
  border-radius: 13px;
  color: var(--workspace-navy-900);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--workspace-float-shadow);
  font-size: 13px;
  font-weight: 680;
  z-index: 100;
}

.pwa-update-bar button { border: 0; border-radius: 8px; padding: 6px 9px; color: #ffffff; background: var(--workspace-navy-900); cursor: pointer; }
.pwa-update-dismiss { color: #526170 !important; background: #eef2f6 !important; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 246px minmax(0, 1fr); }
  .sidebar .brand { padding-inline: 18px; }
  .mode-navigation { margin-inline: 10px; }
  .sidebar-heading { padding-inline: 18px; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(86vw, 310px);
    transform: translateX(-104%);
    box-shadow: var(--workspace-float-shadow);
    transition: transform 180ms ease;
    z-index: 50;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand { align-self: stretch; }
  .mobile-overlay { z-index: 45; }
  .mobile-menu { display: grid; }
  .topbar { min-height: 68px; gap: 12px; padding: 8px 16px; }
  .topbar-left { gap: 9px; }
  .page-title { font-size: 16px; }
  .breadcrumb { max-width: 62vw; }
  .pwa-update-bar { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  .mode-link,
  .sidebar,
  .sidebar .brand-mark { transition-duration: 0.01ms !important; }
}
