:root {
  color-scheme: light dark;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --bg: #050b15;
  --panel: rgba(9, 18, 32, 0.9);
  --panel-2: rgba(12, 24, 42, 0.78);
  --border: rgba(125, 154, 188, 0.2);
  --text: #f2f7ff;
  --muted: #93a8c3;
  --accent: #30a6ff;
  --accent-2: #14b8a6;
  --accent-soft: rgba(48, 166, 255, 0.16);
  --warning: #64748b;
  --danger: #93c5fd;
  --shadow: 0 24px 64px rgba(1, 8, 22, 0.5);
}

body.theme-dark {
  color-scheme: dark;
}

body.theme-light {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: rgba(255, 255, 255, 0.96);
  --border: rgba(15, 23, 42, 0.1);
  --text: #0b1321;
  --muted: #5f718a;
  --accent: #2563eb;
  --accent-2: #1e40af;
  --warning: #64748b;
  --danger: #1d4ed8;
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.09);
}
* { box-sizing: border-box; }
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: "SF Pro Display", Inter, "Segoe UI", Arial, sans-serif;
  background: radial-gradient(1000px 650px at 0% 0%, rgba(32, 96, 175, 0.26), transparent 72%), radial-gradient(850px 560px at 100% 0%, rgba(20, 184, 166, 0.14), transparent 78%), linear-gradient(150deg, #040913 0%, #0a1322 42%, #0f1b2e 100%);
  color: var(--text);
  overflow-x: hidden;
}

@media (display-mode: standalone) {
  .topbar {
    padding-top: calc(10px + env(safe-area-inset-top));
  }
}

body.theme-light {
  background: radial-gradient(1200px 700px at 10% 0%, rgba(37, 99, 235, 0.08), transparent 70%), linear-gradient(145deg, #f6f8fb 0%, #eef3f9 42%, #f8fafc 100%);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

#appRoot { min-height: 100vh; }
.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; animation: page-enter 0.36s ease-out both; }
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.main-panel { padding: 18px 20px; min-width: 0; }
.page-content { width: 100%; max-width: none; margin: 0; }
.topbar, .workspace, .main-panel, .page-content { width: 100%; max-width: 100%; }

.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 26;
  border-top: 1px solid var(--border);
  background: rgba(6, 17, 31, 0.97);
  backdrop-filter: blur(12px);
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  gap: 6px;
}

.mobile-bottom-nav__item {
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  min-height: 56px;
  padding: 6px 4px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
}

.mobile-bottom-nav__item.active {
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.32);
  background: rgba(56, 189, 248, 0.12);
}

.mobile-bottom-nav__item span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--border); background: rgba(6, 15, 28, 0.74); backdrop-filter: blur(12px); gap: 12px; }
.topbar__search { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 999px; padding: 11px 15px; min-width: min(420px, 52vw); }
.topbar__search input { border: 0; outline: 0; background: transparent; color: var(--text); width: 100%; min-width: 0; }
.topbar__search-clear { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.topbar__search-clear:hover { color: var(--text); background: rgba(148, 163, 184, 0.16); }
.topbar__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.menu-toggle { display: none; border: 0; background: rgba(255,255,255,0.04); color: var(--text); padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(145deg, rgba(37,99,235,0.18), rgba(15,23,42,0.74)); border: 1px solid rgba(191,219,254,0.18); display: grid; place-items: center; font-weight: 700; overflow: hidden; position: relative; }
.avatar .brand-logo { width: 22px; height: 22px; }
.avatar__fallback { display: none; }

.sidebar { padding: 18px 16px; border-right: 1px solid var(--border); background: linear-gradient(180deg, rgba(7, 16, 30, 0.94), rgba(6, 14, 28, 0.9)); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.brand { display: flex; align-items: center; min-height: 54px; }
.brand__logo { display: inline-flex; align-items: center; }
.brand__compact { display: none; align-items: center; }
.brand-logo { width: 172px; max-width: 100%; display: block; }
.brand-logo--compact { width: 28px; }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif; }
.brand-lockup__icon { width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(145deg, rgba(48,166,255,0.95), rgba(20,184,166,0.78)); position: relative; box-shadow: 0 8px 18px rgba(16, 68, 125, 0.38); }
.brand-lockup__icon::before,
.brand-lockup__icon::after { content: ""; position: absolute; background: #f8fbff; border-radius: 999px; }
.brand-lockup__icon::before { width: 16px; height: 3px; left: 7px; top: 13px; }
.brand-lockup__icon::after { width: 3px; height: 16px; left: 13px; top: 7px; }
.brand-lockup__text { display: inline-flex; flex-direction: column; line-height: 1.04; }
.brand-lockup__title { font-size: 1.1rem; font-weight: 780; letter-spacing: 0.01em; color: var(--text); }
.brand-lockup__subtitle { font-size: 0.64rem; font-weight: 640; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 12px; color: var(--muted); cursor: pointer; transition: transform 0.18s ease, background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease; font-size: 0.95rem; line-height: 1.25; border: 1px solid transparent; }
.nav-item:hover, .nav-item.active { background: linear-gradient(135deg, rgba(48, 166, 255, 0.14), rgba(20, 184, 166, 0.1)); color: var(--text); border-color: rgba(64, 188, 255, 0.24); transform: translateX(2px); }
.nav-item .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.sidebar__footer { margin-top: auto; padding: 14px; border: 1px solid var(--border); border-radius: 18px; background: rgba(15, 23, 42, 0.68); font-size: 0.9rem; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-header h1 { margin: 0 0 6px; font-size: 1.7rem; }
.page-header p { margin: 0; color: var(--muted); }

.btn { border: 0; border-radius: 12px; padding: 10px 14px; min-height: 42px; font-weight: 650; cursor: pointer; color: #f8fbff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 12px 24px rgba(13, 83, 170, 0.28); transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 16px 28px rgba(13, 83, 170, 0.32); filter: saturate(1.08); }
.btn:active { transform: translateY(0); }
.btn--ghost { background: transparent; box-shadow: none; border: 1px solid var(--border); }
.btn--success { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.btn--danger { background: linear-gradient(135deg, #334155, #1e293b); }

.panel { background: linear-gradient(165deg, var(--panel), var(--panel-2)); border: 1px solid var(--border); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); max-width: 100%; backdrop-filter: blur(10px); }
.panel + .panel { margin-top: 16px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel h3 { margin: 0; font-size: 1rem; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .field { min-width: 170px; }
.pagination { margin-top: 14px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.pagination__meta { color: var(--muted); font-size: 0.9rem; }
.metric-card small { display: block; margin-top: 8px; color: var(--muted); }
.stock-badge--low { color: var(--danger); font-weight: 700; }
.stock-badge--ok { color: var(--accent-2); font-weight: 700; }
.profit-positive { color: var(--accent-2); }
.profit-negative { color: var(--danger); }
.muted { color: var(--muted); }
.stats-grid, .content-grid, .cards-grid { display: grid; gap: 14px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.content-grid { grid-template-columns: 1.2fr 1fr; }
.cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.metric-card { padding: 16px; border-radius: 18px; border: 1px solid var(--border); background: linear-gradient(140deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95)); }
.metric-card strong { display: block; font-size: 1.4rem; margin-top: 10px; }
.metric-card span { color: var(--muted); font-size: 0.92rem; }
.metric-card .trend { margin-top: 10px; color: var(--accent-2); font-size: 0.9rem; }

.table { width: 100%; border-collapse: collapse; min-width: 100%; }
.table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.table tbody tr:hover { background: rgba(60, 167, 248, 0.09); }
.table td:last-child, .table th:last-child { text-align: right; }
.table-responsive, .panel > .table, .card > .table { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.table-responsive .table { min-width: 760px; }
.panel > .table, .card > .table { display: block; }
.panel > .table > thead,
.panel > .table > tbody,
.panel > .table > tfoot,
.card > .table > thead,
.card > .table > tbody,
.card > .table > tfoot {
  display: table;
  width: 100%;
  table-layout: auto;
}
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.badge--paid { background: rgba(37, 99, 235, 0.14); color: #bfdbfe; }
.badge--pending { background: rgba(100, 116, 139, 0.18); color: #dbe5f0; }
.badge--late { background: rgba(30, 64, 175, 0.18); color: #bfdbfe; }
.card { padding: 16px; border-radius: 18px; background: linear-gradient(160deg, rgba(13, 24, 42, 0.82), rgba(8, 18, 34, 0.8)); border: 1px solid var(--border); min-width: 0; }
.card h4 { margin: 0 0 10px; }
.card p { margin: 0; color: var(--muted); }
.card .inline-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.card .inline-actions .btn { flex: 1 1 calc(50% - 4px); min-width: 0; width: 100%; white-space: normal; word-break: break-word; }
.product-cards-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.ai-center-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
}

.ai-role-list {
  display: grid;
  gap: 10px;
}

.ai-role-card {
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.36), rgba(15, 23, 42, 0.5));
  padding: 12px;
  cursor: pointer;
}

body.theme-light .ai-role-card {
  background: linear-gradient(145deg, rgba(248, 250, 252, 0.94), rgba(241, 245, 249, 0.92));
}

.ai-role-card.active {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.35), var(--shadow);
}

.ai-role-card h4 {
  margin: 0 0 6px;
}

.ai-role-card p {
  margin: 0;
  font-size: 0.9rem;
}

.ai-chat-wrap {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel);
}

.ai-chat-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.ai-chat-stream {
  padding: 12px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.ai-bubble {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  max-width: 95%;
  white-space: pre-wrap;
}

.ai-bubble--user {
  justify-self: end;
  background: rgba(56, 189, 248, 0.2);
}

.ai-bubble--assistant {
  justify-self: start;
  background: rgba(15, 23, 42, 0.42);
}

body.theme-light .ai-bubble--assistant {
  background: rgba(226, 232, 240, 0.75);
}

.ai-chat-form {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.ai-chat-form textarea {
  width: 100%;
  min-height: 100px;
}
.chart-grid { display: grid; gap: 10px; }
.chart-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr auto; align-items: center; gap: 10px; }
.chart-bar { width: 100%; background: rgba(148,163,184,0.15); border-radius: 999px; overflow: hidden; height: 10px; }
.chart-bar i { display: block; height: 100%; border-radius: 999px; }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 8px; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: rgba(15, 23, 42, 0.9); color: var(--text); }
.field textarea { min-height: 100px; resize: vertical; }
.inline-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; animation: page-enter 0.32s ease-out both; }
.login-card { width: min(480px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 28px; padding: 28px; box-shadow: var(--shadow); }
.login-brand { margin-bottom: 14px; animation: logo-premium-in 1.08s ease both; transform-origin: 50% 50%; }
.login-card h1 { margin: 0 0 8px; }
.login-card p { color: var(--muted); }
.login-card .field { margin-top: 14px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border); background: rgba(15, 23, 42, 0.9); color: var(--muted); margin-bottom: 16px; }
.empty-state { padding: 24px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 16px; }
.loading-skeleton { display: grid; gap: 10px; }
.loading-skeleton__line { height: 14px; border-radius: 10px; }
.loading-skeleton__line--lg { height: 20px; width: 46%; }
.loading-skeleton__line--md { width: 84%; }
.loading-skeleton__line--sm { width: 64%; }
.alert { padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; background: rgba(56, 189, 248, 0.13); color: var(--text); }
.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.16);
  border-radius: 12px;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
  animation: skeleton-shimmer 1.4s infinite;
}
@keyframes skeleton-shimmer {
  100% { transform: translateX(100%); }
}
.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, 0.72); display: grid; place-items: center; padding: 16px; z-index: 30; animation: modal-fade-in 0.18s ease-out both; }
.modal-card { width: min(760px, calc(100vw - 32px)); max-height: 88vh; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); animation: modal-rise-in 0.22s ease-out both; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.hidden { display: none; }

.messenger-dropzone {
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 8px;
  background: rgba(15, 23, 42, 0.36);
}

.messenger-dropzone--active {
  border-color: rgba(56, 189, 248, 0.8);
  background: rgba(56, 189, 248, 0.08);
}

body.theme-light .messenger-dropzone {
  background: rgba(241, 245, 249, 0.9);
}

.toast-host {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 24px));
}

.toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(2, 6, 23, 0.96);
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease;
}

.toast--success { border-color: rgba(52, 211, 153, 0.45); }
.toast--warning { border-color: rgba(245, 158, 11, 0.45); }
.toast--error { border-color: rgba(244, 63, 94, 0.45); }
.toast--info { border-color: rgba(56, 189, 248, 0.45); }

.toast__body {
  min-width: 0;
}

.toast__body strong {
  display: block;
  margin-bottom: 4px;
}

.toast__close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.toast--leaving {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

*:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.92);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes logo-premium-in {
  0% { opacity: 0.4; transform: translateY(6px) scale(0.985); filter: brightness(0.9); }
  45% { opacity: 1; transform: translateY(0) scale(1.02); filter: brightness(1.05); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-rise-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 1800px) {
  .workspace { grid-template-columns: 300px minmax(0, 1fr); }
  .main-panel { padding: 20px 26px; }
  .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1280px) and (max-width: 1799px) {
  .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1101px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: calc(100vh - 74px);
    overflow-y: auto;
  }
}

@media (max-width: 1600px) {
  .workspace { grid-template-columns: 260px minmax(0, 1fr); }
  .page-header h1 { font-size: 1.5rem; }
  .product-cards-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1366px) {
  .main-panel { padding: 14px 14px; }
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-center-layout { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .menu-toggle { display: inline-flex; }
  .workspace { display: block; min-height: calc(100vh - 68px); }
  .sidebar {
    position: fixed;
    inset: 68px auto 0 0;
    width: min(330px, 86vw);
    height: calc(100vh - 68px);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 25;
    overflow-y: auto;
    box-shadow: var(--shadow);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main-panel { padding: 14px; }
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .topbar__search { min-width: 0; flex: 1 1 100%; order: 3; width: 100%; }
  .topbar__actions { margin-left: auto; }
  .topbar__actions .field { min-width: 150px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-header { flex-wrap: wrap; }
  .toast-host {
    left: 12px;
    right: 12px;
    top: 12px;
    width: auto;
  }
  .messenger-dropzone {
    padding: 12px;
  }
  .table,
  .table-responsive .table,
  .panel > .table,
  .card > .table {
    display: block;
    min-width: 700px;
    white-space: nowrap;
    overflow-x: auto;
  }
}

@media (max-width: 860px) {
  .mobile-bottom-nav {
    display: grid;
  }

  .main-panel {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 768px) {
  .main-panel { padding: 10px; }
  .stats-grid, .cards-grid, .content-grid, .form-grid { grid-template-columns: 1fr; }
  .panel { padding: 14px; border-radius: 16px; }
  .card { padding: 12px; }
  .inline-actions { justify-content: stretch; }
  .inline-actions .btn { flex: 1 1 calc(50% - 6px); min-width: 120px; }
  .page-header .inline-actions { width: 100%; }
  .page-header .inline-actions .btn { flex: 1 1 100%; }
  .pagination { justify-content: space-between; flex-wrap: wrap; }
  .page-header h1 { font-size: 1.35rem; }
  .topbar__actions .btn--ghost { display: none; }
  #installAppBtn { display: none !important; }
  .table-responsive .table,
  .panel > .table,
  .card > .table {
    min-width: 700px;
    white-space: nowrap;
  }
  .product-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-chat-wrap { min-height: 460px; }
  .modal-card { width: min(680px, calc(100vw - 20px)); max-height: 90vh; border-radius: 16px; padding: 14px; }
  .modal-header { position: sticky; top: 0; background: var(--panel); padding-bottom: 8px; z-index: 1; }
}

@media (max-width: 480px) {
  .btn { min-height: 44px; padding: 11px 12px; }
  .menu-toggle { min-width: 44px; min-height: 44px; }
  .topbar__actions .field { min-width: 100%; }
  .inline-actions .btn { flex: 1 1 100%; }
  .field input, .field select, .field textarea { min-height: 44px; }
  .topbar__search {
    border-radius: 14px;
    padding: 11px 12px;
  }
  .mobile-bottom-nav__item {
    min-height: 58px;
    font-size: 0.68rem;
  }
  .field textarea { min-height: 96px; }
  .table-responsive .table,
  .panel > .table,
  .card > .table {
    min-width: 640px;
  }
  .card .inline-actions .btn { flex: 1 1 100%; }
  .product-cards-grid { grid-template-columns: 1fr; }
  .brand__logo { display: none; }
  .brand__compact { display: inline-flex; }
  .brand-logo--compact { width: 30px; }
  .topbar__search-clear { width: 26px; height: 26px; }
}

@media (max-width: 390px) {
  .topbar { padding: 8px; }
  .panel { padding: 12px; }
  .nav-item { padding: 10px; }
}

@media (max-width: 360px) {
  .avatar { width: 36px; height: 36px; }
  .brand { font-size: 1.05rem; }
  .modal-backdrop { padding: 8px; }
}

/* FixHub CRM mobile app shell and responsive Orders Workspace */
.orders-summary { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:12px; padding:10px 12px; border:1px solid var(--border); border-radius:14px; background:var(--card); }
.orders-summary span { color:var(--muted); font-size:.86rem; }
.orders-summary strong { color:var(--text); }
.orders-summary .btn { margin-left:auto; min-height:36px; padding:7px 10px; }
.orders-summary .btn + .btn { margin-left:0; }
.orders-workspace { padding:14px; }
.orders-toolbar { display:grid; grid-template-columns:repeat(6,minmax(110px,1fr)); gap:8px; align-items:end; margin-bottom:12px; }
.orders-toolbar .field { min-width:0; }
.orders-toolbar .field span { font-size:.72rem; }
.orders-toolbar select,.orders-toolbar input { min-height:38px; padding:7px 9px; }
.orders-filter-sheet__head,.orders-filter-trigger { display:none; }
.orders-table-wrap { width:100%; overflow:auto; overscroll-behavior-inline:contain; }
.orders-table { min-width:1080px; table-layout:auto; }
.orders-table thead th { position:sticky; top:0; z-index:2; background:var(--panel); white-space:nowrap; }
.orders-table th button { border:0; background:none; color:inherit; font-weight:inherit; cursor:pointer; padding:0; }
.orders-table td { vertical-align:middle; padding:9px 8px; }
.orders-table td:first-child { min-width:110px; }
.orders-table td:nth-child(2) { min-width:140px; max-width:220px; white-space:normal; }
.orders-table td:last-child { min-width:280px; }
.orders-table td small { display:block; margin-top:3px; color:var(--muted); font-size:.72rem; }
.order-actions { display:flex; align-items:center; gap:5px; flex-wrap:wrap; }
.order-actions > button,.order-more summary,.order-more__menu button { border:1px solid var(--border); background:rgba(148,163,184,.08); color:var(--text); border-radius:9px; min-height:34px; padding:6px 8px; cursor:pointer; font-weight:650; font-size:.75rem; }
.order-more { position:relative; }
.order-more summary { display:grid; place-items:center; list-style:none; min-width:38px; }
.order-more summary::-webkit-details-marker { display:none; }
.order-more__menu { position:absolute; z-index:20; right:0; top:calc(100% + 6px); min-width:190px; display:grid; gap:5px; padding:8px; border:1px solid var(--border); border-radius:12px; background:var(--panel); box-shadow:var(--shadow); }
.order-more__menu button { width:100%; text-align:left; min-height:40px; }
.orders-cards { display:none; }
.order-card { min-width:0; overflow:visible; border:1px solid var(--border); border-radius:16px; background:var(--card); padding:13px; }
.order-card__top,.order-card__customer { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.order-card__top small,.order-card__customer a { display:block; color:var(--muted); font-size:.78rem; margin-top:2px; }
.order-card__customer { margin:12px 0; }
.order-card__customer { flex-direction:column; gap:1px; }
.order-card__badges { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }
.mobile-more-sheet,.mobile-sheet-backdrop { display:none; }
.product-selection-bar { position:sticky; top:8px; z-index:10; }
.product-selection-bar .inline-actions { align-items:center; }
.product-selection-bar progress { width:100%; height:8px; margin-top:8px; }
.product-select-card { position:relative; }
.product-select-card--selected { border-color:var(--accent); box-shadow:0 0 0 2px rgba(14,165,233,.18); }
.product-select-check { display:flex; align-items:center; gap:7px; min-height:44px; cursor:pointer; color:var(--muted); font-size:.8rem; }
.product-select-check input { width:20px; height:20px; accent-color:var(--accent); }
.builder-tabs { display:grid; grid-template-columns:repeat(6,1fr); gap:8px; margin-bottom:14px; }
.builder-tabs button { min-height:46px; border:1px solid var(--border); border-radius:12px; background:var(--card); color:var(--muted); cursor:pointer; }
.builder-tabs button.active { border-color:var(--accent); color:var(--text); background:rgba(14,165,233,.12); }
.builder-form { display:grid; gap:16px; }
.builder-design { display:grid; grid-template-columns:minmax(280px,.7fr) minmax(0,1.3fr); gap:14px; }
.builder-ai textarea { min-height:180px; }
.builder-preview { min-width:0; display:grid; gap:8px; align-content:start; }
.builder-preview__toolbar { display:flex; gap:7px; flex-wrap:wrap; }
.builder-preview__toolbar button,.builder-preview__toolbar a { border:1px solid var(--border); border-radius:9px; padding:8px 10px; color:var(--text); background:var(--card); }
.builder-preview iframe { display:block; width:100%; max-width:100%; height:680px; margin:auto; border:1px solid var(--border); border-radius:14px; background:white; transition:width .2s ease; }
.builder-contract,.builder-publish-checks { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:8px; margin-top:14px; }
.builder-contract span,.builder-publish-checks span { padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--card); }
.builder-domain-status { margin-top:12px; padding:14px; border:1px solid var(--border); border-radius:12px; }
.builder-workspace pre { max-width:100%; overflow:auto; white-space:pre-wrap; }
.builder-sites { display:grid; gap:10px; }
.builder-site-row { display:grid; grid-template-columns:minmax(180px,1.4fr) minmax(120px,.7fr) minmax(140px,.8fr) minmax(150px,.8fr); gap:12px; align-items:center; padding:14px; border:1px solid var(--border); border-radius:14px; background:var(--card); }
.builder-site-row__actions { grid-column:1/-1; display:flex; gap:8px; flex-wrap:wrap; }
.builder-site-row__actions button { min-height:40px; }
.builder-wizard-note { margin:0 0 12px; color:var(--muted); }

@media (max-width:768px) {
  html,body { width:100%; max-width:100%; overflow-x:hidden; overscroll-behavior-y:none; }
  body { padding-top:env(safe-area-inset-top); }
  .app-shell { min-height:100dvh; }
  .workspace { min-height:calc(100dvh - 60px); }
  .sidebar,.menu-toggle { display:none !important; }
  .topbar { position:sticky; top:0; z-index:24; min-height:54px; padding:7px 10px; flex-wrap:nowrap; padding-top:max(7px,env(safe-area-inset-top)); }
  .topbar__search { order:0; flex:1 1 auto; width:auto; min-width:0; padding:8px 10px; }
  .topbar__actions { flex:0 0 auto; margin:0; }
  .topbar__actions .field,.topbar__actions #themeToggleBtn,.topbar__actions [data-page],.topbar__actions #logoutBtn { display:none !important; }
  #installAppBtn { display:inline-flex !important; min-height:44px; padding:8px; font-size:.72rem; }
  #installAppBtn.hidden { display:none !important; }
  .avatar { width:40px; height:40px; }
  .main-panel { padding:10px 8px calc(84px + env(safe-area-inset-bottom)); }
  .page-header { gap:8px; margin-bottom:10px; }
  .page-header h1 { font-size:1.24rem; }
  .page-header p { font-size:.8rem; }
  .orders-heading .inline-actions { width:auto; margin-left:auto; }
  .builder-tabs { display:flex; overflow-x:auto; gap:6px; padding-bottom:4px; }
  .builder-tabs button { flex:0 0 auto; min-width:126px; }
  .builder-design { grid-template-columns:1fr; padding:12px; }
  .builder-preview iframe { height:62dvh; }
  .builder-site-row { grid-template-columns:1fr; }
  .builder-site-row__actions { grid-column:auto; }
  .builder-ai .inline-actions .btn { flex:1 1 calc(50% - 6px); min-width:0; }
  .orders-heading .inline-actions .btn { flex:0 0 auto; min-width:44px; }
  .orders-filter-trigger { display:inline-flex; }
  .orders-summary { display:grid; grid-template-columns:1fr 1fr; gap:7px; padding:10px; }
  .orders-summary .btn { display:none; }
  .orders-workspace { padding:0; border:0; background:none; box-shadow:none; }
  .orders-workspace > .panel-header { padding:0 2px 8px; }
  .orders-table-wrap { display:none; }
  .orders-cards { display:grid; gap:10px; }
  .order-actions--card { display:grid; grid-template-columns:1fr 1fr 44px; }
  .order-actions--card > button:nth-child(1),.order-actions--card > button:nth-child(4) { min-height:44px; }
  .order-actions--card > button:nth-child(2),.order-actions--card > button:nth-child(3) { display:none; }
  .order-actions--card .order-more { grid-column:3; grid-row:1; }
  .order-actions--card .order-more summary { min-height:44px; }
  .order-more__menu { position:fixed; left:8px; right:8px; bottom:calc(76px + env(safe-area-inset-bottom)); top:auto; max-height:60dvh; overflow:auto; }
  .orders-filter-sheet { position:fixed; z-index:40; left:0; right:0; bottom:0; padding:12px 12px calc(16px + env(safe-area-inset-bottom)); border-radius:22px 22px 0 0; border:1px solid var(--border); background:var(--panel); box-shadow:0 -24px 64px rgba(2,8,23,.65); transform:translateY(105%); transition:transform .2s ease; }
  .orders-filter-sheet--open { transform:translateY(0); }
  .orders-filter-sheet__head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
  .orders-filter-sheet__head button,.mobile-more-sheet__head button { width:44px; height:44px; border:0; border-radius:50%; background:rgba(148,163,184,.12); color:var(--text); font-size:1.4rem; }
  .orders-toolbar { grid-template-columns:1fr 1fr; max-height:70dvh; overflow:auto; margin:0; }
  .orders-toolbar .field { display:block; }
  .orders-toolbar select,.orders-toolbar input { width:100%; min-height:44px; }
  .modal-backdrop { align-items:end; padding:0; }
  .modal-card { width:100%; max-width:none; max-height:92dvh; border-radius:22px 22px 0 0; padding:16px 12px calc(16px + env(safe-area-inset-bottom)); }
  .mobile-bottom-nav { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); padding-left:4px; padding-right:4px; gap:2px; }
  .mobile-bottom-nav__item { min-width:0; min-height:58px; padding:4px 1px; font-size:.63rem; touch-action:manipulation; }
  .mobile-more-sheet { display:block; position:fixed; z-index:42; left:0; right:0; bottom:0; padding:8px 12px calc(18px + env(safe-area-inset-bottom)); border-radius:22px 22px 0 0; background:var(--panel); border:1px solid var(--border); transform:translateY(105%); transition:transform .2s ease; }
  .mobile-more-sheet--open { transform:translateY(0); }
  .mobile-more-sheet__handle { width:46px; height:4px; margin:0 auto 8px; border-radius:9px; background:var(--border); }
  .mobile-more-sheet__head { display:flex; align-items:center; justify-content:space-between; }
  .mobile-more-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:10px; }
  .mobile-more-grid button { min-height:52px; border:1px solid var(--border); border-radius:13px; background:rgba(148,163,184,.08); color:var(--text); text-align:left; padding:10px; }
  .mobile-sheet-backdrop { position:fixed; z-index:41; inset:0; background:rgba(2,8,23,.62); }
  body.mobile-sheet-open .mobile-sheet-backdrop { display:block; }
  body.pwa-standalone .topbar { padding-top:max(7px,env(safe-area-inset-top)); }
}

@media (max-width:360px) {
  .main-panel { padding-left:6px; padding-right:6px; }
  .order-card { padding:11px; }
  .orders-summary { grid-template-columns:1fr; }
  .mobile-bottom-nav__item { font-size:.58rem; }
}

.cards-grid[style*="minmax(300px, 1fr) minmax(420px, 2fr)"] {
  grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr) !important;
}

@media (max-width: 900px) {
  .cards-grid[style*="minmax(300px, 1fr) minmax(420px, 2fr)"] {
    grid-template-columns: 1fr !important;
  }
}

.setup-wizard .wizard-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.setup-wizard .wizard-steps {
  display: grid;
  gap: 10px;
  align-content: start;
}

.wizard-step-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
}

.wizard-step-btn small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.wizard-step-btn__index {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.17);
  border: 1px solid rgba(59, 130, 246, 0.45);
}

.wizard-step-btn--active {
  border-color: rgba(34, 197, 94, 0.6);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.14);
}

.wizard-body {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.wizard-step-results,
.wizard-summary {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.wizard-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  padding: 6px 10px;
  border: 1px solid transparent;
}

.wizard-status--ok {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

.wizard-status--error {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.wizard-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wizard-footer__meta {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .setup-wizard .wizard-layout {
    grid-template-columns: 1fr;
  }
}
