* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  font-size: 14px;
  font-family: "Roboto", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  color: var(--text);
  background: var(--bg-page);
}

body.app-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body.public-page {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

a {
  text-decoration: none;
}

.page-enter {
  animation: pageEnter 240ms ease both;
}

body.page-leaving .page-enter {
  opacity: 0.16;
  transition: opacity 180ms ease;
}

@keyframes pageEnter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.public-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: auto;
  background: var(--bg-page);
}

.app-layout {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #F5F7FA 0%, #EEF5FA 100%);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  background: rgba(255, 255, 255, 0.96);
  border-right: 1px solid rgba(226, 232, 240, 0.9);
  padding: 16px 12px;
  transition: width 220ms ease;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.sidebar-collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
}

.main-area {
  flex: 1;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 14px 18px 18px;
  position: relative;
  overflow: hidden;
}

.topbar {
  height: 18px;
  margin-bottom: 8px;
}

.content-shell {
  position: relative;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius-lg);
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  min-height: 0;
  padding: 20px 22px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.07);
  overflow: auto;
  overscroll-behavior: contain;
}

.content-shell::before {
  display: none;
}

.page-header {
  margin-bottom: 14px;
}

.page-header-compact {
  margin-bottom: 12px;
}

.page-title {
  margin: 0;
  font-size: 1.34rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.page-subtitle {
  margin-top: 5px;
  max-width: 860px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .app-layout {
    position: static;
    inset: auto;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }

  body.app-page {
    height: auto;
    overflow: auto;
  }

  .sidebar,
  .sidebar-collapsed .sidebar {
    width: 100%;
    position: static;
    height: auto;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
  }

  .main-area {
    height: auto;
    min-height: auto;
    overflow: visible;
    padding: 10px;
  }

  .content-shell {
    height: auto;
    min-height: calc(100vh - 28px);
    min-height: calc(100dvh - 28px);
    overflow: visible;
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .topbar {
    display: none;
  }
}
