:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --sidebar: #0f3d4c;
  --sidebar-surface: #ffffff;
  --sidebar-border: #e8eef3;
  --sidebar-text: #1a2b33;
  --sidebar-muted: #64748b;
  --sidebar-hover: #f1f5f9;
  --sidebar-active: #e8f6f9;
  --accent: #1a8a9e;
  --accent-hover: #157484;
  --accent-soft: rgba(26, 138, 158, 0.12);
  --text: #1a2b33;
  --text-muted: #5c6f7a;
  --border: #dce6ee;
  --shadow: 0 8px 24px rgba(15, 61, 76, 0.08);
  --shadow-sidebar: 0 1px 3px rgba(15, 61, 76, 0.06), 0 8px 24px rgba(15, 61, 76, 0.04);
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --sidebar-width-expanded: 272px;
  --sidebar-width-collapsed: 78px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 106.25%; /* 17px base — slightly larger than default for readability */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  background: var(--sidebar-surface);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width-expanded);
  min-width: 0;
  max-width: 100%;
  padding: 1rem 0.75rem;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overflow-x: clip;
  border-right: 1px solid var(--sidebar-border);
  box-shadow: var(--shadow-sidebar);
  z-index: 10;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1), padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1rem 0.7rem 1.05rem;
  margin-bottom: 0.35rem;
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--sidebar-border);
  transition: padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  width: 100%;
  min-width: 0;
  transition: align-items 0.28s cubic-bezier(0.4, 0, 0.2, 1), gap 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-mark {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 38px;
}

.brand-logo-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-logo-wrap .brand-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: center center;
}

.brand-icon-wrap {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15, 61, 76, 0.1);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-favicon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-logo {
  display: block;
  height: 42px;
  width: auto;
  max-width: 148px;
  object-fit: contain;
  flex-shrink: 0;
}

.login-brand .brand-logo {
  height: 48px;
  max-width: 200px;
}

.brand-details {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
  opacity: 1;
  max-height: 7rem;
  overflow: hidden;
  transition: opacity 0.22s ease, max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-divider {
  width: 100%;
  height: 1px;
  border: none;
  margin: 0;
  background: var(--sidebar-border);
}

.brand-workspace-card {
  width: 100%;
  min-width: 0;
  padding: 0.62rem 0.68rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--sidebar-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.brand-clinic-name {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-workspace-link {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  margin-top: 0.48rem;
  padding-top: 0.48rem;
  border-top: 1px solid #e8eef3;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  transition: color 0.15s ease;
}

.brand-workspace-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: #94a3b8;
  transition: color 0.15s ease;
}

.brand-workspace-url {
  font-size: 0.71rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.005em;
  color: var(--sidebar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s ease;
}

.brand-workspace-link:hover .brand-workspace-url,
.brand-workspace-link:focus-visible .brand-workspace-url {
  color: var(--accent-hover);
}

.brand-workspace-link:hover .brand-workspace-icon,
.brand-workspace-link:focus-visible .brand-workspace-icon {
  color: var(--accent);
}

.brand-workspace-link:focus-visible {
  outline: 2px solid rgba(26, 138, 158, 0.28);
  outline-offset: 2px;
  border-radius: 4px;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  overscroll-behavior: contain;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 5px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.sidebar-scroll-inner {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-section-label {
  margin: 0 0 0.5rem 0.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  opacity: 1;
  max-height: 2rem;
  overflow: hidden;
  transition: opacity 0.2s ease, max-height 0.25s ease, margin 0.25s ease;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  width: 100%;
}

.sidebar-section-label--desk,
.sidebar-section-label--account {
  margin-top: 1.1rem;
}

.sidebar-nav--account {
  margin-bottom: 0;
}

.sidebar-category-divider {
  display: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: -0.35rem 0.5rem -0.35rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.app-shell.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.app-shell.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.app-shell.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.55rem;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  border-radius: 10px;
  color: var(--sidebar-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, gap 0.28s cubic-bezier(0.4, 0, 0.2, 1), padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--accent-hover);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--sidebar-hover);
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover .nav-icon {
  background: #e2e8f0;
}

.nav-item.active .nav-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: font-size 0.22s ease, white-space 0s linear 0.22s;
}

.nav-label-short {
  display: none;
}

.sidebar-collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.55rem;
  width: calc(100% - 0.7rem);
  max-width: 100%;
  min-width: 0;
  margin: 0.65rem 0.35rem 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  background: transparent;
  color: var(--sidebar-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}

.sidebar-collapse-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapse-toggle:hover,
.sidebar-collapse-toggle:focus-visible {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
  border-color: #cbd5e1;
  outline: none;
}

.sidebar-collapse-label {
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  max-width: 8rem;
  transition: opacity 0.18s ease, max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 901px) {
  html.sidebar-collapsed .sidebar {
    width: var(--sidebar-width-collapsed);
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }

  html.sidebar-collapsed .sidebar-brand {
    align-items: center;
    padding: 0.65rem 0.25rem 0.85rem;
  }

  html.sidebar-collapsed .brand-identity {
    align-items: center;
    gap: 0;
  }

  html.sidebar-collapsed .brand-mark {
    justify-content: center;
    min-height: 46px;
  }

  html.sidebar-collapsed .brand-logo-wrap {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    position: absolute;
  }

  html.sidebar-collapsed .brand-icon-wrap {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    position: absolute;
    left: 50%;
    top: 50%;
  }

  html.sidebar-collapsed .brand-details {
    opacity: 0;
    max-height: 0;
    pointer-events: none;
  }

  html.sidebar-collapsed .sidebar-section-label {
    display: none;
  }

  html.sidebar-collapsed .sidebar-category-divider {
    display: block;
    height: 1px;
    margin: 0.28rem 0.35rem;
    background: var(--sidebar-border);
    flex-shrink: 0;
  }

  html.sidebar-collapsed .sidebar-scroll {
    padding-left: 0;
    padding-right: 0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  html.sidebar-collapsed .sidebar-nav {
    gap: 0.12rem;
  }

  html.sidebar-collapsed .nav-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
    padding: 0.34rem 0.15rem;
    min-height: 0;
    overflow: visible;
  }

  html.sidebar-collapsed .nav-item.active {
    box-shadow: none;
  }

  html.sidebar-collapsed .nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  html.sidebar-collapsed .nav-label {
    flex: 0 0 auto;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
    text-overflow: unset;
    text-align: center;
    transition: font-size 0.22s ease;
  }

  html.sidebar-collapsed .nav-label-full {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  html.sidebar-collapsed .nav-label-short {
    display: block;
    font-size: 0.56rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: visible;
  }

  html.sidebar-collapsed .nav-item.active .nav-label-short {
    color: var(--accent-hover);
    font-weight: 600;
  }

  html.sidebar-collapsed .sidebar-collapse-toggle {
    justify-content: center;
    margin-top: 0.55rem;
    padding: 0.34rem 0.2rem;
  }

  html.sidebar-collapsed .sidebar-collapse-toggle svg {
    transform: rotate(180deg);
  }

  html.sidebar-collapsed .sidebar-collapse-label {
    opacity: 0;
    max-width: 0;
  }

  html.sidebar-collapsed .sidebar-trial-card,
  html.sidebar-collapsed .billing-reminder {
    display: none;
  }

  html.sidebar-collapsed .sidebar-trial-compact {
    display: flex;
  }

  html.sidebar-collapsed .sidebar-footer {
    padding-left: 0;
    padding-right: 0;
    margin-top: 0.35rem;
  }

  html.sidebar-collapsed .sidebar-user-card {
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.25rem;
  }

  html.sidebar-collapsed .sidebar-user-meta {
    display: none;
  }

  html.sidebar-collapsed .sidebar-user-logout-btn {
    width: 28px;
    height: 28px;
  }

  html.sidebar-collapsed .sidebar-collapse-toggle {
    width: calc(100% - 0.9rem);
    margin-left: 0.45rem;
    margin-right: 0.45rem;
  }
}

.nav-icon .nav-svg,
.nav-icon > svg {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  overflow: visible;
}

.sidebar .nav-svg [fill]:not([fill="none"]) {
  fill: currentColor;
}

.sidebar .nav-svg [stroke]:not([stroke="none"]) {
  stroke: currentColor;
}

.nav-svg--filled {
  fill: currentColor;
}

.sidebar-footer {
  flex-shrink: 0;
  min-width: 0;
  width: 100%;
  padding: 0.75rem 0.35rem 0;
  margin-top: auto;
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.8rem;
}

.sidebar-trial-card {
  margin: 0 0.35rem 0.65rem;
  padding: 0.75rem;
  border: 1px solid #a7e8d8;
  border-radius: 12px;
  background: linear-gradient(145deg, #f0fdf9 0%, #ecfdf5 100%);
  box-shadow: 0 1px 2px rgba(15, 61, 76, 0.04);
}

.sidebar-trial-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  min-width: 0;
}

.sidebar-trial-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #047857;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #a7f3d0;
}

.sidebar-trial-days {
  font-size: 0.82rem;
  font-weight: 700;
  color: #065f46;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-trial-copy {
  margin: 0 0 0.65rem;
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.sidebar-trial-subscribe-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.48rem 0.75rem;
  border-radius: 8px;
  border: none;
  background: linear-gradient(145deg, var(--accent) 0%, #157484 100%);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 61, 76, 0.12);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.sidebar-trial-subscribe-btn:hover {
  background: linear-gradient(145deg, var(--accent-hover) 0%, #126673 100%);
  box-shadow: 0 2px 6px rgba(15, 61, 76, 0.16);
  transform: translateY(-1px);
  color: #fff;
}

.sidebar-trial-subscribe-btn:active {
  transform: translateY(0);
}

.sidebar-trial-compact {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  margin: 0 0 0.6rem;
  padding: 0.55rem 0.35rem 0.5rem;
  border-radius: 12px;
  border: 1px solid #99dcc8;
  background: linear-gradient(160deg, #f0fdf9 0%, #e6faf3 48%, #ecfdf5 100%);
  color: #065f46;
  text-decoration: none;
  text-align: center;
  box-shadow:
    0 1px 2px rgba(15, 61, 76, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-trial-compact-value {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #047857;
}

.sidebar-trial-compact-mid {
  font-size: 0.58rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.015em;
  color: #065f46;
}

.sidebar-trial-compact-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.08rem;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  font-size: 0.52rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #047857;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #a7f3d0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.sidebar-trial-compact:hover {
  border-color: #5eead4;
  background: linear-gradient(160deg, #ecfdf5 0%, #d1fae5 52%, #ecfdf5 100%);
  box-shadow:
    0 3px 8px rgba(4, 120, 87, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
}

.sidebar-trial-compact:active {
  transform: translateY(0);
}

.billing-reminder {
  margin: 0 0.35rem 0.65rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  background: #f0f9ff;
}

.billing-reminder.danger {
  border-color: #fecaca;
  background: #fef2f2;
}

.billing-reminder-label {
  margin: 0;
  color: #b91c1c;
  font-size: 0.72rem;
  font-weight: 700;
}

.billing-reminder-days {
  margin: 0;
  color: #0c4a6e;
  font-size: 0.92rem;
  font-weight: 700;
}

.billing-reminder.danger .billing-reminder-days {
  color: #991b1b;
}

.billing-reminder-copy {
  margin: 0.25rem 0 0;
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.billing-reminder-link {
  display: inline-flex;
  margin-top: 0.45rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
}

.billing-reminder-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.55rem 0.5rem;
  border-radius: 12px;
  background: var(--sidebar-hover);
  border: 1px solid var(--sidebar-border);
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(145deg, #b5d4f4 0%, #7eb8e8 100%);
  color: #0c447c;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.sidebar-user-meta {
  min-width: 0;
  flex: 1;
}

.sidebar-user-name {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  margin: 0.08rem 0 0;
  font-size: 0.7rem;
  color: var(--sidebar-muted);
}

.sidebar-user-logout-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--sidebar-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-user-logout-btn svg {
  width: 18px;
  height: 18px;
}

.sidebar-user-logout-btn:hover,
.sidebar-user-logout-btn:focus-visible {
  background: #fef2f2;
  color: #b91c1c;
  outline: none;
}

.sidebar-logout-form {
  margin: 0;
  flex-shrink: 0;
}

.main-content {
  padding: 1.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  overflow-y: auto;
}

.page-body {
  flex: 1;
  min-width: 0;
  container-type: inline-size;
  container-name: page;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.topbar-intro {
  flex: 1;
  min-width: 0;
}

.topbar-intro:not(:has(h1)) {
  display: none;
}

.topbar-actions:not(:has(*)) {
  display: none;
}

.topbar:not(:has(.topbar-intro h1)):not(:has(.topbar-actions > *)) {
  align-items: center;
  margin-bottom: 0;
}

.mobile-brand-mark {
  display: none;
}

@media (min-width: 1281px) {
  .topbar:not(:has(.topbar-intro h1)):not(:has(.topbar-actions > *)) {
    display: none;
  }
}

@media (max-width: 1280px) {
  .mobile-brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(15, 61, 76, 0.12);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }

  .mobile-brand-mark:hover,
  .mobile-brand-mark:focus-visible {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(15, 61, 76, 0.16);
    outline: none;
  }

  .mobile-brand-favicon {
    display: block;
    width: 40px;
    height: 40px;
    object-fit: cover;
  }

  /* Every mobile page: menu + centered favicon (same as desk pages) */
  .topbar {
    position: relative;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    min-height: 48px;
    margin-bottom: 0.75rem;
    padding-top: max(0.15rem, env(safe-area-inset-top, 0px));
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
  }

  .topbar-intro,
  .topbar-actions {
    display: none !important;
  }

  .nav-toggle {
    position: absolute;
    left: 0;
    top: max(0.15rem, env(safe-area-inset-top, 0px));
    margin: 0;
    z-index: 2;
  }
}

/* Page titles moved below the brand bar on mobile */
.page-mobile-intro {
  display: none;
}

@media (max-width: 1280px) {
  .page-mobile-intro {
    display: block;
    margin: 0 0 1rem;
    padding: 0 0.1rem;
  }

  .page-mobile-intro h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
  }

  .page-mobile-sub {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
  }

.page-mobile-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
  }

  .topbar-desktop-only {
    display: none !important;
  }
}

@media (min-width: 1281px) {
  .topbar-desktop-only {
    display: inline-flex;
  }

  .topbar-actions .topbar-desktop-only.rx-btn-outline,
  .topbar-actions button.topbar-desktop-only {
    display: inline-flex;
  }
}

@media (max-width: 900px) {
  .page-mobile-intro h1 {
    font-size: 1.15rem;
  }

  .page-mobile-sub {
    font-size: 0.78rem;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.module-badge {
  font-size: 0.7rem;
  background: #e8f6f9;
  color: var(--accent-hover);
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.module-badge svg,
.module-badge .nav-svg {
  width: 12px;
  height: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #b5d4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 600;
  color: #0c447c;
}

.app-toast {
  position: fixed;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: max(16px, env(safe-area-inset-right));
  left: max(16px, env(safe-area-inset-left));
  margin-left: auto;
  width: auto;
  max-width: 360px;
  background: var(--sidebar);
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  z-index: 1000;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: var(--shadow);
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.app-toast.error {
  background: #922b21;
}

.topbar h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
}

.topbar-sub {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.desk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.desk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.desk-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.desk-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #e8f6f9;
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
}

.desk-card-icon .nav-svg {
  width: 28px;
  height: 28px;
}

.desk-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.desk-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.desk-card-link {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.info-panel {
  margin-top: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.info-panel h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.billing-note {
  margin: 0 0 0.85rem;
  color: var(--text-muted);
}

.billing-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  flex-wrap: wrap;
}

.billing-inline-status {
  font-size: 0.84rem;
  color: #14532d;
}

.billing-inline-status.error {
  color: #991b1b;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 0;
}

.detail-list dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.detail-list dd {
  margin: 0;
  font-size: 0.92rem;
}

.workspace-placeholder {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 560px;
}

.workspace-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: var(--accent);
}

.workspace-icon .nav-svg {
  width: 64px;
  height: 64px;
}

.workspace-placeholder h2 {
  margin: 0 0 0.5rem;
}

.workspace-placeholder p {
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

.btn-secondary {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  max-width: 720px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}

.stat-label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.stat-value {
  margin: 0.35rem 0 0;
  font-weight: 600;
  font-size: 1rem;
}

.error-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.error-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.error-svg {
  width: 56px;
  height: 56px;
  color: #c2410c;
  margin-bottom: 1rem;
}

.error-card .hint {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.error-card code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* —— Auth pages (login split layout + shared form styles) —— */
.auth-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.05fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2rem, 5vw, 3.5rem);
  color: #fff;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(0, 0, 0, 0.18), transparent 50%),
    linear-gradient(155deg, #0a2f3a 0%, var(--sidebar) 42%, #157484 100%);
  overflow: hidden;
}

.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 85%);
  pointer-events: none;
}

.auth-brand-content {
  position: relative;
  z-index: 1;
  max-width: 26rem;
}

.auth-brand-logo .brand-logo {
  height: 44px;
  max-width: 180px;
  filter: brightness(0) invert(1);
}

.auth-brand-eyebrow {
  margin: 1.75rem 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.auth-brand-title {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.auth-brand-tagline {
  margin: 0.85rem 0 0;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

.auth-brand-features {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-brand-features li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.9);
}

.auth-feature-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.75);
}

.auth-brand-footer {
  position: relative;
  z-index: 1;
  margin: 2rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.55);
}

.auth-brand-footer-sep {
  margin: 0 0.35rem;
  opacity: 0.65;
}

.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  background:
    radial-gradient(circle at top right, rgba(26, 138, 158, 0.08), transparent 42%),
    var(--bg);
}

.auth-card {
  width: min(100%, 420px);
  padding: clamp(1.75rem, 4vw, 2.5rem);
  background: var(--surface);
  border: 1px solid rgba(220, 230, 238, 0.95);
  border-radius: calc(var(--radius) + 4px);
  box-shadow:
    0 1px 2px rgba(15, 61, 76, 0.04),
    0 16px 40px rgba(15, 61, 76, 0.08);
}

.auth-card-header {
  margin-bottom: 1.5rem;
}

.auth-card-header h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.auth-card-header p {
  margin: 0.55rem 0 0;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.auth-steps {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}

.auth-step {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
}

.auth-step--current {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(26, 138, 158, 0.22);
}

.auth-step--done {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.auth-step-icon {
  width: 0.85rem;
  height: 0.85rem;
}

.auth-step-sep {
  width: 1.25rem;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

.auth-card-lead {
  margin: 0.85rem 0 0.45rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.auth-email-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  word-break: break-all;
}

.auth-card-hint {
  margin: 0.85rem 0 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.login-page .login-card {
  text-align: left;
  max-width: 400px;
  width: 100%;
}

.login-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.login-brand-text strong {
  display: block;
  font-size: 1.05rem;
}

.login-brand-text span {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.login-error {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0 1.25rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.9rem;
  line-height: 1.45;
}

.login-error-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.login-field input {
  font: inherit;
  font-weight: 400;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-field input::placeholder {
  color: #94a3b8;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 138, 158, 0.18);
}

.login-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
  padding: 0.78rem 1.1rem;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #1c95a9 0%, var(--accent) 100%);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 61, 76, 0.12), 0 8px 18px rgba(26, 138, 158, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-submit-icon {
  width: 1rem;
  height: 1rem;
  transition: transform 0.15s ease;
}

.login-submit:hover {
  background: linear-gradient(180deg, #1a8a9e 0%, var(--accent-hover) 100%);
  box-shadow: 0 2px 4px rgba(15, 61, 76, 0.14), 0 10px 22px rgba(26, 138, 158, 0.28);
  transform: translateY(-1px);
}

.login-submit:hover .login-submit-icon {
  transform: translateX(2px);
}

.login-submit:active {
  transform: translateY(0);
}

.login-submit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.login-submit--full,
.otp-verify-page .login-actions--stacked .login-submit,
.otp-verify-page .login-actions--stacked .login-secondary {
  width: 100%;
  min-height: 2.875rem;
  padding: 0.82rem 1.15rem;
  font-size: 0.95rem;
}

.login-submit--full {
  margin-top: 0.35rem;
}

.login-intro {
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.login-message {
  margin: 0 0 1.25rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.login-message--error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.login-message--success {
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

.login-message.hidden {
  display: none;
}

.otp-verify-page .login-field--otp {
  margin-top: 0.15rem;
}

.otp-verify-page .login-actions--stacked {
  flex-direction: column;
  gap: 0.75rem;
}

.otp-verify-page .login-actions--stacked .login-submit,
.otp-verify-page .login-actions--stacked .login-secondary {
  flex: none;
}

.otp-verify-page .login-actions--stacked .login-submit {
  margin-top: 0;
}

.otp-input {
  letter-spacing: 0.42em;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.otp-input::placeholder {
  letter-spacing: 0.42em;
  color: #cbd5e1;
  font-weight: 500;
}

.login-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.login-actions .login-submit {
  flex: 1 1 10rem;
  margin-top: 0;
}

.login-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex: 1 1 8rem;
  padding: 0.78rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.login-action-icon {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--text-muted);
}

.login-secondary:hover {
  background: var(--bg);
  border-color: #c8d8e4;
}

.login-secondary:disabled,
.login-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.login-footer {
  margin: 1.35rem 0 0;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  text-align: center;
}

.login-footer a {
  color: var(--accent);
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .auth-brand {
    padding: 2rem 1.75rem 1.75rem;
  }

  .auth-brand-features {
    display: none;
  }

  .auth-brand-footer {
    display: none;
  }

  .auth-main {
    padding: 1.5rem 1.25rem 2.5rem;
    align-items: flex-start;
  }
}

/* Short viewports: compact sidebar so menus stay readable */
@media (max-height: 820px) and (min-width: 901px) {
  .sidebar-brand {
    padding: 0.7rem 0.55rem 0.8rem;
    margin-bottom: 0.2rem;
  }

  .brand-details {
    gap: 0.55rem;
    max-height: 5.5rem;
  }

  .brand-workspace-card {
    padding: 0.5rem 0.55rem;
  }

  .nav-item {
    min-height: 40px;
    padding: 0.38rem 0.5rem;
  }

  .sidebar-collapse-toggle {
    margin-top: 0.55rem;
    padding: 0.38rem 0.5rem;
  }

  .sidebar-footer {
    padding-top: 0.55rem;
    margin-top: 0.35rem;
  }

  .sidebar-trial-card {
    padding: 0.55rem 0.6rem;
    margin-bottom: 0.45rem;
  }

  .sidebar-trial-copy {
    display: none;
  }
}

@media (max-height: 700px) and (min-width: 901px) {
  .sidebar-brand {
    padding: 0.55rem 0.5rem 0.65rem;
  }

  .brand-logo-wrap .brand-logo {
    height: 26px;
  }

  .brand-details {
    max-height: 4.5rem;
    gap: 0.45rem;
  }

  .brand-clinic-name {
    font-size: 0.78rem;
  }

  .nav-item {
    min-height: 38px;
    gap: 0.55rem;
    font-size: 0.82rem;
  }

  .nav-icon {
    width: 32px;
    height: 32px;
  }

  .sidebar-trial-card {
    display: none;
  }

  .sidebar-trial-compact {
    display: flex;
  }

  .sidebar-user-avatar {
    width: 34px;
    height: 34px;
  }
}

/* Compact desktop: sidebar still visible but less horizontal room */
@media (max-width: 1280px) and (min-width: 901px) {
  .main-content {
    padding: 1rem 1.25rem 1.5rem;
  }

  .topbar {
    margin-bottom: 1rem;
  }

  .topbar h1 {
    font-size: 1.35rem;
  }

  .topbar-sub {
    font-size: 0.85rem;
  }
}

@media (max-height: 700px) {
  .sidebar-trial-card {
    display: none;
  }

  .sidebar-trial-compact {
    display: flex;
  }

  .sidebar-trial-copy {
    display: none;
  }

  .sidebar-brand {
    padding-bottom: 0.7rem;
  }

  .nav-item {
    min-height: 40px;
  }
}

@media (max-width: 1280px) and (min-width: 601px) {
  .desk-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .sidebar-collapse-toggle {
    display: none;
  }

  .sidebar {
    width: min(288px, 88vw);
  }

  .nav-toggle {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    transform: translateX(-105%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0s;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    overflow-x: clip;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-scroll {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

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

  .sidebar-nav {
    flex-direction: column;
    width: 100%;
  }

  .main-content {
    padding: 1rem max(1rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
  }

  .topbar {
    margin-bottom: 1rem;
  }

  .topbar-sub {
    font-size: 0.85rem;
  }

  .desk-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .detail-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .info-panel {
    padding: 1rem;
  }
}

@media (max-width: 600px) {
  .desk-grid {
    grid-template-columns: 1fr;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .topbar h1 {
    font-size: 1.2rem;
  }

  .user-pill span:not(.user-avatar) {
    display: none;
  }

  .desk-card {
    padding: 1.1rem;
  }

  .workspace-placeholder {
    padding: 1.5rem 1rem;
  }

  .error-page {
    padding: 1rem;
  }

  .error-card {
    padding: 1.5rem;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .auth-brand {
    padding: 1.75rem 1.5rem 1.5rem;
  }

  .auth-brand-features {
    display: none;
  }

  .auth-brand-tagline {
    font-size: 0.92rem;
  }

  .auth-brand-footer {
    display: none;
  }

  .auth-main {
    padding: 1.25rem 1rem 2rem;
    align-items: flex-start;
  }

  .auth-card {
    padding: 1.5rem;
  }
}
