.tenant-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.tenant-bar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.tenant-active-label {
  font-size: 0.9375rem;
  line-height: 1.4;
}
.tenant-active-label strong {
  font-family: var(--font-display);
  font-weight: 500;
}
.live-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--confirmed);
  color: #fff;
  vertical-align: middle;
  margin-left: 0.35rem;
}
.tenant-inspector {
  margin-top: 0.25rem;
}

.tenant-inspector textarea {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
}

.tenant-chip.is-selected {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.tenant-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tenant-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.tenant-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tenant-chip span {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.75;
  margin-top: 0.2rem;
}
.tenant-chip:disabled { opacity: 0.5; cursor: wait; }
.page-header {
  margin: 1.25rem 0 1rem;
}
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}
.kpi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.kpi-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
}
.kpi-chip strong {
  color: var(--text);
  font-weight: 600;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 0.875rem;
}
.data-table th,
.data-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-2);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table select.row-select {
  min-width: 7rem;
  font-size: 0.8125rem;
}
.checklist {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}
.checklist a { color: var(--text); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 1rem;
}
.modal {
  width: min(560px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.modal-head h2 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
}
.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.wizard-step {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.wizard-step.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.wizard-step.done { color: var(--confirmed); }
.vertical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
}
.vertical-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 0.85rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.vertical-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.vertical-card strong { display: block; margin-bottom: 0.35rem; }
.vertical-card span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Staff dashboard shell --------------------------------------------------- */
:root {
  color-scheme: light;
  --bg: #f7f7fa;
  --surface: #ffffff;
  --surface-2: #f4f4f7;
  --border: #e7e7ec;
  --border-strong: #d4d4dc;
  --text: #18181b;
  --muted: #71717a;
  --accent: #5b5bd6;
  --accent-hover: #4d4dc5;
  --accent-soft: #eeeeff;
  --sidebar: #fbfbfd;
  --sidebar-hover: #f2f2f7;
  --pending: #a16207;
  --confirmed: #08785d;
  --fulfilled: #2563eb;
  --cancelled: #be3952;
  --copilot: #8a6512;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgb(24 24 27 / 0.04), 0 10px 30px rgb(24 24 27 / 0.035);
  --font: "Inter", system-ui, sans-serif;
  --font-display: "Inter", system-ui, sans-serif;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  background: var(--bg);
}

[hidden] {
  display: none !important;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.admin-shell {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100svh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100svh;
  overflow: hidden;
  background: color-mix(in srgb, var(--sidebar) 96%, transparent);
  border-right: 1px solid var(--border);
}

.sidebar-head {
  display: flex;
  align-items: center;
  min-height: 68px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.admin-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.admin-sidebar .brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgb(91 91 214 / 0.2);
}

.brand-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.admin-sidebar .brand-name {
  overflow: hidden;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-sidebar .brand-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

#sidebar-close {
  display: none;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
}

.sidebar-navigation {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  padding: 18px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}

.nav-group {
  display: grid;
  gap: 3px;
}

.nav-group:not(:has(.tab:not([hidden]))) {
  display: none;
}

.nav-label {
  padding: 0 10px 5px;
  color: #92929d;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-navigation .tab {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  gap: 10px;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #5f606b;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 550;
  line-height: 1.25;
  text-align: left;
  white-space: normal;
  transition: background 120ms ease, color 120ms ease;
}

.sidebar-navigation .tab::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  content: "";
}

.sidebar-navigation .tab:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}

.sidebar-navigation .tab.active {
  background: var(--accent-soft);
  color: #34349a;
  font-weight: 650;
}

.sidebar-navigation .tab.active::before {
  background: var(--accent);
}

.nav-icon {
  display: grid;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #8a8b96;
}

.tab:hover .nav-icon {
  color: #5f606b;
}

.tab.active .nav-icon {
  color: var(--accent);
}

.nav-icon svg,
.workspace-context svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-utilities {
  display: grid;
  gap: 4px;
  padding: 14px 12px 16px;
  border-top: 1px solid var(--border);
}

.sidebar-utilities .quick-links,
.utility-links {
  display: grid;
  align-items: stretch;
  gap: 2px;
  font-size: 0.75rem;
}

.sidebar-utilities .quick-link,
.utility-link {
  display: block;
  overflow: hidden;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-utilities .quick-link:hover,
.utility-link:hover {
  background: var(--sidebar-hover);
  color: var(--text);
}

.sidebar-utilities .quick-link.phone {
  color: var(--text);
  font-weight: 600;
}

.sidebar-utilities .quick-links .sep {
  display: none;
}

.sidebar-overlay {
  display: none;
}

.admin-workspace {
  min-width: 0;
}

.workspace-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 0.86);
  backdrop-filter: blur(16px);
}

.workspace-context {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.workspace-context > div {
  display: grid;
  min-width: 0;
}

.workspace-context span {
  color: var(--muted);
  font-size: 0.625rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-context strong {
  overflow: hidden;
  margin-top: 2px;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.workspace-topbar .topbar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.workspace-meta {
  max-width: min(38vw, 440px);
  overflow: hidden;
  margin-right: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.icon-button svg {
  width: 15px;
  height: 15px;
}

.admin-main {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 26px 32px 64px;
}

.admin-main > section {
  min-width: 0;
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 16px;
  align-items: start;
}

.users-inspector {
  position: sticky;
  top: 16px;
}

.order.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.users-inspector textarea {
  width: 100%;
  min-height: 8rem;
  resize: vertical;
}

.orders,
.products {
  min-width: 0;
  max-width: 100%;
}

.tenant-bar {
  gap: 12px;
  margin: 0 0 18px;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(24 24 27 / 0.025);
}

.tenant-chip {
  background: var(--surface-2);
}

.tenant-chip:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.tenant-chip.active {
  border-color: var(--accent);
  background: var(--accent);
}

.page-header {
  margin: 4px 0 18px;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.panel,
.stat,
.order,
.product,
.data-table,
.status-banner,
details.admin-section {
  box-shadow: 0 1px 2px rgb(24 24 27 / 0.03);
}

.panel,
.stat,
.order,
.product,
.status-banner,
details.admin-section {
  border-color: var(--border);
}

.stat strong {
  font-family: var(--font);
  font-weight: 650;
  letter-spacing: -0.025em;
}

h2,
.order-id,
.product-name {
  font-family: var(--font);
  font-weight: 650;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-sm,
button:not(.tab):not(.mode-btn):not(.btn-sm) {
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

.btn-sm {
  background: var(--accent);
}

.btn-sm:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-sm.secondary {
  background: var(--surface);
}

.btn-sm.secondary:hover:not(:disabled),
.btn-sm.ghost:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 960px) {
  body.nav-open {
    overflow: hidden;
  }

  .admin-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-sidebar {
    position: fixed;
    left: 0;
    width: min(288px, calc(100vw - 48px));
    box-shadow: 24px 0 60px rgb(24 24 27 / 0.16);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  body.nav-open .admin-sidebar {
    transform: translateX(0);
  }

  #sidebar-close {
    display: grid;
    place-items: center;
  }

  #menu-toggle {
    display: grid;
  }

  #sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgb(24 24 27 / 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.nav-open #sidebar-overlay {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 640px) {
  .workspace-topbar {
    min-height: 62px;
    padding: 0 14px;
  }

  .workspace-meta {
    display: none;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
  }

  .icon-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .admin-main {
    padding: 18px 14px 48px;
  }

  .users-layout {
    grid-template-columns: 1fr;
  }

  .users-inspector {
    position: static;
  }

  .orders {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .tenant-bar {
    padding: 13px;
  }

  .tenant-bar-main {
    align-items: stretch;
  }

  .tenant-bar-main .btn-sm {
    width: 100%;
  }

  .stats {
    gap: 8px;
  }

  .stat,
  .panel,
  .order,
  .product {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .admin-sidebar,
  #sidebar-overlay {
    transition: none;
  }
}
