/* Final operational overrides loaded after the legacy stylesheet. */
body {
  color: #0f172a;
  font-family: "Noto Sans Thai", "IBM Plex Sans Thai", "Prompt", "Leelawadee UI", "Segoe UI", sans-serif;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select,
textarea,
.btn,
.badge,
.hint,
.stack-header,
.list-item,
.report-row,
.stat-card,
.table-stack,
.data-table,
.modal-card,
.sidebar,
.sidebar *,
.topbar,
.topbar * {
  font-family: inherit;
}

/* Removed static override */

.bottom-nav {
  border: 1px solid rgba(148, 163, 184, 0.18) !important;
}

.bottom-nav button span:not(.nav-icon) {
  color: #102033;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.bottom-nav button.active span:not(.nav-icon),
.bottom-nav button.active .nav-icon {
  color: #ffffff;
}

.bottom-nav button:not(.active):hover {
  background: rgba(8, 47, 73, 0.08);
  border-color: rgba(8, 47, 73, 0.18);
}

.dashboard-link-card,
.activity-button,
.report-button {
  width: 100%;
  appearance: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.dashboard-link-card:hover,
.activity-button:hover,
.report-button:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 116, 144, 0.34);
  box-shadow: 0 18px 38px rgba(7, 26, 47, 0.14);
}

#dashboardPage #dashboardStats.stats-grid {
  display: grid !important;
  gap: 14px !important;
  margin-bottom: 20px !important;
}

#dashboardPage #dashboardStats .stat-card {
  min-height: 108px !important;
  padding: 18px 20px !important;
  border-radius: 24px !important;
}

#dashboardPage #dashboardStats .stat-card span {
  font-size: 0.82rem !important;
  line-height: 1.2 !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
}

#dashboardPage #dashboardStats .stat-card strong {
  font-size: clamp(2rem, 3vw, 3rem) !important;
  line-height: 1 !important;
}

.finance-two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.finance-column {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 47, 74, 0.1);
}

.finance-column h3 {
  margin: 0 0 6px;
  color: #071a2f;
}

.report-row.is-income {
  border-left: 4px solid #0f766e;
}

.report-row.is-expense {
  border-left: 4px solid #dc2626;
}

.danger-badge {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.defect-map-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(7, 26, 47, 0.05), rgba(22, 184, 214, 0.08));
  border: 1px solid rgba(15, 47, 74, 0.1);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(2, 8, 23, 0.62);
  backdrop-filter: blur(10px);
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(960px, 100%);
  max-height: min(92vh, 860px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 28px 80px rgba(2, 8, 23, 0.34);
}

.defect-modal-card {
  display: grid;
  gap: 18px;
}

.defect-device-canvas {
  position: relative;
  min-height: 430px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 8%, rgba(14, 165, 233, 0.16), transparent 18%),
    linear-gradient(145deg, #eaf2f9, #f8fafc);
  border: 1px dashed rgba(15, 47, 74, 0.24);
  overflow: hidden;
  cursor: crosshair;
}

.device-outline {
  position: absolute;
  inset: 42px 32%;
  display: grid;
  place-items: center;
  border: 6px solid #071a2f;
  border-radius: 38px;
  background: linear-gradient(180deg, rgba(7, 26, 47, 0.06), rgba(22, 184, 214, 0.08));
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.72);
  color: #071a2f;
  font-weight: 900;
}

.device-outline::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  width: 64px;
  height: 8px;
  border-radius: 999px;
  background: #071a2f;
  transform: translateX(-50%);
}

.device-outline::after {
  content: "";
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 4px solid rgba(7, 26, 47, 0.8);
  transform: translateX(-50%);
}

.defect-device-canvas[data-device="tablet"] .device-outline,
.defect-device-canvas[data-device="notebook"] .device-outline {
  inset: 64px 18%;
  border-radius: 28px;
}

.defect-device-canvas[data-device="airpods"] .device-outline {
  inset: 80px 30%;
  border-radius: 80px 80px 36px 36px;
}

.defect-pin {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #dc2626;
  border: 3px solid #ffffff;
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.32);
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 900;
}

.defect-list {
  display: grid;
  gap: 10px;
}

.defect-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

/* Removed layout media override */

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 18px;
  }

  .topbar {
    padding: 16px;
  }

  .topbar h1 {
    font-size: clamp(26px, 9vw, 38px);
  }

  .defect-device-canvas {
    min-height: 360px;
  }

  .device-outline {
    inset: 44px 24%;
  }
}

body.is-loading .main-content {
  pointer-events: none;
}

.bottom-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(11, 42, 74, 0.28) transparent;
}

.bottom-nav::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.bottom-nav::-webkit-scrollbar-thumb {
  background: rgba(11, 42, 74, 0.24);
  border-radius: 999px;
}

.bottom-nav[data-role="admin"] {
  box-shadow:
    0 24px 70px rgba(2, 8, 23, 0.3),
    inset 0 0 0 1px rgba(245, 182, 66, 0.16);
}

.bottom-nav[data-role="manager"] {
  box-shadow:
    0 24px 70px rgba(2, 8, 23, 0.26),
    inset 0 0 0 1px rgba(34, 211, 238, 0.14);
}

.side-brand {
  position: relative;
  overflow: hidden;
}

.side-brand::after {
  content: "";
  position: absolute;
  inset: auto -30% -55% auto;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 68%);
  pointer-events: none;
}

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(239, 246, 255, 0.88));
  border: 1px solid rgba(191, 219, 254, 0.72);
  box-shadow: 0 18px 34px rgba(8, 47, 73, 0.08);
}

.view-toolbar-label {
  display: grid;
  gap: 2px;
}

.view-toolbar-label strong {
  color: #071a2f;
  font-size: 0.98rem;
}

.view-toolbar-label span {
  color: #5b6b80;
  font-size: 0.84rem;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.84);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.view-toggle button {
  min-width: 84px;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #526274;
  font-weight: 850;
}

.view-toggle button.active {
  color: #ffffff;
  background: linear-gradient(135deg, #071a2f, #0e5470 68%, #1aa6b7);
  box-shadow: 0 10px 22px rgba(7, 26, 47, 0.2);
}

.command-center-panel {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(26, 166, 183, 0.12), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.9));
  border: 1px solid rgba(186, 213, 235, 0.86);
  box-shadow: 0 24px 54px rgba(11, 42, 74, 0.08);
}

.compact-stack {
  align-items: start;
}

.command-center-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.command-center-list,
.notification-preview-list {
  display: grid;
  gap: 12px;
}

.command-center-card,
.notification-row {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(186, 213, 235, 0.92);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.command-center-card:hover,
.notification-row:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 116, 144, 0.32);
  box-shadow: 0 18px 34px rgba(7, 26, 47, 0.1);
}

.command-center-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px 18px 18px 20px;
}

.command-center-card strong {
  display: block;
  margin-bottom: 4px;
  color: #071a2f;
  font-size: 1rem;
}

.command-center-card p {
  margin: 0;
  color: #66758a;
  font-size: 0.88rem;
  line-height: 1.45;
}

.command-center-count {
  display: inline-grid;
  place-items: center;
  min-width: 64px;
  min-height: 64px;
  padding: 0 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.84);
  color: #071a2f;
  font-size: 1.12rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(191, 219, 254, 0.52);
}

.command-center-side {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(203, 217, 232, 0.92);
}

.notification-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
}

.notification-row strong,
.notification-row span,
.notification-row b {
  display: block;
}

.notification-row strong {
  color: #071a2f;
}

.notification-row span {
  margin-top: 4px;
  color: #66758a;
  font-size: 0.86rem;
}

.notification-row b {
  color: #0b2a4a;
  white-space: nowrap;
}

.card-status-group,
.activity-side {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.status-badge {
  font-weight: 900;
  border-width: 1px;
  border-style: solid;
}

.tone-primary {
  color: #0f3b57;
  background: #dbeafe;
  border-color: #93c5fd;
}

.tone-info {
  color: #0f4c81;
  background: #e0f2fe;
  border-color: #7dd3fc;
}

.tone-progress {
  color: #4338ca;
  background: #e0e7ff;
  border-color: #a5b4fc;
}

.tone-warning {
  color: #92400e;
  background: #fef3c7;
  border-color: #fcd34d;
}

.tone-success {
  color: #166534;
  background: #dcfce7;
  border-color: #86efac;
}

.tone-success-soft {
  color: #0f766e;
  background: #ccfbf1;
  border-color: #5eead4;
}

.tone-danger {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}

.tone-neutral {
  color: #475569;
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.empty-state-rich {
  display: grid;
  justify-items: start;
  gap: 8px;
  min-height: 180px;
  align-content: center;
  padding: 22px;
}

.empty-state-rich strong {
  color: #071a2f;
  font-size: 1rem;
}

.empty-state-rich p {
  margin: 0;
  color: #66758a;
  line-height: 1.55;
}

.empty-state-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #0f3b57;
  font-size: 1.15rem;
  font-weight: 900;
}

.loading-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.loading-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(205, 217, 232, 0.92);
  box-shadow: 0 18px 34px rgba(7, 26, 47, 0.06);
}

.loading-line {
  position: relative;
  overflow: hidden;
  height: 13px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.88);
}

.loading-line::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.88), transparent);
  animation: loadingShimmer 1.2s ease infinite;
}

.loading-line.is-wide {
  height: 18px;
  width: 68%;
}

@keyframes loadingShimmer {
  to {
    transform: translateX(100%);
  }
}

.data-table-wrap {
  overflow: auto;
  border-radius: 24px;
  border: 1px solid rgba(203, 217, 232, 0.92);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 34px rgba(7, 26, 47, 0.06);
}

/* Fix for table mode display */
#repairList.list-grid.is-table-view {
  display: block !important;
  width: 100% !important;
}

.data-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 16px;
  background: linear-gradient(180deg, #f8fbff, #edf4fa);
  color: #465569;
  font-size: 0.82rem;
  font-weight: 900;
  text-align: left;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(203, 217, 232, 0.92);
}

.data-table tbody td {
  padding: 14px 16px;
  vertical-align: top;
  border-bottom: 1px solid rgba(226, 232, 240, 0.82);
  color: #0f172a;
}

.data-table tbody tr:hover {
  background: rgba(248, 250, 252, 0.92);
}

.table-stack {
  display: grid;
  gap: 2px;
}

.table-stack span {
  color: #66758a;
  font-size: 0.86rem;
}

.table-product {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-thumb,
.table-thumb-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid rgba(203, 217, 232, 0.92);
}

.table-thumb-placeholder {
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, #eff6ff, #ecfeff);
  color: #1aa6b7;
  font-weight: 900;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-link-button {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: #0e7490;
  font-weight: 800;
  cursor: pointer;
}

.inline-link-button:hover {
  color: #0b2a4a;
  text-decoration: underline;
}

.report-period-card {
  margin-bottom: 18px;
}

.period-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.period-breakdown-grid > section {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 248, 253, 0.9));
  border: 1px solid rgba(203, 217, 232, 0.92);
}

.period-breakdown-grid h3 {
  margin: 0;
  color: #071a2f;
  font-size: 1rem;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.report-list {
  display: grid;
  gap: 10px;
}

@media (max-width: 1100px) {
  .command-center-grid,
  .period-breakdown-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .bottom-nav {
    scroll-snap-type: x proximity;
  }

  .bottom-nav button {
    scroll-snap-align: start;
  }

  .view-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .view-toggle {
    width: 100%;
    justify-content: space-between;
  }

  .view-toggle button {
    flex: 1 1 0;
  }

  .command-center-panel {
    padding: 18px;
  }

  .command-center-card,
  .notification-row {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .view-toolbar {
    padding: 12px 14px;
    border-radius: 18px;
  }

  .command-center-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .command-center-card {
    grid-template-columns: 1fr;
  }

  .command-center-count,
  .activity-side {
    justify-self: start;
  }

  .notification-row {
    display: grid;
    justify-items: start;
  }
}

.report-insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.report-insight-card {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid rgba(186, 213, 235, 0.92);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(14, 165, 233, 0.12), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.9));
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.report-insight-card:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 116, 144, 0.34);
  box-shadow: 0 20px 38px rgba(8, 47, 73, 0.12);
}

.report-insight-label {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 47, 73, 0.08);
  color: #0b2a4a;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.report-insight-card strong {
  color: #071a2f;
  font-size: 1.1rem;
}

.report-insight-card p {
  margin: 0;
  color: #5b6b80;
  font-size: 0.9rem;
  line-height: 1.45;
}

.record-highlight {
  scroll-margin-top: 96px;
  animation: record-highlight-pulse 2.1s ease;
}

.data-table tr.record-highlight td {
  background: rgba(186, 230, 253, 0.34);
}

.list-item.record-highlight,
.product-card.record-highlight,
.sale-group-card.record-highlight {
  border-color: rgba(14, 165, 233, 0.48) !important;
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.34), 0 22px 42px rgba(8, 47, 73, 0.14);
}

@keyframes record-highlight-pulse {
  0% {
    transform: translateY(-2px);
  }

  100% {
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .report-insights-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .bottom-nav {
    position: static !important;
    top: auto !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch !important;
    gap: 10px !important;
    overflow: visible !important;
    margin: 12px 0 18px !important;
    padding: 14px !important;
    scroll-snap-type: none !important;
  }

  .side-brand {
    display: flex !important;
    grid-column: 1 / -1;
    margin-bottom: 2px !important;
    padding: 12px 14px !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
  }

  .nav-group-label {
    display: block !important;
    grid-column: 1 / -1;
    margin: 8px 4px 2px !important;
    color: #8bdaf0 !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    letter-spacing: 0.14em !important;
  }

  .bottom-nav button {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: flex-start !important;
    padding: 12px 14px !important;
    border-radius: 18px !important;
  }

  .bottom-nav button .nav-icon {
    flex: 0 0 auto;
  }

  .bottom-nav button span:not(.nav-icon) {
    font-size: 13px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .report-insight-card {
    padding: 16px 18px;
    border-radius: 20px;
  }

  .bottom-nav {
    grid-template-columns: 1fr !important;
  }
}

.report-summary-card {
  position: relative;
  width: 100%;
  min-height: 138px;
  align-content: start;
  gap: 8px;
  text-align: left;
}

.report-summary-card strong {
  max-width: calc(100% - 8px);
}

.report-summary-card small {
  color: #5b6b80;
  font-size: 0.82rem;
  line-height: 1.45;
}

.report-summary-card::before {
  content: "ดูรายละเอียด";
  position: absolute;
  right: 16px;
  bottom: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(8, 47, 73, 0.08);
  color: #0b2a4a;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

#bottomNav.bottom-nav {
  scrollbar-gutter: stable;
}

/* Removed layout media override */

@media (max-width: 980px) {
  #app.app-shell {
    display: block !important;
  }

  #bottomNav.bottom-nav {
    position: static !important;
    top: auto !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    overflow: visible !important;
    margin: 12px 0 18px !important;
    padding: 14px !important;
    border-radius: 24px !important;
    background:
      radial-gradient(circle at top right, rgba(103, 232, 249, 0.14), transparent 26%),
      linear-gradient(180deg, #071a2f 0%, #0b2a4a 100%) !important;
    border: 1px solid rgba(125, 211, 252, 0.14) !important;
    box-shadow: 0 22px 48px rgba(2, 8, 23, 0.18) !important;
  }

  #bottomNav .side-brand,
  #bottomNav .nav-group-label {
    grid-column: 1 / -1;
  }

  #bottomNav .side-brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 2px !important;
    padding: 12px 14px !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
  }

  #bottomNav .side-brand .side-brand-mark {
    width: 56px !important;
    height: 56px !important;
    flex-basis: 56px !important;
  }

  #bottomNav .side-brand img {
    width: 100% !important;
    height: 100% !important;
  }

  #bottomNav .side-brand strong,
  #bottomNav .side-brand span {
    color: #ffffff !important;
  }

  #bottomNav .nav-group-label {
    display: block !important;
    margin: 8px 4px 2px !important;
    color: #8bdaf0 !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    letter-spacing: 0.14em !important;
  }

  #bottomNav button {
    width: 100% !important;
    min-width: 0 !important;
    justify-content: flex-start !important;
    padding: 12px 14px !important;
    border-radius: 18px !important;
    color: #d7e7f8 !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
  }

  #bottomNav button span:not(.nav-icon) {
    color: #d7e7f8 !important;
    font-size: 13px !important;
    font-weight: 850 !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    text-align: left !important;
  }

  #bottomNav button .nav-icon {
    color: #67e8f9 !important;
    background: rgba(103, 232, 249, 0.12) !important;
  }

  #bottomNav button.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #0ea5e9, #0891b2) !important;
    box-shadow: 0 12px 28px rgba(14, 165, 233, 0.26) !important;
  }

  #bottomNav button.active span:not(.nav-icon),
  #bottomNav button.active .nav-icon {
    color: #ffffff !important;
  }

  #dashboardPage #dashboardStats.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  #dashboardPage #dashboardStats.stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  #dashboardPage #dashboardStats .stat-card {
    min-height: 96px !important;
    padding: 16px !important;
  }

  #dashboardPage #dashboardStats .stat-card strong {
    font-size: clamp(1.85rem, 8vw, 2.5rem) !important;
  }
}

@media (max-width: 640px) {
  #bottomNav.bottom-nav {
    grid-template-columns: 1fr !important;
  }

  .report-summary-card::before {
    position: static;
    width: max-content;
    margin-top: 2px;
  }
}

/* Compact scale pass: reduce overall UI size while keeping readability. */
body {
  font-size: 14px !important;
}

.topbar {
  padding: 14px 18px !important;
  min-height: 82px !important;
  border-radius: 24px !important;
}

.topbar h1 {
  font-size: clamp(1.28rem, 2vw, 1.72rem) !important;
}

.topbar .eyebrow {
  font-size: 0.68rem !important;
  margin-bottom: 1px !important;
}

.main-content {
  gap: 14px !important;
}

.dashboard-filter-bar,
.dashboard-panel,
.report-summary-card {
  border-radius: 20px !important;
}

.dashboard-filter-bar {
  padding: 12px 14px !important;
}

.dashboard-panel {
  padding: 16px 18px !important;
}

.dashboard-panel h2,
.report-summary-card h3 {
  font-size: clamp(1.08rem, 1.7vw, 1.32rem) !important;
}

.dashboard-panel p,
.report-row span,
.activity-row span,
.empty-state,
.dashboard-filter-bar p {
  font-size: 0.86rem !important;
}

.activity-row {
  padding: 11px 12px !important;
  border-radius: 16px !important;
}

#dashboardPage #dashboardStats.stats-grid {
  gap: 12px !important;
}

#dashboardPage #dashboardStats .stat-card {
  min-height: 96px !important;
  padding: 14px 16px !important;
  border-radius: 20px !important;
}

#dashboardPage #dashboardStats .stat-card span {
  font-size: 0.76rem !important;
  line-height: 1.18 !important;
}

#dashboardPage #dashboardStats .stat-card strong {
  font-size: clamp(1.8rem, 2.4vw, 2.55rem) !important;
}

@media (min-width: 981px) {
  #app.app-shell {
    grid-template-columns: 272px minmax(0, 1fr) !important;
    gap: 16px !important;
    padding: 14px 18px 20px !important;
  }

  #bottomNav.bottom-nav {
    top: 14px !important;
    gap: 6px !important;
    max-height: calc(100vh - 28px) !important;
    padding: 15px !important;
    border-radius: 26px !important;
  }

  #bottomNav .side-brand {
    gap: 12px !important;
    min-height: 78px !important;
    padding: 12px 14px !important;
    border-radius: 20px !important;
  }

  #bottomNav .side-brand .side-brand-mark {
    width: 56px !important;
    height: 56px !important;
    flex: 0 0 56px !important;
    border-radius: 16px !important;
  }

  #bottomNav .side-brand strong {
    font-size: 0.96rem !important;
    line-height: 1.04 !important;
  }

  #bottomNav .side-brand div span {
    font-size: 0.76rem !important;
    line-height: 1.22 !important;
  }

  #bottomNav .nav-group-label {
    margin: 14px 8px 4px !important;
    font-size: 10px !important;
  }

  #bottomNav button {
    min-height: 44px !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
  }

  #bottomNav button::before {
    top: 10px !important;
    bottom: 10px !important;
  }

  #bottomNav button span:not(.nav-icon) {
    font-size: 13px !important;
  }

  #bottomNav button .nav-icon {
    width: 28px !important;
    height: 28px !important;
  }
}

@media (max-width: 980px) {
  body {
    font-size: 13.5px !important;
  }

  #bottomNav.bottom-nav {
    padding: 12px !important;
    border-radius: 20px !important;
  }

  #bottomNav .side-brand {
    gap: 10px !important;
    padding: 10px 12px !important;
  }

  #bottomNav .side-brand .side-brand-mark {
    width: 50px !important;
    height: 50px !important;
    flex-basis: 50px !important;
  }

  #bottomNav .side-brand strong {
    font-size: 0.92rem !important;
  }

  #bottomNav .side-brand div span {
    font-size: 0.74rem !important;
  }

  #bottomNav button {
    min-height: 44px !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
  }

  #bottomNav button span:not(.nav-icon) {
    font-size: 12.5px !important;
  }

  #dashboardPage #dashboardStats.stats-grid {
    gap: 10px !important;
  }
}

@media (max-width: 760px) {
  #dashboardPage #dashboardStats .stat-card {
    min-height: 88px !important;
    padding: 14px !important;
  }

  #dashboardPage #dashboardStats .stat-card strong {
    font-size: clamp(1.68rem, 7vw, 2.15rem) !important;
  }
}

.installment-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.mini-stat {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(7, 26, 47, 0.04), rgba(22, 184, 214, 0.08));
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.mini-stat span,
.mini-stat small {
  color: #5f7492;
  font-size: 12px;
  line-height: 1.35;
}

.mini-stat strong {
  color: #0f172a;
  font-size: 16px;
  line-height: 1.35;
}

.installment-detail-layout {
  display: grid;
  gap: 16px;
}

.installment-history-card,
.installment-schedule-card {
  display: grid;
  gap: 12px;
}

.text-danger {
  color: #dc2626;
  font-weight: 700;
}

.modal-card .data-table-wrap {
  margin-top: 0;
}

.installment-history-group + .installment-history-group {
  margin-top: 16px;
}

.installment-history-group .stack-header {
  margin-bottom: 8px;
}

.lookup-helper,
.installment-lookup-helper {
  display: block;
  margin-top: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.picker-field {
  display: grid;
  gap: 10px;
}

.picker-field .btn {
  width: 100%;
  justify-content: center;
}

.picker-summary {
  min-height: 52px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(130, 168, 214, 0.35);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 247, 255, 0.92));
  color: #3f5876;
  font-weight: 600;
  line-height: 1.45;
}

.product-picker-modal {
  width: min(1180px, 94vw);
  max-height: min(88vh, 920px);
  overflow: auto;
}

.product-picker-modal label {
  display: grid;
  gap: 8px;
}

.product-picker-modal select,
.product-picker-modal input[type="search"] {
  width: 100%;
}

.product-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.product-picker-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

.product-picker-grid .product-card {
  height: 100%;
}

.product-picker-grid .product-card-actions {
  margin-top: auto;
}

.picker-helper {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(227, 241, 255, 0.72);
  border: 1px solid rgba(130, 168, 214, 0.26);
  color: #47617f;
  font-weight: 600;
}

.debt-preview-card {
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(130, 168, 214, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 248, 255, 0.94));
}

.sale-cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.sale-cart-main {
  display: grid;
  gap: 6px;
}

.sale-cart-side {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.sale-cart-editors {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 160px));
  gap: 12px;
}

.sale-cart-editors label {
  display: grid;
  gap: 6px;
}

.sale-cart-editors span {
  font-size: 12px;
  font-weight: 700;
  color: #48617c;
}

.sale-cart-editors input {
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(130, 168, 214, 0.35);
  background: rgba(255, 255, 255, 0.96);
}

.sale-picker label select,
#installmentProductSelect {
  min-height: 48px;
}

/* --- FINAL MOBILE FIX --- */
@media screen and (max-width: 980px) {
  #bottomNav, 
  .bottom-nav,
  .nav-group-label,
  .side-brand,
  #bottomNav button {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
  
  .mobile-bottom-nav {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 9999999 !important;
  }

  .main-content {
    padding-bottom: 100px !important;
  }
}
