/* LibOTP app shell — multi-page dashboard */
.app-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 100% 0%, rgba(61, 255, 197, 0.08), transparent 50%),
    linear-gradient(180deg, #071018, #0c1a24);
  color: var(--text);
  font-family: var(--font-body);
}

.app-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  grid-template-areas: 'side main';
  min-height: 100vh;
}

.app-sidebar {
  grid-area: side;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(8, 18, 26, 0.92);
  backdrop-filter: blur(12px);
  padding: 1rem 0.85rem;
  overflow-y: auto;
  z-index: 20;
}

/* Must not take a grid cell on desktop (breaks 2-col layout) */
.sidebar-backdrop {
  display: none;
}


.side-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem 1.1rem;
  text-decoration: none;
  color: inherit;
}

.side-brand .titles strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.side-brand .titles span {
  color: var(--muted);
  font-size: 0.8rem;
}

.side-section {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.85rem 0.75rem 0.4rem;
}

.side-nav {
  display: grid;
  gap: 0.2rem;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}

.side-link.install-app-btn {
  width: 100%;
  border: 1px solid rgba(61, 255, 197, 0.35);
  background: rgba(61, 255, 197, 0.1);
  color: var(--mint);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.side-link.install-app-btn:hover {
  background: rgba(61, 255, 197, 0.18);
}

.side-link.install-app-btn.hidden {
  display: none !important;
}

.side-link:hover {
  color: var(--text);
  background: rgba(61, 255, 197, 0.06);
}

.side-link.active {
  color: var(--mint);
  background: rgba(61, 255, 197, 0.12);
  box-shadow: inset 3px 0 0 var(--mint);
}

.side-ico {
  width: 20px;
  text-align: center;
  opacity: 0.9;
  font-size: 0.95rem;
}

.side-footer {
  margin-top: auto;
  padding: 0.85rem 0.5rem 0.35rem;
  border-top: 1px solid var(--line);
}

.side-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.side-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint), #2ad0ff);
  color: #041018;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: var(--font-display);
}

.side-user .meta {
  min-width: 0;
  flex: 1;
}

.side-user .meta strong {
  display: block;
  font-size: 0.9rem;
}

.side-user .meta span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.side-user-actions a,
.side-user-actions button {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(4, 16, 24, 0.5);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  padding: 0;
}

.side-user-actions a:hover,
.side-user-actions button:hover {
  color: var(--mint);
  border-color: rgba(61, 255, 197, 0.35);
}

/* Dashboard popular services */
.app-content.dash-wide {
  width: min(1200px, 100%);
}

.dash-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.15rem 1.35rem;
  border-radius: 18px;
  margin-bottom: 1.25rem;
  background:
    linear-gradient(120deg, rgba(61, 255, 197, 0.22), rgba(42, 208, 255, 0.12) 45%, rgba(255, 200, 87, 0.1));
  border: 1px solid rgba(61, 255, 197, 0.28);
}

.dash-banner h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.dash-banner p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.pop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.pop-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(14, 28, 38, 0.72);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  position: relative;
}

.pop-card:hover {
  border-color: rgba(61, 255, 197, 0.4);
  transform: translateY(-2px);
  background: rgba(14, 28, 38, 0.95);
}

.pop-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.pop-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(4, 16, 24, 0.7);
  border: 1px solid var(--line);
}

.pop-logo.fallback {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--mint);
}

.pop-go {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(61, 255, 197, 0.25);
  background: rgba(61, 255, 197, 0.12);
  color: var(--mint);
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.pop-name {
  font-weight: 700;
  font-size: 0.98rem;
  margin: 0;
}

.pop-country {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.pop-country img {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  object-fit: cover;
}

.pop-price {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--mint);
}

.pop-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
}

.pop-op {
  color: var(--muted);
  font-size: 0.78rem;
}

.pop-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--amber);
  background: rgba(255, 200, 87, 0.12);
  border: 1px solid rgba(255, 200, 87, 0.28);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.dash-browse {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0 0.5rem;
}

@media (max-width: 1100px) {
  .pop-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .pop-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .pop-grid {
    grid-template-columns: 1fr;
  }
}

.app-main {
  grid-area: main;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.35rem;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 24, 0.65);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.app-topbar .sub {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.app-content {
  padding: 1.25rem 1.35rem 2.5rem;
  width: min(1100px, 100%);
  max-width: 100%;
  box-sizing: border-box;
}

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 960px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas: 'main';
  }
  .app-sidebar {
    grid-area: unset;
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .menu-toggle {
    display: inline-flex;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 15;
  }
  .sidebar-backdrop.show {
    display: block;
  }
}
