:root {
  --ink: #0d2137;
  --ink-soft: #1c3a56;
  --mist: #e8eef4;
  --paper: #f3f6f9;
  --accent: #0f8a78;
  --accent-deep: #0a5f53;
  --line: rgba(13, 33, 55, 0.1);
  --sidebar-w: 260px;
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: "Segoe UI", system-ui, sans-serif;
}

body.app-shell {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
}

.public-nav {
  background: var(--ink) !important;
}

.public-footer {
  background: var(--ink);
  color: rgba(244, 247, 250, 0.7);
}

.app-frame {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-sidebar {
  background: linear-gradient(180deg, #071522 0%, #0d2137 60%, #12324d 100%);
  color: #f4f7fa;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 1040;
}

.app-sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar__brand a {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.app-sidebar__close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.1rem;
}

.app-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.65rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.app-nav-label {
  margin: 0.85rem 0.55rem 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 247, 250, 0.45);
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.4rem;
  color: rgba(244, 247, 250, 0.82);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-nav-link i {
  font-size: 1.05rem;
  opacity: 0.9;
}

.app-nav-link:hover,
.app-nav-link.is-active {
  background: rgba(15, 138, 120, 0.22);
  color: #fff;
}

.app-nav-link.is-active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.app-sidebar__foot {
  padding: 0.85rem 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-topbar__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  flex: 1;
  letter-spacing: -0.02em;
}

.app-menu-toggle {
  color: var(--ink);
  font-size: 1.5rem;
  padding: 0;
  text-decoration: none;
}

.app-content {
  padding: 1.25rem 1.25rem 2rem;
}

.app-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 1.1rem 1.15rem;
}

.app-metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  padding: 1rem 1.1rem;
}

.app-metric__label {
  color: #5a7186;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.app-metric__value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}

.app-page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.app-page-head h1 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  margin: 0;
}

.app-panel--narrow { max-width: 720px; }
.ua-cell { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 991.98px) {
  .app-frame {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, var(--sidebar-w));
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(7, 21, 34, 0.45);
    z-index: 1035;
  }

  body.sidebar-open .app-sidebar-backdrop {
    display: block !important;
  }

  .app-content {
    padding: 1rem 0.85rem 1.75rem;
  }
}
