/* ============================================================
   NextChatAi — shared design system
   Extracted & consolidated from the product mockups.
   ============================================================ */

:root {
  --ink: #0e0e0f;
  --surface: #f5f3ef;
  --card: #ffffff;
  --accent: #1a6b4a;
  --accent-light: #e6f2ed;
  --accent-mid: #2d9e6e;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --blue: #1d4ed8;
  --blue-light: #dbeafe;
  --violet: #6d28d9;
  --violet-light: #ede9fe;
  --muted: #6b6b6b;
  --border: #e4e0d8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--surface);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }

/* Layout variants ------------------------------------------------ */
body.layout-app { min-height: 100vh; display: flex; }
body.layout-full { height: 100vh; display: flex; overflow: hidden; }
body.layout-auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 80% -10%, #e6f2ed 0%, transparent 60%),
    var(--surface);
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: 220px; min-height: 100vh; background: var(--ink);
  display: flex; flex-direction: column; flex-shrink: 0;
}
body.layout-app .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.logo {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 18px;
  color: #fff; padding: 28px 24px 24px; letter-spacing: -.5px;
  border-bottom: 1px solid #ffffff12;
}
.logo span { color: var(--accent-mid); }
.nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.nav::-webkit-scrollbar { width: 0; }
.nav-label {
  font-size: 10px; font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: #ffffff40; padding: 0 12px; margin: 16px 0 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; cursor: pointer; font-size: 13.5px;
  color: #ffffff80; font-weight: 400; transition: all .15s; margin-bottom: 2px;
}
.nav-item:hover { background: #ffffff0f; color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 500; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .9; }
.nav-badge {
  margin-left: auto; background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 99px; line-height: 16px;
}
.sidebar-footer { padding: 16px 12px; border-top: 1px solid #ffffff10; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.user-chip:hover { background: #ffffff0f; }
.avatar, .avatar-sm {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700;
  color: #fff; flex-shrink: 0; background: var(--accent);
}
.user-name { font-size: 13px; color: #ffffffcc; font-weight: 500; }
.user-role { font-size: 11px; color: #ffffff50; }

/* ============================================================
   Main column + topbar
   ============================================================ */
.main {
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}
body.layout-app .main { margin-left: 220px; }
body.layout-full .main { min-height: 0; overflow: hidden; }

.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
body.layout-app .topbar { position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.page-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent-light); border: 1px solid #b6ddc9;
  border-radius: 99px; padding: 5px 12px 5px 8px;
  font-size: 12.5px; font-weight: 500; color: var(--accent); cursor: pointer;
}
.page-dot { width: 8px; height: 8px; background: var(--accent-mid); border-radius: 50%; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: #fff; transition: background .15s; position: relative;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; color: var(--muted); }
.notif-dot {
  position: absolute; top: 7px; right: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #ef4444; border: 1.5px solid #fff;
}

/* Content area */
.content { padding: 28px; flex: 1; }
body.layout-app .content { padding: 32px; }
body.layout-full .content { overflow-y: auto; }
.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.page-head { margin-bottom: 24px; }
.page-head h1 {
  font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 700;
  letter-spacing: -.5px; margin-bottom: 4px;
}
.page-head p { font-size: 13px; color: var(--muted); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 9px; font-size: 13px;
  font-weight: 500; cursor: pointer; font-family: 'DM Sans', sans-serif;
  border: 1px solid var(--border); background: #fff; color: var(--ink);
  transition: all .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #2a2a2b; }
.btn.success { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.success:hover { background: #145c3d; }
.btn.danger { color: var(--red); border-color: #fecaca; background: #fff5f5; }
.btn.danger:hover { background: #fee2e2; }
.btn.block { width: 100%; justify-content: center; }
.btn.lg { padding: 12px 20px; font-size: 14px; }

/* ============================================================
   Stat / summary cards
   ============================================================ */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }

.stat-card, .sum-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 22px; position: relative; overflow: hidden;
}
.sum-card { border-radius: 12px; padding: 18px 20px; }
.stat-card::before, .sum-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.green::before, .sum-card.green::before { background: var(--accent-mid); }
.stat-card.amber::before, .sum-card.amber::before { background: var(--amber); }
.stat-card.blue::before, .sum-card.blue::before { background: var(--blue); }
.stat-card.red::before, .sum-card.red::before { background: var(--red); }
.stat-label, .sum-label { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
.stat-value, .sum-value {
  font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 700;
  letter-spacing: -1px; line-height: 1; margin-bottom: 6px;
}
.sum-value { font-size: 26px; margin-bottom: 5px; }
.stat-sub, .sum-sub { font-size: 11.5px; color: var(--muted); }
.stat-sub b, .sum-sub b { color: var(--accent); }
.sum-icon {
  position: absolute; right: 16px; top: 16px;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.sum-icon svg { width: 16px; height: 16px; }

/* ============================================================
   Panels
   ============================================================ */
.panel { background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.panel-header {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.panel-action { font-size: 12px; color: var(--accent); font-weight: 500; cursor: pointer; }
.panel-body { padding: 20px 22px; }

.main-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.right-col { display: flex; flex-direction: column; gap: 20px; }

/* ============================================================
   Tabs
   ============================================================ */
.tabs { display: flex; gap: 2px; padding: 10px 22px 0; border-bottom: 1px solid var(--border); }
.tab {
  font-size: 12.5px; font-weight: 500; padding: 7px 14px;
  border-radius: 6px 6px 0 0; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab:hover:not(.active) { color: var(--ink); }

/* ============================================================
   Badges & status pills
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px; letter-spacing: .02em;
}
.badge-new, .mb-new { background: var(--accent-light); color: var(--accent); }
.badge-ai, .mb-ai { background: var(--violet-light); color: var(--violet); }
.badge-human, .mb-human { background: var(--amber-light); color: var(--amber); }
.badge-resolved, .mb-resolved { background: #f1f5f9; color: #64748b; }
.mini-badge { display: inline-block; font-size: 9.5px; font-weight: 600; padding: 2px 6px; border-radius: 99px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px;
}
.sp-active, .s-confirmed { background: var(--accent-light); color: var(--accent); }
.sp-low, .s-pending { background: var(--amber-light); color: var(--amber); }
.sp-critical { background: var(--red-light); color: var(--red); }
.sp-out, .s-cancelled { background: var(--red-light); color: var(--red); }
.s-fulfilled { background: var(--blue-light); color: var(--blue); }
.sp-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ============================================================
   Tables
   ============================================================ */
.order-table { width: 100%; border-collapse: collapse; }
.order-table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase;
  padding: 10px 22px; border-bottom: 1px solid var(--border); background: #fafaf8;
}
.order-table td { padding: 12px 22px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.order-table tr:last-child td { border-bottom: none; }
.order-table tbody tr { transition: background .1s; }
.order-table tbody tr:hover { background: #fafaf8; }
.order-id { font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700; color: var(--muted); }

/* Inline inventory mini-list (overview) */
.inv-row { padding: 12px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.inv-row:last-child { border-bottom: none; }
.inv-icon {
  width: 34px; height: 34px; border-radius: 8px; background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.inv-name { font-size: 13px; font-weight: 500; }
.inv-sku { font-size: 11px; color: var(--muted); }
.inv-right { margin-left: auto; text-align: right; }
.inv-qty { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; }
.inv-qty.low { color: var(--red); }
.inv-qty.ok { color: var(--accent); }
.stock-bar-wrap { width: 60px; height: 4px; background: var(--border); border-radius: 99px; margin-top: 4px; margin-left: auto; }
.stock-bar { height: 100%; border-radius: 99px; }

/* ============================================================
   Conversation rows (overview inbox preview)
   ============================================================ */
.conv-list { max-height: 400px; overflow-y: auto; }
.conv-list::-webkit-scrollbar { width: 4px; }
.conv-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.conv-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 22px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .1s; position: relative;
}
.conv-row:hover { background: #fafaf9; }
.conv-row.unread { background: #f9fffe; }
.conv-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; color: #fff;
}
.conv-name { font-size: 13.5px; font-weight: 500; margin-bottom: 3px; }
.conv-preview { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.conv-meta { margin-left: auto; text-align: right; flex-shrink: 0; }
.conv-time { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.unread-dot {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; background: var(--accent-mid); border-radius: 50%;
}

/* ============================================================
   AI control card (dark)
   ============================================================ */
.ai-card { background: var(--ink); border-radius: 14px; padding: 22px; color: #fff; }
.ai-card-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.ai-card-sub { font-size: 12px; color: #ffffff60; margin-bottom: 18px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.toggle-label { font-size: 13px; color: #ffffffcc; }
.ai-stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.ai-stat { background: #ffffff0d; border-radius: 10px; padding: 12px 14px; }
.ai-stat-val { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 700; color: var(--accent-mid); }
.ai-stat-lbl { font-size: 11px; color: #ffffff50; margin-top: 2px; }

/* Toggle switch */
.toggle { width: 40px; height: 22px; border-radius: 99px; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; }
.toggle.on { background: var(--accent-mid); }
.toggle.off { background: #ffffff30; }
.toggle.off.light { background: #d1d5db; }
.toggle-thumb { position: absolute; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 3px #0004; }
.toggle.on .toggle-thumb { left: 21px; }
.toggle.off .toggle-thumb { left: 3px; }
.toggle.sm { width: 36px; height: 20px; }
.toggle.sm .toggle-thumb { width: 16px; height: 16px; top: 2px; }
.toggle.sm.on .toggle-thumb { left: 18px; }
.toggle.sm.off .toggle-thumb { left: 2px; }

/* ============================================================
   Comment cards
   ============================================================ */
.comment-row { padding: 14px 22px; border-bottom: 1px solid var(--border); }
.comment-row:last-child { border-bottom: none; }
.comment-post { font-size: 11px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.comment-post-dot { width: 5px; height: 5px; background: var(--border); border-radius: 50%; }
.comment-text { font-size: 13px; color: var(--ink); margin-bottom: 6px; line-height: 1.5; }
.comment-reply {
  font-size: 12px; color: var(--accent); background: var(--accent-light);
  border-left: 2px solid var(--accent-mid); padding: 6px 10px; border-radius: 0 6px 6px 0; line-height: 1.4;
}
.comment-footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.comment-from { font-size: 11.5px; font-weight: 500; }
.comment-time { font-size: 11px; color: var(--muted); }

/* ============================================================
   Forms
   ============================================================ */
.form-row { margin-bottom: 16px; }
.form-row:last-child { margin-bottom: 0; }
.form-label { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; display: block; }
.form-input, .form-select, textarea.form-input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 14px; font-size: 13.5px;
  font-family: 'DM Sans', sans-serif; color: var(--ink); outline: none;
}
.form-input:focus, .form-select:focus, textarea.form-input:focus { border-color: var(--accent-mid); background: #fff; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* Search + filter controls */
.action-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.search-wrap { position: relative; flex: 1; max-width: 320px; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%; background: #fff; border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 12px 9px 34px; font-size: 13px; font-family: 'DM Sans', sans-serif; color: var(--ink); outline: none;
}
.search-input:focus { border-color: var(--accent-mid); }
.filter-select {
  background: #fff; border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 32px 9px 12px; font-size: 13px; font-family: 'DM Sans', sans-serif;
  color: var(--ink); outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a7a7a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

/* ============================================================
   Inventory table
   ============================================================ */
.cat-tabs { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.cat-tab {
  display: flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted);
  border: 1px solid transparent; transition: all .15s;
}
.cat-tab:hover { color: var(--ink); background: #fff; border-color: var(--border); }
.cat-tab.active { background: #fff; border-color: var(--border); color: var(--ink); box-shadow: 0 1px 3px #0000000a; }
.cat-count { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 99px; background: var(--surface); color: var(--muted); }
.cat-tab.active .cat-count { background: var(--accent-light); color: var(--accent); }

.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.prod-table { width: 100%; border-collapse: collapse; }
.prod-table thead th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--muted);
  letter-spacing: .07em; text-transform: uppercase; padding: 12px 20px;
  border-bottom: 1px solid var(--border); background: #faf9f6; white-space: nowrap;
}
.prod-table tbody tr { border-bottom: 1px solid #f0ede6; transition: background .1s; cursor: pointer; }
.prod-table tbody tr:last-child { border-bottom: none; }
.prod-table tbody tr:hover { background: #fafaf8; }
.prod-table tbody tr.selected { background: var(--accent-light); }
.prod-table td { padding: 14px 20px; font-size: 13.5px; vertical-align: middle; }
.prod-name-wrap { display: flex; align-items: center; gap: 12px; }
.prod-thumb {
  width: 42px; height: 42px; border-radius: 9px; background: var(--surface);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.prod-name { font-weight: 500; font-size: 13.5px; margin-bottom: 2px; }
.prod-sku { font-size: 11.5px; color: var(--muted); }
.prod-price { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; }
.stock-cell { display: flex; flex-direction: column; gap: 5px; min-width: 100px; }
.stock-num { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; }
.stock-num.ok { color: var(--accent); }
.stock-num.low { color: var(--amber); }
.stock-num.critical { color: var(--red); }
.stock-num.out { color: #9ca3af; }
.stock-bar-bg { height: 4px; background: var(--surface); border-radius: 99px; width: 80px; }
.stock-bar-fill { height: 100%; border-radius: 99px; transition: width .3s; }
.row-actions { display: flex; align-items: center; gap: 6px; opacity: 0; transition: opacity .15s; }
.prod-table tbody tr:hover .row-actions { opacity: 1; }
.row-btn {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer; background: #fff; transition: all .15s;
}
.row-btn:hover { background: var(--surface); }
.row-btn svg { width: 13px; height: 13px; color: var(--muted); }
.row-btn.danger:hover { background: var(--red-light); border-color: #fca5a5; }
.row-btn.danger:hover svg { color: var(--red); }
.sparkline { display: flex; align-items: flex-end; gap: 2px; height: 24px; }
.spark-bar { width: 5px; border-radius: 2px; background: var(--border); }
.alert-strip {
  display: flex; align-items: center; gap: 10px; background: #fff7ed; border: 1px solid #fed7aa;
  border-radius: 10px; padding: 11px 16px; margin-bottom: 18px; font-size: 13px; color: var(--amber);
}
.alert-strip svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-strip strong { font-weight: 600; }
.alert-strip .alert-link { margin-left: auto; font-weight: 500; cursor: pointer; text-decoration: underline; }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: #0008;
  display: flex; align-items: center; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: #fff; border-radius: 16px; width: 480px; max-width: 95vw; box-shadow: 0 24px 60px #0002; transform: translateY(12px); transition: transform .2s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header { padding: 22px 24px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; }
.modal-close { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.modal-close:hover { background: var(--surface); }
.modal-close svg { width: 14px; height: 14px; color: var(--muted); }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.emoji-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.emoji-opt {
  width: 40px; height: 40px; border-radius: 9px; background: var(--surface); border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; transition: all .15s;
}
.emoji-opt:hover { border-color: var(--border); }
.emoji-opt.selected { border-color: var(--accent-mid); background: var(--accent-light); }
.restock-amount { display: flex; align-items: center; gap: 12px; margin: 16px 0; }
.qty-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 18px; font-weight: 500; color: var(--ink); background: #fff; transition: all .15s; flex-shrink: 0; user-select: none;
}
.qty-btn:hover { background: var(--surface); }
.qty-display { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 700; text-align: center; width: 80px; }
.restock-info { background: var(--surface); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.restock-info-row { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); }
.restock-info-row:last-child { margin-bottom: 0; }
.restock-info-row b { color: var(--ink); font-weight: 500; }
.restock-info-row.total { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; }
.restock-info-row.total b { color: var(--accent); font-weight: 700; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeUp .3s ease both; }
.stats-grid > *, .summary-grid > * { animation: fadeUp .3s ease both; }
.stats-grid > *:nth-child(2), .summary-grid > *:nth-child(2) { animation-delay: .05s; }
.stats-grid > *:nth-child(3), .summary-grid > *:nth-child(3) { animation-delay: .1s; }
.stats-grid > *:nth-child(4), .summary-grid > *:nth-child(4) { animation-delay: .15s; }

/* ============================================================
   Topbar dropdowns
   ============================================================ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 44px #0e0e0f1f; min-width: 280px; z-index: 120;
  opacity: 0; transform: translateY(-6px); pointer-events: none; transition: all .15s;
  overflow: hidden;
}
.dropdown.open .dropdown-menu { opacity: 1; transform: translateY(0); pointer-events: all; }
.dropdown-menu.left { right: auto; left: 0; }
.dropdown-head {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.dropdown-head-title { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; }
.dropdown-head-action { font-size: 11.5px; color: var(--accent); font-weight: 500; cursor: pointer; }
.dropdown-list { max-height: 340px; overflow-y: auto; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  font-size: 13px; cursor: pointer; transition: background .12s; border-bottom: 1px solid #f0ede6;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--surface); }
.dropdown-item.current { background: var(--accent-light); }
.dropdown-foot { padding: 10px 16px; border-top: 1px solid var(--border); text-align: center; }
.dropdown-foot a { font-size: 12px; color: var(--accent); font-weight: 500; }
.dd-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.dd-icon svg { width: 16px; height: 16px; }
.dd-icon.human { background: var(--amber-light); color: var(--amber); }
.dd-icon.stock { background: var(--red-light); color: var(--red); }
.dd-icon.order { background: var(--accent-light); color: var(--accent); }
.dd-icon.ai { background: var(--violet-light); color: var(--violet); }
.dd-title { font-size: 12.5px; font-weight: 500; }
.dd-body { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.dd-time { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.dd-unread { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-mid); margin-left: auto; flex-shrink: 0; }
.menu-link { display: flex; align-items: center; gap: 10px; padding: 10px 16px; font-size: 13px; cursor: pointer; transition: background .12s; }
.menu-link:hover { background: var(--surface); }
.menu-link svg { width: 16px; height: 16px; color: var(--muted); }
.menu-link.danger { color: var(--red); }
.menu-link.danger svg { color: var(--red); }

/* ============================================================
   Slide-over drawer
   ============================================================ */
.drawer-overlay {
  position: fixed; inset: 0; background: #0e0e0f55; z-index: 210;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 94vw;
  background: #fff; z-index: 220; box-shadow: -16px 0 48px #0e0e0f1a;
  transform: translateX(100%); transition: transform .25s ease;
  display: flex; flex-direction: column; overflow: hidden;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.drawer-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; }
.drawer-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.drawer-body::-webkit-scrollbar { width: 4px; }
.drawer-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
.drawer-section { margin-bottom: 22px; }
.drawer-section-title { font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.drawer-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-shrink: 0; }

/* Status timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -22px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--border); }
.timeline-item.done .timeline-dot { border-color: var(--accent-mid); background: var(--accent-mid); }
.timeline-item.current .timeline-dot { border-color: var(--accent); background: #fff; }
.timeline-label { font-size: 13px; font-weight: 500; }
.timeline-time { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.line-item { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 0; border-bottom: 1px solid #f0ede6; }
.line-item:last-child { border-bottom: none; }
.line-item.total { font-weight: 600; border-top: 1px solid var(--border); border-bottom: none; margin-top: 4px; padding-top: 10px; }

/* ============================================================
   Toasts
   ============================================================ */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff;
  padding: 12px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 12px 32px #0e0e0f33;
  animation: toastIn .25s ease both; min-width: 240px;
}
.toast.leaving { animation: toastOut .2s ease forwards; }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success svg { color: var(--accent-mid); }
.toast.info svg { color: #60a5fa; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.empty-icon svg { width: 26px; height: 26px; color: var(--muted); }
.empty-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; margin-bottom: 5px; }
.empty-desc { font-size: 13px; color: var(--muted); max-width: 320px; margin: 0 auto 18px; line-height: 1.5; }

/* ============================================================
   Charts (pure CSS/SVG)
   ============================================================ */
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 38px; border-radius: 6px 6px 0 0; background: var(--accent-mid); transition: height .4s ease; position: relative; }
.chart-bar.alt { background: var(--accent-light); border: 1px solid #b6ddc9; }
.chart-x { font-size: 11px; color: var(--muted); }
.chart-val { font-size: 11px; font-weight: 600; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f0ede6; }
.rank-row:last-child { border-bottom: none; }
.rank-num { width: 22px; height: 22px; border-radius: 6px; background: var(--surface); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.rank-bar-bg { flex: 1; height: 6px; background: var(--surface); border-radius: 99px; }
.rank-bar-fill { height: 100%; border-radius: 99px; background: var(--accent-mid); }

/* ============================================================
   Mobile sidebar / hamburger
   ============================================================ */
.hamburger { display: none; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: #fff; align-items: center; justify-content: center; cursor: pointer; }
.hamburger svg { width: 18px; height: 18px; color: var(--ink); }
.sidebar-scrim { display: none; position: fixed; inset: 0; background: #0e0e0f66; z-index: 95; }

@media (max-width: 900px) {
  .hamburger { display: flex; }
  body.layout-app .sidebar,
  body.layout-full .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-scrim { display: block; }
  body.layout-app .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  body.layout-app .content { padding: 18px 16px; }
  .main-grid, .bottom-grid, .stats-grid, .summary-grid { grid-template-columns: 1fr !important; }
  .topbar .page-chip span, .topbar-title { font-size: 14px; }
  .drawer { width: 100%; }
  /* Inbox: collapse the right detail pane on small screens */
  .detail-pane { display: none; }
}
@media (max-width: 600px) {
  .conv-list-pane { width: 100%; }
  .topbar .page-chip { display: none; }
}
