:root {
  --bg: #eef2f7;
  --card: #fff;
  --border: #dbe3ef;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --warn: #b45309;
  --ok: #047857;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, Segoe UI, Roboto, Arial, sans-serif;
}

.layout-root {
  min-height: 100vh;
}

.topbar {
  background: linear-gradient(90deg, #0f172a, #1e3a8a);
  color: #f8fafc;
  padding: 16px 22px;
}

.topbar div {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.topnav {
  display: flex;
  gap: 8px;
}

.topnav a {
  color: #dbeafe;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.topnav a.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 600;
}

.topbar span {
  color: #bfdbfe;
  font-size: 13px;
}

.main-area {
  padding: 20px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.page-heading h1 {
  margin: 0;
  font-size: 26px;
}

.page-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.page-heading p.ecom-purchasing-note {
  flex: 1;
  margin: 0;
  padding: 0 12px;
  color: #dc2626;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.heading-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  background: #0f766e;
}

.stock-table {
  max-height: 70vh;
}

.current-stock-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 250px);
}

.current-stock-table {
  flex: 1;
  max-height: calc(100vh - 330px);
}

.column-filter-row th {
  padding: 6px 8px;
  background: #fff;
}

.column-filter-inp {
  min-width: 120px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
}

.stock-table .grid th,
.stock-table .grid td {
  white-space: nowrap;
}

.ecom-cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.card.clickable {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.1);
}

.card.active {
  outline: 2px solid var(--accent);
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-picking {
  background: #fef3c7;
  color: #92400e;
}

.status-packed {
  background: #d1fae5;
  color: #065f46;
}

.status-shipped {
  background: #dbeafe;
  color: #1e40af;
}

.status-cancelled {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #94a3b8;
}

.status-other {
  background: #e2e8f0;
  color: #475569;
}

.ecom-status-btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.ecom-status-btn:hover .status-badge {
  outline: 2px solid #94a3b8;
}

.ecom-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.ecom-modal {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px 18px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.ecom-modal h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.ecom-modal p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.ecom-modal-info {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155 !important;
}

.ecom-modal label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 8px 0 4px;
}

.ecom-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

.status-incomplete {
  background: #fee2e2;
  color: #991b1b;
  margin-left: 4px;
}

.ecom-short-pick-banner {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 700;
}

.ecom-sku-short td {
  color: #991b1b;
  background: #fef2f2;
}

.ecom-sku-short .ecom-sku-code {
  text-decoration: line-through;
}

.ecom-sku-missing-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  vertical-align: middle;
}

.qty-complete {
  color: var(--ok);
  font-weight: 700;
}

.qty-pending {
  color: #b91c1c;
  font-weight: 700;
}

.panel-loading {
  opacity: 0.72;
  pointer-events: none;
}

.loading-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 600;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: ecom-spin 0.7s linear infinite;
  flex: 0 0 auto;
}

@keyframes ecom-spin {
  to { transform: rotate(360deg); }
}

.ecom-content-layout.is-loading {
  position: relative;
}

.ecom-content-layout.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 252, 0.35);
  pointer-events: none;
  border-radius: 8px;
}

.ecom-detail-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  color: #334155;
  font-weight: 600;
}

.ecom-detail-panels {
  display: grid;
  grid-template-columns: minmax(280px, 1.1fr) minmax(280px, 1fr);
  gap: 14px;
  align-items: start;
}

.ecom-products-panel h3,
.cargo-visual h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.ecom-products-grid {
  font-size: 12px;
}

.ecom-products-grid th,
.ecom-products-grid td {
  padding: 5px 7px;
}

@media (max-width: 1100px) {
  .ecom-detail-panels {
    grid-template-columns: 1fr;
  }
}

.ecom-table {
  max-height: 620px;
}

.ecom-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 130px);
}

.ecom-page .ecom-toolbar-row {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 20;
  padding-bottom: 12px;
  background: var(--bg);
}

.ecom-page .ecom-content-layout {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.ecom-page .ecom-order-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
}

.ecom-page .ecom-order-panel h2 {
  flex: 0 0 auto;
}

.ecom-order-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  margin-bottom: 8px;
  position: sticky;
  top: var(--ecom-toolbar-height, 0px);
  z-index: 19;
  padding: 10px 0 8px;
  background: var(--card);
}

.ecom-order-panel-head h2 {
  margin: 0;
}

.ecom-order-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted, #64748b);
}

.ecom-order-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 600;
}

.ecom-page-size {
  min-width: 72px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
}

.ecom-pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ecom-pager-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  line-height: 1;
}

.ecom-pager-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.ecom-pager-info {
  white-space: nowrap;
}

.ecom-hscroll-top {
  flex: 0 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  height: 14px;
  margin-bottom: 2px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: #f8fafc;
  position: sticky;
  top: calc(var(--ecom-toolbar-height, 0px) + var(--ecom-order-header-height, 0px));
  z-index: 18;
}

.ecom-hscroll-spacer {
  height: 1px;
  pointer-events: none;
}

.ecom-page .ecom-order-grid {
  flex: 0 0 auto;
  min-height: 260px;
  height: calc(100vh - var(--ecom-toolbar-height, 0px) - var(--ecom-order-header-height, 0px) - 72px);
  max-height: calc(100vh - var(--ecom-toolbar-height, 0px) - var(--ecom-order-header-height, 0px) - 72px);
  overflow: auto;
  border-radius: 0 0 10px 10px;
}

/* Grid kendi alanında kaydırılırken hem sütun başlıkları hem filtre satırı görünür kalır. */
.ecom-order-grid .grid thead {
  position: static;
}

.ecom-order-grid .grid thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
}

.ecom-order-grid .grid thead tr.column-filter-row th {
  position: sticky;
  top: 35px;
  z-index: 4;
  background: #fff;
}

.ecom-content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
}

.ecom-weekly-panel {
  height: fit-content;
}

.ecom-summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ecom-summary-heading h2 {
  margin: 0;
}

.ecom-summary-excel-btn {
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.ecom-weekly-cards {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.ecom-week-filter {
  margin-bottom: 8px;
}

.ecom-period-type-inp {
  min-width: 160px;
}

.ecom-detail-btn {
  width: 100%;
  padding: 8px 10px;
}

.ecom-weekly-card {
  border-radius: 12px;
  padding: 12px;
  color: #fff;
}

.ecom-weekly-card .card-title {
  color: rgba(255, 255, 255, 0.86);
}

.ecom-weekly-card .card-value {
  color: #fff;
  font-size: 34px;
}

.ecom-weekly-card .sub {
  color: rgba(255, 255, 255, 0.88);
}

.ecom-summary-detail {
  display: none;
  margin-top: 8px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 11px;
  line-height: 1.35;
}

.ecom-weekly-card:hover .ecom-summary-detail {
  display: block;
}

.ecom-weekly-card.orders {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.ecom-weekly-card.sku {
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.ecom-week-inp {
  min-width: 160px;
}

.ecom-return-table .col-address {
  min-width: 140px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ecom-return-table .col-email {
  min-width: 120px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ecom-return-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 12px;
}

.ecom-return-legend-item {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
}

.ecom-return-legend-item.completed {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.ecom-return-legend-item.open {
  background: #fff;
  color: #475569;
}

.ecom-return-row-completed {
  background: #dcfce7 !important;
}

.ecom-return-row-completed td {
  background: #dcfce7 !important;
}

.ecom-table .ecom-grid {
  font-size: 12px;
  table-layout: auto;
}

.ecom-table .col-expand {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.ecom-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.ecom-expand-btn:hover {
  background: #e2e8f0;
  border-color: #64748b;
}

.ecom-table .ecom-grid th,
.ecom-table .ecom-grid td {
  padding: 5px 7px;
  white-space: nowrap;
}

.ecom-table .column-filter-inp {
  min-width: 0;
  width: 100%;
  max-width: 140px;
  padding: 4px 6px;
  font-size: 11px;
}

.ecom-table select.column-filter-inp {
  cursor: pointer;
}

.ecom-table .col-order {
  min-width: 72px;
}

.ecom-table .col-ref {
  min-width: 110px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ecom-table .col-qty {
  min-width: 52px;
}

.ecom-table .col-stage {
  min-width: 72px;
}

.ecom-table .col-track {
  min-width: 72px;
}

.ecom-table .col-carrier {
  min-width: 72px;
  max-width: 96px;
}

.ecom-table .col-cargo {
  min-width: 72px;
}

.ecom-table .col-city {
  min-width: 88px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ecom-table .purchasing-late-friday {
  color: #b91c1c;
  font-weight: 700;
  background: #fee2e2;
}

.ecom-toolbar-row {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}

.ecom-toolbar-filters {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  margin-bottom: 0;
  padding: 10px 12px;
  gap: 8px;
}

.ecom-toolbar-filters .filter-item {
  width: 100%;
}

.ecom-toolbar-filters .ecom-date-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ecom-toolbar-filters .ecom-date-filters .filter-item {
  width: auto;
  min-width: 0;
}

.ecom-toolbar-filters .filter-item label {
  font-size: 11px;
}

.ecom-filter-inp {
  min-width: 0 !important;
  width: 100%;
  padding: 7px 8px;
  font-size: 12px;
}

.ecom-performance-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.ecom-performance-panel {
  padding: 6px 8px;
  margin-bottom: 0;
  min-width: 0;
}

.ecom-performance-title {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 5px;
  font-weight: 700;
  line-height: 1.25;
}

.ecom-performance-subtitle {
  margin-top: 8px;
  margin-bottom: 4px;
  color: #0f172a;
}

.ecom-performance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.ecom-performance-table th,
.ecom-performance-table td {
  border: 1px solid #cbd5e1;
  padding: 3px 5px;
  text-align: center;
  white-space: nowrap;
}

.ecom-performance-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  line-height: 1.2;
}

.ecom-perf-sub {
  font-size: 9px;
  font-weight: 500;
  color: #64748b;
}

.ecom-performance-table .ecom-perf-label {
  text-align: left;
  font-weight: 700;
  color: #0f172a;
}

.ecom-performance-table .num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.ecom-perf-weekend-head {
  color: #b91c1c;
}

.ecom-perf-weekend {
  color: #b91c1c;
  font-weight: 700;
  background: #fee2e2;
}

.ecom-table .col-dt {
  min-width: 128px;
  font-size: 11px;
}

.ecom-table .col-delivered {
  min-width: 68px;
}

.ecom-table .col-name {
  min-width: 80px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ecom-table .status-badge {
  padding: 2px 8px;
  font-size: 11px;
}

.status-mini {
  text-align: center;
  font-weight: 700;
  font-size: 11px;
}

.status-mini.delivered {
  color: #065f46;
}

.ecom-detail-row td {
  background: #f8fafc;
}

.cargo-visual {
  display: grid;
  grid-template-columns: 1.1fr 1.9fr;
  gap: 16px;
}

.cargo-steps {
  display: grid;
  gap: 8px;
}

.cargo-step {
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
}

.cargo-step.pending {
  background: #f1f5f9;
  color: #64748b;
}

.cargo-step.done {
  background: #fef3c7;
  color: #92400e;
}

.cargo-step.delivered {
  background: #d1fae5;
  color: #065f46;
}

.cargo-events {
  display: grid;
  gap: 6px;
}

.cargo-event-line {
  display: grid;
  grid-template-columns: 150px 1.5fr 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  border: 1px dashed #dbe3ef;
  border-radius: 8px;
  padding: 6px 8px;
}

.toolbar,
.panel,
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  padding: 14px;
  margin-bottom: 16px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.filter-item label,
.card-title,
.filter-note {
  color: var(--muted);
  font-size: 12px;
}

.inp {
  min-width: 220px;
  padding: 9px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.btn {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 16px;
}

.btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.card {
  padding: 16px;
}

.card-value {
  font-size: 32px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.card-value.ok {
  color: var(--ok);
}

.card-value.warn {
  color: var(--warn);
}

.sub {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-grid,
.movement-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(520px, 1.4fr);
  gap: 16px;
  margin-bottom: 16px;
}

.movement-grid {
  grid-template-columns: repeat(2, minmax(360px, 1fr));
}

.panel {
  padding: 16px;
}

.panel h2 {
  font-size: 16px;
  margin: 0 0 14px;
}

.pie-layout {
  display: flex;
  align-items: center;
  gap: 20px;
  width: fit-content;
  max-width: 100%;
}

.pie-chart {
  width: 180px;
  height: 180px;
  flex-shrink: 0;
  display: block;
  border-radius: 50%;
  border: 10px solid #fff;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12), 0 12px 24px rgba(15, 23, 42, 0.12);
}

.pie-chart-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pie-segment {
  cursor: pointer;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.pie-segment:hover {
  opacity: 0.9;
}

.pie-reset-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.legend-row-btn {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: inherit;
  width: 100%;
  text-align: left;
  padding: 0;
}

.legend-row strong {
  margin-left: 4px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 430px;
  overflow: auto;
}

.movement-table {
  max-height: 360px;
}

.grid {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}

.grid th,
.grid td {
  border-bottom: 1px solid var(--border);
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

.grid thead {
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}

.grid .num {
  text-align: right;
}

.muted {
  color: var(--muted);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 420px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.login-subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-btn {
  width: 100%;
  margin-top: 4px;
}

.logout-link {
  color: #fecaca;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.logout-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

@media (max-width: 980px) {
  .cards,
  .dashboard-grid,
  .movement-grid,
  .pie-layout {
    grid-template-columns: 1fr;
  }

  .cargo-visual {
    grid-template-columns: 1fr;
  }

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

  .ecom-toolbar-row {
    grid-template-columns: 1fr;
  }

  .ecom-performance-group {
    grid-template-columns: 1fr;
  }

  .ecom-page {
    min-height: auto;
  }

  .ecom-page .ecom-order-grid {
    max-height: 60vh;
  }

  .cargo-event-line {
    grid-template-columns: 1fr;
  }

  .current-stock-panel {
    min-height: auto;
  }

  .current-stock-table {
    max-height: 70vh;
  }
}

/* ─── AI Chat Panel ─────────────────────────────────────────────── */
.ai-chat-fab-wrapper {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.ai-chat-fab {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1e3a8a);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(37,99,235,0.45);
  transition: transform 0.18s, box-shadow 0.18s;
}

.ai-chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(37,99,235,0.55);
}

.ai-chat-fab-open {
  background: linear-gradient(135deg, #475569, #1e293b);
}

.ai-chat-panel {
  width: 360px;
  max-width: calc(100vw - 56px);
  height: 500px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.ai-chat-header {
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-chat-title {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-chat-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  flex-shrink: 0;
}

.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-chat-clear-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 6px;
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
}

.ai-chat-clear-btn:hover {
  background: rgba(255,255,255,0.25);
}

.ai-chat-close-btn {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  opacity: 0.8;
}

.ai-chat-close-btn:hover {
  opacity: 1;
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}

.ai-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  gap: 10px;
  padding: 20px 10px;
}

.ai-chat-empty-icon {
  font-size: 36px;
}

.ai-chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-top: 6px;
}

.ai-suggestion-btn {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s;
}

.ai-suggestion-btn:hover {
  background: #e2e8f0;
}

.ai-msg {
  display: flex;
}

.ai-msg-user {
  justify-content: flex-end;
}

.ai-msg-assistant {
  justify-content: flex-start;
}

.ai-msg-bubble {
  max-width: 84%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.ai-msg-user .ai-msg-bubble {
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.ai-msg-assistant .ai-msg-bubble {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 3px;
}

.ai-msg-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px;
}

.ai-msg-typing span {
  width: 7px;
  height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: ai-typing-bounce 1.2s ease-in-out infinite;
}

.ai-msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-msg-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ai-typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-6px); opacity: 1; }
}

.ai-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  flex-shrink: 0;
}

.ai-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  max-height: 100px;
  overflow-y: auto;
  outline: none;
}

.ai-chat-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}

.ai-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.ai-chat-send-btn:hover:not(:disabled) {
  background: #1d4ed8;
}

.ai-chat-send-btn:disabled {
  background: #94a3b8;
  cursor: default;
}

.ai-send-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ecom-spin 0.7s linear infinite;
}
