:root {
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #1a1d2e;
  --muted: #8b93a7;
  --purple: #7b61ff;
  --purple-dark: #6347f5;
  --purple-light: #f3efff;
  --purple-soft: #ebe4ff;
  --accent: var(--purple);
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --info: #3b82f6;
  --border: #eceef4;
  --sidebar: #ffffff;
  --sidebar-text: #5c6378;
  --sidebar-active: linear-gradient(135deg, #7b61ff, #9d7bff);
  --shadow: 0 8px 30px rgba(88, 63, 200, 0.06);
  --radius: 16px;
}
* { box-sizing: border-box; }
body { margin:0; font-family: 'Inter', system-ui, sans-serif; background:var(--bg); color:var(--text); }
.wrap { max-width: 460px; margin: 0 auto; padding: 24px; }
.app-shell { display:flex; min-height:100vh; }
.sidebar {
  width: 260px; flex-shrink:0; background:var(--sidebar);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column; padding:24px 16px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display:flex; align-items:center;
  margin-bottom:28px; padding:0 8px;
}
.brand-logo-img {
  height: 34px; width: auto; max-width: 100%;
  display: block; object-fit: contain;
}
.sidebar-logo {
  width:42px; height:42px; border-radius:12px;
  background: linear-gradient(135deg, var(--purple), #9d7bff);
  color:#fff; display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:800;
}
.sidebar-nav { display:flex; flex-direction:column; gap:4px; flex:1; }
.sidebar-nav button, .sidebar-nav a.nav-link {
  width:100%; text-align:left; background:transparent; color:var(--sidebar-text);
  border:none; padding:12px 14px; border-radius:12px; font-weight:600;
  cursor:pointer; font-size:14px; display:flex; align-items:center; gap:10px;
  text-decoration:none;
}
.sidebar-nav button:hover, .sidebar-nav a.nav-link:hover { background:#f7f7fb; color:var(--text); }
.sidebar-nav button.active {
  background: var(--sidebar-active); color:#fff;
  box-shadow: 0 8px 20px rgba(123, 97, 255, 0.28);
}
.nav-icon { width:20px; text-align:center; font-size:15px; opacity:.9; }
.nav-badge {
  margin-left:auto; background:var(--purple-light); color:var(--purple-dark);
  font-size:11px; font-weight:700; padding:2px 8px; border-radius:999px;
}
.sidebar-nav button.active .nav-badge { background:rgba(255,255,255,.22); color:#fff; }
.sidebar-user {
  margin-top:auto; padding:14px; border-radius:14px; background:#f8f9fc;
  border:1px solid var(--border); display:flex; gap:12px; align-items:center;
}
.sidebar-avatar {
  width:40px; height:40px; border-radius:50%;
  background: linear-gradient(135deg, #c4b5fd, #7b61ff);
  color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700;
}
.sidebar-user-meta { min-width:0; flex:1; }
.sidebar-user-name { font-weight:700; font-size:14px; }
.sidebar-user-email { font-size:12px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sidebar-footer { margin-top:12px; }
.sidebar-footer button { width:100%; }

.app-shell.is-booting .topbar,
.app-shell.is-booting .content-area,
.app-shell.is-booting .app-footer-banner {
  visibility: hidden;
}
.topbar {
  display:flex; align-items:flex-start; justify-content:space-between; gap:20px;
  padding:28px 32px 0; flex-wrap:wrap;
}
.topbar-greeting h1 { margin:0 0 6px; font-size:28px; font-weight:800; }
.topbar-greeting p { margin:0; color:var(--muted); font-size:14px; }
.topbar-actions { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.store-select-wrap { position:relative; }
.store-select-btn {
  display:flex; align-items:center; gap:10px; padding:10px 14px;
  border:1px solid var(--border); border-radius:12px; background:#fff;
  font-weight:600; cursor:pointer; min-width:220px; color:var(--text);
}
.store-select-label {
  flex:1; min-width:0; text-align:left;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.store-dot { width:10px; height:10px; border-radius:50%; background:var(--ok); flex-shrink:0; }
.store-dot.inactive { background:#d1d5db; }
.store-dropdown {
  position:absolute; right:0; top:calc(100% + 8px); width:min(320px, 90vw);
  background:#fff; border:1px solid var(--border); border-radius:14px;
  box-shadow:var(--shadow); padding:12px; z-index:40; display:none;
}
.store-dropdown.open { display:block; }
.store-dropdown input {
  width:100%; padding:10px 12px; border:1px solid var(--border);
  border-radius:10px; margin-bottom:8px;
}
.store-option {
  display:flex; align-items:center; gap:10px; padding:10px 12px;
  border-radius:10px; cursor:pointer; border:none; background:transparent;
  width:100%; text-align:left; font:inherit;
}
.store-option:hover, .store-option.active { background:var(--purple-light); }
.store-option { color:var(--text); }
.date-select-wrap { position:relative; }
.date-select-btn {
  display:flex; align-items:center; gap:8px; padding:10px 14px;
  border:1px solid var(--border); border-radius:12px; background:#fff;
  font-weight:600; font-size:13px; cursor:pointer; color:var(--text);
  min-width:190px; white-space:nowrap;
}
.date-dropdown {
  position:absolute; right:0; top:calc(100% + 8px); width:min(280px, 90vw);
  background:#fff; border:1px solid var(--border); border-radius:14px;
  box-shadow:var(--shadow); padding:12px; z-index:40; display:none;
}
.date-dropdown.open { display:block; }
.date-preset {
  width:100%; text-align:left; padding:10px 12px; border-radius:10px;
  border:none; background:transparent; font:inherit; font-weight:600;
  cursor:pointer; color:var(--text);
}
.date-preset:hover, .date-preset.active { background:var(--purple-light); color:var(--purple-dark); }
.pill-btn {
  padding:10px 14px; border:1px solid var(--border); border-radius:12px;
  background:#fff; font-weight:600; font-size:13px; cursor:pointer; color:var(--text);
}
.icon-btn {
  width:42px; height:42px; border:1px solid var(--border); border-radius:12px;
  background:#fff; cursor:pointer; font-size:18px; color:var(--text);
}

.content-area { padding:24px 32px 32px; flex:1; width:100%; min-width:0; }
.main-panel {
  flex:1; min-width:0; width:100%;
  display:flex; flex-direction:column;
}
.page-shell { width:100%; min-width:0; }
#integrationsPage .onboarding-banner { width:100%; max-width:none; margin-bottom:16px; }

/* ——— Integrations page ——— */
.integrations-page-shell { width:100%; min-width:0; }
.integrations-page-head {
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:20px; flex-wrap:wrap; margin-bottom:18px;
}
.integrations-page-title { display:flex; align-items:center; gap:12px; }
.integrations-page-title h1 {
  margin:0; font-size:28px; font-weight:800; letter-spacing:-0.02em;
}
.integrations-page-title-icon {
  width:44px; height:44px; border-radius:14px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:20px;
  background:linear-gradient(135deg, #7b61ff, #9d7bff);
  box-shadow:0 8px 20px rgba(123, 97, 255, 0.25);
}
.integrations-page-subtitle {
  margin:8px 0 0; color:var(--muted); font-size:14px; max-width:560px;
}
.integrations-add-btn {
  padding:11px 18px; border-radius:12px; border:none; white-space:nowrap;
  background:linear-gradient(135deg, #7b61ff, #9d7bff);
  box-shadow:0 8px 20px rgba(123, 97, 255, 0.28);
  font-weight:700; font-size:14px; color:#fff;
}
.integrations-add-btn:hover { filter:brightness(1.03); }
.integrations-page-actions {
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  justify-content:flex-end; flex:1; min-width:280px;
}
.integrations-search-wrap {
  position:relative; display:flex; align-items:center;
  flex:1; min-width:220px; max-width:300px;
}
.integrations-search-icon {
  position:absolute; left:14px; color:var(--muted); font-size:16px; pointer-events:none;
}
.integrations-search-input {
  width:100%; padding:11px 14px 11px 38px; border-radius:12px;
  border:1px solid var(--border); background:#fff; font-size:14px;
}
.integrations-category-tabs {
  margin:0 0 18px;
  gap:8px;
}
.integrations-category-tabs button {
  display:inline-flex; align-items:center; gap:8px;
  padding:9px 16px; border-radius:999px; border:1px solid var(--border);
  background:#fff; font-size:13px; font-weight:700; color:var(--text);
  box-shadow:0 1px 2px rgba(15, 23, 42, 0.03);
}
.integrations-category-tabs button:hover {
  border-color:#c4b5fd; background:#faf8ff;
}
.integrations-category-tabs button.active {
  background:linear-gradient(135deg, #7b61ff, #9d7bff);
  border-color:transparent; color:#fff;
  box-shadow:0 6px 16px rgba(123, 97, 255, 0.24);
}
.integrations-category-tab-count {
  min-width:22px; height:22px; padding:0 7px; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700; background:#f3f4f8; color:var(--muted);
}
.integrations-category-tabs button.active .integrations-category-tab-count {
  background:rgba(255,255,255,.22); color:#fff;
}
.integrations-grid-empty {
  grid-column:1 / -1; padding:28px 12px; text-align:center; font-size:14px;
}
.integrations-grid {
  display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:16px;
}
@media (max-width: 960px) {
  .integrations-grid { grid-template-columns:1fr; }
}
.integration-platform-card {
  position:relative; overflow:hidden;
  border:1px solid var(--border); border-radius:18px; padding:20px;
  background:#fff; min-height:220px;
  display:flex; flex-direction:column; gap:12px;
  box-shadow:0 1px 2px rgba(15, 23, 42, 0.04);
}
.integration-platform-card > :not(.integration-platform-wave) {
  position:relative; z-index:1;
}
.integration-platform-top {
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
}
.integration-platform-menu {
  width:32px; height:32px; flex-shrink:0; padding:0; margin-top:2px;
  border:none; border-radius:10px; background:transparent; color:var(--muted);
  font-size:18px; line-height:1; cursor:pointer;
}
.integration-platform-menu:hover:not(:disabled) { background:#f3f4f8; }
.integration-platform-menu:disabled { opacity:.35; cursor:default; }
.integration-platform-head {
  display:flex; align-items:flex-start; gap:14px; min-width:0; flex:1;
}
.integration-platform-icon {
  width:52px; height:52px; flex-shrink:0; border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  border:1px solid #eef0f5; overflow:hidden; padding:0;
  background:#f6f7fb;
}
.integration-platform-icon img {
  width:100%; height:100%; object-fit:cover; display:block;
}
.integration-platform-icon--muted {
  background:#f3f4f8; color:var(--muted); font-weight:800; font-size:18px;
}
.integration-platform-title-wrap {
  min-width:0; flex:1; display:flex; flex-direction:column; gap:6px;
}
.integration-platform-title {
  margin:0; font-size:18px; font-weight:800; letter-spacing:-0.01em;
}
.integration-platform-status {
  display:inline-flex; align-items:center; gap:6px;
  font-size:13px; font-weight:700;
}
.integration-platform-status.is-active { color:#16a34a; }
.integration-platform-status.is-pending { color:#b45309; }
.integration-platform-status.is-inactive { color:#6b7280; }
.integration-platform-link {
  display:block; margin-top:2px;
  font-size:13px; color:var(--purple); text-decoration:none; word-break:break-all;
}
.integration-platform-link:hover { text-decoration:underline; }
.integration-platform-desc {
  margin:0; color:var(--muted); font-size:14px; line-height:1.45;
}
.integration-platform-footer {
  display:flex; flex-wrap:wrap; gap:8px; margin-top:auto; padding-top:4px;
}
.integration-action-btn {
  display:inline-flex; align-items:center; gap:6px;
  padding:9px 12px; border-radius:10px; border:1px solid var(--border);
  background:#fff; color:var(--text); font-weight:600; font-size:13px; cursor:pointer;
}
.integration-action-btn:hover { background:#fafbff; border-color:#dfe3ef; }
.integration-action-btn-primary {
  background:linear-gradient(135deg, #7b61ff, #9d7bff); border-color:transparent; color:#fff;
}
.integration-action-btn-danger {
  background:#fff5f5; border-color:#fecaca; color:#b91c1c;
}
.integration-connect-btn {
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 14px; border-radius:12px; border:1px solid var(--border);
  background:#fff; color:var(--text); font-weight:600; font-size:14px; cursor:pointer;
}
.integration-connect-btn:disabled { opacity:.55; cursor:not-allowed; }
.integration-connect-btn:not(:disabled):hover { background:#fafbff; border-color:#dfe3ef; }
.integration-platform-wave {
  position:absolute; right:0; bottom:0; width:72%; height:52%;
  pointer-events:none; z-index:0;
}
.integration-platform-wave svg {
  display:block; width:100%; height:100%;
}
.integration-row-icon { width:28px; height:28px; object-fit:contain; flex-shrink:0; }
.platform-card-icon {
  width:40px; height:40px; object-fit:contain; display:block; margin-bottom:10px;
}
.page-header { margin-bottom:20px; }
.page-header-row { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.page-header h1 { margin:0; font-size:24px; font-weight:800; }
h1,h2 { margin: 0 0 16px; }
.card {
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px; margin-bottom:16px; box-shadow:var(--shadow);
}
.card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; }
.card-head h2, .card-head h3 { margin:0; font-size:16px; font-weight:700; }
.card-link { color:var(--purple); font-size:13px; font-weight:600; text-decoration:none; }
.card-link:hover { text-decoration:underline; }

input, button, select, textarea {
  font: inherit; padding:10px 12px; border-radius:10px;
  border:1px solid var(--border); background:#fff; color:var(--text);
}
button {
  background:var(--accent); border:none; cursor:pointer; font-weight:600; color:#fff;
}
button.secondary { background:#fff; color:var(--text); border:1px solid var(--border); }
button.danger { background:#fee2e2; color:#b91c1c; border:none; }
button.linkish { background:transparent; border:none; color:var(--purple); padding:0; font-weight:600; cursor:pointer; text-align:left; }

/* Нейтральні кнопки в шапці та списках — після загального button */
.topbar-actions button.store-select-btn,
.topbar-actions button.date-select-btn,
.topbar-actions button.icon-btn,
button.store-option,
button.date-preset,
button.modal-close,
button.platform-card,
button.np-dropdown-item,
.sidebar-nav button,
.sidebar-footer button.secondary {
  background:#fff;
  border:1px solid var(--border);
  color:var(--text);
}
.sidebar-nav button.active { background:var(--sidebar-active); border:none; color:#fff; }
#selectedStoreLabel,
#dateRangeLabel,
.store-select-label {
  color:var(--text) !important;
}
.kpi-label { color:#5c6378; }
.kpi-value { color:var(--text); }
.card-head h2, .card-head h3, .card h2, .card h3 { color:var(--text); }
.donut span { color:var(--text); position:relative; z-index:1; }
.row { display:flex; gap:12px; flex-wrap:wrap; align-items:end; }
.row > * { flex:1; min-width:140px; }
table { width:100%; border-collapse:collapse; }
th, td { text-align:left; padding:12px 10px; border-bottom:1px solid var(--border); font-size:14px; vertical-align:top; }
th { color:var(--muted); font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.03em; }
.muted { color:var(--muted); font-size:13px; }
.hidden { display: none !important; }
.badge { display:inline-block; padding:4px 10px; border-radius:999px; font-size:12px; font-weight:600; background:#eef2ff; color:#4338ca; }
.badge.ok, .status-picked { background:#dcfce7; color:#166534; }
.badge.picking, .status-picking { background:var(--purple-light); color:var(--purple-dark); }
.badge.new, .status-new { background:#dbeafe; color:#1d4ed8; }
.badge.error { background:#fee2e2; color:#b91c1c; }
.badge.status-inactive { background:#f3f4f6; color:#6b7280; }
.badge.status-awaiting { background:#fef3c7; color:#b45309; }
.error { color:#dc2626; margin-top:8px; }
.success { color:#16a34a; margin-top:8px; }
.tabs { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.tabs button { background:#f3f4f6; color:var(--text); }
.tabs button.active { background:var(--purple); color:#fff; }
.log-toolbar { display:flex; gap:12px; align-items:center; justify-content:space-between; flex-wrap:wrap; margin-bottom:16px; }
.lightbox { position:fixed; inset:0; background:rgba(0,0,0,.85); display:flex; align-items:center; justify-content:center; z-index:1000; padding:24px; }
.lightbox img { max-width:100%; max-height:90vh; border-radius:12px; }
.lightbox button { position:absolute; top:24px; right:24px; }
.achievement-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:16px; }
.achievement-card { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:16px; }
.achievement-card img, .achievement-placeholder { width:100%; height:160px; object-fit:cover; border-radius:12px; background:#f3f4f6; display:flex; align-items:center; justify-content:center; color:var(--muted); margin-bottom:12px; }
.achievement-value { font-size:28px; font-weight:700; margin:8px 0; }
.store-checks { display:flex; flex-wrap:wrap; gap:12px 20px; margin-top:8px; }
.store-checks label { display:flex; align-items:center; gap:6px; margin:0; color:var(--text); cursor:pointer; }
input[readonly] { opacity: 0.65; cursor: not-allowed; }
.form-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:16px; align-items:center; }
.modal-backdrop { position:fixed; inset:0; background:rgba(15,23,42,.45); display:flex; align-items:center; justify-content:center; z-index:1100; padding:24px; }
.modal { background:var(--card); border:1px solid var(--border); border-radius:18px; width:100%; max-width:520px; max-height:90vh; overflow:auto; padding:24px; box-shadow:0 24px 48px rgba(0,0,0,.15); }
.modal-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:16px; }
.modal-head h2 { margin:0; font-size:20px; }
.modal-close { background:#fff; border:1px solid var(--border); color:var(--muted); padding:6px 10px; line-height:1; }
.modal .row > * { min-width:100%; }
.modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.modal select,
.modal textarea {
  width:100%;
  display:block;
  box-sizing:border-box;
}
.modal label + input:not([type="checkbox"]):not([type="radio"]),
.modal label + select,
.modal label + textarea,
.modal p + input:not([type="checkbox"]):not([type="radio"]),
.modal p + select {
  margin-bottom:12px;
}
.modal .field-copy-row { width:100%; }
.modal-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:20px; }
.packing-thumb { width:72px; height:72px; object-fit:cover; border-radius:8px; cursor:pointer; background:#f3f4f6; }
.packing-thumb.placeholder { display:flex; align-items:center; justify-content:center; color:var(--muted); font-size:11px; }
.detail-head { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.detail-head h1 { margin:0; flex:1; font-size:22px; }
label { display:block; font-size:13px; color:var(--muted); margin-bottom:4px; font-weight:600; }
.log-view { background:#0f172a; color:#e2e8f0; padding:16px; border-radius:12px; overflow:auto; max-height:480px; font-size:12px; line-height:1.5; }

/* Login */
.login-screen {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  padding:24px; background: linear-gradient(180deg, #f7f7fb 0%, #ece9ff 100%);
}
.login-card {
  width:min(440px, 100%); background:#fff; border:1px solid var(--border);
  border-radius:20px; padding:36px; box-shadow:var(--shadow);
}
.login-card .brand-row { display:flex; align-items:center; margin-bottom:24px; }
.login-card .brand-row .brand-logo-img { height: 38px; }
.login-card h1 { margin:0 0 8px; font-size:26px; }

/* Dashboard */
.kpi-grid { display:grid; grid-template-columns:repeat(4, 1fr); gap:16px; margin-bottom:20px; }
.kpi-card {
  background:#fff; border:1px solid var(--border); border-radius:var(--radius);
  padding:18px 20px; box-shadow:var(--shadow);
}
.kpi-label { font-size:13px; color:var(--muted); margin-bottom:8px; }
.kpi-value { font-size:28px; font-weight:800; margin-bottom:8px; }
.kpi-trend { font-size:12px; font-weight:600; color:var(--ok); }
.kpi-trend.neutral { color:var(--muted); }
.kpi-spark { height:36px; margin-top:12px; border-radius:8px; opacity:.85; }

.dash-grid { display:grid; grid-template-columns:1.1fr 1fr 0.9fr; gap:16px; margin-bottom:16px; }
.dash-grid-2 { display:grid; grid-template-columns:1fr 1fr 1fr 1fr; gap:16px; }
.store-row {
  display:flex; align-items:center; gap:12px; padding:12px 0;
  border-bottom:1px solid var(--border);
}
.store-row:last-child { border-bottom:none; }
.store-icon {
  width:40px; height:40px; border-radius:10px; background:var(--purple-light);
  display:flex; align-items:center; justify-content:center; font-weight:700; color:var(--purple);
}
.store-row-main { flex:1; min-width:0; }
.store-row-name { font-weight:600; }
.store-row-url { font-size:12px; color:var(--muted); }
.store-row-stats { text-align:right; font-size:13px; }
.store-row-stats strong { display:block; font-size:15px; }

.order-mini { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); }
.order-mini:last-child { border-bottom:none; }
.order-mini-id { font-weight:700; }
.order-mini-time { font-size:12px; color:var(--muted); }

.donut-wrap { display:flex; align-items:center; gap:20px; }
.donut {
  width:120px; height:120px; border-radius:50%;
  background: conic-gradient(var(--purple) 0 var(--donut-pct, 98%), #e8e8ef var(--donut-pct, 98%) 100%);
  display:flex; align-items:center; justify-content:center; position:relative; flex-shrink:0;
}
.donut::after {
  content:''; width:78px; height:78px; border-radius:50%; background:#fff; position:absolute;
}
.donut span { position:relative; z-index:1; font-weight:800; font-size:18px; }
.donut-legend { font-size:13px; }
.donut-legend div { display:flex; justify-content:space-between; gap:16px; padding:4px 0; }
.info-banner {
  margin-top:14px; padding:12px 14px; border-radius:12px;
  background:#eff6ff; color:#1e40af; font-size:13px;
}

.integration-row { display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--border); }
.integration-row:last-child { border-bottom:none; }
.dot-ok { width:8px; height:8px; border-radius:50%; background:var(--ok); }

.scanner-widget { text-align:center; }
.scanner-illustration {
  width:100%; max-width:180px; margin:0 auto 12px;
  padding:20px; border-radius:14px; background:linear-gradient(180deg,#f8f9fc,#eef2ff);
}
.scanner-illustration svg { width:100%; height:auto; }

.timeline { display:flex; flex-direction:column; gap:14px; }
.timeline-item { display:flex; gap:12px; align-items:flex-start; }
.timeline-dot {
  width:32px; height:32px; border-radius:10px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-size:14px;
}
.timeline-dot.ok { background:#dcfce7; }
.timeline-dot.warn { background:#fef3c7; }
.timeline-dot.info { background:var(--purple-light); }
.timeline-text { font-size:13px; }
.timeline-text strong { display:block; margin-bottom:2px; }

.quick-actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.quick-btn {
  display:flex; flex-direction:column; align-items:flex-start; gap:8px;
  padding:16px; border-radius:14px; border:none; cursor:pointer; font-weight:700;
  color:#fff; text-align:left; min-height:88px;
}
.quick-btn.purple { background:linear-gradient(135deg,#7b61ff,#9d7bff); }
.quick-btn.green { background:linear-gradient(135deg,#22c55e,#4ade80); }
.quick-btn.orange { background:linear-gradient(135deg,#f59e0b,#fbbf24); color:#422006; }
.quick-btn.blue { background:linear-gradient(135deg,#3b82f6,#60a5fa); }
.quick-btn span { font-size:22px; }

.app-footer-banner {
  margin:0 32px 24px; padding:14px 20px; border-radius:14px;
  background: linear-gradient(135deg, #7b61ff, #9d7bff);
  color:#fff; display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
  font-size:14px;
}
.app-footer-banner a { color:#fff; font-weight:700; text-decoration:none; }
.app-footer-banner a:hover { text-decoration:underline; }

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

/* ——— Products page ——— */
.products-page .content-area,
.products-page-shell { width: 100%; min-width: 0; }
.products-page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 16px;
}
.products-page-title { display: flex; align-items: center; gap: 12px; }
.products-page-title h1 {
  margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
}
.products-page-title-icon {
  width: 44px; height: 44px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: linear-gradient(135deg, #7b61ff, #9d7bff);
  box-shadow: 0 8px 20px rgba(123, 97, 255, 0.25);
}
.products-page-subtitle {
  margin: 8px 0 0; color: var(--muted); font-size: 14px; max-width: 560px;
}
.products-page-actions-wrap {
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  flex: 1; min-width: 280px;
}
.products-page-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  justify-content: flex-end; width: 100%;
}
.products-filter-select,
.products-per-page select {
  min-width: 148px; padding: 11px 36px 11px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff; font-weight: 600; font-size: 14px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b93a7' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.products-search-wrap {
  position: relative; display: flex; align-items: center; min-width: 220px; flex: 1; max-width: 280px;
}
.products-search-icon {
  position: absolute; left: 14px; color: var(--muted); font-size: 16px; pointer-events: none;
}
.products-search-input {
  width: 100%; padding: 11px 14px 11px 38px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff; font-size: 14px;
}
.products-search-input:focus {
  outline: none; border-color: #c4b5fd; box-shadow: 0 0 0 3px rgba(123, 97, 255, 0.12);
}
.products-add-btn {
  padding: 11px 18px; border-radius: 12px; border: none; white-space: nowrap;
  background: linear-gradient(135deg, #7b61ff, #9d7bff);
  box-shadow: 0 8px 20px rgba(123, 97, 255, 0.28);
  font-weight: 700; font-size: 14px; color: #fff;
}
.products-add-btn:hover { filter: brightness(1.03); }
.products-toolbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  flex-wrap: wrap;
}
.products-tool-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-weight: 600; font-size: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.products-tool-btn:hover { background: #fafbff; border-color: #dfe3ef; }
.products-tool-icon { font-size: 16px; line-height: 1; color: var(--muted); }
.products-table-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.products-meta {
  margin: 0; padding: 14px 18px 0; color: var(--muted); font-size: 13px;
}
.products-meta:empty { display: none; padding: 0; }
.products-table-wrap { overflow-x: auto; }
.products-table { width: 100%; border-collapse: collapse; }
.products-table th, .products-table td {
  padding: 14px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle;
}
.products-table thead th {
  font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; background: #fafbff;
}
.products-col-check { width: 44px; text-align: center; }
.products-col-channels { width: 120px; }
.products-col-menu { width: 44px; text-align: center; }
.products-col-check input,
.products-row-check {
  width: 16px; height: 16px; accent-color: var(--purple); cursor: pointer;
}
.products-name-cell {
  display: flex; align-items: center; gap: 12px; min-width: 0;
}
.products-name-body {
  min-width: 0; flex: 1;
  display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 4px;
}
.products-row-menu {
  width: 34px; height: 34px; padding: 0; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.products-row-menu:hover {
  background: #f3f4f8; border-color: var(--border); color: var(--text);
}
.products-table-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; padding: 14px 18px; border-top: 1px solid var(--border); background: #fff;
}
.products-per-page {
  display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; font-weight: 600;
}
.products-pagination {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.products-page-btn {
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.products-page-btn:hover:not(:disabled) { background: #fafbff; border-color: #dfe3ef; }
.products-page-btn.active {
  background: linear-gradient(135deg, #7b61ff, #9d7bff); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(123, 97, 255, 0.24);
}
.products-page-btn:disabled { opacity: .45; cursor: default; }
.products-page-ellipsis { color: var(--muted); padding: 0 4px; font-weight: 600; }

.products-table { width: 100%; border-collapse: collapse; }
.products-table th, .products-table td {
  padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle;
}
.products-table th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.product-thumb {
  width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: #f3f4f8;
  display: block; flex-shrink: 0;
}
.product-thumb-empty {
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.products-table tbody tr.product-row {
  cursor: pointer;
  transition: background .12s ease;
}
.products-table tbody tr.product-row:hover,
.products-table tbody tr.product-row.is-active {
  background: var(--purple-light);
}
.product-name-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; padding: 0; font: inherit; color: inherit;
  text-align: left; cursor: default;
}
.product-name-open {
  display: block; width: 100%; margin: 0; padding: 0;
  background: none; border: none; font: inherit; color: inherit;
  text-align: left; cursor: pointer;
}
.product-name-open strong {
  display: block; font-size: 14px; font-weight: 600; line-height: 1.35;
  transition: color .12s ease;
}
.product-name-open:hover strong { color: var(--purple); }
.product-expand-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-right: 4px; padding: 0;
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  vertical-align: top;
}
.product-expand-chevron {
  color: var(--purple); font-size: 12px; width: 14px; flex-shrink: 0;
}
.products-name-hint {
  flex: 1 0 100%; font-size: 12px; margin-top: 2px;
}
.products-table tbody tr.product-row.is-expanded td {
  border-bottom: none;
  padding-bottom: 6px;
}
.products-table tbody tr.product-channel-row {
  cursor: default;
}
.products-table tbody tr.product-channel-row td {
  background: #fafbff;
  border-bottom: 1px solid var(--border);
  padding: 8px;
  vertical-align: middle;
}
.product-channel-logo-cell {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border);
}
.product-channels-panel-drawer {
  display: flex; flex-direction: column; gap: 8px;
}
.product-channel-drawer-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 12px; background: #fff;
}
.product-channel-drawer-body { min-width: 0; flex: 1; }
.product-channel-drawer-meta { font-size: 12px; margin-top: 4px; }
.product-channel-icon { font-size: 18px; flex-shrink: 0; line-height: 1.2; display: inline-flex; align-items: center; }
.channel-logo { width: 24px; height: 24px; object-fit: contain; display: block; }
.product-channel-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.product-channel-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 4px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.product-channel-badge .channel-logo { width: 22px; height: 22px; }
.product-channel-logo-cell .channel-logo,
.product-channel-icon .channel-logo { width: 26px; height: 26px; }

.products-channel-tabs {
  margin: 0 0 16px;
  gap: 8px;
}
.products-channel-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.products-channel-tabs button:hover {
  border-color: #c4b5fd;
  background: #faf8ff;
}
.products-channel-tabs button.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}
.products-channel-tab-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.products-channel-tab-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .08);
  line-height: 1.2;
}
.products-channel-tabs button.active .products-channel-tab-count {
  background: rgba(255, 255, 255, .22);
}

.product-image-upload {
  border: 1px dashed var(--border); border-radius: 14px; padding: 12px;
  background: #fafbff; margin-bottom: 4px;
}
.product-image-preview {
  min-height: 120px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: #fff; border: 1px solid var(--border);
  overflow: hidden; margin-bottom: 10px;
}
.product-image-preview img {
  width: 100%; max-height: 180px; object-fit: contain; display: block;
}
.product-image-upload-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.product-image-upload.is-dragover {
  border-color: var(--purple); background: var(--purple-light);
}

.product-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 1200;
  opacity: 0; pointer-events: none; transition: opacity .22s ease;
}
.product-drawer-backdrop.open {
  opacity: 1; pointer-events: auto;
}
.product-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(460px, 100vw);
  background: #fff; border-left: 1px solid var(--border);
  box-shadow: -20px 0 60px rgba(26, 29, 46, .14);
  z-index: 1201; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .24s ease;
}
.product-drawer.open { transform: translateX(0); }
.product-drawer.hidden { display: none; }
.product-drawer-backdrop.hidden { display: none; }
.product-drawer-head {
  position: relative;
  display: flex; flex-direction: column; align-items: stretch; gap: 16px;
  padding: 24px 24px 20px;
}
.product-drawer-head-text { min-width: 0; width: 100%; padding-right: 44px; }
.product-drawer-kicker {
  margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--purple);
}
.product-drawer-head h2 {
  margin: 0; font-size: 22px; line-height: 1.35; font-weight: 800; letter-spacing: -0.02em;
}
.product-drawer-close {
  position: absolute; top: 20px; right: 20px; z-index: 2;
  width: 36px; height: 36px; flex-shrink: 0; padding: 0;
  border-radius: 999px; border: none; background: #f3f4f8; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer;
}
.product-drawer-close:hover { background: #ebedf3; color: var(--text); }
.product-drawer-body {
  flex: 1; overflow: auto; padding: 0 24px 24px;
  display: flex; flex-direction: column; gap: 20px;
}
.product-drawer-image-wrap {
  width: 100%; padding: 0; margin: 0;
  background: transparent; border: none;
}
.product-drawer-image {
  width: 100%; max-height: 280px; border-radius: 0; object-fit: contain;
  background: transparent; display: block; margin: 0 auto;
}
.product-drawer-image-empty {
  min-height: 180px; display: flex; align-items: center; justify-content: center;
  font-size: 48px; background: transparent; border-radius: 0;
}
.product-drawer-meta {
  margin: 0; display: flex; flex-direction: column;
}
.product-drawer-meta-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.product-drawer-meta-row:last-child { border-bottom: none; }
.product-drawer-meta dt {
  margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.product-drawer-meta dd {
  margin: 0; font-weight: 700; font-size: 14px; text-align: right; word-break: break-word;
}
.product-drawer-section-title {
  margin: 0 0 12px; font-size: 15px; font-weight: 800; color: var(--text);
}
.product-drawer-channel-list {
  display: flex; flex-direction: column; gap: 10px;
}
.product-drawer-channel-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: #fff;
}
.product-drawer-channel-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: #fafbff; border: 1px solid #eef0f5;
}
.product-drawer-channel-icon .channel-logo { width: 24px; height: 24px; }
.product-drawer-channel-main { min-width: 0; flex: 1; }
.product-drawer-channel-main strong {
  display: block; font-size: 13px; font-weight: 600; line-height: 1.35;
  margin-bottom: 6px;
}
.product-drawer-channel-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.product-drawer-channel-chevron {
  flex-shrink: 0; color: var(--muted); font-size: 22px; line-height: 1; font-weight: 300;
}
.product-drawer-barcode-actions {
  display: flex; flex-direction: column; gap: 10px;
}
.product-drawer-barcode-actions.hidden { display: none; }
.product-drawer-cancel-btn {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff;
  color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
}
.product-drawer-cancel-btn:hover { background: #fafbff; border-color: #dfe3ef; }
.product-drawer-channels { margin-top: 4px; }
.product-drawer-barcode-btn {
  width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 18px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, #7b61ff, #9d7bff);
  box-shadow: 0 8px 20px rgba(123, 97, 255, 0.28);
  color: #fff; font-weight: 700; font-size: 15px; cursor: pointer;
}
.product-drawer-barcode-btn:hover { filter: brightness(1.03); }
.product-drawer-barcode-icon { font-size: 18px; line-height: 1; opacity: .95; }
.product-drawer-scan-box {
  border: 1px dashed #cfc6f5; background: var(--purple-light);
  border-radius: 14px; padding: 14px;
}
.product-drawer-scan-box label {
  display: block; font-weight: 700; margin-bottom: 8px; font-size: 14px;
}
.product-drawer-scan-box input {
  width: 100%; font: inherit; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff;
}
.product-drawer-scan-hint {
  margin: 8px 0 0; font-size: 12px; color: var(--muted);
}
.product-drawer-scan-status {
  min-height: 20px; margin: 0; font-size: 13px;
}
.product-drawer-scan-status.ok { color: var(--ok); font-weight: 600; }
.product-drawer-scan-status.error { color: var(--danger); font-weight: 600; }
.product-drawer-delete-actions {
  margin: 0; padding-top: 4px;
}
.product-drawer-delete-actions .danger {
  width: 100%; padding: 12px; border-radius: 12px;
}
.product-drawer-footer {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 16px 24px 24px; border-top: 1px solid var(--border); background: #fff;
}
.product-drawer-nav-btn {
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-weight: 600; font-size: 13px;
  cursor: pointer; white-space: nowrap;
}
.product-drawer-nav-btn:hover:not(:disabled) { background: #fafbff; border-color: #dfe3ef; }
.product-drawer-nav-btn:disabled { opacity: .45; cursor: default; }

.order-drawer { width: min(480px, 100vw); }
.order-drawer-progress {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.order-drawer-items { display: flex; flex-direction: column; gap: 8px; }
.order-item-row {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center;
  padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: #fff;
}
.order-item-row.is-complete { border-color: #bbf7d0; background: #f0fdf4; }
.order-item-row img, .order-item-thumb-empty {
  width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: #f3f4f8;
}
.order-item-thumb-empty { display: flex; align-items: center; justify-content: center; }
.order-item-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.order-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.order-item-qty { font-weight: 700; white-space: nowrap; }
.order-drawer-ambiguous {
  border: 1px solid #fde68a; background: #fffbeb; border-radius: 12px; padding: 12px;
}
.order-drawer-ambiguous button { width: 100%; margin-top: 8px; text-align: left; }
.order-drawer-footer { flex-wrap: wrap; }
.products-table tbody tr.order-row,
table tbody tr.order-row {
  cursor: pointer;
  transition: background .12s ease;
}
table tbody tr.order-row:hover,
table tbody tr.order-row.is-active {
  background: var(--purple-light);
}

.placeholder-page .ph-icon {
  width:72px; height:72px; border-radius:18px; margin:0 auto 16px;
  background:var(--purple-light); display:flex; align-items:center; justify-content:center;
  font-size:32px;
}
.settings-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:12px; }
.settings-tile {
  padding:18px; border:1px solid var(--border); border-radius:14px; background:#fff;
  cursor:pointer; text-align:left; transition:border-color .15s;
}
.settings-tile:hover { border-color:#d8ccff; }
.settings-tile strong { display:block; margin-bottom:4px; }

.dashboard-empty {
  text-align:center; padding:72px 24px; max-width:520px; margin:40px auto;
}
.dashboard-empty .empty-icon {
  width:88px; height:88px; border-radius:22px; margin:0 auto 20px;
  background:var(--purple-light); display:flex; align-items:center; justify-content:center; font-size:36px;
}
.dashboard-empty h2 { margin:0 0 10px; font-size:26px; }
.dashboard-empty p { color:var(--muted); margin:0 0 24px; }

.sidebar-nav button.locked-out {
  opacity:.45; pointer-events:none;
}
.onboarding-banner {
  background:#fff7ed; border:1px solid #fed7aa; color:#9a3412;
  border-radius:14px; padding:14px 18px; margin-bottom:16px; font-size:14px;
}

.settings-delivery-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}
.settings-delivery-grid .integration-platform-card label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
  display: block;
}
.integration-platform-icon--openai {
  background: #ecfdf5;
  color: #047857;
  font-weight: 800;
  font-size: 14px;
}
@media (max-width: 960px) {
  .settings-delivery-grid { grid-template-columns: 1fr; }
}
.integration-card {
  border:1px solid var(--border); border-radius:16px; padding:18px 20px; margin-bottom:12px;
  background:#fff;
}
.integration-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:14px; }
.integration-card-title { display:flex; align-items:center; gap:12px; }
.integration-logo {
  width:44px; height:44px; border-radius:12px; background:#f3efff;
  display:flex; align-items:center; justify-content:center; font-weight:800; color:var(--purple);
}
.integration-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.status-inactive { background:#fee2e2; color:#b91c1c; }
.status-awaiting { background:#fef3c7; color:#b45309; }

.platform-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:16px 0; }
.platform-card {
  border:1px solid var(--border); border-radius:14px; padding:16px; text-align:left;
  background:#fff; cursor:pointer; position:relative;
}
.platform-card:hover:not(:disabled) { border-color:#d8ccff; background:var(--purple-light); }
.platform-card:disabled { opacity:.55; cursor:not-allowed; }
.platform-card .dev-badge {
  position:absolute; top:10px; right:10px; font-size:10px; font-weight:700;
  background:#f3f4f6; color:var(--muted); padding:3px 8px; border-radius:999px;
}
.keys-reveal { margin-top:16px; padding:16px; border-radius:12px; background:#f8f9fc; border:1px solid var(--border); }
.keys-reveal input { width:100%; margin-top:6px; margin-bottom:12px; }
.field-copy-row { display:flex; gap:8px; align-items:center; margin-bottom:12px; }
.field-copy-row input { flex:1; margin:6px 0 0; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:13px; }
.field-copy-row button { margin-top:6px; white-space:nowrap; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns:repeat(2, 1fr); }
  .dash-grid { grid-template-columns:1fr; }
  .dash-grid-2 { grid-template-columns:1fr 1fr; }
}
@media (max-width: 768px) {
  .sidebar { display:none; }
  .topbar, .content-area, .app-footer-banner { padding-left:16px; padding-right:16px; }
  .kpi-grid, .dash-grid-2 { grid-template-columns:1fr; }
}

/* —— Orders (merged picking) —— */
.orders-page-shell { width: 100%; min-width: 0; }
.orders-page-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.orders-page-title { display: flex; align-items: center; gap: 12px; }
.orders-page-title h1 {
  margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
}
.orders-page-title-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: #eef2ff; font-size: 20px;
}
.orders-page-subtitle {
  margin: 8px 0 0; color: var(--muted); font-size: 14px; max-width: 520px;
}
.orders-page-actions-wrap { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.orders-page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.orders-filter-select {
  min-width: 160px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; padding: 0 12px; font-weight: 600; font-size: 13px;
}
.orders-search-wrap {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 12px; background: #fff; min-width: 240px;
}
.orders-search-icon { color: var(--muted); font-size: 14px; }
.orders-search-input {
  border: 0; outline: none; background: transparent; width: 100%; font-size: 13px; font-weight: 500;
}
.orders-tool-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--border); background: #fff;
  font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; text-decoration: none;
}
.orders-tool-btn:hover { border-color: #c4b5fd; background: #faf8ff; }
.orders-tool-icon { font-size: 14px; }
.orders-status-tabs,
.orders-channel-tabs {
  margin: 0 0 14px; gap: 8px; display: flex; flex-wrap: wrap;
}
.orders-status-tabs button,
.orders-channel-tabs button {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px;
  border-radius: 999px; border: 1px solid var(--border); background: #fff;
  font-size: 13px; font-weight: 700; color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03); cursor: pointer;
}
.orders-status-tabs button:hover,
.orders-channel-tabs button:hover { border-color: #c4b5fd; background: #faf8ff; }
.orders-status-tabs button.active,
.orders-channel-tabs button.active {
  background: var(--purple); border-color: var(--purple); color: #fff;
}
.orders-channel-tab-icon { width: 20px; height: 20px; object-fit: contain; display: block; flex-shrink: 0; }
.orders-channel-tab-count {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, .08); line-height: 1.2;
}
.orders-channel-tabs button.active .orders-channel-tab-count,
.orders-status-tabs button.active .orders-channel-tab-count { background: rgba(255,255,255,.22); }
.orders-table-card {
  background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.orders-meta { margin: 0; padding: 14px 18px 0; font-size: 13px; color: var(--muted); }
.orders-table-wrap { overflow-x: auto; }
.orders-table { width: 100%; border-collapse: collapse; }
.orders-table th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.orders-table td {
  padding: 14px 16px; border-bottom: 1px solid #f1f3f8; font-size: 14px; vertical-align: middle;
}
.orders-table tr.order-row { cursor: pointer; }
.orders-table tr.order-row:hover td { background: #fafbff; }
.orders-table tr.order-row.is-active td { background: #f3f0ff; }
.orders-channel-cell { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.orders-channel-cell img { width: 22px; height: 22px; object-fit: contain; }
.orders-packing-link { margin: 16px 0 0; }
.orders-packing-link .linkish {
  border: 0; background: none; color: var(--purple); font: inherit; font-weight: 700; cursor: pointer; padding: 0;
}
.orders-packing-link .linkish:hover { text-decoration: underline; }
.orders-add-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 12px; border: 0; background: var(--purple); color: #fff;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.orders-add-btn:hover { filter: brightness(1.05); }

.add-order-modal { max-width: 760px; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.add-order-section { margin-top: 18px; }
.add-order-section-title { margin: 0 0 10px; font-size: 14px; font-weight: 800; }
.add-order-channel-select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.add-order-modal textarea {
  width: 100%;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  resize: vertical;
}
.add-order-np-block { margin-top: 4px; }
.add-order-np-type-label {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
}
.add-order-np-type-tabs { margin: 8px 0 12px; }
.np-search-wrap { position: relative; }
.np-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.np-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.np-dropdown-item:hover { background: #f7f7fb; color: var(--text); }
.np-dropdown-item.muted,
.np-dropdown-item.error {
  cursor: default;
  color: var(--muted);
  font-weight: 400;
}
.add-order-products-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.add-order-product-search { min-width: 220px; height: 38px; }
.add-order-product-list {
  max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 14px;
  background: #fafbff; padding: 8px;
}
.add-order-product-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  cursor: pointer; background: #fff; border: 1px solid transparent; margin-bottom: 6px;
}
.add-order-product-row:hover { border-color: #e7e9f3; }
.add-order-product-row input { width: 16px; height: 16px; flex-shrink: 0; }
.add-order-product-thumb {
  width: 42px; height: 42px; border-radius: 10px; overflow: hidden; background: #f3f4f8;
  display: grid; place-items: center; flex-shrink: 0;
}
.add-order-product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.add-order-product-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.add-order-product-main strong { font-size: 14px; }
.add-order-product-main span { font-size: 12px; }
.add-order-selected-list {
  display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border);
  border-radius: 14px; padding: 10px; background: #fff;
}
.add-order-selected-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: #fafbff;
}
.add-order-selected-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.add-order-qty-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.add-order-qty-wrap input { width: 72px; height: 36px; }
.add-order-remove-btn { min-width: 36px; height: 36px; padding: 0; }

.ai-consultant-fab {
  position: fixed;
  right: 24px;
  bottom: 64px;
  z-index: 1150;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: none;
  background: var(--purple);
  color: #fff;
  box-shadow: 0 12px 28px rgba(91, 33, 182, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ai-consultant-fab:hover { filter: brightness(1.06); }
.ai-consultant-fab.is-open { background: #312e81; }
.ai-consultant-fab-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.35);
}
.ai-consultant-panel {
  position: fixed;
  right: 24px;
  bottom: 132px;
  z-index: 1150;
  width: min(380px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 160px));
  max-height: min(680px, calc(100vh - 160px));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-consultant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbff;
}
.ai-consultant-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}
.ai-consultant-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}
.ai-consultant-msg p { margin: 0; }
.ai-consultant-msg--assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}
.ai-consultant-msg--user {
  align-self: flex-end;
  background: var(--purple);
  color: #fff;
}
.ai-consultant-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.ai-consultant-form textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
}
.ai-consultant-form button {
  align-self: flex-end;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--purple);
  color: #fff;
  border: none;
  font-weight: 700;
  cursor: pointer;
}
.ai-consultant-form button:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 768px) {
  .orders-page-actions-wrap { align-items: stretch; width: 100%; }
  .orders-page-actions { justify-content: stretch; }
  .orders-search-wrap { min-width: 0; flex: 1; }
}

