:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #edf1f8;
  --glass: rgba(255, 255, 255, .92);
  --text: #15203a;
  --muted: #657189;
  --subtle: #8792a7;
  --border: rgba(16, 24, 40, .09);
  --border-strong: rgba(16, 24, 40, .15);
  --shadow: 0 18px 45px rgba(28, 39, 68, .12);
  --shadow-soft: 0 8px 24px rgba(28, 39, 68, .08);
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-soft: rgba(139,92,246,.16);
  --success: #10b981;
  --success-soft: rgba(16,185,129,.14);
  --warning: #f59e0b;
  --warning-soft: rgba(245,158,11,.15);
  --danger: #f43f5e;
  --danger-soft: rgba(244,63,94,.14);
  --info: #0284c7;
  --info-soft: rgba(2,132,199,.14);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar-w: 270px;
  --topbar-h: 82px;
  --content-max: 1680px;
  --ease: cubic-bezier(.2,.8,.2,1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080c18;
  --surface: #0e1424;
  --surface-2: #141c30;
  --surface-3: #1a2540;
  --glass: rgba(14, 20, 36, .86);
  --text: #f7f8fc;
  --muted: #99a5bc;
  --subtle: #6f7b93;
  --border: rgba(255,255,255,.09);
  --border-strong: rgba(255,255,255,.15);
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  --shadow-soft: 0 10px 28px rgba(0,0,0,.18);
}

html[data-accent="emerald"] { --accent:#10b981; --accent-strong:#059669; --accent-soft:rgba(16,185,129,.15); }
html[data-accent="blue"] { --accent:#3b82f6; --accent-strong:#2563eb; --accent-soft:rgba(59,130,246,.15); }
html[data-accent="orange"] { --accent:#f97316; --accent-strong:#ea580c; --accent-soft:rgba(249,115,22,.15); }

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 75% -10%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 31rem),
    var(--bg);
  color: var(--text);
  font-family: "Noto Sans Bengali", "Hind Siliguri", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
svg { width: 20px; height: 20px; fill: currentColor; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 52%, white); outline-offset: 2px; }

.skip-link { position: fixed; left: 12px; top: -70px; z-index: 9999; padding: 10px 14px; border-radius: 10px; background: var(--accent); color: #fff; transition: top .2s ease; }
.skip-link:focus { top: 12px; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 24px 18px 18px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
}
.brand-block { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 8px 22px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; background: linear-gradient(145deg, var(--accent), var(--accent-strong)); box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 28%, transparent); color: #fff; font-weight: 900; font-size: 20px; }
.brand-block strong, .brand-block span { display: block; }
.brand-block strong { font-size: 16px; letter-spacing: -.02em; }
.brand-block span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.side-nav { display: grid; gap: 6px; }
.side-nav a {
  position: relative;
  min-height: 48px;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border-radius: 13px;
  color: var(--muted);
  transition: color .18s ease, background .18s ease, transform .18s var(--ease);
}
.side-nav a:hover { color: var(--text); background: var(--surface-2); transform: translateX(2px); }
.side-nav a.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); box-shadow: 0 9px 24px color-mix(in srgb, var(--accent) 20%, transparent); }
.side-nav a b { min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 800; }
.side-nav a.active b { background: rgba(255,255,255,.18); color: #fff; }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; }
.demo-card { display: flex; gap: 10px; align-items: flex-start; padding: 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; }
.demo-card strong, .demo-card small { display: block; }
.demo-card strong { font-size: 12px; }
.demo-card small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.status-dot { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px var(--success-soft); }
.profile-card { width: 100%; border: 0; display: grid; grid-template-columns: 36px 1fr 18px; gap: 10px; align-items: center; padding: 10px; border-radius: 13px; background: transparent; text-align: left; cursor: pointer; }
.profile-card:hover { background: var(--surface-2); }
.profile-card .avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); font-weight: 900; }
.profile-card strong, .profile-card small { display: block; }
.profile-card strong { font-size: 12px; }
.profile-card small { color: var(--muted); font-size: 10px; }
.profile-card svg { width: 16px; height: 16px; color: var(--muted); }

.workspace { min-height: 100vh; padding-left: var(--sidebar-w); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(18px);
}
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.page-heading p, .page-heading h1 { margin: 0; }
.page-heading p { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; }
.page-heading h1 { margin-top: 2px; font-size: clamp(20px, 2vw, 27px); line-height: 1.16; letter-spacing: -.03em; }
.global-search { position: relative; width: min(30vw, 410px); height: 46px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.global-search > svg { flex: 0 0 auto; color: var(--muted); }
.global-search input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.global-search input::placeholder { color: var(--subtle); }
kbd { flex: 0 0 auto; padding: 3px 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--subtle); font-size: 10px; font-family: inherit; }
.search-results { position: absolute; top: calc(100% + 9px); left: 0; right: 0; max-height: 410px; overflow: auto; padding: 8px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.search-result { width: 100%; display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 0; border-radius: 11px; color: var(--text); background: transparent; text-align: left; cursor: pointer; }
.search-result:hover { background: var(--surface-2); }
.search-result .result-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); font-size: 18px; }
.search-result strong, .search-result small { display: block; }
.search-result small { color: var(--muted); }
.search-result em { color: var(--subtle); font-size: 11px; font-style: normal; }

.icon-button, .primary-button, .secondary-button, .danger-button, .ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform .16s var(--ease), background .16s ease, border-color .16s ease, opacity .16s ease;
}
button:active { transform: scale(.97); }
button:disabled { cursor: not-allowed; opacity: .48; }
.icon-button { width: 44px; padding: 0; background: var(--surface-2); border: 1px solid var(--border); }
.icon-button:hover { background: var(--surface-3); }
.primary-button { padding: 0 16px; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); color: #fff; font-weight: 800; box-shadow: 0 9px 24px color-mix(in srgb, var(--accent) 20%, transparent); }
.primary-button:hover { filter: brightness(1.06); }
.secondary-button { padding: 0 16px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 750; }
.secondary-button:hover { background: var(--surface-3); }
.ghost-button { padding: 0 13px; min-height: 38px; background: transparent; color: var(--muted); }
.ghost-button:hover { color: var(--text); background: var(--surface-2); }
.danger-button { padding: 0 16px; background: var(--danger); color: #fff; font-weight: 800; }
.notification-button { position: relative; }
.notification-button span { position: absolute; right: 8px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface-2); }
.mobile-menu { display: none; }

main { width: min(100%, var(--content-max)); margin: 0 auto; padding: 26px 28px 50px; }
.view { animation: viewIn .26s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.view-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.view-header h2, .view-header p { margin: 0; }
.view-header h2 { font-size: clamp(22px, 2.7vw, 34px); line-height: 1.2; letter-spacing: -.04em; }
.view-header p { max-width: 660px; margin-top: 7px; color: var(--muted); }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: .14em; font-weight: 900; }
.demo-badge, .tag, .status-badge, .risk-badge, .visibility-badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; border-radius: 999px; font-weight: 800; white-space: nowrap; }
.demo-badge { padding: 5px 9px; background: var(--accent-soft); color: var(--accent); font-size: 10px; }
.tag { padding: 5px 9px; background: var(--surface-3); color: var(--muted); font-size: 10px; }

.grid { display: grid; gap: 16px; }
.metrics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.metric-card { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--surface-2) 75%, transparent)); box-shadow: var(--shadow-soft); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.metric-icon.success { background: var(--success-soft); color: var(--success); }
.metric-icon.warning { background: var(--warning-soft); color: var(--warning); }
.metric-icon.info { background: var(--info-soft); color: var(--info); }
.metric-value { margin-top: 16px; font-size: clamp(22px, 2.4vw, 31px); line-height: 1; letter-spacing: -.04em; font-weight: 900; overflow-wrap: anywhere; }
.metric-meta { display: flex; align-items: center; gap: 7px; margin-top: 11px; color: var(--muted); font-size: 11px; }
.metric-meta .up { color: var(--success); font-weight: 800; }
.metric-meta .down { color: var(--danger); font-weight: 800; }

.dashboard-grid { grid-template-columns: minmax(0, 1.7fr) minmax(290px, .8fr); align-items: start; }
.stack { display: grid; gap: 16px; }
.panel { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-soft); overflow: hidden; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.panel-header h3, .panel-header p { margin: 0; }
.panel-header h3 { font-size: 16px; letter-spacing: -.02em; }
.panel-header p { margin-top: 4px; color: var(--muted); font-size: 11px; }
.panel-body { padding: 18px 20px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { min-height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-soft); }
.chart-wrap { position: relative; height: 300px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.chart-tooltip { position: absolute; z-index: 2; pointer-events: none; padding: 8px 10px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow-soft); font-size: 11px; transform: translate(-50%, -110%); }
.chart-legend { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 10px; color: var(--muted); font-size: 11px; }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); }
.chart-legend i.orders { background: var(--info); }

.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-action { min-height: 92px; border: 1px solid var(--border); border-radius: 15px; padding: 13px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; background: var(--surface-2); text-align: left; cursor: pointer; }
.quick-action:hover { border-color: color-mix(in srgb, var(--accent) 42%, var(--border)); background: var(--accent-soft); }
.quick-action .qa-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--accent-soft); color: var(--accent); }
.quick-action strong { font-size: 12px; }
.quick-action small { color: var(--muted); font-size: 10px; }

.status-overview { display: grid; gap: 12px; }
.status-row { display: grid; grid-template-columns: minmax(90px, 1fr) auto; gap: 10px; align-items: center; }
.status-row .status-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.status-row .status-name strong { color: var(--text); }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.activity-list, .mini-list { display: grid; gap: 0; }
.activity-item { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 11px; padding: 11px 0; }
.activity-item:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 45px; bottom: -6px; width: 1px; background: var(--border); }
.activity-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-2); color: var(--accent); z-index: 1; }
.activity-copy strong, .activity-copy small { display: block; }
.activity-copy strong { font-size: 11px; font-weight: 750; }
.activity-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search-field { position: relative; min-width: 230px; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-field svg { color: var(--muted); }
.filter-select, .date-input { height: 44px; min-width: 145px; padding: 0 36px 0 12px; border: 1px solid var(--border); border-radius: 13px; background-color: var(--surface); color: var(--text); }
.bulk-bar { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 12px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 13px; background: var(--accent-soft); }
.bulk-bar span { font-size: 12px; font-weight: 800; }
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.data-panel { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-soft); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: var(--surface-2); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; font-weight: 900; }
td { font-size: 12px; }
tbody tr { transition: background .14s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
.table-main { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.table-main strong, .table-main small { display: block; }
.table-main strong { font-size: 12px; }
.table-main small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.product-thumb { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: linear-gradient(145deg, var(--accent-soft), var(--surface-3)); font-size: 21px; }
.customer-avatar { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: var(--surface-3); color: var(--accent); font-size: 11px; font-weight: 900; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-actions button { width: 34px; height: 34px; min-height: 34px; border: 0; border-radius: 9px; display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; }
.row-actions button:hover { background: var(--surface-3); color: var(--text); }
.row-actions svg { width: 17px; height: 17px; }
.checkbox { width: 18px; height: 18px; accent-color: var(--accent); }
.status-badge { padding: 5px 9px; font-size: 10px; }
.status-new { color: var(--info); background: var(--info-soft); }
.status-confirmed { color: #a78bfa; background: rgba(167,139,250,.14); }
.status-packed { color: #f59e0b; background: rgba(245,158,11,.14); }
.status-shipped { color: #22d3ee; background: rgba(34,211,238,.14); }
.status-delivered { color: var(--success); background: var(--success-soft); }
.status-cancelled, .status-returned { color: var(--danger); background: var(--danger-soft); }
.stock-good { color: var(--success); font-weight: 850; }
.stock-low { color: var(--warning); font-weight: 850; }
.stock-out { color: var(--danger); font-weight: 850; }
.visibility-badge { padding: 4px 8px; font-size: 9px; }
.visibility-on { color: var(--success); background: var(--success-soft); }
.visibility-off { color: var(--muted); background: var(--surface-3); }
.risk-badge { padding: 4px 8px; font-size: 9px; }
.risk-low { color: var(--success); background: var(--success-soft); }
.risk-medium { color: var(--warning); background: var(--warning-soft); }
.risk-high { color: var(--danger); background: var(--danger-soft); }

.mobile-card-list { display: none; }
.entity-card { padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-soft); }
.entity-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.entity-card-main { display: flex; gap: 11px; min-width: 0; }
.entity-card-main > div:last-child { min-width: 0; }
.entity-card-main strong, .entity-card-main small { display: block; }
.entity-card-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-card-main small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.entity-card-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.entity-card-grid div { padding: 9px; border-radius: 11px; background: var(--surface-2); }
.entity-card-grid span, .entity-card-grid strong { display: block; }
.entity-card-grid span { color: var(--muted); font-size: 9px; }
.entity-card-grid strong { margin-top: 2px; font-size: 11px; }
.entity-card-actions { margin-top: 11px; display: flex; gap: 7px; }
.entity-card-actions button { flex: 1; min-height: 40px; }

.product-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.product-card { position: relative; padding: 15px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-soft); overflow: hidden; }
.product-card::before { content:""; position:absolute; inset:0; pointer-events:none; background: radial-gradient(circle at 95% 0%, var(--accent-soft), transparent 40%); }
.product-card-head { position: relative; display: flex; justify-content: space-between; gap: 9px; }
.product-art { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: var(--surface-2); font-size: 30px; }
.product-menu { width: 34px; height: 34px; min-height: 34px; }
.product-card h3 { position: relative; margin: 14px 0 3px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-card .sku { position: relative; color: var(--muted); font-size: 10px; }
.product-price-row { position: relative; display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-top: 13px; }
.product-price-row strong { font-size: 18px; }
.product-price-row small { color: var(--muted); font-size: 9px; }
.product-card-meta { position: relative; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.product-card-meta div { padding: 8px; border-radius: 10px; background: var(--surface-2); }
.product-card-meta span, .product-card-meta strong { display:block; }
.product-card-meta span { color: var(--muted); font-size: 8px; }
.product-card-meta strong { margin-top: 2px; font-size: 10px; }
.product-card-actions { position: relative; display: flex; gap: 7px; margin-top: 12px; }
.product-card-actions button { flex: 1; min-height: 39px; font-size: 11px; }

.summary-strip { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.summary-item { padding: 14px 16px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); }
.summary-item span, .summary-item strong { display: block; }
.summary-item span { color: var(--muted); font-size: 10px; }
.summary-item strong { margin-top: 5px; font-size: 18px; }

.finance-grid { grid-template-columns: minmax(0, 1.2fr) minmax(330px, .8fr); align-items: start; }
.finance-breakdown { display: grid; gap: 12px; }
.breakdown-row { display: flex; justify-content: space-between; gap: 15px; align-items: center; }
.breakdown-row span { color: var(--muted); }
.breakdown-row strong { font-size: 13px; }
.breakdown-row.total { padding-top: 12px; border-top: 1px solid var(--border); }
.breakdown-row.total span, .breakdown-row.total strong { color: var(--text); font-size: 16px; font-weight: 900; }
.category-bars { display: grid; gap: 14px; }
.category-bar-head { display:flex; justify-content:space-between; gap:10px; font-size:11px; }
.category-bar-head span { color:var(--muted); }
.category-bar .progress { margin-top:7px; }

.settings-layout { display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 16px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 20px); display: grid; gap: 5px; padding: 8px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.settings-nav button { min-height: 42px; border:0; border-radius:11px; padding:0 12px; background:transparent; color:var(--muted); text-align:left; cursor:pointer; }
.settings-nav button.active { background:var(--accent-soft); color:var(--accent); font-weight:800; }
.settings-content { display:grid; gap:16px; }
.settings-section { padding:20px; border:1px solid var(--border); border-radius:var(--radius-lg); background:var(--surface); }
.settings-section h3, .settings-section p { margin:0; }
.settings-section p { margin-top:5px; color:var(--muted); font-size:11px; }
.settings-form { margin-top:18px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.color-options { display:flex; gap:10px; flex-wrap:wrap; margin-top:14px; }
.color-option { width:46px; height:46px; min-height:46px; border:3px solid transparent; border-radius:14px; cursor:pointer; }
.color-option.active { border-color:var(--text); box-shadow:0 0 0 3px var(--accent-soft); }
.color-option[data-value="violet"] { background:#8b5cf6; }
.color-option[data-value="emerald"] { background:#10b981; }
.color-option[data-value="blue"] { background:#3b82f6; }
.color-option[data-value="orange"] { background:#f97316; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.danger-zone .danger-button { margin-top:16px; }
.data-actions { display:flex; gap:10px; flex-wrap:wrap; margin-top:16px; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 750; }
.field input, .field select, .field textarea {
  width: 100%; min-width: 0; min-height: 45px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; outline: 0; background: var(--surface-2); color: var(--text); resize: vertical;
}
.field textarea { min-height: 74px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.field small { color: var(--subtle); font-size: 9px; }
.field-error { min-height: 0; color: var(--danger) !important; }
.field-span-2 { grid-column: span 2; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.switch-field { min-height: 44px; display:flex; align-items:center; gap:10px; cursor:pointer; }
.switch-field input { position:absolute; opacity:0; pointer-events:none; }
.switch { position:relative; width:44px; height:24px; flex:0 0 auto; border-radius:999px; background:var(--surface-3); transition:.18s ease; }
.switch::after { content:""; position:absolute; width:18px; height:18px; left:3px; top:3px; border-radius:50%; background:#fff; box-shadow:0 2px 6px rgba(0,0,0,.25); transition:.18s var(--ease); }
.switch-field input:checked + .switch { background:var(--accent); }
.switch-field input:checked + .switch::after { transform:translateX(20px); }
.switch-field input:focus-visible + .switch { outline:3px solid var(--accent-soft); }
.margin-preview { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:12px; border-radius:12px; background:var(--success-soft); color:var(--success); }
.selected-product { display:flex; align-items:center; gap:11px; padding:12px; border-radius:13px; background:var(--surface-2); }

.drawer { position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(520px, 100%); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); transform: translateX(103%); transition: transform .24s var(--ease); }
.drawer.open { transform: none; }
.drawer-header, .sheet-header { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; padding:18px 20px; border-bottom:1px solid var(--border); }
.drawer-header h2, .sheet-header h2 { margin:0; font-size:20px; }
.drawer-body { flex:1; min-height:0; overflow:auto; padding:20px; }
.sheet-backdrop { position:fixed; inset:0; z-index:80; background:rgba(2,6,23,.55); backdrop-filter:blur(3px); animation:fadeIn .18s ease; }
@keyframes fadeIn { from { opacity:0; } }
.detail-section { padding:15px; border:1px solid var(--border); border-radius:15px; background:var(--surface-2); margin-bottom:12px; }
.detail-section h3 { margin:0 0 12px; font-size:13px; }
.detail-row { display:flex; justify-content:space-between; gap:14px; padding:7px 0; font-size:11px; }
.detail-row span { color:var(--muted); }
.detail-row strong { text-align:right; }
.order-items { display:grid; gap:9px; }
.order-item { display:grid; grid-template-columns:40px 1fr auto; gap:10px; align-items:center; padding:10px; border-radius:12px; background:var(--surface); }
.order-item strong, .order-item small { display:block; }
.order-item small { color:var(--muted); font-size:9px; }
.timeline { display:grid; }
.timeline-item { position:relative; display:grid; grid-template-columns:24px 1fr; gap:10px; padding:0 0 16px; }
.timeline-item::after { content:""; position:absolute; left:11px; top:23px; bottom:0; width:2px; background:var(--border); }
.timeline-item:last-child::after { display:none; }
.timeline-dot { width:24px; height:24px; display:grid; place-items:center; border-radius:50%; background:var(--surface-3); color:var(--muted); font-size:9px; z-index:1; }
.timeline-item.done .timeline-dot { background:var(--success-soft); color:var(--success); }
.timeline-item.current .timeline-dot { background:var(--accent); color:#fff; box-shadow:0 0 0 5px var(--accent-soft); }
.timeline-copy strong, .timeline-copy small { display:block; }
.timeline-copy strong { font-size:11px; }
.timeline-copy small { color:var(--muted); font-size:9px; }
.drawer-actions { position:sticky; bottom:-20px; display:flex; gap:8px; margin:18px -20px -20px; padding:14px 20px calc(14px + env(safe-area-inset-bottom)); background:var(--glass); border-top:1px solid var(--border); backdrop-filter:blur(16px); }
.drawer-actions button { flex:1; }

.bottom-sheet { position:fixed; z-index:95; left:50%; bottom:0; width:min(560px,100%); max-height:min(82vh,720px); overflow:auto; padding-bottom:env(safe-area-inset-bottom); border:1px solid var(--border); border-bottom:0; border-radius:24px 24px 0 0; background:var(--surface); box-shadow:var(--shadow); transform:translate(-50%,105%); transition:transform .24s var(--ease); }
.bottom-sheet.open { transform:translate(-50%,0); }
.sheet-handle { width:44px; height:4px; margin:10px auto 0; border-radius:99px; background:var(--border-strong); }
.sheet-content { padding:16px 20px 22px; }
.action-list { display:grid; gap:9px; }
.action-item { width:100%; display:grid; grid-template-columns:42px 1fr 18px; gap:11px; align-items:center; padding:11px; border:1px solid var(--border); border-radius:14px; background:var(--surface-2); color:var(--text); text-align:left; cursor:pointer; }
.action-item:hover { border-color:color-mix(in srgb,var(--accent) 45%,var(--border)); }
.action-item .action-icon { width:42px; height:42px; display:grid; place-items:center; border-radius:12px; background:var(--accent-soft); color:var(--accent); }
.action-item strong, .action-item small { display:block; }
.action-item small { margin-top:2px; color:var(--muted); font-size:10px; }
.action-item > svg { width:16px; height:16px; color:var(--muted); }

.modal { width:min(720px,calc(100% - 24px)); max-height:min(90vh,820px); padding:0; border:1px solid var(--border); border-radius:22px; background:var(--surface); color:var(--text); box-shadow:var(--shadow); overflow:hidden; }
.compact-modal { width:min(560px,calc(100% - 24px)); }
.modal::backdrop, .confirm-dialog::backdrop { background:rgba(2,6,23,.68); backdrop-filter:blur(4px); }
.modal form { max-height:inherit; display:flex; flex-direction:column; }
.modal-header { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; padding:18px 20px; border-bottom:1px solid var(--border); }
.modal-header h2 { margin:0; font-size:20px; }
.modal-body { overflow:auto; padding:20px; }
.modal-footer { display:flex; justify-content:flex-end; gap:9px; padding:14px 20px calc(14px + env(safe-area-inset-bottom)); border-top:1px solid var(--border); background:var(--surface-2); }
.confirm-dialog { width:min(420px,calc(100% - 24px)); padding:24px; border:1px solid var(--border); border-radius:22px; background:var(--surface); color:var(--text); text-align:center; box-shadow:var(--shadow); }
.confirm-dialog h2 { margin:14px 0 6px; }
.confirm-dialog p { margin:0; color:var(--muted); }
.confirm-icon { width:52px; height:52px; margin:auto; display:grid; place-items:center; border-radius:16px; background:var(--danger-soft); color:var(--danger); font-size:24px; font-weight:900; }
.confirm-actions { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-top:20px; }
.toast-region { position:fixed; right:20px; bottom:20px; z-index:150; width:min(360px,calc(100% - 24px)); display:grid; gap:9px; pointer-events:none; }
.toast { display:grid; grid-template-columns:34px 1fr auto; gap:10px; align-items:center; padding:12px; border:1px solid var(--border); border-radius:14px; background:var(--surface); box-shadow:var(--shadow); animation:toastIn .24s var(--ease); pointer-events:auto; }
@keyframes toastIn { from { opacity:0; transform:translateY(12px) scale(.97); } }
.toast-icon { width:34px; height:34px; display:grid; place-items:center; border-radius:10px; background:var(--success-soft); color:var(--success); }
.toast.error .toast-icon { background:var(--danger-soft); color:var(--danger); }
.toast.warning .toast-icon { background:var(--warning-soft); color:var(--warning); }
.toast strong, .toast small { display:block; }
.toast strong { font-size:11px; }
.toast small { color:var(--muted); font-size:9px; }
.toast button { width:28px; height:28px; border:0; border-radius:8px; background:transparent; color:var(--muted); cursor:pointer; }

.empty-state { padding:48px 20px; text-align:center; }
.empty-state .empty-icon { width:62px; height:62px; margin:0 auto 14px; display:grid; place-items:center; border-radius:20px; background:var(--surface-2); color:var(--accent); }
.empty-state h3 { margin:0; }
.empty-state p { max-width:430px; margin:7px auto 16px; color:var(--muted); }
.mobile-bottom-nav { display:none; }
.mobile-only { display:none; }

@media (max-width: 1280px) {
  :root { --sidebar-w: 238px; }
  .product-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .metrics-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width: 1024px) {
  :root { --sidebar-w: 84px; }
  .sidebar { padding-inline:12px; }
  .brand-block { justify-content:center; padding-inline:0; }
  .brand-block > div:last-child, .side-nav a span, .side-nav a b, .sidebar-foot { display:none; }
  .side-nav a { grid-template-columns:1fr; place-items:center; padding:0; }
  .dashboard-grid, .finance-grid { grid-template-columns:1fr; }
  .settings-layout { grid-template-columns:1fr; }
  .settings-nav { position:static; display:flex; overflow:auto; }
  .settings-nav button { white-space:nowrap; }
  .global-search { width:min(39vw,360px); }
}

@media (max-width: 760px) {
  :root { --topbar-h: 66px; }
  body { padding-bottom:calc(74px + env(safe-area-inset-bottom)); }
  .sidebar {
    width:min(310px,86vw);
    transform:translateX(-103%);
    transition:transform .24s var(--ease);
    box-shadow:var(--shadow);
    z-index: 85;
  }
  .sidebar.open { transform:none; }
  .brand-block { justify-content:flex-start; }
  .brand-block > div:last-child, .side-nav a span, .side-nav a b, .sidebar-foot { display:block; }
  .side-nav a { grid-template-columns:24px 1fr auto; place-items:initial; padding:0 13px; }
  .sidebar-foot { margin-top:auto; }
  .workspace { padding-left:0; }
  .topbar { height:var(--topbar-h); padding:10px 14px; }
  .mobile-menu { display:inline-flex; }
  .page-heading p { display:none; }
  .page-heading h1 { font-size:19px; }
  .global-search, .desktop-quick { display:none; }
  main { padding:18px 14px 28px; }
  .view-header { align-items:flex-start; margin-bottom:16px; }
  .view-header h2 { font-size:24px; }
  .view-header p { font-size:12px; }
  .header-actions .secondary-button span, .header-actions .primary-button span { display:none; }
  .header-actions .secondary-button, .header-actions .primary-button { width:44px; padding:0; }
  .metrics-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .metric-card { padding:14px; }
  .metric-value { font-size:22px; }
  .metric-meta { font-size:9px; }
  .panel-header, .panel-body { padding:15px; }
  .chart-wrap { height:245px; }
  .summary-strip { grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
  .toolbar { align-items:stretch; }
  .toolbar-left, .toolbar-right { width:100%; }
  .search-field { flex:1; min-width:0; }
  .filter-select { flex:1; min-width:0; }
  .data-panel .table-wrap { display:none; }
  .mobile-card-list { display:grid; gap:10px; padding:10px; }
  .product-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .product-card { padding:12px; }
  .product-art { width:50px; height:50px; font-size:25px; }
  .product-card h3 { font-size:12px; }
  .product-price-row strong { font-size:16px; }
  .product-card-meta { grid-template-columns:1fr; }
  .settings-form, .form-grid { grid-template-columns:1fr; }
  .field-span-2 { grid-column:auto; }
  .settings-section { padding:15px; }
  .finance-grid { gap:10px; }
  .drawer { width:100%; }
  .drawer-header { padding-top:calc(14px + env(safe-area-inset-top)); }
  .drawer-actions { bottom:-20px; }
  .modal { width:100%; max-height:92dvh; margin:auto 0 0; border-radius:22px 22px 0 0; }
  .modal[open] { position:fixed; inset:auto 0 0; }
  .modal-body { padding:16px; }
  .modal-header { padding:15px 16px; }
  .modal-footer { padding-inline:16px; }
  .mobile-bottom-nav {
    position:fixed; z-index:70; left:0; right:0; bottom:0; height:calc(66px + env(safe-area-inset-bottom)); padding:6px 8px env(safe-area-inset-bottom); display:grid; grid-template-columns:repeat(5,1fr); align-items:end; border-top:1px solid var(--border); background:var(--glass); backdrop-filter:blur(18px);
  }
  .mobile-bottom-nav a, .mobile-bottom-nav button { position:relative; height:54px; border:0; border-radius:12px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; background:transparent; color:var(--muted); font-size:9px; cursor:pointer; }
  .mobile-bottom-nav a.active { color:var(--accent); }
  .mobile-bottom-nav svg { width:20px; height:20px; }
  .mobile-bottom-nav b { position:absolute; top:3px; right:calc(50% - 20px); min-width:17px; height:17px; padding:0 4px; display:grid; place-items:center; border-radius:99px; background:var(--danger); color:#fff; font-size:8px; }
  .mobile-bottom-nav .mobile-fab { width:54px; height:54px; margin:auto auto 11px; border-radius:18px; background:linear-gradient(135deg,var(--accent),var(--accent-strong)); color:#fff; box-shadow:0 9px 24px color-mix(in srgb,var(--accent) 30%,transparent); }
  .mobile-bottom-nav .mobile-fab svg { width:24px; height:24px; }
  .toast-region { right:12px; bottom:calc(78px + env(safe-area-inset-bottom)); }
  .desktop-only { display:none !important; }
  .mobile-only { display:initial; }
}

@media (max-width: 430px) {
  .metrics-grid { grid-template-columns:1fr 1fr; }
  .metric-label { font-size:10px; }
  .metric-icon { width:32px; height:32px; }
  .metric-icon svg { width:17px; height:17px; }
  .metric-value { font-size:20px; }
  .quick-actions { grid-template-columns:1fr 1fr; }
  .product-grid { grid-template-columns:1fr 1fr; }
  .product-card-actions { flex-direction:column; }
  .product-card-actions button { width:100%; }
  .summary-item strong { font-size:16px; }
  .bulk-bar { align-items:flex-start; flex-direction:column; }
  .bulk-actions { width:100%; }
  .bulk-actions button, .bulk-actions select { flex:1; }
}

@media (max-width: 350px) {
  main { padding-inline:10px; }
  .topbar { padding-inline:10px; }
  .metrics-grid, .product-grid { grid-template-columns:1fr; }
  .summary-strip { grid-template-columns:1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
}

@media print {
  body * { visibility:hidden !important; }
  #printArea, #printArea * { visibility:visible !important; }
  #printArea { position:absolute; inset:0; width:100%; color:#111; background:#fff; padding:30px; }
  .no-print { display:none !important; }
}

/* Closed overlays stay fully outside the visual and accessibility flow. */
.drawer, .bottom-sheet { visibility: hidden; opacity: 0; pointer-events: none; }
.drawer.open, .bottom-sheet.open { visibility: visible; opacity: 1; pointer-events: auto; }
.quick-action strong, .quick-action small { display: block; }
@media (max-width: 760px) {
  .panel > .table-wrap { display: none; }
  .panel > .mobile-card-list { display: grid; padding: 10px; }
}
