:root {
  --rm-bg: #f3f0ea;
  --rm-surface: #ffffff;
  --rm-ink: #1c1917;
  --rm-muted: #78716c;
  --rm-accent: #0f766e;
  --rm-accent-dark: #0d5f59;
  --rm-sidebar: #1c1917;
  --rm-sidebar-text: #e7e5e4;
  --rm-sidebar-width: 260px;
  --rm-topbar-height: 56px;
  --rm-bottom-nav-height: 64px;
  --rm-radius: 14px;
  --rm-shadow: 0 8px 24px rgba(28, 25, 23, 0.08);
  --rm-safe-top: env(safe-area-inset-top, 0px);
  --rm-safe-right: env(safe-area-inset-right, 0px);
  --rm-safe-bottom: env(safe-area-inset-bottom, 0px);
  --rm-safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

.app-body {
  margin: 0;
  background:
    radial-gradient(ellipse at top left, rgba(15, 118, 110, 0.12), transparent 45%),
    linear-gradient(180deg, #f7f4ef 0%, var(--rm-bg) 100%);
  color: var(--rm-ink);
  font-family: "Segoe UI", system-ui, sans-serif;
  padding-left: var(--rm-safe-left);
  padding-right: var(--rm-safe-right);
}

.app-body.sidebar-open {
  overflow: hidden;
  touch-action: none;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(var(--rm-sidebar-width), 86vw);
  padding-top: calc(0.75rem + var(--rm-safe-top));
  padding-bottom: calc(0.75rem + var(--rm-safe-bottom));
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  background: var(--rm-sidebar);
  color: var(--rm-sidebar-text);
  z-index: 1040;
  transform: translateX(-105%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 28px rgba(0, 0, 0, 0.18);
}

.app-sidebar.open {
  transform: translateX(0);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.5rem 0.65rem 0.85rem;
  letter-spacing: 0.02em;
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.sidebar-brand-link:hover {
  color: inherit;
  opacity: 0.92;
}

.sidebar-brand-text {
  flex: 1;
  min-width: 0;
}

.sidebar-brand .brand-logo {
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 50%;
  background: #fff;
  padding: 0.12rem;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.sidebar-brand i.bi-cup-hot-fill {
  display: none;
}

.sidebar-close {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  color: var(--rm-sidebar-text);
  text-decoration: none;
  font-size: 0.95rem;
  min-height: 48px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link i {
  font-size: 1.15rem;
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(94, 234, 212, 0.14);
  color: #fff;
}

.sidebar-link.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
  z-index: 1035;
  backdrop-filter: blur(2px);
}

.sidebar-backdrop.show {
  display: block;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: calc(var(--rm-topbar-height) + var(--rm-safe-top));
  padding-top: var(--rm-safe-top);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(28, 25, 23, 0.08);
}

.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(28, 25, 23, 0.1);
  background: var(--rm-surface);
  color: var(--rm-ink);
  flex-shrink: 0;
  padding: 0;
}

.btn-icon:active {
  transform: scale(0.97);
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar-title h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.topbar-title .live-hint {
  font-size: 0.72rem;
  color: var(--rm-muted);
  line-height: 1.2;
  margin-top: 0.1rem;
}

.topbar-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.topbar-actions .navbar-nav {
  flex-direction: row;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
}

.topbar-actions .nav-link {
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem;
}

.topbar-user {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-bell {
  position: relative;
}

.notif-bell-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #c2410c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}

.notif-dropdown {
  width: min(360px, calc(100vw - 1.5rem));
  padding: 0;
  border: 1px solid rgba(28, 25, 23, 0.1);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(28, 25, 23, 0.14);
}

.notif-dropdown-head,
.notif-dropdown-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: #fafaf9;
}

.notif-dropdown-foot {
  display: block;
  text-align: center;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--rm-ink);
  border-top: 1px solid rgba(28, 25, 23, 0.08);
}

.notif-dropdown-foot:hover {
  background: #f5f5f4;
  color: var(--rm-ink);
}

.notif-dropdown-body {
  max-height: min(420px, 55vh);
  overflow: auto;
}

.notif-empty {
  padding: 1rem 0.9rem;
}

.notif-item {
  display: block;
  padding: 0.75rem 0.9rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(28, 25, 23, 0.06);
}

.notif-item:hover {
  background: #fafaf9;
  color: inherit;
}

.notif-item.is-unread {
  background: rgba(234, 88, 12, 0.06);
}

.notif-item-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.notif-item-msg {
  font-size: 0.82rem;
  color: #57534e;
  margin-top: 0.15rem;
}

.notif-item-time {
  font-size: 0.72rem;
  color: #a8a29e;
  margin-top: 0.35rem;
}

.btn-logout {
  min-height: 40px;
  min-width: 40px;
  padding: 0.4rem 0.7rem;
  border-radius: 11px;
  border: 1px solid rgba(28, 25, 23, 0.12);
  background: var(--rm-surface);
  color: var(--rm-ink);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-logout:hover {
  background: #f5f5f4;
  color: var(--rm-ink);
}

.app-content {
  padding: 0.9rem 0.75rem calc(1.75rem + var(--rm-safe-bottom));
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.app-content:has(.tenants-page) {
  max-width: 1400px;
}

.overflow-visible {
  overflow: visible !important;
}

/* Page header / primary actions */
.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-toolbar > p,
.page-toolbar .page-toolbar-lead {
  flex: 1 1 12rem;
  margin: 0;
  color: var(--rm-muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.page-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.page-toolbar-actions .btn {
  flex: 1 1 auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

/* Filter bars */
.filter-bar,
.panel-filters {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.filter-bar .form-label,
.panel-filters .form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--rm-muted);
  margin-bottom: 0.25rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-chips .btn {
  min-height: 40px;
  border-radius: 999px;
  padding-inline: 0.85rem;
}

.dash-quick-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (min-width: 768px) {
  .dash-quick-links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.dash-quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 5.25rem;
  padding: 0.85rem 0.6rem;
  text-decoration: none;
  color: var(--rm-ink);
  background: var(--rm-surface);
  border: 1px solid rgba(28, 25, 23, 0.08);
  border-radius: var(--rm-radius);
  box-shadow: var(--rm-shadow);
  font-weight: 650;
  font-size: 0.9rem;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.dash-quick-link i {
  font-size: 1.45rem;
  color: var(--rm-accent);
}

.dash-quick-link:hover {
  color: var(--rm-ink);
  border-color: rgba(15, 118, 110, 0.35);
  background: rgba(15, 118, 110, 0.06);
  transform: translateY(-1px);
}

.stat-card {
  background: var(--rm-surface);
  border-radius: var(--rm-radius);
  box-shadow: var(--rm-shadow);
  padding: 1rem 1rem;
  height: 100%;
  border: 1px solid rgba(28, 25, 23, 0.05);
}

.stat-card .stat-label {
  color: var(--rm-muted);
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

.stat-card .stat-value {
  font-size: clamp(1.2rem, 4.5vw, 1.55rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--rm-ink);
  word-break: break-word;
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 118, 110, 0.12);
  color: var(--rm-accent);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.panel-card {
  background: var(--rm-surface);
  border-radius: var(--rm-radius);
  box-shadow: var(--rm-shadow);
  border: 1px solid rgba(28, 25, 23, 0.05);
  padding: 0.9rem;
  min-height: 0;
  height: auto;
}

.panel-card.h-100 {
  height: 100% !important;
}

.panel-card h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.85rem;
}

.btn-accent {
  background: var(--rm-accent);
  border-color: var(--rm-accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--rm-accent-dark);
  border-color: var(--rm-accent-dark);
  color: #fff;
}

/* Tables & actions */
.table-touch td,
.table-touch th {
  vertical-align: middle;
}

.table-touch th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--rm-muted);
  white-space: nowrap;
}

.action-btn {
  min-width: 42px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-cluster {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  max-width: 100%;
}

.action-cluster .btn {
  margin: 0 !important;
}

@media (max-width: 767.98px) {
  .table-touch {
    font-size: 0.9rem;
  }

  .table-touch > :not(caption) > * > * {
    padding: 0.65rem 0.55rem;
  }

  .table-touch td.text-nowrap,
  .table-touch th.text-nowrap {
    white-space: normal !important;
  }

  .table-touch td.text-end {
    text-align: left !important;
  }

  .action-cluster {
    justify-content: flex-start;
    width: 100%;
  }

  .action-cluster .btn {
    flex: 1 1 calc(50% - 0.35rem);
    min-width: 0;
  }

  .stat-card .stat-icon {
    display: none;
  }

  .panel-card {
    padding: 0.8rem;
    border-radius: 12px;
  }

  /* Forms: larger taps */
  .app-content .form-control,
  .app-content .form-select,
  .app-content .btn:not(.btn-sm):not(.btn-close):not(.btn-icon) {
    min-height: 44px;
  }

  .app-content .form-control-lg,
  .app-content .form-select-lg {
    min-height: 48px;
  }

  .app-content .btn-sm.action-btn {
    min-height: 42px;
    min-width: 42px;
  }

  /* Stack filter form rows more tightly */
  .app-content form .row.g-2 > [class*="col-"],
  .app-content form .row.g-3 > [class*="col-"] {
    margin-bottom: 0;
  }
}

/* DataTables mobile chrome */
.dataTables_wrapper .row {
  --bs-gutter-y: 0.65rem;
  margin-bottom: 0.5rem;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
  text-align: left !important;
}

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--rm-muted);
}

.dataTables_wrapper .dataTables_filter input {
  width: 100% !important;
  margin: 0 !important;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(28, 25, 23, 0.14);
  padding: 0.5rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  margin: 0 !important;
}

.dataTables_wrapper .dataTables_info {
  font-size: 0.82rem;
  color: var(--rm-muted);
  padding-top: 0.65rem !important;
}

.dataTables_wrapper .dataTables_paginate {
  padding-top: 0.5rem !important;
  float: none !important;
  text-align: left !important;
}

.dataTables_wrapper .dataTables_paginate .pagination {
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-start;
  margin: 0;
}

.dataTables_wrapper .page-link {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px !important;
}

.business-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.45rem;
}

.business-cat-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.55rem 0.6rem;
  border: 1px solid rgba(28, 25, 23, 0.1);
  border-radius: 10px;
  background: #fff;
  font-size: 0.88rem;
  cursor: pointer;
  min-height: 44px;
}

.business-cat-chip input {
  margin: 0;
  flex-shrink: 0;
}

.business-cat-chip:has(input:checked) {
  border-color: var(--rm-accent);
  background: rgba(15, 118, 110, 0.08);
}

/* Dashboard chart area */
.panel-card canvas {
  max-width: 100%;
}

@media (max-width: 575.98px) {
  .topbar-title .live-hint {
    display: none;
  }

  .page-toolbar-actions .btn {
    width: 100%;
  }
}

@media (min-width: 576px) {
  .page-toolbar-actions {
    width: auto;
  }

  .page-toolbar-actions .btn {
    flex: 0 0 auto;
  }
}

@media (min-width: 768px) {
  .dataTables_wrapper .dataTables_filter label,
  .dataTables_wrapper .dataTables_length label {
    flex-direction: row;
    align-items: center;
    width: auto;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 220px !important;
  }

  .dataTables_wrapper .dataTables_length select {
    width: auto;
  }

  .dataTables_wrapper .dataTables_filter {
    text-align: right !important;
  }

  .dataTables_wrapper .dataTables_paginate {
    text-align: right !important;
  }
}

@media (min-width: 992px) {
  .app-sidebar {
    width: var(--rm-sidebar-width);
    transform: translateX(0);
    box-shadow: none;
  }

  .sidebar-toggle,
  .sidebar-close {
    display: none !important;
  }

  .sidebar-backdrop {
    display: none !important;
  }

  .app-main {
    margin-left: var(--rm-sidebar-width);
  }

  .app-content {
    padding: 1.5rem 1.5rem calc(2.5rem + var(--rm-safe-bottom));
  }

  .topbar-title h1 {
    font-size: 1.2rem;
  }

  .panel-card {
    padding: 1rem;
  }

  .stat-card {
    padding: 1.1rem 1.15rem;
  }
}

/* FSSAI-style veg / non-veg / egg marker */
.diet-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1.5px solid;
  border-radius: 2px;
  flex-shrink: 0;
  vertical-align: middle;
  box-sizing: border-box;
}

.diet-mark::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.diet-mark--veg {
  color: #15803d;
  border-color: #15803d;
}

.diet-mark--nonveg {
  color: #b91c1c;
  border-color: #b91c1c;
}

.diet-mark--egg {
  color: #ca8a04;
  border-color: #ca8a04;
}

.diet-mark-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.report-chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
}

.report-chart-wrap--tall {
  height: 280px;
}

.report-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* —— Mobile-app list surfaces (Categories / Menu / Orders / Payments) —— */
.app-search {
  position: sticky;
  top: calc(var(--rm-topbar-height) + var(--rm-safe-top));
  z-index: 5;
  margin-bottom: 0.75rem;
  background: linear-gradient(180deg, rgba(247, 244, 239, 0.96) 60%, transparent);
  padding-bottom: 0.35rem;
}

.app-search-field {
  position: relative;
}

.app-search-field > i {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rm-muted);
  font-size: 1rem;
  pointer-events: none;
}

.app-search input {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(28, 25, 23, 0.12);
  background: #fff;
  padding: 0.55rem 0.9rem 0.55rem 2.55rem;
  font-size: 1rem;
  box-shadow: 0 4px 14px rgba(28, 25, 23, 0.05);
}

.app-search input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.app-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-bottom: 4.5rem;
}

.app-list-item {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--rm-surface);
  border-radius: 16px;
  border: 1px solid rgba(28, 25, 23, 0.06);
  box-shadow: 0 6px 18px rgba(28, 25, 23, 0.06);
  padding: 0.9rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.app-list-item:active {
  transform: scale(0.985);
}

.app-list-item.is-hidden {
  display: none;
}

.app-list-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.app-list-body {
  flex: 1;
  min-width: 0;
}

.app-list-title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  margin: 0;
  word-break: break-word;
}

.app-list-title a {
  color: inherit;
  text-decoration: none;
}

.app-list-title a:hover {
  color: var(--rm-accent);
}

.app-list-meta {
  color: var(--rm-muted);
  font-size: 0.82rem;
  line-height: 1.35;
  margin-top: 0.2rem;
}

.app-list-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}

.app-list-side {
  text-align: right;
  flex-shrink: 0;
}

.app-list-amount {
  font-weight: 750;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.app-list-amount-sub {
  font-size: 0.78rem;
  color: var(--rm-muted);
  margin-top: 0.15rem;
}

.app-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.15rem;
  border-top: 1px solid rgba(28, 25, 23, 0.06);
}

.app-list-actions .btn {
  flex: 1 1 auto;
  min-height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.app-list-empty {
  text-align: center;
  color: var(--rm-muted);
  padding: 2.5rem 1rem;
  background: var(--rm-surface);
  border-radius: 16px;
  border: 1px dashed rgba(28, 25, 23, 0.12);
}

.fab-add {
  display: none;
}

.filter-chips-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.15rem;
  margin-bottom: 0.85rem;
}

.filter-chips-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chips-scroll .btn {
  flex: 0 0 auto;
  white-space: nowrap;
  border-radius: 999px;
  min-height: 40px;
}

.mobile-panel {
  background: var(--rm-surface);
  border-radius: 16px;
  border: 1px solid rgba(28, 25, 23, 0.06);
  box-shadow: 0 6px 18px rgba(28, 25, 23, 0.06);
  padding: 1rem;
  margin-bottom: 0.85rem;
}

.mobile-panel > h2 {
  font-size: 0.95rem;
  font-weight: 750;
  margin: 0 0 0.75rem;
}

.sticky-form-actions {
  position: sticky;
  bottom: calc(0.65rem + var(--rm-safe-bottom));
  z-index: 6;
  display: grid;
  gap: 0.5rem;
  padding-top: 0.5rem;
  background: linear-gradient(180deg, transparent, rgba(247, 244, 239, 0.95) 28%);
}

.sticky-form-actions .btn {
  min-height: 48px;
  border-radius: 14px;
}

@media (min-width: 768px) {
  .sticky-form-actions {
    position: static;
    display: flex;
    flex-wrap: wrap;
    background: none;
    padding-top: 0;
  }

  .sticky-form-actions .btn {
    width: auto;
    min-width: 7rem;
  }
}

@media (max-width: 767.98px) {
  .page-toolbar-lead {
    display: none;
  }

  .page-toolbar {
    margin-bottom: 0.65rem;
  }

  .page-toolbar-actions {
    display: none;
  }

  .fab-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    position: fixed;
    right: calc(0.9rem + var(--rm-safe-right));
    bottom: calc(1rem + var(--rm-safe-bottom));
    z-index: 1010;
    min-height: 52px;
    padding: 0 1.15rem;
    border-radius: 999px;
    background: var(--rm-accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    box-shadow: 0 10px 28px rgba(15, 118, 110, 0.35);
    border: 0;
  }

  .fab-add:hover,
  .fab-add:focus {
    background: var(--rm-accent-dark);
    color: #fff;
  }

  .fab-add:active {
    transform: scale(0.97);
  }

  .panel-card {
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(28, 25, 23, 0.06);
  }

  .app-content .panel-card[style*="max-width"] {
    max-width: none !important;
  }
}

@media (min-width: 768px) {
  .app-list,
  .app-search,
  .mobile-only,
  .fab-add {
    display: none !important;
  }

  .desktop-only {
    display: block !important;
  }
}

@media (max-width: 767.98px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block;
  }
}

/* —— Mobile bottom nav + FAB quick sheet —— */
.bottom-nav,
.quick-sheet,
.quick-sheet-backdrop {
  display: none;
}

@media (max-width: 991.98px) {
  .has-bottom-nav .app-content {
    padding-bottom: calc(1.25rem + var(--rm-bottom-nav-height) + var(--rm-safe-bottom));
  }

  .has-bottom-nav .app-list {
    padding-bottom: calc(1rem + var(--rm-bottom-nav-height));
  }

  .has-bottom-nav .sticky-form-actions {
    bottom: calc(0.65rem + var(--rm-bottom-nav-height) + var(--rm-safe-bottom));
  }

  /* Global FAB sheet replaces page-level FABs */
  .has-bottom-nav .fab-add {
    display: none !important;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1045;
    min-height: calc(var(--rm-bottom-nav-height) + var(--rm-safe-bottom));
    padding: 0.35rem 0.35rem calc(0.35rem + var(--rm-safe-bottom));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(28, 25, 23, 0.08);
    box-shadow: 0 -8px 24px rgba(28, 25, 23, 0.06);
  }

  .bottom-nav:has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bottom-nav-item {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--rm-muted);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 48px;
    padding: 0.2rem 0.15rem;
    border-radius: 12px;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-item i {
    font-size: 1.2rem;
    line-height: 1;
  }

  .bottom-nav-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-nav-item.active {
    color: var(--rm-accent);
  }

  .bottom-nav-item:active {
    transform: scale(0.96);
  }

  .bottom-nav-fab {
    appearance: none;
    border: 0;
    width: 54px;
    height: 54px;
    margin: -1.15rem auto 0;
    border-radius: 50%;
    background: var(--rm-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.38);
    position: relative;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-fab.is-open {
    background: var(--rm-ink);
    transform: rotate(45deg);
  }

  .bottom-nav-fab:active {
    transform: scale(0.96);
  }

  .bottom-nav-fab.is-open:active {
    transform: rotate(45deg) scale(0.96);
  }

  .quick-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(28, 25, 23, 0.45);
    backdrop-filter: blur(2px);
  }

  .quick-sheet-backdrop[hidden] {
    display: none !important;
  }

  .quick-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1055;
    max-height: min(78vh, 640px);
    background: #fff;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -16px 40px rgba(28, 25, 23, 0.18);
    padding-bottom: var(--rm-safe-bottom);
    transform: translateY(110%);
    transition: transform 0.28s ease;
  }

  .quick-sheet[hidden] {
    display: none !important;
  }

  .quick-sheet.is-open {
    transform: translateY(0);
  }

  .quick-sheet-handle {
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: rgba(28, 25, 23, 0.18);
    margin: 0.55rem auto 0.15rem;
    flex-shrink: 0;
  }

  .quick-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0.85rem 0.55rem;
  }

  .quick-sheet-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 750;
  }

  .quick-sheet-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0.85rem 1rem;
  }

  .quick-sheet-section + .quick-sheet-section {
    margin-top: 0.85rem;
  }

  .quick-sheet-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--rm-muted);
    margin-bottom: 0.45rem;
  }

  .quick-sheet-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .quick-sheet-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 84px;
    padding: 0.65rem 0.4rem;
    border-radius: 16px;
    background: #f7f4ef;
    border: 1px solid rgba(28, 25, 23, 0.06);
    color: var(--rm-ink);
    text-decoration: none;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.2;
  }

  .quick-sheet-tile i {
    font-size: 1.35rem;
    color: var(--rm-accent);
  }

  .quick-sheet-tile:active {
    transform: scale(0.97);
    background: rgba(15, 118, 110, 0.1);
  }

  body.quick-sheet-open {
    overflow: hidden;
    touch-action: none;
  }
}

@media (min-width: 992px) {
  .bottom-nav,
  .quick-sheet,
  .quick-sheet-backdrop {
    display: none !important;
  }
}

@media (max-width: 380px) {
  .quick-sheet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
