/* ==========================================================================
   HOTEZO COMPONENTS
   Reusable UI primitives built on top of design-system.css tokens.
   ========================================================================== */

/* ---------------------------------- Buttons --------------------------------- */
/* A page-header action (".flex-between > .btn", e.g. "+ New Booking")
   must keep its width — .btn is nowrap + overflow:hidden, so shrinking
   clipped the label on phones. */
.flex-between > .btn {
  flex-shrink: 0;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out-3), box-shadow var(--dur-fast) var(--ease-out-3), opacity var(--dur-fast);
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.25) 50%, transparent 80%);
  transform: translateX(-120%);
  transition: transform var(--dur-slow) var(--ease-out-3);
  z-index: 1;
}

.btn:hover::after {
  transform: translateX(120%);
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--on-gradient);
  box-shadow: 0 4px 16px rgba(201, 162, 39, 0.35);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.btn-ghost {
  background: var(--glass);
  color: var(--text-high);
  border-color: var(--glass-border);
  backdrop-filter: blur(12px);
}

.btn-ghost:hover {
  border-color: var(--color-primary-2);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 12px 32px rgba(239, 68, 68, 0.32);
  transform: translateY(-2px);
}

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8125rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }
.btn-icon { padding: 0.625rem; border-radius: var(--radius-full); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* Inline text-style action, for dense table rows (room/rate-plan edit & remove)
   where a full .btn would be too heavy visually. */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-primary-2);
}

.link-btn:hover {
  text-decoration: underline;
}

.link-btn--danger {
  color: var(--color-rose);
}

/* -------------------------------- Form fields -------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-med);
}

.input,
.select,
textarea.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-high);
  font-size: 0.9375rem;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.input::placeholder {
  color: var(--text-low);
}

.input:focus,
.select:focus,
textarea.input:focus {
  outline: none;
  border-color: var(--color-primary-2);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.16);
}

.field-error {
  font-size: 0.8125rem;
  color: var(--color-rose);
}

/* ---------------------------------- Cards ------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.card-hover {
  transition: transform var(--dur-base) var(--ease-out-3), box-shadow var(--dur-base) var(--ease-out-3), border-color var(--dur-base);
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent-hover-border);
}

/* ------------------------------- KPI stat card -------------------------------- */
.stat-card {
  position: relative;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow: hidden;
}

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  background: var(--gradient-primary-soft);
  color: var(--color-primary-2);
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stat-card__label {
  font-size: 0.875rem;
  color: var(--text-med);
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.8125rem;
  font-weight: 600;
  width: fit-content;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.stat-card__trend--up {
  color: var(--color-emerald);
  background: rgba(16, 185, 129, 0.12);
}

.stat-card__trend--down {
  color: var(--color-rose);
  background: rgba(239, 68, 68, 0.12);
}

/* ---------------------------------- Data table --------------------------------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-med);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  z-index: 1;
}

.table tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-high);
}

.table tbody tr:nth-child(even) {
  background: var(--glass);
}

.table tbody tr {
  transition: background var(--dur-fast);
}

.table tbody tr:hover {
  background: var(--gradient-primary-soft);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4);
}

.pagination button {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-med);
  font-size: 0.8125rem;
  font-weight: 600;
}

.pagination button.active {
  background: var(--gradient-primary);
  color: var(--on-gradient);
}

/* ------------------------------------ Alerts ----------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.875rem;
  line-height: 1.4;
}

.alert--error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.24);
  color: var(--color-rose);
}

.alert--success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.24);
  color: var(--color-emerald);
}

.alert--warning {
  background: rgba(232, 114, 15, 0.1);
  border-color: rgba(232, 114, 15, 0.24);
  color: var(--color-amber);
}

.alert--info {
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.24);
  color: var(--color-cyan);
}

/* ----------------------------------- Dropdown ----------------------------------- */
.dropdown {
  position: relative;
}

.dropdown__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  padding: var(--space-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease-out-3), transform var(--dur-fast) var(--ease-out-3), visibility var(--dur-fast);
  z-index: var(--z-dropdown);
  /* A floating menu sits over arbitrary page content (charts, gradient
     cards, images) it can't predict — true `.glass` translucency reads
     as illegible there in a way it doesn't on an in-flow card. Solid
     surface fill wins the cascade over .glass's `background: var(--glass)`
     since this rule loads later; the blur/border/shadow from .glass
     stay applied (harmlessly inert once opaque) so the class can stay
     in the markup without a template change. */
  background: var(--surface);
}

.dropdown.open .dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/*
 * A `data-dropdown-fixed` dropdown (see ui.js's positionFixedMenu())
 * shows a *portal* copy of this menu instead — appended straight to
 * `<body>` so `position: fixed` isn't hijacked by a `.glass`
 * ancestor's `backdrop-filter` (any filter/backdrop-filter creates a
 * containing block for fixed descendants, same as `transform` does).
 * The original menu here must stay invisible so the two copies never
 * both show at once.
 */
.dropdown[data-dropdown-fixed] > .dropdown__menu {
  display: none;
}

.dropdown__menu--portal {
  position: fixed;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease-out-3), transform var(--dur-fast) var(--ease-out-3), visibility var(--dur-fast);
}

.dropdown__menu--portal.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown__menu-header {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-1);
}

.dropdown__menu-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-high);
}

.dropdown__menu-email {
  font-size: 0.75rem;
  color: var(--text-low);
}

.dropdown__menu button.sidebar__link,
.dropdown__menu form {
  width: 100%;
}

.dropdown__menu button.sidebar__link {
  text-align: left;
  font-size: 0.875rem;
}

.dropdown__menu--scroll {
  max-height: 320px;
  overflow-y: auto;
}

/* ----------------------------------- Modal -------------------------------------- */
/* `display: grid; place-items: center` centers the modal's MIDPOINT —
   for a form taller than the viewport (the rate-plan drawer's 5
   sections, the package wizard, etc.) that pushes the top above the
   visible area while the bottom sticks out, which reads as "the modal
   is stuck at the bottom and overlapping." Flex + `overflow-y: auto`
   on the backdrop + `margin: auto` on the modal is the standard safe-
   centering fix: short content still centers exactly as before, but
   content taller than the viewport aligns to the top and the backdrop
   itself scrolls, so the header/close button are never pushed off
   above the fold. `100dvh` (falling back to `100vh` on older browsers
   that don't support it, since an unsupported value is ignored and
   the earlier declaration stands) keeps this correct on mobile, where
   `vh` includes space the browser's own address bar can cover. */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  z-index: var(--z-modal);
  padding: var(--space-6);
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  max-height: 100dvh;
  max-height: calc(100vh - 2 * var(--space-6));
  max-height: calc(100dvh - 2 * var(--space-6));
  margin: auto;
  overflow-y: auto;
  padding: var(--space-8);
}

/* The ARI rate-plan drawer's 5 sections need real room to breathe —
   same modal chrome, just a wider cap. */
.modal--lg {
  max-width: 720px;
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.modal__close {
  color: var(--text-med);
  font-size: 1.25rem;
  line-height: 1;
}

.modal__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  margin-bottom: var(--space-4);
}

.modal__icon--danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-rose);
}

.modal__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* Narrow screens — tighter backdrop/modal padding so a multi-column
   form (the rate-plan drawer, the package wizard) has real usable
   width instead of two layers of var(--space-6)/var(--space-8)
   padding eating into a 360px viewport, and actions stack full-width
   so a two-button row never overflows. */
@media (max-width: 700px) {
  .modal-backdrop {
    padding: var(--space-3);
    align-items: flex-start;
  }

  .modal {
    padding: var(--space-5);
    max-height: calc(100vh - 2 * var(--space-3));
    max-height: calc(100dvh - 2 * var(--space-3));
  }

  .modal__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal__actions .btn {
    width: 100%;
  }
}

/* ----------------------------------- Toasts -------------------------------------- */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: min(360px, calc(100vw - var(--space-8)));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-left: 3px solid var(--color-primary-2);
}

.toast--success { border-left-color: var(--color-emerald); }
.toast--error { border-left-color: var(--color-rose); }
.toast--warning { border-left-color: var(--color-amber); }
.toast--info { border-left-color: var(--color-cyan); }

.toast__title {
  font-weight: 600;
  font-size: 0.875rem;
}

.toast__body {
  font-size: 0.8125rem;
  color: var(--text-med);
}

/* ------------------------------------ Tabs ---------------------------------------- */
.tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  width: fit-content;
  max-width: 100%;
  /* Long tab sets (the 11-tab hotel hub) wrap whole tabs onto a second
     row on narrower desktops instead of squeezing every label onto two
     lines (.tab is nowrap) — and on phones scroll sideways instead. */
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }
}

.tab {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-med);
  transition: color var(--dur-fast), background var(--dur-fast);
}

.tab.active {
  background: var(--gradient-primary);
  color: var(--on-gradient);
}

/* ------------------------------ Badges / status pills ------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge--success { background: rgba(16, 185, 129, 0.12); color: var(--color-emerald); }
.badge--warning { background: rgba(232, 114, 15, 0.12); color: var(--color-amber); }
.badge--danger { background: rgba(239, 68, 68, 0.12); color: var(--color-rose); }
.badge--info { background: rgba(6, 182, 212, 0.12); color: var(--color-cyan); }
.badge--neutral { background: var(--surface-2); color: var(--text-med); }

/* ------------------------------- Cancellation timeline bar -------------------------- */
/* The "before check-in -> check-in -> no-show" strip rendered by
   cancellation-policy.js's renderTimeline() — a row of proportionally
   -widthed segments (green = free, amber = partial charge, red = full
   charge) plus a trailing no-show block when the policy has one. */
.cancel-timeline {
  display: flex;
  height: 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.cancel-timeline__seg { height: 100%; min-width: 2px; }
.cancel-timeline__seg--noshow { flex: 0 0 14%; border-left: 2px solid var(--bg); }
.cancel-timeline__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-low);
}

/* ------------------------------------ Sidebar --------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 264px;
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  border-right: 1px solid var(--border);
  background: var(--surface);
  transition: width var(--dur-base) var(--ease-out-3);
}

.sidebar.collapsed {
  width: 84px;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-inline: var(--space-2);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.sidebar__mobile-close {
  display: none;
  margin-left: auto;
  color: var(--text-med);
}

.sidebar__logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sidebar__logo::before {
  content: 'H';
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  overflow-y: auto;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.7rem var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-med);
  font-size: 0.9375rem;
  font-weight: 500;
  position: relative;
  transition: color var(--dur-fast), background var(--dur-fast);
}

.sidebar__link:hover {
  color: var(--text-high);
  background: var(--glass);
}

.sidebar__link.active {
  color: var(--on-gradient);
  background: var(--gradient-primary);
  box-shadow: 0 8px 24px rgba(201, 162, 39, 0.35);
}

.sidebar__link[aria-disabled='true'] {
  opacity: 0.4;
  pointer-events: none;
}

/* First sidebar group label (e.g. "Grow your Business") — the sidebar
   had no group concept before this; kept minimal (a small caption, no
   collapsible chrome) since it's the only grouped section so far. */
.sidebar__group-label {
  padding: var(--space-4) var(--space-3) var(--space-1);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-low);
}

.sidebar.collapsed .sidebar__group-label {
  display: none;
}

.sidebar__collapse-btn {
  border-top: 1px solid var(--border);
  padding-top: var(--space-4);
}

.sidebar__collapse-btn .icon {
  transition: transform var(--dur-base) var(--ease-out-3);
}

/* Collapsed rail: icon-only links with a glass tooltip on hover */
.sidebar.collapsed .sidebar__brand span:not(.sidebar__mobile-close),
.sidebar.collapsed .sidebar__link span {
  display: none;
}

.sidebar.collapsed .sidebar__link {
  justify-content: center;
  position: relative;
}

.sidebar.collapsed .sidebar__collapse-btn .icon {
  transform: rotate(180deg);
}

.sidebar.collapsed .sidebar__link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--surface-2);
  color: var(--text-high);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  box-shadow: var(--shadow-sm);
  transition: opacity var(--dur-fast), transform var(--dur-fast), visibility var(--dur-fast);
  z-index: var(--z-dropdown);
}

.sidebar.collapsed .sidebar__link:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

/* --------------------------------------- Topbar --------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--overlay);
  backdrop-filter: blur(16px);
  /* Sticky + backdrop-filter is the single most expensive combination
     to scroll past — this bar is on-screen for the entire page, so
     keep its GPU layer warm rather than recomposited every frame. */
  transform: translateZ(0);
  will-change: transform;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.topbar__menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: var(--text-med);
}

.hotel-filter {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 600;
  max-width: 200px;
}

.hotel-filter span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * Phones: title + hotel pill + theme + bell + avatar measured ~520-545px
 * wide, so mobile browsers laid the whole page out wider than the screen
 * and zoomed everything out. Let the title truncate (the page's own
 * <h1> repeats it right below) and cap the hotel pill.
 */
@media (max-width: 600px) {
  .topbar {
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
  }

  .topbar > .flex-center {
    min-width: 0;
    gap: var(--space-2);
  }

  .topbar h4 {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar__actions {
    flex-shrink: 0;
    gap: var(--space-2);
  }

  .hotel-filter {
    max-width: 128px;
    min-width: 0;
    padding: 0.45rem 0.7rem;
  }
}

/* Under ~480px the title would get ~30px ("De…") — drop it; the page's
   own <h1> carries it. */
@media (max-width: 480px) {
  .topbar h4 {
    display: none;
  }
}

.theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: transform var(--dur-fast);
}

.theme-toggle:hover {
  transform: rotate(20deg);
}

.theme-toggle__icon {
  grid-area: 1 / 1;
}

.theme-toggle__icon--moon {
  display: none;
}

:root[data-theme='light'] .theme-toggle__icon--sun {
  display: none;
}

:root[data-theme='light'] .theme-toggle__icon--moon {
  display: block;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-toggle__icon--sun {
    display: none;
  }

  :root:not([data-theme]) .theme-toggle__icon--moon {
    display: block;
  }
}

.notif-bell {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-full);
  background: var(--color-rose);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid var(--bg);
}

.notif-item {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}

.notif-item:hover {
  background: var(--glass);
}

.notif-item__subject {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-high);
}

.notif-item__time {
  font-size: 0.75rem;
  color: var(--text-low);
  margin-top: 2px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: grid;
  place-items: center;
  color: var(--on-gradient);
  font-weight: 700;
  font-size: 0.875rem;
  overflow: hidden;
}

.avatar__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* -------------------------------------- Search -------------------------------------- */
.search-box {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-box__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-low);
  pointer-events: none;
}

.search-box__input {
  padding-left: 2.25rem;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  border-radius: var(--radius-md);
  max-height: 320px;
  overflow-y: auto;
}

.search-results__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.search-results__item:hover {
  background: var(--glass);
}

.search-results__label {
  color: var(--text-high);
  font-weight: 500;
}

.search-results__meta {
  color: var(--text-low);
  font-size: 0.8125rem;
}

.search-results__empty {
  padding: var(--space-3);
  font-size: 0.8125rem;
  color: var(--text-low);
  text-align: center;
}

/* ------------------------------------ Breadcrumbs -------------------------------------- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.8125rem;
  color: var(--text-low);
}

.breadcrumbs a:hover {
  color: var(--text-high);
}

.breadcrumbs .sep {
  opacity: 0.5;
}

/* ------------------------------------ Empty states --------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-16) var(--space-6);
  color: var(--text-med);
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary-soft);
  display: grid;
  place-items: center;
  color: var(--color-primary-2);
  margin-bottom: var(--space-2);
  /* The icon is an emoji glyph — without this it inherits body text
     size and renders as a ~14px speck in the 64px circle. */
  font-size: 1.75rem;
  line-height: 1;
}

/* -------------------------------------- Skeletons ------------------------------------------ */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  color: transparent !important;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
  animation: skeleton-shimmer 1.4s infinite;
}

@keyframes skeleton-shimmer {
  100% { transform: translateX(100%); }
}

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

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

.app-content {
  padding: var(--space-8) var(--space-6);
  flex: 1;
}

/* ---------------------------------- Mobile shell ------------------------------------------- */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(4px);
  z-index: calc(var(--z-modal) - 1);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--ease-out-3), visibility var(--dur-base);
  display: none;
}

.sidebar-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.bottom-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  display: none;
  align-items: center;
  justify-content: space-around;
  padding: var(--space-2) 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.bottom-tab-bar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-med);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
}

.bottom-tab-bar__item.active {
  color: var(--color-primary-2);
}

.bottom-tab-bar__item[aria-disabled='true'] {
  opacity: 0.4;
  pointer-events: none;
}

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

  .topbar__menu-btn {
    display: grid;
    place-items: center;
  }

  .search-box {
    display: none;
  }

  /* Slide-over: hidden off-canvas until .mobile-open, full nav (not
     icon-only) regardless of any desktop .collapsed state. */
  .sidebar,
  .sidebar.collapsed {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: auto;
    height: 100vh;
    width: 280px;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-out-3);
    z-index: var(--z-modal);
    border-right: 1px solid var(--border);
  }

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

  .sidebar.collapsed .sidebar__brand span:not(.sidebar__mobile-close),
  .sidebar.collapsed .sidebar__link span {
    display: initial;
  }

  .sidebar.collapsed .sidebar__group-label {
    display: block;
  }

  .sidebar.collapsed .sidebar__link {
    justify-content: flex-start;
  }

  .sidebar__brand {
    padding-inline: var(--space-2);
  }

  .sidebar__mobile-close {
    display: inline-flex;
  }

  .sidebar__collapse-btn {
    display: none;
  }

  .sidebar__nav {
    flex-direction: column;
    overflow-y: auto;
  }

  .sidebar-backdrop {
    display: block;
  }

  .bottom-tab-bar {
    display: flex;
  }

  .app-content {
    padding-bottom: calc(var(--space-16) + var(--space-8));
  }
}
