/* legacy token removed, see styles/core/variables.css */

/* STYLE.CSS FREEZE NOTICE
   - File này chỉ giữ legacy fallback + quarantine.
   - DO NOT ADD NEW CSS HERE. Move to base/layout/components/pages.
   - Source of truth: styles/core/*, styles/layout/*, styles/components/*, styles/pages/*.
   - Prefer linking new sheets from index.html after modular CSS (bump ?v= when changed).
*/

* {
  box-sizing: border-box;
  font-family: var(--font-ui);
  font-size: 13px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body.dark {
  --bg: #0f172a;
  --card: #111827;
  --border: #334155;
  --text: #e5e7eb;
  --muted: #94a3b8;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
}

/* moved: sidebar base styles -> styles/layout/sidebar.css */

.content {
  padding: var(--space-2) var(--space-3);
}

.main-content {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* moved: topbar base styles -> styles/layout/topbar.css */

#appContent {
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  padding-inline: 18px;
}

.page-shell {
  width: 100%;
}

.container-xl { max-width: var(--content-max); margin: 0 auto; padding-inline: var(--space-3); }
.container-lg { max-width: 1360px; margin: 0 auto; }
.container-md { max-width: 1160px; margin: 0 auto; }
.container-mobile { max-width: 760px; margin: 0 auto; }

/* moved: notification styles -> styles/components/notification.css */
/* moved: toast/alert base styles -> styles/components/toast.css */

.toolbar,
.grid,
.cards,
.panel {
  margin-top: 14px;
}

.toolbar {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
  max-width: 100%;
}

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  font-size: 13px;
  min-height: 32px;
}

input.input-md,
select.input-md,
textarea.input-md {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  min-height: 34px;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.btn.btn-sm {
  padding: 4px 10px;
  min-height: 30px;
  font-size: 12px;
}

.btn.btn-md {
  padding: 8px 14px;
  min-height: 36px;
}

.btn.btn-lg {
  padding: 10px 18px;
  min-height: 40px;
  font-size: 14px;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.28);
}

.btn.primary:hover {
  filter: brightness(1.03);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn:not(.primary):not(.danger) {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #374151;
}

.btn.ghost {
  background: #fff;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.card-title {
  color: var(--muted);
  font-size: 12px;
}

.card-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 15px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
}

.panel h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
}

.chart-card {
  height: auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, 0.7);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.chart-wrapper {
  position: relative;
  height: 260px;
  width: 100%;
  max-height: 260px;
  border-radius: 12px;
  overflow: hidden;
}

.chart-wrapper--compact {
  height: 260px;
  max-height: 260px;
}

canvas {
  width: 100% !important;
  height: 260px !important;
}

.hidden {
  display: none !important;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.analytics-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 12px;
  margin-top: var(--space-3);
  align-items: stretch;
}

.analytics-overview-grid .panel,
.analytics-side-stack .panel {
  margin-top: 0;
}

.dashboard-chart-panel {
  padding: 10px;
}

.dashboard-chart-panel h3,
.compact-list-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.analytics-side-stack {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}

.compact-list-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  min-height: 0;
  border: 1px solid rgba(203, 213, 225, 0.7);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.compact-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compact-list-cols,
.compact-list-row {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr 1fr;
  gap: 8px;
  align-items: center;
}

.compact-list-cols {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  padding: 4px 0 6px;
  border-bottom: 1px solid rgba(203, 213, 225, 0.7);
}

.compact-list-body {
  overflow-y: auto;
  max-height: 170px;
  padding-top: 6px;
}

.compact-list-row {
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(203, 213, 225, 0.7);
}

.compact-list-row:last-child {
  border-bottom: 0;
}

.compact-list-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chart-skeleton {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.12), rgba(148, 163, 184, 0.2), rgba(148, 163, 184, 0.12));
  background-size: 200% 100%;
  animation: shimmer 1s linear infinite;
}

.chart-toggle-group {
  display: inline-flex;
  gap: 6px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  table-layout: fixed;
}

thead th,
.table-header,
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 5;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 11px 10px;
  text-align: left;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

th {
  background: #f9fafb;
  font-weight: 600;
}

tbody tr:hover {
  background: #f8fbff;
}

tr.clickable {
  cursor: pointer;
}

tr.selected {
  background: #e8f0ff;
}

.status {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
}

.status.paid {
  background: #dcfce7;
  color: #14532d;
}

.status.pending {
  background: #fef3c7;
  color: #78350f;
}

.status.cancelled {
  background: #fee2e2;
  color: #7f1d1d;
}

.status.neutral {
  background: #e5e7eb;
  color: #374151;
}

.stock-badge {
  padding: 2px 8px;
  font-size: 11px;
}

.stock-badge.ok {
  background: #dcfce7;
  color: #166534;
}

.stock-badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.stock-badge.bad {
  background: #fee2e2;
  color: #991b1b;
}

.stock-badge.zero {
  background: #e5e7eb;
  color: #374151;
}

.table-wrap {
  margin-top: 12px;
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 12px;
  max-width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: #fff;
  padding-right: 6px;
}

.dashboard-lower-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.dashboard-lower-grid .dashboard-source-panel {
  grid-column: 1 / -1;
}

/* ===== LEGACY COMPAT START ===== */
/* LEGACY STYLE - không chỉnh trực tiếp, ưu tiên block final phía dưới.
   Modal/base form rules cũ giữ lại để tương thích. */
body:not(.use-new-ui) .modal,
body:not(.use-new-ui) .modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
  animation: fadeIn var(--dur-fast) var(--ease-out);
  z-index: 9999;
}

body:not(.use-new-ui) .modal.hidden {
  display: none;
}

body:not(.use-new-ui) .modal-card,
body:not(.use-new-ui) .modal-content,
body:not(.use-new-ui) .pos-modal {
  width: min(92vw, 1080px);
  height: min(84vh, 860px);
  max-height: min(84vh, 860px);
  overflow: hidden;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: var(--space-3);
  animation: zoomIn var(--dur-fast) var(--ease-out);
  position: relative;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}

body:not(.use-new-ui) .modal-card.pos-modal {
  width: min(98vw, 960px);
  height: auto;
  max-height: 92vh;
  padding: 0;
}

body.modal-open {
  overflow: hidden;
}

.modal-head {
  margin-bottom: 4px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 4px;
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-meta {
  font-size: 12px;
  color: #64748b;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.modal-close-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

#modalForm {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

#modalForm label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 5px;
}

#modalForm label.full {
  grid-column: 1 / -1;
}

.modal-actions {
  margin-top: auto;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  background: #fff;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.modal-card.modal-compact {
  width: min(92vw, 780px);
  max-width: 820px;
  height: auto;
  max-height: 82vh;
  padding: 12px;
}

.modal-card.modal-compact #modalForm {
  height: auto;
  max-height: calc(82vh - 120px);
  overflow: auto;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-form-grid .full {
  grid-column: 1 / -1;
}

.modal-card.modal-compact #modalForm label {
  gap: 4px;
  font-size: 13px;
}

.modal-card.modal-compact #modalForm input,
.modal-card.modal-compact #modalForm select,
.modal-card.modal-compact #modalForm textarea {
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 8px;
}

.modal-card.modal-compact .btn {
  min-height: 32px;
  padding: 4px 10px;
}

.btn.btn-xs {
  min-height: 26px;
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.15;
}

.compact-product-table th,
.compact-product-table td {
  padding: 5px 6px;
  font-size: 12px;
  line-height: 1.25;
}

.compact-product-table tbody tr:hover {
  background: #f4f8ff;
}

.product-row td {
  vertical-align: middle;
}

.truncate-cell {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-edit-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  overflow-x: hidden;
  padding: 2px 0;
}

.product-modal-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.modal-card.modal-product-detail {
  width: min(80vw, 920px);
  max-width: 920px;
  height: auto;
  max-height: 86vh;
  border-radius: 16px;
  padding: 10px 12px;
}

.modal-card.modal-product-center {
  width: 70vw;
  max-width: 720px;
  height: auto;
  max-height: 86vh;
  border-radius: 14px;
  padding: 14px;
}

.modal-card.modal-product-center #modalForm {
  height: auto;
  max-height: calc(86vh - 120px);
  overflow: auto;
  overflow-x: hidden;
  font-size: 13px;
}

.modal-card.modal-product-center #modalForm label {
  gap: 4px;
  font-size: 13px;
}

.modal-card.modal-product-center #modalForm input,
.modal-card.modal-product-center #modalForm select,
.modal-card.modal-product-center #modalForm textarea {
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}

.product-center-form {
  display: grid;
  gap: 10px;
}

.product-section {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
}

.product-section h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.product-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-checkbox-row input[type="checkbox"] {
  min-height: 14px !important;
}

.product-history-actions {
  display: flex;
  gap: 6px;
}

.compact-history-panel {
  margin-top: -2px;
}

.product-center-toolbar {
  gap: 6px;
}

.product-center-table table {
  table-layout: fixed;
  width: 100%;
}

.product-center-table .actions-col {
  width: 88px;
}

.product-actions-cell {
  position: relative;
  white-space: nowrap;
}

.product-row-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 130px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
  z-index: 4;
  display: grid;
  gap: 3px;
}

.product-row-menu .product-quick-item.danger {
  color: #b91c1c;
}

.link-like {
  border: 0;
  background: transparent;
  color: #1d4ed8;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-size: inherit;
}

.modal-card.modal-product-detail #modalForm {
  height: auto;
  max-height: calc(86vh - 118px);
  overflow: auto;
  overflow-x: hidden;
  gap: 8px;
}

.modal-card.modal-product-detail .modal-head {
  padding-bottom: 6px;
  margin-bottom: 2px;
}

.modal-card.modal-product-detail .modal-actions {
  margin-top: 6px;
  padding-top: 6px;
}

.product-pill-tab {
  min-height: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.product-pill-tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.product-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-detail-grid .full {
  grid-column: 1 / -1;
}

.product-history-head {
  display: flex;
  justify-content: flex-end;
}

.product-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.product-stats-grid .card {
  min-height: 92px;
}

.product-quick-actions {
  margin-right: auto;
  position: relative;
}

.product-quick-toggle {
  min-width: 36px;
  width: 36px;
  padding: 0;
  font-weight: 700;
}

.product-quick-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: 160px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
  padding: 6px;
  display: grid;
  gap: 4px;
  z-index: 8;
}

.product-quick-item {
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  font-size: 13px;
  padding: 6px 8px;
  color: #0f172a;
  cursor: pointer;
}

.product-quick-item:hover {
  background: #f1f5f9;
}

@media (max-width: 960px) {
  .modal-card.modal-product-detail {
    width: 92vw;
  }

  .modal-card.modal-product-center {
    width: 92vw;
  }

  .product-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .product-detail-grid {
    grid-template-columns: 1fr;
  }

  .modal-card.modal-product-center {
    padding: 10px;
  }

  .product-stats-grid {
    grid-template-columns: 1fr;
  }
}

.pos-order-layout {
  display: grid;
  grid-template-columns: 68% 32%;
  gap: 12px;
  min-height: 0;
  height: auto;
  align-items: start;
}

.pos-order-layout.pos-real {
  grid-template-columns: 68% 32%;
}

.pos-left,
.pos-right {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
  align-self: start;
}

.pos-right .panel {
  position: sticky;
  top: 0;
  padding: 8px;
}

.pos-head-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 6px;
}

.pos-head-grid.compact {
  grid-template-columns: 2.1fr .9fr;
  align-items: end;
}

.pos-items-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  max-height: 420px;
}

.pos-items-table {
  width: 100%;
  table-layout: fixed;
}

.pos-items-table th,
.pos-items-table td {
  padding: 4px;
  font-size: 11px;
}

.pos-items-table th:first-child,
.pos-items-table td:first-child {
  width: 35%;
}

.pos-items-table input {
  width: 100%;
  font-size: 11px;
  padding: 4px 6px;
}

.pos-product-cell {
  position: relative;
}

.oi-stock-badge {
  margin-top: 3px;
  min-height: 14px;
  font-size: 11px;
  color: transparent;
}

.oi-stock-badge.warn {
  color: #b91c1c;
  font-weight: 600;
}

.oi-profit.profit-good {
  color: #15803d;
  font-weight: 700;
  background: #ecfdf3;
}

.oi-profit.profit-low {
  color: #a16207;
  font-weight: 700;
  background: #fffbeb;
}

.oi-profit.profit-bad {
  color: #b91c1c;
  font-weight: 700;
  background: #fef2f2;
}

.pos-suggest {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.customer-search-wrapper,
.product-search-wrapper {
  position: relative;
  width: 100%;
}

.customer-dropdown,
.product-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  z-index: 10080;
  background: white;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.pos-option {
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid #eef2f7;
}

.pos-option-top {
  font-size: 12px;
}

.pos-option-meta {
  margin-top: 2px;
  color: #6b7280;
  font-size: 11px;
}

.pos-option.active,
.pos-option:hover {
  background: #e8f0ff;
}

.pos-option.empty-hint {
  color: #64748b;
  cursor: default;
}

.small-list {
  font-size: 12px;
  line-height: 1.5;
}

.pos-actions-row {
  display: flex;
  gap: 8px;
}

.customer-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}

.mini-form {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.mini-form .mini-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
}

.pos-global-search {
  position: relative;
}

.pos-global-search input {
  width: 100%;
  padding: 7px 9px;
  font-size: 13px;
}

.pos-cart-head,
.pos-cart-row {
  display: grid;
  grid-template-columns: 2.4fr .7fr .8fr .8fr .9fr .7fr .8fr .5fr;
  gap: 6px;
  align-items: center;
}

.pos-cart-head {
  font-size: 11px;
  color: #6b7280;
  padding: 2px 4px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}

.pos-cart-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  height: auto;
}

.pos-cart-row {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 3px;
  background: #fff;
  min-height: 34px;
}

.oi-col input {
  width: 100%;
}

.oi-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-footer-sticky {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  background: #fff;
}

.pos-shortcut-helper {
  position: sticky;
  bottom: 4px;
  margin-top: 6px;
  font-size: 11px;
  color: #4b5563;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 5px 8px;
  display: inline-flex;
  gap: 10px;
}

.pos-summary {
  position: sticky;
  top: 0;
}

.pos-save-panel {
  display: grid;
  gap: 6px;
}

.btn.big {
  min-height: 36px;
  font-size: 13px;
  font-weight: 700;
}

.compact-note textarea {
  min-height: 46px;
}

.pos-modal-headline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}

.pos-modal-headline .left {
  font-size: 14px;
  font-weight: 700;
}

.pos-modal-headline .right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
}

.tiny-date {
  min-height: 30px;
  padding: 4px 8px;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.chip {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
}

.empty.compact {
  padding: 8px 6px;
  font-size: 12px;
}

.more-actions summary {
  list-style: none;
}

.more-actions[open] button {
  margin-top: 4px;
  width: 100%;
}

.btn.small {
  padding: 4px 8px;
  font-size: 12px;
}

.mini-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

.preview-box {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f9fafb;
  padding: 10px;
}

.empty {
  text-align: center;
  color: #6b7280;
  padding: 16px 8px;
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 18px;
  font-size: 13px;
}

/* moved: alerts stack -> styles/components/toast.css */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from { transform: scale(0.98); opacity: 0.6; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .content {
    padding: var(--space-2);
  }

  .toolbar {
    display: flex;
    width: 100%;
  }

  .analytics-overview-grid,
  .analytics-side-stack,
  .chart-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .chart-wrapper {
    height: 220px;
    max-height: 220px;
  }

  .chart-wrapper--compact {
    height: 220px;
    max-height: 220px;
  }

  canvas {
    height: 220px !important;
  }

  .compact-list-body {
    max-height: 180px;
  }

  .modal-form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-lower-grid {
    grid-template-columns: 1fr;
  }

  .notification-dropdown {
    right: -4px;
    width: min(392px, calc(100vw - 12px));
    max-height: min(520px, calc(100vh - 72px));
  }

  .notification-list {
    max-height: calc(min(520px, calc(100vh - 72px)) - 62px);
  }
}

@media (max-width: 1400px) {
  .container-xl,
  .topbar,
  #appContent {
    max-width: 1200px;
  }
}

@media (max-width: 1200px) {
  .app {
    grid-template-columns: 240px 1fr;
  }

  .container-xl,
  .topbar,
  #appContent {
    max-width: 1000px;
  }
}

@media (max-height: 840px) {
  .sidebar-widget {
    padding: 9px 10px;
    border-radius: 12px;
  }

  .sidebar-clock-time {
    font-size: 34px;
    line-height: 1.08;
  }

  .sidebar-clock-meta {
    margin-top: 2px;
    font-size: 12px;
  }

  .sidebar-stats {
    margin-top: 7px;
    padding-top: 7px;
    gap: 5px;
  }

  .sidebar-stat {
    font-size: 12px;
  }
}

@media (max-width: 992px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 10px;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  #menu {
    transition: max-height 0.24s ease, opacity 0.2s ease;
    max-height: 640px;
    opacity: 1;
    overflow: hidden;
  }

  .sidebar-widget {
    transition: max-height 0.24s ease, opacity 0.2s ease, margin-top 0.2s ease;
    max-height: 240px;
    opacity: 1;
    margin-top: 0;
    overflow: hidden;
  }

  body.sidebar-collapsed #menu,
  body.sidebar-collapsed .sidebar-widget {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
  }

  .container-xl,
  .topbar,
  #appContent {
    max-width: 100%;
    padding-inline: 10px;
  }
}

@media (max-width: 768px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 800px) {
  .modal-card:not(.pos-modal),
  .modal-content:not(.pos-modal) {
    max-height: 95vh;
    padding: 10px;
  }

  .pos-order-layout {
    min-height: 0;
  }

  .pos-global-search input {
    padding: 7px 8px;
    font-size: 13px;
  }

  .modal-card.pos-modal,
  #modal .modal-card.pos-modal {
    height: auto !important;
    max-height: 94vh !important;
  }

  .pos-order-layout,
  #modal .modal-card.pos-modal .pos-order-layout {
    height: auto !important;
    min-height: 0 !important;
  }
}

/* POS-grade FIFO inventory page helpers --------------------------------- */
.grid.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 1100px) {
  .grid.cols-2 {
    grid-template-columns: 1fr;
  }
}

.row-warn td {
  background: #fffbeb;
}

.row-bad td {
  background: #fef2f2;
  color: #7f1d1d;
  font-weight: 600;
}

td.profit-good,
.profit-good {
  color: #15803d;
  font-weight: 700;
}

td.profit-low,
.profit-low {
  color: #a16207;
  font-weight: 700;
}

td.profit-bad,
.profit-bad {
  color: #b91c1c;
  font-weight: 700;
}

/* LEGACY STYLE - không chỉnh trực tiếp, ưu tiên block final phía dưới.
   Các pass redesign cũ (premium/modern/visual balance) chỉ để backward compatibility. */
/* Premium redesign pass --------------------------------------------------- */
/* legacy token removed, see styles/core/variables.css */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.app,
.content,
#appContent,
.page-shell {
  min-width: 0;
}

.app {
  grid-template-columns: 260px minmax(0, 1fr);
  overflow-x: clip;
}

.content {
  padding: 14px 16px 18px;
}

/* removed duplicate topbar/sidebar block (see styles/layout/topbar.css + styles/layout/sidebar.css) */

.cards,
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.card,
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover,
.panel:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: #334155;
}

.card-value {
  margin-top: 6px;
  font-size: 24px;
}

.panel h3 {
  font-size: 16px;
  font-weight: 700;
}

.dashboard-lower-grid {
  margin-top: 12px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.dashboard-source-panel {
  margin-top: 12px;
}

.chart-wrapper,
.chart-wrapper--compact,
canvas {
  height: 210px !important;
  max-height: 210px;
}

.toolbar {
  border-radius: 14px;
  padding: 8px;
  width: 100%;
  max-width: 100%;
}

.toolbar input,
.toolbar select {
  min-width: 112px;
}

input,
select,
textarea {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.btn {
  border-radius: 10px;
  min-height: 34px;
  padding: 6px 12px;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.btn.primary {
  color: #fff;
  background: linear-gradient(120deg, #3b82f6 0%, #2563eb 100%);
  border-color: #2563eb;
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.26);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(59, 130, 246, 0.33);
}

.btn.secondary,
.btn:not(.primary):not(.danger) {
  background: #fff;
  border-color: rgba(148, 163, 184, 0.5);
  color: #1e293b;
}

.btn.danger {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fecaca;
}

.btn.secondary:hover,
.btn:not(.primary):not(.danger):hover {
  background: #f8fafc;
}

.btn.danger:hover {
  background: #fecaca;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.24);
}

table {
  min-width: 100%;
  width: 100%;
  table-layout: fixed;
  border: 0;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8faff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
}

th,
td {
  height: 46px;
  padding: 10px 12px;
  font-size: 13px;
  vertical-align: middle;
}

tbody tr:nth-child(even) {
  background: rgba(59, 130, 246, 0.025);
}

tbody tr:hover {
  background: rgba(59, 130, 246, 0.09);
}

.table-wrap tbody tr:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.07), rgba(186, 230, 253, 0.18));
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
}

.order-row {
  cursor: pointer;
}

.money-col {
  text-align: right !important;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: 0;
}

.profit-positive {
  color: #15803d !important;
}

.profit-negative {
  color: #b91c1c !important;
}

.profit-low {
  color: #b45309 !important;
}

.profit-zero {
  color: #6b7280 !important;
}

.cod-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
}

.cod-badge.cod-positive {
  color: #9a3412;
  background: #ffedd5;
  border-color: #fdba74;
}

.cod-badge.cod-zero {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

input[data-currency="vnd"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
}

input[data-currency="vnd"].currency-auto-formatted {
  background: #ecfeff;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.22);
  transform: scale(1.01);
}

.status {
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
}

.status.paid {
  background: linear-gradient(120deg, #dcfce7, #bbf7d0);
  border-color: rgba(34, 197, 94, 0.4);
  color: #166534;
}

.status.pending {
  background: linear-gradient(120deg, #fffbeb, #fef3c7);
  border-color: rgba(245, 158, 11, 0.45);
  color: #92400e;
}

.status.cancelled {
  background: linear-gradient(120deg, #fee2e2, #fecaca);
  border-color: rgba(239, 68, 68, 0.4);
  color: #991b1b;
}

.status.neutral {
  background: linear-gradient(120deg, #e2e8f0, #cbd5e1);
  border-color: rgba(100, 116, 139, 0.45);
  color: #334155;
}

.orders-summary-cards .card-value {
  font-variant-numeric: tabular-nums;
}

/* LEGACY STYLE - không chỉnh trực tiếp, ưu tiên block final phía dưới.
   Orders table tuning cũ; chỉnh mới thì sửa ở block orders-table riêng. */
.order-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: visible;
}

.orders-table th,
.orders-table td {
  height: 43px;
  padding: 7px 8px;
  font-size: 13px;
}

.orders-table .col-order-id {
  width: 70px;
  min-width: 70px;
  text-align: center;
}

.orders-table .col-order-date {
  width: 95px;
  min-width: 95px;
  text-align: center;
}

.orders-table .col-order-customer {
  width: 160px;
  min-width: 160px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orders-table .col-order-actions {
  width: 170px;
  min-width: 170px;
  overflow: visible;
}

.orders-table .col-order-status {
  width: 130px;
  min-width: 130px;
}

.orders-table .col-money {
  width: 122px;
  min-width: 122px;
  text-align: right !important;
}

.orders-table {
  min-width: 1240px;
  table-layout: auto;
}

.inline-actual-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  border-radius: 8px;
  padding: 2px 4px;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.inline-actual-cell.flash-success {
  background: #dcfce7;
  box-shadow: inset 0 0 0 1px #86efac;
}

.inline-actual-cell.flash-error {
  background: #fee2e2;
  box-shadow: inset 0 0 0 1px #fca5a5;
}

.inline-actual-cell.saving {
  opacity: 0.85;
}

.inline-edit-trigger {
  border: 0;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
  width: 20px;
  height: 20px;
  cursor: pointer;
  line-height: 1;
}

.inline-edit-trigger:hover {
  background: #cbd5e1;
}

.inline-actual-input {
  width: 100%;
  min-height: 28px;
  text-align: right;
  padding: 4px 8px;
}

.inline-cell-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(59, 130, 246, 0.25);
  border-top-color: #2563eb;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

.order-more-menu {
  position: relative;
}

.order-more-trigger {
  min-width: 36px;
  text-align: center;
}

.order-more-menu > summary {
  list-style: none;
}

.order-more-menu > summary::-webkit-details-marker {
  display: none;
}

.order-more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 170px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
  padding: 6px;
  display: grid;
  gap: 4px;
}

.order-quick-item {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: #0f172a;
}

.order-quick-item:hover {
  background: #f1f5f9;
}

.order-quick-item.danger {
  color: #b91c1c;
}

.status:not(.paid):not(.pending):not(.cancelled):not(.neutral) {
  background: linear-gradient(120deg, #dbeafe, #bfdbfe);
  border-color: rgba(59, 130, 246, 0.4);
  color: #1e3a8a;
}

/* moved: alert variants -> styles/components/toast.css */

.modal,
.modal-overlay {
  animation: fadeIn 0.2s ease;
}

.modal-card,
.modal-content,
.pos-modal {
  border-radius: 16px;
  box-shadow: 0 26px 60px rgba(2, 6, 23, 0.25);
}

.chart-skeleton {
  background: linear-gradient(100deg, rgba(148, 163, 184, 0.1), rgba(148, 163, 184, 0.25), rgba(148, 163, 184, 0.1));
}

/* removed duplicate keyframes toastIn (see styles/components/toast.css) */

@media (max-width: 1280px) {
  .cards,
  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .sidebar {
    width: 100%;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .dashboard-lower-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  #appContent,
  .container-xl {
    max-width: 100%;
    padding-inline: 10px;
  }
}

@media (max-width: 640px) {
  .cards,
  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* === Layout overflow fix (sidebar/content) ============================== */
/* Triệt thanh cuộn ngang trên toàn app + sidebar, giữ sidebar 260px cứng,
   main-content co giãn an toàn với min-width: 0 để không bị nội dung bên
   trong (table, page-shell, ...) đẩy tràn ra ngoài. */

html,
body,
#app {
  overflow-x: hidden;
  max-width: 100%;
}

/* Dùng width: 100% thay cho 100vw có chủ đích: trên Windows, 100vw bao
   gồm cả vùng vertical scrollbar (~17px) trong khi body chỉ chiếm vùng
   nội dung => 100vw sẽ tạo overflow ngang ngay cả khi đã overflow-x:hidden
   ở các tầng cha. width: 100% lấp đúng vùng body, kết hợp flex chia đều
   sidebar + main-content nên không phát sinh tràn. */
.app.app-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

/* LEGACY HOLD - affects sidebar overflow and responsive app-shell constraints */
.sidebar {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  flex: 0 0 260px;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar * {
  max-width: 100%;
  box-sizing: border-box;
}

.main-content {
  flex: 1 1 0%;
  min-width: 0;
  overflow-x: hidden;
}

#appContent.content-container,
.content-container {
  max-width: 1500px;
  width: 100%;
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
}

.sidebar-widget {
  width: calc(100% - 20px);
  max-width: calc(100% - 20px);
  margin: 10px;
  box-sizing: border-box;
  overflow: hidden;
}

.sidebar-clock-time {
  font-size: 30px;
  line-height: 1.12;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.menu-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 992px) {
  .app.app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex: 0 0 auto;
  }
}

/* === Modern SaaS dashboard polish ======================================= */
/* legacy token removed, see styles/core/variables.css */

body {
  background: radial-gradient(circle at 8% -10%, rgba(59, 130, 246, 0.08), transparent 42%), var(--bg);
  color: var(--text);
}

/* LEGACY HOLD - affects premium sidebar visual skin and active-state glow */
.sidebar {
  /* --navy was never defined → invalid gradient dropped sidebar bg → body bleed-through on #menu */
  background: linear-gradient(180deg, #111a2e 0%, #0d1730 64%, #090f1a 100%);
  box-shadow: inset -1px 0 0 rgba(148, 163, 184, 0.2), 18px 0 40px rgba(2, 6, 23, 0.34);
}

.menu-item {
  border-radius: 14px;
  transition: transform var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.menu-item:hover {
  background: rgba(59, 130, 246, 0.16);
}

.menu-item.active {
  background: linear-gradient(100deg, rgba(59, 130, 246, 0.34), rgba(34, 211, 238, 0.2));
  border-color: rgba(125, 211, 252, 0.58);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.28), 0 12px 28px rgba(59, 130, 246, 0.28), 0 0 24px rgba(34, 211, 238, 0.22);
}

/* LEGACY VISUAL OVERRIDE DISABLED - source-of-truth in styles/layout + styles/components + styles/pages */
/* Chỉ áp khi cố ý bật legacy-ui và không có use-new-ui */
body.legacy-ui:not(.use-new-ui) .topbar,
body.legacy-ui:not(.use-new-ui) .toolbar,
body.legacy-ui:not(.use-new-ui) .card,
body.legacy-ui:not(.use-new-ui) .panel,
body.legacy-ui:not(.use-new-ui) .table-wrap {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.82), var(--card));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-lg);
}

.card,
.panel,
.table-wrap {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.card:hover,
.panel:hover,
.table-wrap:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

table {
  background: transparent;
}

thead th {
  background: linear-gradient(180deg, rgba(226, 236, 255, 0.74), rgba(241, 246, 255, 0.92));
}

th,
td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

tbody tr {
  transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}

tbody tr:hover,
.table-wrap tbody tr:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.12), rgba(34, 211, 238, 0.1));
}

tbody tr.selected,
tr.selected {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(34, 211, 238, 0.14));
}

.btn,
input,
select,
textarea,
.modal-close-btn,
.product-pill-tab,
.chip {
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.btn {
  border-radius: 14px;
}

.btn.primary {
  background: linear-gradient(125deg, #60a5fa 0%, var(--accent-blue) 45%, #2563eb 100%);
  border-color: rgba(37, 99, 235, 0.85);
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.34), 0 0 20px rgba(34, 211, 238, 0.14);
}

.btn.primary:hover {
  box-shadow: 0 14px 30px rgba(59, 130, 246, 0.4), 0 0 24px rgba(34, 211, 238, 0.2);
}

.status,
.stock-badge,
.cod-badge {
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42), 0 8px 16px rgba(11, 18, 32, 0.08);
}

.status.paid,
.stock-badge.ok,
.cod-badge.cod-zero {
  box-shadow: inset 0 0 0 1px rgba(187, 247, 208, 0.8), 0 0 0 1px rgba(34, 197, 94, 0.22), 0 0 16px rgba(34, 197, 94, 0.2);
}

.status.pending,
.stock-badge.warn,
.cod-badge.cod-positive {
  box-shadow: inset 0 0 0 1px rgba(253, 230, 138, 0.75), 0 0 0 1px rgba(245, 158, 11, 0.2), 0 0 14px rgba(245, 158, 11, 0.18);
}

.status.cancelled,
.stock-badge.bad,
.stock-badge.zero {
  box-shadow: inset 0 0 0 1px rgba(254, 202, 202, 0.74), 0 0 0 1px rgba(239, 68, 68, 0.2), 0 0 14px rgba(239, 68, 68, 0.16);
}

/* UI polish pass: loading/toast/motion/perf-friendly animation */
/* moved: toast stack and item styles -> styles/components/toast.css */

.route-enter {
  animation: routeEnter 160ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 18px 10px;
}
.empty-state-icon { font-size: 22px; opacity: 0.85; }
.empty-state-title { font-weight: 700; color: #334155; }
.empty-state-desc { color: #64748b; font-size: 12px; }

.route-error-card {
  display: grid;
  gap: 8px;
  border-color: rgba(239, 68, 68, 0.28);
}
.route-error-title { font-weight: 700; color: #991b1b; font-size: 14px; }
.route-error-desc { color: #7f1d1d; }

.skeleton-card,
.table-skeleton {
  position: relative;
  overflow: hidden;
}
.skeleton-line {
  height: 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.28), rgba(148, 163, 184, 0.16));
  background-size: 220% 100%;
  animation: shimmer 1.1s linear infinite;
}
.skeleton-line.w40 { width: 40%; }
.skeleton-line.w70 { width: 70%; height: 20px; }

.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.65; cursor: not-allowed; }

.card:hover,
.panel:hover {
  transform: none;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.075);
}

tbody tr:hover,
.table-wrap tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

.inline-actual-cell.flash-success {
  animation: flashOk 520ms ease-out;
}
.inline-actual-cell.flash-error {
  animation: flashErr 520ms ease-out;
}

.modal,
.modal-overlay {
  transition: opacity 160ms ease;
}

.modal-card-loading {
  position: relative;
}
.modal-card-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.15));
  background-size: 220% 100%;
  animation: shimmer 1s linear infinite;
  pointer-events: none;
}

.modal.modal-closing,
.modal-overlay.modal-closing {
  opacity: 0;
}

@keyframes routeEnter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* removed duplicate keyframes toastInSoft (see styles/components/toast.css) */

@keyframes flashOk {
  0% { background: rgba(34, 197, 94, 0.26); }
  100% { background: transparent; }
}

@keyframes flashErr {
  0% { background: rgba(239, 68, 68, 0.24); }
  100% { background: transparent; }
}

/* Shell/layout refactor (SaaS/POS) */
html,
body {
  height: 100%;
}

body {
  overflow: hidden;
}

.app.app-layout {
  min-height: 100vh;
  height: 100vh;
}

/* LEGACY HOLD - affects fixed sidebar width/collapsed offsets with main-content */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 248px;
  min-width: 248px;
  max-width: 248px;
  z-index: 90;
  transition: width 160ms ease, min-width 160ms ease, max-width 160ms ease;
}

.menu-ico {
  width: 20px;
  min-width: 20px;
  font-size: 16px;
}

.menu-item {
  min-height: 40px;
  gap: 12px;
}

.menu-item:hover {
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.22), 0 0 18px rgba(56, 189, 248, 0.12);
}

body.sidebar-collapsed .sidebar {
  width: 82px;
  min-width: 82px;
  max-width: 82px;
}

body.sidebar-collapsed .brand,
body.sidebar-collapsed .menu-label,
body.sidebar-collapsed .sidebar-widget {
  opacity: 0;
  visibility: hidden;
}

body.sidebar-collapsed .menu-item {
  justify-content: center;
  padding-inline: 0;
}

.main-content {
  margin-left: 248px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  transition: margin-left 160ms ease;
}

body.sidebar-collapsed .main-content {
  margin-left: 82px;
}

/* LEGACY HOLD - affects fixed topbar offsets and top-search shell behavior */
.topbar {
  position: fixed;
  top: 0;
  left: 248px;
  right: 0;
  z-index: 80;
  height: 70px;
  border-radius: 0;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(248, 250, 252, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.06);
  transition: left 160ms ease;
}

body.sidebar-collapsed .topbar {
  left: 82px;
}

.topbar-inner {
  height: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-title-group { min-width: 200px; }
.topbar-breadcrumb { color: var(--muted); font-size: 12px; display: flex; gap: 8px; margin-bottom: 3px; }
.page-title-text { margin: 0; font-size: 18px; font-weight: 700; }

.topbar-actions { flex: 1; justify-content: flex-end; gap: 10px; }
.top-search-wrap { position: relative; width: min(420px, 46vw); }
.topbar-search { width: 100%; padding-left: 34px; }
.top-search-wrap::before { content: "⌕"; position: absolute; left: 12px; top: 7px; color: #64748b; font-size: 14px; }

.top-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
  padding: 8px;
  z-index: 12020;
}

.top-search-item { width: 100%; border: 0; background: transparent; display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 10px; text-align: left; cursor: pointer; }
.top-search-item:hover { background: #eff6ff; }
.top-search-type { font-size: 11px; color: #1d4ed8; background: #dbeafe; border-radius: 999px; padding: 2px 7px; }
.top-search-main { display: grid; gap: 2px; }
.top-search-main small { color: var(--muted); }
.top-search-empty { color: var(--muted); text-align: center; padding: 8px; }

.command-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 14000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(14vh, 140px) 16px 24px;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.command-palette-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.command-palette-modal {
  width: min(720px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 26px 64px rgba(15, 23, 42, 0.22);
  overflow: hidden;
  transform: scale(0.98) translateY(6px);
  opacity: 0;
  transition: transform 120ms ease, opacity 120ms ease;
}

.command-palette-overlay.is-open .command-palette-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.command-palette-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: transparent;
  font-size: 16px;
  padding: 16px 18px;
  outline: none;
}

.command-palette-list {
  max-height: min(56vh, 460px);
  overflow-y: auto;
  padding: 8px;
}

.command-palette-item {
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: transparent;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
}

.command-palette-item:hover,
.command-palette-item.is-active {
  background: #eff6ff;
}

.command-palette-icon {
  font-size: 15px;
  line-height: 1;
}

.command-palette-title {
  font-size: 14px;
  color: #0f172a;
}

.command-palette-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 999px;
  padding: 2px 8px;
}

.command-palette-empty {
  color: #64748b;
  text-align: center;
  padding: 14px;
}

body.command-palette-open {
  overflow: hidden;
}

.topbar-extras { display: flex; align-items: center; gap: 10px; }
.quick-add-wrap,
.user-menu-wrap { position: relative; }
.quick-add-dropdown,
.user-menu-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px;
  background: rgba(255,255,255,0.88); backdrop-filter: blur(10px);
  border: 1px solid rgba(148,163,184,0.35); border-radius: 14px; padding: 7px;
  box-shadow: 0 16px 36px rgba(15,23,42,0.15); z-index: 12020;
}
.quick-add-item,
.user-menu-item { width: 100%; border: 0; background: transparent; padding: 8px 9px; text-align: left; border-radius: 9px; cursor: pointer; }
.quick-add-item:hover,
.user-menu-item:hover { background: #f1f5f9; }
.user-menu-item.danger { color: #b91c1c; }

.sync-status { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(148,163,184,0.35); border-radius: 999px; padding: 7px 10px; font-size: 12px; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
.sync-saving .sync-dot { background: #f59e0b; }
.sync-offline .sync-dot { background: #ef4444; }

.user-avatar-btn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid rgba(148,163,184,0.35); background: linear-gradient(120deg,#2563eb,#1d4ed8); color: #fff; font-weight: 700; cursor: pointer; }
/* removed duplicate notification bell pulse (see styles/components/notification.css) */

.content-scroll {
  margin-top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  padding: 18px 20px 20px;
}

#appContent {
  max-width: 1320px;
  padding-inline: 0;
}

.content-stage { animation: none; }

.table-wrap,
table,
.panel,
.card {
  max-width: 100%;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bellShake {
  0% { transform: rotate(0deg); }
  33% { transform: rotate(10deg); }
  66% { transform: rotate(-8deg); }
  100% { transform: rotate(0deg); }
}

@media (max-width: 1100px) {
  .top-search-wrap { width: min(260px, 44vw); }
}

@media (max-width: 992px) {
  body { overflow: auto; }
  .sidebar { width: 82px; min-width: 82px; max-width: 82px; }
  .main-content { margin-left: 82px; }
  .topbar { left: 82px; }
}

@media (max-width: 768px) {
  .topbar-inner { padding: 0 12px; }
  .topbar-extras .sync-status { display: none; }
  .top-search-wrap { width: 180px; }
  .content-scroll { padding-inline: 12px; }
  .command-palette-overlay {
    padding: 72px 10px 16px;
  }
  .command-palette-modal {
    width: 100%;
    border-radius: 18px;
  }
}

/* Performance-focused overrides */
.global-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
  z-index: 13000;
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  transition: transform 220ms ease, opacity 120ms ease;
}

.global-loading-bar.active {
  opacity: 1;
  transform: scaleX(0.88);
}

[data-dashboard-deferred] {
  opacity: 0.88;
  transition: opacity 120ms ease;
  content-visibility: auto;
  contain-intrinsic-size: 320px;
}

[data-dashboard-deferred].deferred-ready {
  opacity: 1;
}

.dashboard-kpi-grid,
.dashboard-lower-grid,
.dashboard-source-panel {
  content-visibility: auto;
}

/* LEGACY VISUAL OVERRIDE DISABLED - source-of-truth in styles/layout + styles/components + styles/pages */
body.legacy-ui:not(.use-new-ui) .topbar,
body.legacy-ui:not(.use-new-ui) .toolbar,
body.legacy-ui:not(.use-new-ui) .card,
body.legacy-ui:not(.use-new-ui) .panel,
body.legacy-ui:not(.use-new-ui) .table-wrap {
  backdrop-filter: blur(2px) !important;
  -webkit-backdrop-filter: blur(2px) !important;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07) !important;
}

.card,
.panel,
.btn,
.menu-item,
tbody tr {
  transition-duration: 120ms !important;
}

/* Ẩn notification chỉ khi shell legacy-ui thuần — không áp với use-new-ui */
body.legacy-ui:not(.use-new-ui) .notification-dropdown,
body.legacy-ui:not(.use-new-ui) #notificationDropdown,
body.legacy-ui:not(.use-new-ui) .route-enter {
  display: none !important;
  animation: none !important;
}

.page-shell {
  position: relative;
}

.page-content {
  position: relative;
  min-height: 180px;
}

.page-shell.route-shell-stale .page-content::after {
  content: "Đang cập nhật...";
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 11px;
  line-height: 1.2;
  color: rgba(100, 116, 139, 0.92);
  pointer-events: none;
  z-index: 3;
}

body.dark .page-shell.route-shell-stale .page-content::after {
  color: rgba(148, 163, 184, 0.88);
}

.fade-page-enter {
  opacity: 0;
}

.fade-page-active {
  opacity: 1;
  transition: opacity var(--instant-ms) var(--instant-ease);
}

.page-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  background: linear-gradient(180deg, rgba(245, 247, 251, 0.14), rgba(245, 247, 251, 0.22));
}

.page-loading-overlay.active {
  opacity: 1;
}

.page-loading-skeleton {
  position: absolute;
  inset: 14px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.page-loading-skeleton > span {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.26), rgba(148, 163, 184, 0.16));
  background-size: 220% 100%;
  animation: shimmer 1s linear infinite;
}

.page-loading-skeleton > span:nth-child(1) { width: 42%; }
.page-loading-skeleton > span:nth-child(2) { width: 68%; }
.page-loading-skeleton > span:nth-child(3) { width: 92%; }
.page-loading-skeleton > span:nth-child(4) { width: 88%; }
.page-loading-skeleton > span:nth-child(5) { width: 76%; }
.page-loading-skeleton > span:nth-child(6) { width: 54%; }

.page-content.is-loading .table-wrap {
  position: relative;
  overflow: hidden;
  min-height: 240px;
}

.page-content.is-loading .table-wrap::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: 50px;
  bottom: 10px;
  border-radius: 10px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(148, 163, 184, 0.16) 0px,
      rgba(148, 163, 184, 0.16) 14px,
      rgba(255, 255, 255, 0) 14px,
      rgba(255, 255, 255, 0) 44px
    );
  opacity: 0.85;
  pointer-events: none;
}

/* === Typography + spacing polish (safe UI-only) ========================= */
/* legacy token removed, see styles/core/variables.css */

body {
  font-size: 14px;
  line-height: 1.45;
}

.page-title-text {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.panel h3,
.section-title,
.toolbar-title {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: var(--space-8px);
}

th,
td {
  font-size: 14px;
  line-height: 1.35;
}

.modal-meta,
.notification-head-count,
.notification-message,
.notification-time,
.sidebar-clock-meta,
.sidebar-stat-label,
.small-list,
.empty-state-desc {
  font-size: 12px;
}

.status,
.stock-badge,
.cod-badge,
.top-search-type,
.command-palette-tag,
.chip {
  font-size: 12px;
  line-height: 1.2;
}

.content {
  padding: var(--space-16px);
}

#appContent,
.container-xl,
.topbar {
  padding-inline: var(--space-16px);
}

.toolbar,
.grid,
.cards,
.panel,
.table-wrap,
.dashboard-lower-grid {
  margin-top: var(--space-12px);
}

.cards,
.dashboard-kpi-grid,
.chart-grid,
.analytics-overview-grid,
.analytics-side-stack {
  gap: var(--space-12px);
}

.card,
.panel {
  padding: var(--space-16px);
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-8px);
}

.card-value {
  margin-top: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.orders-summary-cards .card,
.dashboard-kpi-grid .card,
.product-stats-grid .card {
  padding: var(--space-12px) var(--space-16px);
  min-height: 80px;
}

thead th {
  height: 40px;
  padding: var(--space-8px) var(--space-12px);
}

tbody tr {
  height: 42px;
}

th,
td {
  padding: var(--space-8px) var(--space-12px);
}

.sidebar {
  width: 248px;
  min-width: 248px;
  max-width: 248px;
  padding: var(--space-16px) var(--space-12px) var(--space-12px);
  gap: var(--space-12px);
}

#menu {
  gap: var(--space-8px);
}

.menu-item {
  min-height: 40px;
  padding: var(--space-8px) var(--space-12px);
  gap: var(--space-12px);
}

.menu-ico {
  width: 20px;
  min-width: 20px;
}

.modal-card,
.modal-content,
.pos-modal {
  padding: var(--space-16px);
}

.modal-head {
  margin-bottom: var(--space-8px);
  padding-bottom: var(--space-8px);
  gap: var(--space-12px);
}

#modalForm,
.modal-form-grid,
.product-modal-body,
.product-center-form {
  gap: var(--space-12px);
}

#modalForm label {
  gap: var(--space-4px);
}

.modal-actions {
  padding-top: var(--space-12px);
  gap: var(--space-8px);
}

.topbar {
  max-width: 1320px;
  padding-top: var(--space-8px);
  padding-bottom: var(--space-8px);
}

.topbar-inner {
  gap: var(--space-12px);
}

.topbar-actions,
.topbar-extras {
  gap: var(--space-8px);
}

.content-scroll {
  padding: var(--space-16px) var(--space-16px) var(--space-20px);
}

/* Modal/Form polish pass (safe CSS-only overrides) */
.modal,
.modal-overlay {
  background: rgba(15, 23, 42, 0.35);
  animation: fadeIn 120ms ease;
}

.modal-card:not(.pos-modal),
.modal-content:not(.pos-modal) {
  width: min(90vw, 900px);
  max-width: 900px;
  height: auto;
  max-height: 86vh;
  border-radius: 16px;
  box-shadow: 0 18px 42px rgba(2, 6, 23, 0.2);
  overflow: hidden;
  animation: zoomIn 120ms ease;
}

.modal-card.modal-compact,
.modal-card.modal-product-center {
  width: min(88vw, 720px);
  max-width: 760px;
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #fff;
  min-height: 44px;
}

.modal-title-wrap h3,
.modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.modal-meta {
  font-size: 12px;
  opacity: 0.9;
}

#modalForm {
  padding-right: 2px;
  overflow: auto;
}

#modalForm label {
  font-size: 13px;
  font-weight: 600;
}

#modalForm input,
#modalForm select,
#modalForm textarea {
  min-height: 36px;
  font-size: 13px;
  border-radius: 10px;
}

#modalForm textarea {
  min-height: 72px;
}

#modalForm input::placeholder,
#modalForm textarea::placeholder {
  color: #94a3b8;
}

#modalForm input:focus,
#modalForm select:focus,
#modalForm textarea:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 6;
  background: #fff;
  border-top: 1px solid var(--border);
}

.modal-actions .btn {
  min-height: 34px;
  padding: 6px 12px;
}

.customer-dropdown,
.product-dropdown,
.pos-suggest {
  width: 100%;
  max-height: 240px;
  z-index: 10100;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

@media (max-width: 900px) {
  .modal-card:not(.pos-modal),
  .modal-content:not(.pos-modal) {
    width: min(96vw, 760px);
    max-height: 90vh;
  }
}

/* Visual balance pass (layout/spacing only, no logic changes) */

#appContent,
.container-xl,
.topbar,
.page-shell {
  max-width: 1280px;
}

.content-scroll {
  padding: 14px 16px 18px;
}

.sidebar {
  width: 236px;
  min-width: 236px;
  max-width: 236px;
  gap: var(--vb-gap-2);
}

#menu {
  gap: 6px;
}

.menu-item,
.sidebar-item {
  min-height: 38px;
  padding: 7px 10px;
  gap: 10px;
  border-radius: 10px;
}

.menu-item.active,
.sidebar-item.active {
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.16), 0 6px 16px rgba(59, 130, 246, 0.14);
}

.menu-ico {
  width: 18px;
  min-width: 18px;
}

.topbar {
  padding: 7px 12px;
  border-radius: 14px;
}

.topbar-inner {
  gap: 10px;
  align-items: center;
}

.top-search-wrap {
  width: min(340px, 42vw);
}

.topbar-actions,
.topbar-extras {
  gap: 6px;
}

.btn,
input,
select,
textarea {
  border-radius: var(--vb-radius-control);
}

.card,
.panel,
.table-wrap {
  border-radius: var(--vb-radius-card);
  box-shadow: var(--vb-shadow-soft);
}

.card,
.panel {
  padding: 14px;
}

.cards,
.dashboard-kpi-grid,
.dashboard-lower-grid,
.analytics-overview-grid,
.analytics-side-stack,
.chart-grid {
  gap: var(--vb-gap-2);
}

.dashboard-kpi-grid .card {
  min-height: 72px;
  padding: 10px 12px;
}

.card-title {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 600;
  color: #475569;
}

.card-value {
  font-size: 24px;
  line-height: 1.15;
}

table {
  box-shadow: var(--vb-shadow-none);
}

thead th {
  background: #f8fafc;
  color: #64748b;
}

tbody tr {
  height: 43px;
}

tbody tr:nth-child(even) {
  background: rgba(148, 163, 184, 0.045);
}

tbody tr:hover,
.table-wrap tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}

.status,
.stock-badge,
.cod-badge {
  border-radius: var(--vb-radius-pill);
}

.modal-card:not(.pos-modal),
.modal-content:not(.pos-modal) {
  border-radius: var(--vb-radius-card);
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.18);
}

.modal-head,
.modal-actions {
  padding-inline: 2px;
}

#modalForm,
.modal-form-grid,
.product-modal-body,
.product-center-form {
  gap: var(--vb-gap-2);
}

.toolbar,
.grid,
.cards,
.panel,
.table-wrap {
  margin-top: 12px;
}

/* Table UX polish pass (CSS-only, safe overrides) */
.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.55) transparent;
}

.table-wrap::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.55);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 10px 12px;
  line-height: 1.35;
}

tbody tr {
  height: 44px;
  transition: background-color 120ms ease;
}

th,
td {
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.35;
}

tbody tr:nth-child(even) {
  background: rgba(148, 163, 184, 0.06);
}

tbody tr:hover,
.table-wrap tbody tr:hover {
  background: rgba(59, 130, 246, 0.08);
}

tr.clickable {
  cursor: pointer;
}

td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.money-col,
td.money-col,
th.money-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 600;
  white-space: nowrap;
}

.status,
.stock-badge,
.cod-badge {
  font-size: 12px;
}

.status.paid {
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%);
  color: #166534;
  border-color: rgba(34, 197, 94, 0.45);
}

.status.pending {
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.45);
}

.status.cancelled {
  background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.45);
}

.status.neutral {
  background: linear-gradient(180deg, #e5e7eb 0%, #d1d5db 100%);
  color: #374151;
  border-color: rgba(107, 114, 128, 0.4);
}

.btn.small,
.btn-xs {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.more-actions summary {
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  background: #fff;
}

.more-actions[open] {
  position: relative;
}

.more-actions[open] > div,
.more-actions[open] > .menu,
.more-actions[open] > .popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  z-index: 20;
}

.table-wrap .empty-state,
.table-wrap .empty,
.table-wrap .empty-row td {
  text-align: center;
  color: #64748b;
  background: #f8fafc;
}

/* Premium dashboard scoped patch */
.dashboard-premium-wrap {
  display: grid;
  gap: 12px;
}

.dashboard-toolbar-premium {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.segment-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.78);
}

.segment-btn {
  border: 0;
  border-radius: 999px;
  min-height: 30px;
  padding: 0 12px;
  background: transparent;
  color: #475569;
  font-weight: 600;
  cursor: pointer;
}

.segment-btn.active {
  background: linear-gradient(120deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
}

.dashboard-filter-inputs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-quick-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-chip {
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
  display: grid;
  gap: 2px;
}

.quick-chip span {
  font-size: 11px;
  color: #64748b;
}

.quick-chip strong {
  font-size: 14px;
}

.premium-kpi-card {
  padding: 12px;
}

.premium-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.premium-kpi-icon {
  width: 24px;
  height: 24px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.12);
}

.premium-kpi-foot {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kpi-trend {
  font-size: 11px;
  font-weight: 700;
}

.trend-up { color: #16a34a; }
.trend-down { color: #dc2626; }
.trend-neutral { color: #64748b; }

.kpi-sparkline {
  width: 108px;
  height: 28px;
}

.kpi-sparkline path {
  fill: none;
  stroke: rgba(59, 130, 246, 0.72);
  stroke-width: 1.8;
}

.dashboard-premium-grid {
  align-items: stretch;
}

.premium-activity-panel .activity-feed {
  display: grid;
  gap: 8px;
}

.activity-item {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.72);
}

.activity-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}

.activity-text {
  display: grid;
  gap: 2px;
}

.activity-text strong {
  font-size: 13px;
}

.activity-text small {
  color: #64748b;
}

.alerts-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.alert-col-title {
  font-weight: 700;
  margin-bottom: 6px;
}

/* Dashboard only: .inv-alert-row is also used on <tr> in inventory tables — never flex globally */
.dashboard-layout .alerts-columns .inv-alert-row,
.dashboard-page .alerts-columns .inv-alert-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.08);
  margin-bottom: 6px;
}

.dashboard-layout .alerts-columns .inv-alert-row.warn,
.dashboard-page .alerts-columns .inv-alert-row.warn {
  background: rgba(245, 158, 11, 0.1);
}

.dashboard-layout .alerts-columns .inv-alert-row.danger,
.dashboard-page .alerts-columns .inv-alert-row.danger {
  background: rgba(239, 68, 68, 0.1);
}

body.dark .segment-control,
body.dark .quick-chip,
body.dark .activity-item {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.3);
}

body.dark .segment-btn { color: #cbd5e1; }
body.dark .segment-btn.active { color: #fff; }
body.dark .activity-text small,
body.dark .quick-chip span { color: #94a3b8; }

@media (max-width: 1100px) {
  .dashboard-toolbar-premium {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .dashboard-quick-strip,
  .alerts-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .dashboard-quick-strip,
  .alerts-columns {
    grid-template-columns: 1fr;
  }
}

/* ========= Instant app feel (native-light polish, CSS-only) ========= */

.app-layout button:not(.menu-item):not(.sidebar-item):not(.notification-bell):not(.modal-close-btn):not(.topbar-inquiry-chip):not(:disabled),
.app-layout .btn:not(:disabled) {
  transition:
    transform 120ms var(--instant-ease),
    box-shadow 120ms var(--instant-ease),
    background-color 120ms var(--instant-ease),
    border-color 120ms var(--instant-ease),
    filter 120ms var(--instant-ease),
    opacity 120ms var(--instant-ease);
}

.app-layout .btn:hover:not(:disabled),
.app-layout button:not(.menu-item):not(.sidebar-item):not(.notification-bell):not(.modal-close-btn):not(.topbar-inquiry-chip):not(:disabled):hover {
  transform: translateY(-1px);
}

.app-layout .btn:active:not(:disabled),
.app-layout button:not(.menu-item):not(.sidebar-item):not(.notification-bell):not(.modal-close-btn):not(.topbar-inquiry-chip):not(:disabled):active {
  transform: translateY(0) scale(0.98);
}

.app-layout .card:not(.premium-kpi-card),
.app-layout .panel {
  border-color: rgba(228, 233, 243, 0.98);
  padding: var(--space-3);
}

.app-layout .card.premium-kpi-card {
  border-color: rgba(228, 233, 243, 0.98);
}

body.dark .app-layout .card,
body.dark .app-layout .panel {
  border-color: rgba(82, 96, 118, 0.92);
}

.app-layout .card:hover,
.app-layout .panel:hover {
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.078) !important;
}

.app-layout #menu .menu-item:hover,
.app-layout #menu .sidebar-item:hover {
  transform: none;
}

.app-layout .toolbar,
.app-layout .toolbar.compact-toolbar,
.app-layout .dashboard-toolbar {
  gap: var(--space-2);
  row-gap: var(--space-2);
  align-items: center;
}

.app-layout .toolbar input,
.app-layout .toolbar select {
  min-height: 36px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.app-layout input:not([type="checkbox"]):not([type="radio"]):focus-visible,
.app-layout select:focus-visible,
.app-layout textarea:focus-visible {
  outline: none;
  border-color: rgba(59, 130, 246, 0.42);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}

body.dark .app-layout input:not([type="checkbox"]):not([type="radio"]):focus-visible,
body.dark .app-layout select:focus-visible,
body.dark .app-layout textarea:focus-visible {
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.22);
}

.app-layout ::placeholder {
  color: rgba(100, 116, 139, 0.52);
  opacity: 1;
}

body.dark .app-layout ::placeholder {
  color: rgba(148, 163, 184, 0.48);
}

.app-layout .table-wrap thead th,
.app-layout table thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  background: linear-gradient(180deg, #fafbfd 0%, #f4f6f9 100%);
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.065);
}

body.dark .app-layout .table-wrap thead th,
body.dark .app-layout table thead th {
  background: linear-gradient(180deg, #1e293b 0%, #172033 100%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.06);
}

.app-layout tbody tr {
  transition: background-color 120ms var(--instant-ease);
}

.app-layout tbody tr:hover,
.app-layout .table-wrap tbody tr:hover {
  background: rgba(59, 130, 246, 0.045);
}

.app-layout tbody tr .btn.btn-xs,
.app-layout tbody tr .order-actions .btn,
.app-layout tbody tr .product-actions-cell .btn {
  opacity: 0.84;
  transition: opacity 120ms var(--instant-ease), transform 120ms var(--instant-ease), filter 120ms var(--instant-ease);
}

.app-layout tbody tr:hover .btn.btn-xs,
.app-layout tbody tr:hover .order-actions .btn,
.app-layout tbody tr:hover .product-actions-cell .btn {
  opacity: 1;
}

.app-layout #menu,
.app-layout .content-scroll,
.app-layout .command-palette-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.48) transparent;
}

.app-layout #menu::-webkit-scrollbar,
.app-layout .content-scroll::-webkit-scrollbar,
.app-layout .command-palette-list::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.app-layout #menu::-webkit-scrollbar-thumb,
.app-layout .content-scroll::-webkit-scrollbar-thumb,
.app-layout .command-palette-list::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.38);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.app-layout #menu::-webkit-scrollbar-thumb:hover,
.app-layout .content-scroll::-webkit-scrollbar-thumb:hover,
.app-layout .command-palette-list::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 116, 139, 0.45);
}

body.dark .app-layout #menu,
body.dark .app-layout .content-scroll,
body.dark .app-layout .command-palette-list {
  scrollbar-color: rgba(71, 85, 105, 0.55) transparent;
}

body.dark .app-layout #menu::-webkit-scrollbar-thumb,
body.dark .app-layout .content-scroll::-webkit-scrollbar-thumb,
body.dark .app-layout .command-palette-list::-webkit-scrollbar-thumb {
  background-color: rgba(71, 85, 105, 0.55);
}

/* ===== LEGACY COMPAT END ===== */

/* ===== Modal system (single source of truth) =====
   Nguồn chính để chỉnh modal từ đây trở xuống.
   - Overlay may blur the page behind
   - Modal content is ALWAYS solid white (no glass/opacity/blur)
   - Normal modals have padding; POS sale modal uses padding: 0 and its own internal layout
*/

/* legacy token removed, see styles/core/variables.css */

.modal,
.modal-overlay {
  background: var(--modal-overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* Base surfaces (no glass) */
.modal-card,
.modal-content,
.pos-modal {
  background: #ffffff;
  opacity: 1;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
  border: 1px solid var(--modal-border);
  border-radius: var(--modal-radius);
  box-shadow: var(--modal-shadow);
}

/* Normal modal sizing + padding */
.modal-card:not(.pos-modal),
.modal-content:not(.pos-modal) {
  width: min(92vw, 1040px);
  max-width: 1100px;
  padding: var(--modal-pad);
}

.modal-card.modal-order-detail,
#modal .modal-card.modal-order-detail {
  width: min(86vw, 860px) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: 82vh !important;
  padding: 18px 20px !important;
}

#modal .modal-card.modal-order-detail #modalForm {
  height: auto !important;
  max-height: calc(82vh - 120px) !important;
  overflow-y: auto !important;
  overflow-x: hidden;
  gap: 12px !important;
}

#modal .modal-card.modal-order-detail .modal-head h3 {
  font-size: 22px;
}

#modal .modal-card.modal-order-detail .panel {
  padding: 14px;
}

#modal .modal-card.modal-order-detail .preview-grid {
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 10px;
}

#modal .modal-card.modal-order-detail .table-wrap th,
#modal .modal-card.modal-order-detail .table-wrap td {
  padding: 8px 10px;
}

#modal .modal-card.modal-order-detail .order-detail-actions {
  justify-content: flex-end;
  margin-top: 10px;
}

/* Normal modal header/footer */
.modal-head {
  background: #ffffff;
  border-bottom: 1px solid var(--modal-border);
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 18px 22px 14px;
  margin: 0;
}

.modal-title-wrap h3,
.modal-head h3 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--control-text);
}

.modal-meta {
  color: #64748b;
  opacity: 1;
}

.modal-close-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--modal-border);
  background: #ffffff;
  color: #334155;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
  transform: translateY(-1px);
}

#modalForm {
  overflow: auto;
  min-height: 0;
  padding: 18px 22px 0;
}

.modal-card:not(.pos-modal) #modalForm,
.modal-content:not(.pos-modal) #modalForm {
  padding-left: 0;
  padding-right: 0;
}

#modalForm::-webkit-scrollbar { width: 8px; height: 8px; }
#modalForm::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.46);
  border: 2px solid transparent;
  background-clip: padding-box;
}
#modalForm::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.55);
  border: 2px solid transparent;
  background-clip: padding-box;
}

#modalForm input,
#modalForm select,
#modalForm textarea {
  background: #ffffff;
  color: var(--control-text);
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  min-height: 42px;
}

#modalForm textarea { min-height: 88px; }

#modalForm input::placeholder,
#modalForm textarea::placeholder {
  color: var(--control-placeholder);
  opacity: 1;
}

#modalForm input:focus,
#modalForm select:focus,
#modalForm textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: #ffffff;
  border-top: 1px solid var(--modal-border);
  padding: 14px 22px;
  margin-top: 10px;
}

.modal-actions .btn { min-height: 40px; border-radius: 12px; }

/* POS sale modal (Thêm đơn bán) — must not inherit normal padding */
.modal-card.pos-modal,
#modal .modal-card.pos-modal {
  width: min(88vw, 1040px);
  max-width: 1040px;
  height: auto !important;
  min-height: 0 !important;
  max-height: min(88vh, 760px) !important;
  padding: 0 !important;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

#modal .modal-card.pos-modal .modal-actions { display: none; }
#modal .modal-card.pos-modal .modal-actions { margin-top: 0 !important; }

#modal .modal-card.pos-modal .modal-head {
  padding: 14px 18px;
}

#modal .modal-card.pos-modal .modal-head h3 {
  font-size: 22px;
}

#modal .modal-card.pos-modal .modal-close-btn {
  width: 34px;
  height: 34px;
}

#modal .modal-card.pos-modal #modalForm {
  padding: 0;
  margin: 0;
  background: #ffffff;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(min(88vh, 760px) - 118px) !important;
  overflow-y: auto !important;
  overflow-x: hidden;
}

#modal .modal-card.pos-modal .pos-modal-headline {
  padding: 8px 14px;
  margin-bottom: 6px;
  min-height: auto;
  border-bottom: 0;
  background: #ffffff;
}

#modal .modal-card.pos-modal .pos-modal-headline .left {
  display: none;
}

#modal .modal-card.pos-modal .pos-modal-headline .right {
  margin-left: auto;
}

#modal .modal-card.pos-modal .pos-order-layout.pos-real {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 14px;
  padding: 10px 14px 12px;
  min-height: 0;
  height: auto;
  align-items: start;
}

#modal .modal-card.pos-modal .pos-left,
#modal .modal-card.pos-modal .pos-right {
  min-height: 0;
  align-self: start;
}

#modal .modal-card.pos-modal .pos-left {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  min-height: 0 !important;
  padding-bottom: 0 !important;
}

#modal .modal-card.pos-modal .pos-right {
  display: grid;
  grid-template-rows: repeat(4, auto);
  align-content: start;
  gap: 10px;
}

#modal .modal-card.pos-modal .pos-right .panel,
#modal .modal-card.pos-modal .pos-left .panel {
  padding: 10px;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.05);
}

#modal .modal-card.pos-modal .pos-items-wrap {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  max-height: 260px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
}

#modal .modal-card.pos-modal .pos-cart-list {
  min-height: 0 !important;
  height: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

#modal .modal-card.pos-modal #orderItemsEmpty {
  min-height: 64px !important;
  padding: 12px !important;
  display: grid;
  place-items: center;
  text-align: center;
}

#modal .modal-card.pos-modal .pos-global-search input,
#modal .modal-card.pos-modal .pos-head-grid select,
#modal .modal-card.pos-modal .pos-head-grid input,
#modal .modal-card.pos-modal textarea,
#modal .modal-card.pos-modal .preview-grid input,
#modal .modal-card.pos-modal .preview-grid select {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12.5px;
  border-radius: 10px;
}

#modal .modal-card.pos-modal textarea {
  min-height: 58px;
}

#modal .modal-card.pos-modal .pos-head-grid.compact {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  margin-top: 0;
}

#modal .modal-card.pos-modal .pos-head-grid.compact > label:nth-child(3) {
  grid-column: 1 / -1;
}

#modal .modal-card.pos-modal .pos-left > label.compact-note {
  margin-top: 4px !important;
}

#modal .modal-card.pos-modal .product-dropdown {
  z-index: 10100;
}

#modal .modal-card.pos-modal .preview-grid > div {
  display: flex;
  align-items: center;
  min-height: 32px;
}

#modal .modal-card.pos-modal .preview-grid > div:nth-child(even) {
  width: 100%;
}

#modal .modal-card.pos-modal .preview-grid input,
#modal .modal-card.pos-modal .preview-grid select {
  width: 100%;
}

#modal .modal-card.pos-modal .pos-modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 40;
  background: #ffffff;
  border-top: 1px solid var(--modal-border);
  min-height: 50px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#modal .modal-card.pos-modal .pos-footer-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#modal .modal-card.pos-modal .pos-right .panel {
  min-height: auto;
}

#modal .modal-card.pos-modal .pos-right .panel h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

#modal .modal-card.pos-modal label,
#modal .modal-card.pos-modal .card-title {
  color: #334155;
}

/* Ensure no global blur can leak into modal content */
.modal-card *,
.modal-content *,
.pos-modal * { filter: none; }

.modal-card .card,
.modal-card .panel,
.modal-card .table-wrap,
.modal-card table,
.modal-content .card,
.modal-content .panel,
.modal-content .table-wrap,
.modal-content table,
.pos-modal .card,
.pos-modal .panel,
.pos-modal .table-wrap,
.pos-modal table {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.modal-card thead th,
.modal-content thead th,
.pos-modal thead th {
  background: #f8fafc;
  color: var(--control-text);
  border-color: var(--modal-border);
}

@media (max-width: 1100px) {
  .modal-card:not(.pos-modal),
  .modal-content:not(.pos-modal) {
    padding: var(--modal-pad-sm);
  }
  .modal-head { padding: 14px 16px 12px; }
  #modalForm { padding: 14px 16px 0; }
  .modal-actions { padding: 12px 16px; }
  .modal-title-wrap h3,
  .modal-head h3 { font-size: 24px; }

  #modal .modal-card.pos-modal {
    width: 96vw;
    height: min(92vh, 760px);
    max-height: min(92vh, 760px);
  }

  #modal .modal-card.pos-modal .pos-order-layout.pos-real {
    grid-template-columns: 1fr;
  }
}

/* ===== NEW UI QUARANTINE GUARD =====
   Prevent legacy style.css visuals from overriding modular component/page CSS. */
body.use-new-ui .modal-card,
body.use-new-ui .modal-content,
body.use-new-ui .pos-modal,
body.use-new-ui .table-wrap,
body.use-new-ui .card,
body.use-new-ui .panel {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.use-new-ui .table-wrap table,
body.use-new-ui .orders-table,
body.use-new-ui .product-center-table table {
  background: transparent;
}

/* Customers CRM polish */
.customers-page .customers-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.customers-page .customers-toolbar input,
.customers-page .customers-toolbar select {
  height: 34px;
  min-height: 34px;
  font-size: 12.5px;
}

.customers-page .customers-toolbar #customerSearchFilter {
  min-width: 300px;
  flex: 1 1 320px;
}

.customers-page .customer-kpi-grid .card {
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}

.customers-page .customer-source-panel {
  border-radius: 14px;
}

.customers-page .customer-source-panel h3 {
  margin-bottom: 10px;
}

.customers-page .customer-source-list {
  display: block;
}

.customers-page .customer-source-summary {
  border: 1px solid #e7edf5;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.customers-page .customer-source-head,
.customers-page .customer-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px 140px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}

.customers-page .customer-source-head {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  border-bottom: 1px solid #e7edf5;
}

.customers-page .customer-source-row {
  border-bottom: 1px solid #eef2f7;
}

.customers-page .customer-source-row:last-child {
  border-bottom: 0;
}

.customers-page .customer-source-row .source-name {
  color: #334155;
  font-size: 12.5px;
}

.customers-page .customer-source-row .source-count {
  color: #64748b;
  font-size: 12px;
}

.customers-page .customer-source-row .source-revenue,
.customers-page .customer-source-head .source-revenue {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.customers-page .customer-source-empty {
  color: #64748b;
  font-size: 12.5px;
  padding: 9px 10px;
}

.customers-page .customer-table-wrap {
  overflow-x: auto;
}

.customers-page table {
  table-layout: fixed;
  width: 100%;
}

.customers-page .customer-crm-table {
  width: 100%;
  min-width: 1180px;
}

.customers-page .customer-crm-table th,
.customers-page .customer-crm-table td {
  padding: 8px 10px;
  font-size: 12.8px;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: clip;
}

.customers-page .customer-crm-table th.money-head,
.customers-page .customer-crm-table td.money-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.customers-page .customer-crm-table td.count-cell,
.customers-page .customer-crm-table td.date-cell {
  text-align: center;
}

.customers-page th.customer-col-id,
.customers-page .customer-col-id {
  text-align: center;
}

.customers-page th.customer-col-source,
.customers-page .customer-col-source {
  text-align: center;
}

.customers-page th.customer-col-tier,
.customers-page .customer-col-tier {
  text-align: center;
}

.customers-page th.customer-col-orders,
.customers-page .customer-col-orders {
  text-align: center;
}

.customers-page th.customer-col-spent,
.customers-page .customer-col-spent {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.customers-page th.customer-col-last-date,
.customers-page .customer-col-last-date {
  text-align: center;
}

.customers-page th.customer-col-actions,
.customers-page .customer-col-actions {
  text-align: center;
}

.customers-page .customer-col-name,
.customers-page .customer-col-top-product,
.customers-page .customer-col-note {
  overflow: hidden;
  text-overflow: ellipsis;
}

.customers-page .customer-id-cell {
  text-align: center;
  white-space: nowrap;
  color: #475569;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.customers-page .customer-main-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}

.customers-page .customer-name-link {
  font-weight: 700;
  text-align: left;
}

.customers-page .customer-subtext {
  color: #64748b;
  font-size: 11.8px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customers-page .customer-tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 7px;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
}

.customers-page .customer-tier-badge.tier-vip {
  background: #fef9c3;
  border-color: #fde68a;
  color: #a16207;
}

.customers-page .customer-tier-badge.tier-loyal {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.customers-page .customer-tier-badge.tier-new {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0369a1;
}

.customers-page .customer-tier-badge.tier-dormant {
  background: #ffedd5;
  border-color: #fdba74;
  color: #9a3412;
}

.customers-page .customer-tier-badge.tier-normal {
  background: #f1f5f9;
  border-color: #dbe3ee;
  color: #475569;
}

.customers-page .customer-source-select {
  width: 100%;
  max-width: 116px;
  height: 28px;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid #dbe3ee;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  padding: 0 24px 0 10px;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 11px, calc(100% - 7px) 11px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  margin: 0 auto;
  display: block;
}

.customers-page .customer-source-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.customers-page .customer-row:hover td {
  background: rgba(15, 23, 42, 0.024);
}

.customers-page .customer-actions-cell {
  text-align: center;
  white-space: nowrap;
}

.customers-page .customer-actions-cell .btn {
  min-width: 46px;
}

#modal .customer-detail-modal {
  display: grid;
  gap: 10px;
}

#modal .customer-detail-grid {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

#modal .customer-detail-label {
  color: #64748b;
  font-size: 12px;
}

#modal .customer-detail-value {
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
}

#modal .customer-detail-orders h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

/* Dashboard — storefront inquiries */
.hydra-dash-storefront-inq .hydra-inq-table {
  font-size: 13px;
}

.hydra-dash-storefront-inq .hydra-inq-table td {
  vertical-align: top;
}

.hydra-inq-note {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  max-width: 320px;
  white-space: pre-wrap;
  word-break: break-word;
}

.hydra-inq-actions {
  white-space: normal;
}

.hydra-inq-actions .btn {
  margin: 2px;
}

.hydra-inq-new-pill {
  display: inline-block;
  background: #f59e0b;
  color: #1c1917;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.topbar-inquiry-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  margin-right: 8px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.22);
  color: #b45309;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.topbar-inquiry-chip strong,
.topbar-inquiry-chip__count {
  font-weight: 800;
  color: #92400e;
}

.topbar-inquiry-chip__label {
  font-weight: 600;
  color: #b45309;
}

.topbar-inquiry-chip:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
  color: #b45309;
  text-decoration: none;
}

.topbar-inquiry-chip:focus-visible {
  outline: 2px solid rgba(245, 158, 11, 0.45);
  outline-offset: 2px;
}

body.use-new-ui .sidebar-inquiry-badge,
body.use-new-ui .menu-item-badge.sidebar-inquiry-badge {
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: none;
  border-radius: 999px;
  background: #f59e0b;
  color: #1c1917;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-sizing: border-box;
  align-self: center;
  box-shadow: none;
}

/* Phase 6 — CRM layout + inquiry badges */
.hydra-crm-dashboard-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 2.2fr);
  gap: 14px;
  align-items: start;
}

@media (max-width: 1100px) {
  .hydra-crm-dashboard-row {
    grid-template-columns: 1fr;
  }
}

.hydra-dash-crm-kpis .hydra-crm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .hydra-dash-crm-kpis .hydra-crm-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.hydra-crm-kpi {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hydra-crm-kpi-lab {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hydra-crm-kpi-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.hydra-crm-top-block {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}

.hydra-crm-top-title {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}

.hydra-crm-top-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.hydra-crm-top-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hydra-inq-table-wrap {
  overflow-x: auto;
}

.hydra-inq-code {
  font-size: 12px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
}

.hydra-inq-lead-hint {
  margin: 0 0 0.75rem;
}

.hydra-inq-status-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.hydra-inq-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.hydra-inq-st {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hydra-inq-st--new {
  background: #fef3c7;
  color: #92400e;
}
.hydra-inq-st--contacted {
  background: #dbeafe;
  color: #1e40af;
}
.hydra-inq-st--negotiating {
  background: #ede9fe;
  color: #5b21b6;
}
.hydra-inq-st--reserved {
  background: #cffafe;
  color: #0e7490;
}
.hydra-inq-st--converted {
  background: #dcfce7;
  color: #166534;
}
.hydra-inq-st--cancelled {
  background: #f1f5f9;
  color: #64748b;
}

.hydra-inq-line-details {
  margin: 0;
  font-size: 12px;
}

.hydra-inq-line-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #334155;
  list-style-position: outside;
}

.hydra-inq-line-details[open] summary {
  margin-bottom: 6px;
}

.hydra-inq-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}

.hydra-inq-mini-table th,
.hydra-inq-mini-table td {
  border: 1px solid #e2e8f0;
  padding: 4px 8px;
  text-align: left;
}

.hydra-inq-mini-table .num,
.hydra-inq-mini-table .money-col {
  text-align: right;
  white-space: nowrap;
}

.hydra-inq-res-banner {
  margin: 6px 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.hydra-inq-res-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 4px;
}
.hydra-dash-reservations .hydra-inq-table {
  font-size: 13px;
}

.hydra-crm-timeline h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.hydra-crm-tl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.hydra-crm-tl-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px 10px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  align-items: start;
}

.hydra-crm-tl-note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #64748b;
  line-height: 1.35;
}

.hydra-crm-tl-left {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.hydra-crm-tl-mid {
  text-align: right;
  white-space: nowrap;
}

.hydra-crm-tl-actions {
  white-space: nowrap;
}

.hydra-crm-tl-kind {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 6px;
}

.hydra-crm-tl-kind--order {
  background: #e0f2fe;
  color: #0369a1;
}

.hydra-crm-tl-kind--inquiry {
  background: #fef9c3;
  color: #854d0e;
}

/* CRM customer detail — retail profile v2 */
#modal .hydra-crm-profile--v2 {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#modal .hydra-crm-profile--v2 .panel {
  padding: 8px 10px;
  margin: 0;
}

#modal .hydra-crm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px 10px;
  padding: 2px 2px 4px;
}

#modal .hydra-crm-head-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

#modal .hydra-crm-head-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

#modal .hydra-crm-head-source {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

#modal .hydra-crm-head-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  max-width: 100%;
}

#modal .hydra-crm-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

#modal .hydra-crm-tag--empty {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  font-weight: 600;
}

#modal .hydra-crm-sec-title {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

#modal .hydra-crm-kpi-grid--4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

#modal .hydra-crm-kpi-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  background: #f8fafc;
  min-width: 0;
}

#modal .hydra-crm-kpi-card--spend {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-color: #bfdbfe;
}

#modal .hydra-crm-kpi-card--profit {
  background: linear-gradient(135deg, #ecfdf5 0%, #f8fafc 100%);
  border-color: #a7f3d0;
}

#modal .hydra-crm-kpi-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#modal .hydra-crm-kpi-value {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
  word-break: break-word;
}

#modal .hydra-crm-kpi-card--spend .hydra-crm-kpi-value {
  color: #1d4ed8;
}

#modal .hydra-crm-kpi-card--profit .hydra-crm-kpi-value {
  color: #047857;
}

#modal .hydra-crm-rank-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 200px;
  overflow-y: auto;
}

#modal .hydra-crm-rank-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

#modal .hydra-crm-rank-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#modal .hydra-crm-rank-card:first-child .hydra-crm-rank-num {
  background: #fef3c7;
  color: #b45309;
}

#modal .hydra-crm-rank-body {
  flex: 1;
  min-width: 0;
}

#modal .hydra-crm-rank-name {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#modal .hydra-crm-rank-stats {
  display: flex;
  gap: 12px;
  margin-top: 2px;
  font-size: 11px;
  color: #64748b;
}

#modal .hydra-crm-rank-stat strong {
  color: #0f172a;
  font-weight: 800;
}

#modal .hydra-crm-rank-stat--rev strong {
  color: #1d4ed8;
}

#modal .hydra-crm-order-timeline {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 280px;
  overflow-y: auto;
}

#modal .hydra-crm-order-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

#modal .hydra-crm-order-card:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

#modal .hydra-crm-order-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#modal .hydra-crm-order-id {
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
}

#modal .hydra-crm-order-date {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

#modal .hydra-crm-order-top .status-badge {
  margin-left: auto;
}

#modal .hydra-crm-order-products {
  font-size: 12px;
  color: #334155;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#modal .hydra-crm-order-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

#modal .hydra-crm-order-total {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

#modal .hydra-crm-order-profit {
  font-size: 11px;
  font-weight: 700;
  color: #059669;
}

#modal .hydra-crm-behavior-grid--4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

#modal .hydra-crm-behavior-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  min-width: 0;
}

#modal .hydra-crm-behavior-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

#modal .hydra-crm-behavior-value {
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  word-break: break-word;
}

#modal .hydra-crm-footer {
  background: #f8fafc;
  border-color: #e2e8f0;
}

#modal .hydra-crm-crm-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
}

#modal .hydra-crm-crm-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  min-width: 0;
}

#modal .hydra-crm-crm-row span {
  color: #94a3b8;
  font-weight: 600;
}

#modal .hydra-crm-crm-row strong {
  color: #334155;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
}

#modal .hydra-crm-crm-row--full {
  grid-column: 1 / -1;
}

#modal .hydra-crm-social-more,
#modal .hydra-crm-inq-more {
  margin-top: 6px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
}

#modal .hydra-crm-social-more summary,
#modal .hydra-crm-inq-more summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  list-style: none;
}

#modal .hydra-crm-social-more summary::-webkit-details-marker,
#modal .hydra-crm-inq-more summary::-webkit-details-marker {
  display: none;
}

#modal .hydra-crm-crm-rows--nested {
  margin-top: 6px;
}

#modal .hydra-crm-inq-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  max-height: 140px;
  overflow-y: auto;
}

#modal .hydra-crm-inq-row {
  padding: 5px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fafafa;
  font-size: 11px;
}

#modal .hydra-crm-inq-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

#modal .hydra-crm-empty {
  font-size: 12px;
  color: #94a3b8;
  padding: 6px 2px;
}

@media (max-width: 720px) {
  #modal .hydra-crm-kpi-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #modal .hydra-crm-head {
    flex-direction: column;
  }

  #modal .hydra-crm-head-tags {
    justify-content: flex-start;
  }

  #modal .hydra-crm-crm-rows {
    grid-template-columns: 1fr;
  }
}
