﻿/* ===========================================================
   Mutanabbi Invoicing System - Royal Blue Theme
   Light app with dark sidebar
=========================================================== */

:root {
  /* Layout */
  --sidebar-bg: linear-gradient(180deg, #020617 0%, #020617 60%, #030712 100%);

  --sidebar-text: #e5e7eb;
  --sidebar-hover: #1e293b;

	/* --app-bg: #f1f5f9;*/
  --app-bg: #e2ecf7;
  --card-bg: #ffffff;

  --text-main: #0f172a;
  --text-muted: #64748b;

  --border: #cbd5e1;
  --primary: #2563eb;
  --primary-soft: #e0ecff;
  --danger: #ef4444;

  --radius-lg: 18px;
  --radius: 12px;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 78px;
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.12);

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--text-main);
}

/* Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-shell.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed-width);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: width 0.2s ease, min-width 0.2s ease, padding 0.2s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 14px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.45), transparent 55%);
  position: relative;
}

.logo-circle {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #60a5fa 0, #1d4ed8 65%, #020617 100%);
  color: #f9fafb;
  font-weight: 700;
  font-size: 18px;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-toggle {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  color: #e5e7eb;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.sidebar-toggle:hover {
  background: rgba(37, 99, 235, 0.55);
}

.logo-title {
  font-weight: 600;
  font-size: 15px;
}

.logo-subtitle {
  font-size: 11px;
  opacity: 0.8;
}

.logo-developer {
  font-size: 10px;
  opacity: 0.72;
}

/* Nav */
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 6px;
}

.nav-link {
  border: none;
  background: transparent;
  color: #cbd5f5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  text-align: left;
  transition: background 0.18s ease-out, color 0.18s ease-out,
    transform 0.18s ease-out;
}

/*.nav-link:hover {
  background: rgba(148, 163, 184, 0.2);
  color: #ffffff;
  transform: translateX(2px);
}*/
.nav-link:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateX(2px);
}


/*.nav-link.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.7));
  color: #eff6ff;
}*/

/* Default nav links */
.nav-link {
  color: #cbd5e1;
}

/* Invoicing pages */
.group-btn.invoicing.active ~ .nav-group-items .nav-link.active {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-left: 3px solid #10b981;
}

/* Admin pages */
.group-btn.admin.active ~ .nav-group-items .nav-link.active {
  background: rgba(99, 102, 241, 0.18);
  color: #c7d2fe;
  border-left: 3px solid #6366f1;
}

/* Inventory pages */
.group-btn.inventory.active ~ .nav-group-items .nav-link.active {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  border-left: 3px solid #f59e0b;
}

/* Store sales pages */
.group-btn.store-sales.active ~ .nav-group-items .nav-link.active {
  background: rgba(14, 165, 233, 0.18);
  color: #7dd3fc;
  border-left: 3px solid #0ea5e9;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}


/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: radial-gradient(circle at bottom, rgba(37, 99, 235, 0.3), transparent);
  font-size: 11px;
  color: #cbd5f5;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-name {
  opacity: 0.9;
}

.app-shell.sidebar-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}

.app-shell.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 8px 6px;
}

.app-shell.sidebar-collapsed .logo-text,
.app-shell.sidebar-collapsed .group-btn .text,
.app-shell.sidebar-collapsed .group-btn .icon,
.app-shell.sidebar-collapsed .nav-group-items {
  display: none !important;
}

.app-shell.sidebar-collapsed .nav-group-title {
  justify-content: center;
  min-height: 46px;
  padding: 12px 8px;
  font-size: 0;
}

.app-shell.sidebar-collapsed .nav-group-title::after {
  content: attr(data-icon);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  position: absolute;
  right: -12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.app-shell.sidebar-collapsed .nav {
  align-items: center;
}

.app-shell.sidebar-collapsed .nav-group {
  width: 100%;
}

.app-shell.sidebar-collapsed .group-btn {
  justify-content: center;
  padding: 12px 8px;
  min-height: 46px;
}

.app-shell.sidebar-collapsed .group-btn::after {
  content: attr(data-icon);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.app-shell.sidebar-collapsed #btn-logout {
  width: 100%;
  min-width: 0;
  padding: 7px 0;
  font-size: 0;
}

.app-shell.sidebar-collapsed #btn-logout::after {
  content: "Out";
  font-size: 11px;
}

/* Main */
.main {
  flex: 1;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Buttons */
.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  transition: background 0.18s ease-out, border-color 0.18s ease-out,
    transform 0.18s ease-out, box-shadow 0.18s ease-out;
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: rgba(37, 99, 235, 0.6);
  color: #f9fafb;
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
  justify-content: center;
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.5);
}

.btn.ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.6);
  color: var(--text-main);
}

.btn.small {
  padding: 5px 11px;
  font-size: 12px;
}

.btn.tiny {
  padding: 3px 7px;
  font-size: 11px;
}

.btn.danger {
  background: #b91c1c;
  border-color: rgba(248, 113, 113, 0.7);
  color: #ffffff;
  justify-content: center;
  
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 14px 14px 16px;
  box-shadow: var(--shadow-soft);
  
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-header h2 {
  margin: 0;
  font-size: 16px;
}

.big-card {
  margin-top: 16px;
}

/* Metrics */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  background: linear-gradient(135deg, #ffffff, #ffffff);
  /*background: linear-gradient(135deg, #eff6ff, #e0f2fe);*/
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 22px;
  font-weight: 600;
  margin-top: 4px;
  color: #1f2937;
}

/* Generic */
.page {
  display: none;
}

.page.active {
  display: block;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

label {
  font-size: 12px;
  color: var(--text-muted);
}

input,
select {
  border-radius: 9px;
  border: 1px solid var(--border);
  padding: 7px 9px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary-soft);
}

/* Table */
.table-wrapper {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  margin-top: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead {
  background: var(--primary-soft);
}

th,
td {
  padding: 7px 9px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody tr:nth-child(even) {
  background: rgba(148, 163, 184, 0.06);
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.08);
}

.qty-input,
.discount-input,
.tax-input,
.inv-qty,
.inv-discount,
.inv-tax {
  min-width: 64px;
  width: 72px;
}

#invoice input[readonly] {
  background: #f1f5f9;
  color: #64748b;
}

tfoot td {
  background: rgba(37, 99, 235, 0.04);
  font-weight: 500;
}

.text-right {
  text-align: right;
}

/* Badges & toolbar */
.badge {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 13px;
}

.toolbar-flex {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-actions input {
  flex: 1;
}

.muted {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.form-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.search-input {
  min-width: 210px;
}

.hidden-file {
  display: none;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.filters input,
.filters select {
  min-width: 150px;
}

.filters .search-input {
  min-width: 260px;
  flex: 1 1 260px;
}

.item-txn-type-filter {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 4px 0;
  padding: 8px 12px 10px;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
}

.item-txn-type-filter legend {
  padding: 0 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.item-txn-type-filter label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #334155;
  font-size: 13px;
}

.filters .item-txn-type-filter input {
  min-width: 0;
  margin: 0;
}

.report-type-filter {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  margin: 0;
  padding: 9px 12px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.report-type-filter legend {
  padding: 0 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.report-type-filter label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  font-size: 13px;
}

.report-type-filter input {
  min-width: 0;
  margin: 0;
}

#items .filters .search-input {
  flex-basis: 100%;
}

#items .filters select {
  min-width: 260px;
}

.search-metric-grid {
  margin-bottom: 14px;
}

.search-metric-card {
  grid-column: span 2;
}

#inventory-products .search-metric-card {
  grid-column: span 1;
}

#admin-products .search-metric-card {
  grid-column: span 1;
}

#admin-products > .card + .card {
  margin-top: 14px;
}

#admin-products .product-master-kpi-grid {
  margin-bottom: 0;
}

#admin-products .product-master-kpi-card .metric {
  border-radius: 18px;
  padding: 18px;
  border: none;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  transition: transform .2s ease, box-shadow .2s ease;
}

#admin-products .product-master-kpi-card .metric:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0,0,0,.12);
}

#admin-products .product-master-kpi-card .metric .metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--metric-text-sub);
}

#admin-products .product-master-kpi-card .metric .metric-value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--metric-text-main);
}

#inventory-products > .card + .card {
  margin-top: 14px;
}

#inventory-products .inventory-product-kpi-grid {
  margin-bottom: 0;
}

#inventory-products .inventory-product-kpi-card .metric {
  border-radius: 18px;
  padding: 18px;
  border: none;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  transition: transform .2s ease, box-shadow .2s ease;
}

#inventory-products .inventory-product-kpi-card .metric:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0,0,0,.12);
}

#inventory-products .inventory-product-kpi-card .metric .metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--metric-text-sub);
}

#inventory-products .inventory-product-kpi-card .metric .metric-value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--metric-text-main);
}

#admin-products-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

#inventory-products-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

#linked-barcodes-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

#admin-products-table th,
#admin-products-table td,
#inventory-products-table th,
#inventory-products-table td,
#linked-barcodes-table th,
#linked-barcodes-table td {
  white-space: nowrap;
}

#admin-products-table .product-master-row {
  cursor: pointer;
}

#admin-products-table .product-master-row:hover,
#admin-products-table .product-master-row:focus {
  background: rgba(37, 99, 235, 0.10);
  outline: 2px solid rgba(37, 99, 235, 0.22);
  outline-offset: -2px;
}

#inventory-products-table .inventory-product-row {
  cursor: pointer;
}

#inventory-products-table .inventory-product-row:hover,
#inventory-products-table .inventory-product-row:focus {
  background: rgba(96, 165, 250, 0.12);
  outline: none;
}

.search-document-filters .search-input {
  flex: 1 1 560px;
  min-width: 280px;
}

.search-document-filters input[type="date"] {
  flex: 0 1 150px;
}

.search-type-filter {
  flex-basis: 100%;
}

.search-document-filters select {
  flex: 1 1 170px;
}

.search-document-filters .btn {
  min-height: 33px;
}

.search-doc-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-doc-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.search-doc-title h2 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
  font-weight: 800;
}

.search-doc-title span,
.search-card-heading span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.search-kpi-card,
.search-filter-card,
.search-table-card {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.search-doc-page .search-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.search-doc-page .search-metric-card {
  grid-column: auto;
  min-height: 86px;
  padding: 16px;
  border-radius: 8px;
  box-shadow: none;
}

.search-doc-page .search-metric-card .metric-value {
  margin-top: 8px;
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
}

.search-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.search-card-heading h3 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.search-column-picker {
  position: relative;
  flex: 0 0 auto;
}

.search-column-toggle {
  min-height: 34px;
  border-radius: 8px;
  font-weight: 800;
}

.search-column-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  width: 260px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.search-column-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 0 8px;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
  font-size: 12px;
}

.search-column-options {
  display: grid;
  gap: 4px;
  max-height: 310px;
  margin-top: 8px;
  overflow: auto;
}

.search-column-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 5px 6px;
  border-radius: 6px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

.search-column-options label:hover {
  background: #f1f5f9;
}

.search-column-options input {
  width: 14px;
  height: 14px;
  accent-color: #2563eb;
}

.search-document-filters {
  align-items: stretch;
  gap: 8px;
}

.search-document-filters input,
.search-document-filters select {
  min-height: 36px;
  border-radius: 8px;
}

.search-document-filters .btn {
  min-height: 36px;
  border-radius: 8px;
  font-weight: 800;
}

.search-type-filter {
  padding: 10px 12px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
}

.search-type-filter legend {
  padding: 0 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.search-type-filter label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 3px 12px 3px 0;
  color: #0f172a;
  font-weight: 700;
}

.search-type-filter input {
  width: 14px;
  height: 14px;
  accent-color: #2563eb;
}

.search-table-wrapper {
  margin-top: 0;
  border-radius: 8px;
  background: #ffffff;
  overflow: auto;
}

.search-results-table {
  min-width: 1460px;
  border-collapse: separate;
  border-spacing: 0;
}

.search-results-table thead {
  background: #eaf2ff;
}

.search-results-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 9px;
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  border-bottom: 1px solid #cbd5e1;
  white-space: nowrap;
}

.search-results-table td {
  padding: 9px;
  vertical-align: middle;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
}

.search-result-row:hover {
  background: #f8fbff;
}

.search-type-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.search-doc-number a {
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
}

.search-doc-number a:hover {
  text-decoration: underline;
}

.search-main-cell {
  max-width: 240px;
}

.search-main-cell strong,
.search-main-cell span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-main-cell strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.search-main-cell span {
  margin-top: 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.search-branch-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-date-cell,
.search-amount-cell {
  white-space: nowrap;
}

.search-amount-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.search-actions-cell {
  width: 138px;
  min-width: 138px;
  position: relative;
}

.search-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  min-width: 124px;
  position: relative;
}

.search-row-actions .btn.tiny {
  min-height: 26px;
  border-radius: 7px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.search-action-primary {
  background: #ffffff;
  border: 1px solid #dbeafe;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.search-action-more {
  width: 34px;
  min-width: 34px;
  padding: 0;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: transparent;
  position: relative;
}

.search-action-more::before {
  content: "...";
  color: #334155;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  transform: translateY(-2px);
}

.search-action-menu-wrap {
  position: relative;
}

.search-action-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 25;
  display: none;
  min-width: 154px;
  padding: 6px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
}

.search-action-menu-wrap:hover .search-action-menu,
.search-action-menu-wrap:focus-within .search-action-menu {
  display: grid;
  gap: 4px;
}

.search-action-menu .btn.tiny {
  width: 100%;
  justify-content: flex-start;
  border-radius: 6px;
  background: transparent;
  border-color: transparent;
  color: #0f172a;
  box-shadow: none;
}

.search-action-menu .btn.tiny:hover {
  background: #eff6ff;
}

.search-action-menu .btn.tiny.success {
  color: #047857;
}

.search-action-menu .btn.tiny.danger {
  margin-top: 3px;
  background: #fff1f2;
  color: #b91c1c;
}

.search-action-menu .btn.tiny.danger:hover {
  background: #fee2e2;
}

.search-pagination {
  margin-top: 12px;
}

@media (max-width: 900px) {
  .search-doc-page .search-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-document-filters .search-input,
  .search-document-filters input[type="date"],
  .search-document-filters select,
  .search-document-filters .btn {
    flex: 1 1 100%;
  }
}

.column-chooser {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
}

.column-chooser label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.column-chooser input {
  margin: 0;
}

.search-filters {
  margin: 10px 0 12px;
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 1100px) {
  .search-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .search-metric-card {
    grid-column: span 4;
  }
}

/* Hint text */
.hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .main {
    padding: 12px;
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Admin Panels ---------- */

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.admin-tab.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #f9fafb;
  border-color: rgba(37, 99, 235, 0.6);
}

.admin-panel {
  margin-top: 8px;
}

.admin-section-title {
  margin: 6px 0 8px;
  font-size: 15px;
}

.admin-form-title {
  margin: 16px 0 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.admin-divider {
  margin: 18px 0;
  border: none;
  border-top: 1px dashed var(--border);
}

.hidden {
  display: none !important;
}

.final-total {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  break-inside: avoid;
  page-break-inside: avoid;
}

.final-total table {
  width: 100%;
  border-collapse: collapse;
}

.final-total td {
  border: 1px solid #cbd5f5;
  padding: 8px;
}

.final-total .label {
  background: #e0ecff;
}

.final-total .value {
  text-align: center;
}




.amount-words {
  margin-top: 18px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  border: 1px solid #cbd5f5;
  padding: 10px;
  background: #f8fbff;
  break-inside: avoid;
  page-break-inside: avoid;
}
.amount-words span {
  font-weight: 500;
}

.form-group-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.form-group-grid input,
.form-group-grid select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.form-actions {
  grid-column: span 4;
  display: flex;
  gap: 10px;
  margin-top: 6px;
}


/* Admin panel form layout */
.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.admin-form-grid .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-form-grid .form-group label {
  font-size: 12px;
  color: var(--text-muted);
}

.admin-form-grid .form-group input,
.admin-form-grid .form-group select {
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.admin-form-grid .form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.account-help {
  margin: 0 0 18px;
  color: var(--text-muted);
}

.account-code-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.account-code-row input {
  min-width: 90px;
  flex: 1;
}

.account-code-button {
  flex-shrink: 0;
  white-space: nowrap;
}

.account-message {
  min-height: 20px;
  margin-top: 4px;
  font-size: 13px;
}

.account-message.success {
  color: #15803d;
}

.account-message.error {
  color: #b91c1c;
}


.admin-search-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.admin-search {
  width: 220px;
  padding: 8px 12px 8px 36px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 14px;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M11 11l3 3m-1-7A5 5 0 111 7a5 5 0 0112 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.admin-search:focus {
  width: 300px;
  background: #ffffff;
  border-color: #60a5fa;
  outline: none;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

.product-master-search-wrapper {
  justify-content: stretch;
  margin-bottom: 14px;
}

#search-products.admin-search,
#inventory-product-search.admin-search {
  width: 100%;
  min-height: 64px;
  box-sizing: border-box;
  font-size: 15px;
}

#search-items.admin-search {
  width: 100%;
  min-height: 64px;
  box-sizing: border-box;
  font-size: 15px;
}

#search-products.admin-search:focus,
#inventory-product-search.admin-search:focus,
#search-items.admin-search:focus {
  width: 100%;
}


.pagination {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.pagination button {
  padding: 6px 12px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
}

.pagination button:hover {
  background: #d1d5db;
}

.pagination button.active {
  background: #1e40af;
  color: white;
  border-color: #1e40af;
}

.pagination button:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: default;
}

.pagination {
  margin-top: 12px;
  text-align: center;
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  min-width: 34px;
}

.pagination button.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.pagination button:hover {
  background: #e5e7eb;
}

.pagination button.disabled {
  opacity: 0.4;
  cursor: default;
}

.report-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.report-output {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #f8fafc;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.pagination button {
  padding: 4px 8px;
  margin: 0 2px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}

.pagination button.active {
  background: #2563eb;
  color: white;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination .pagination-ellipsis,
.pagination .pagination-summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 6px;
  color: #64748b;
  font-size: 13px;
}

.pagination .pagination-summary {
  margin-left: 8px;
  white-space: nowrap;
}

/* Invoice Adjustment inputs inside table */
#adjustments table input[type="number"]{
  width: 90px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
}
#adjustments .badge{
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: #fee2e2;
  color: #991b1b;
}

.adj-added {
  background: #eef6ff;
}

.badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-open {
  background: #dcfce7;
  color: #166534;
}

.badge-closed {
  background: #fee2e2;
  color: #991b1b;
}

.invoice-top-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.invoice-load-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.invoice-load-stack .toolbar-flex {
  width: 420px;
}

.invoice-load-stack .search-input {
  flex: 1;
  min-width: 0;
}

.load-invoice-box {
  width: 420px;
}

.load-row {
  display: flex;
  gap: 8px;
}

.load-row input {
  flex: 1;
}

.invoice-load-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.invoice-load-bar input {
  width: 280px;
}
.issue-invoice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.issue-invoice-header h3 {
  margin: 0;
}

.invoice-load-bar {
  display: flex;
  gap: 8px;
}

.invoice-load-bar input {
  width: 260px;
}

.badge-issued {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 600;
}

.badge-cancelled {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
}

/* ================= ITEM PICKER ================= */

.picker-box {
  width: 720px;       /* â¬… was 900px */
  max-width: 90%;
  max-height: 75vh;

  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);

  position: relative;
  z-index: 1;
}


.picker-header {
   padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.picker-header h3 {
  margin: 0;
  font-size: 16px;
}

.picker-header small {
  color: #6b7280;
  font-size: 12px;
}

.picker-search {
  padding: 12px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.picker-search input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}

.picker-table {
  padding: 10px 18px 18px;
  overflow-y: auto;

  /* ðŸ‘‡ 9 rows visible */
  max-height: 400px;
}
.picker-table table {
  width: 100%;
  border-collapse: collapse;
}

.picker-table th {
  text-align: left;
  font-size: 12px;
  padding: 10px 8px;
  color: #374151;
  background: #eef2ff;
}

.picker-table td {
  padding: 8px;
  font-size: 13px;
}

.picker-table tr:hover {
  background: #f1f5f9;
  cursor: pointer;
}

.picker-table button {
  padding: 4px 10px;
}

.picker-table .btn {
  background: #2563eb;
  color: white;
  border-radius: 999px;
  font-size: 12px;
  padding: 4px 10px;
}

.picker-table tr:hover .btn {
  background: #1d4ed8;
}
.picker-table thead th {
  position: sticky;
  top: 0;
  background: #eef2ff;
  z-index: 1;
}


.picker-box {
  animation: pickerFadeIn 0.15s ease-out;
}

.product-form-modal-box {
  width: min(980px, 94%);
  max-height: 88vh;
  overflow: hidden;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 1;
  animation: pickerFadeIn 0.15s ease-out;
}

.invoice-change-modal-box {
  width: min(560px, 92%);
  max-height: 88vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 1;
  padding: 18px;
  animation: pickerFadeIn 0.15s ease-out;
}

.invoice-change-modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.invoice-change-item-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
}

.invoice-change-item-card span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.invoice-change-item-card strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#invoice-change-note {
  resize: vertical;
  min-height: 78px;
}

.invoice-change-log-panel {
  margin-top: 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
  overflow: hidden;
}

.invoice-change-log-panel.hidden {
  display: none;
}

.invoice-change-log-panel .table-toolbar {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #dbeafe;
  background: #eff6ff;
}

.invoice-change-log-panel .table-wrapper {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.product-detail-modal-box {
  width: min(1240px, calc(100vw - 48px));
  height: min(92vh, 920px);
  max-height: 92vh;
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  animation: productDetailFadeIn 0.15s ease-out;
  display: flex;
  flex-direction: column;
}

#admin-product-detail-modal {
  left: 0;
  width: 100%;
}

.product-detail-header {
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.product-detail-heading {
  min-width: 0;
  flex: 1 1 auto;
}

.product-detail-title-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.product-detail-title-row h3 {
  margin: 0;
  max-width: 780px;
  color: #0f172a;
  font-size: 20px;
  line-height: 1.25;
}

.product-detail-badges,
.product-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.product-detail-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.product-detail-badge.product {
  background: #dbeafe;
  color: #1d4ed8;
}

.product-detail-badge.kit {
  background: #ede9fe;
  color: #5b21b6;
}

.product-detail-badge.active,
.product-detail-badge.movement {
  background: #dcfce7;
  color: #047857;
}

.product-detail-badge.inactive {
  background: #fee2e2;
  color: #b91c1c;
}

.product-detail-meta {
  margin-top: 10px;
}

.product-detail-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  max-width: 360px;
  padding: 5px 9px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: #ffffff;
}

.product-detail-chip small {
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.product-detail-chip strong {
  min-width: 0;
  overflow: hidden;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-detail-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.product-detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px 18px;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
}

.product-detail-field {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.product-detail-field span {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.product-detail-field strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-detail-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.product-detail-section h3 {
  margin: 0 0 10px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
}

.product-detail-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.product-detail-summary-tables {
  align-items: start;
}

.product-detail-section .table-wrapper {
  margin-top: 0;
  max-height: 260px;
  overflow: auto;
  border-radius: 10px;
}

.product-detail-section table {
  min-width: 100%;
}

.product-detail-section th,
.product-detail-section td {
  white-space: nowrap;
}

.product-detail-section th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eaf2ff;
  color: #0f172a;
}

.product-detail-section td {
  background: #ffffff;
}

.product-detail-empty {
  color: #64748b;
  font-size: 12px;
  text-align: center;
}

.product-detail-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
}

.product-detail-status.base {
  background: #dbeafe;
  color: #1d4ed8;
}

.product-detail-status.active {
  background: #dcfce7;
  color: #047857;
}

.product-detail-status.inactive {
  background: #fee2e2;
  color: #b91c1c;
}

.product-modal-form {
  padding: 16px;
  max-height: calc(88vh - 70px);
  overflow: auto;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  margin: 12px 0;
}

.admin-filter-grid .form-actions {
  justify-content: flex-end;
}

.product-master-actions {
  margin: 12px 0 14px;
}

.customer-items-filter-grid {
  grid-template-columns: minmax(260px, 360px) 1fr;
}

@keyframes pickerFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.picker-table tr:hover {
  background: #f8fafc;
}

.stock-transfer-modal-box {
  width: min(900px, 94%);
  max-height: 86vh;
  overflow: hidden;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  position: relative;
  z-index: 1;
  animation: pickerFadeIn 0.15s ease-out;
}

.stock-transfer-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 12px;
}

.stock-transfer-meta span {
  color: #475569;
}

.stock-transfer-meta strong {
  display: block;
  margin-top: 2px;
  color: #0f172a;
}

.stock-transfer-table-wrap {
  max-height: 48vh;
  overflow: auto;
  padding: 12px 16px;
}

.stock-transfer-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.stock-transfer-table-wrap th,
.stock-transfer-table-wrap td {
  border: 1px solid #cbd5e1;
  padding: 8px;
  text-align: left;
}

.stock-transfer-table-wrap th {
  position: sticky;
  top: 0;
  background: #eef2ff;
  z-index: 1;
}

.stock-transfer-table-wrap input {
  width: 120px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
}

.stock-transfer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px 16px;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
}

.stock-transfer-actions > div {
  display: flex;
  gap: 8px;
}

.stock-transfer-print-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 13px;
}

/* ================= MODAL (CONTENT-ALIGNED) ================= */

:root {
  --sidebar-width: 240px;
}

.modal {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 1000;
}

.modal.hidden {
  display: none;
}

/* ===== DIM BACKGROUND (CONTENT ONLY) ===== */
.modal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 0;
}

/* Disable sidebar interaction when modal is open */
body.modal-open .sidebar {
  pointer-events: none;
  filter: grayscale(0.3);
  opacity: 0.6;
}

.nav-group {
  margin-bottom: 10px;
}

.nav-group-toggle {
  width: 100%;
  text-align: left;
  font-weight: 600;
}

.nav-group-items {
  padding-left: 12px;
}

.hidden {
  display: none;
}


/* ================= ADMIN PAGE VISIBILITY FIX ================= */

.page.active {
  display: block;
}

/* Force admin content to render */
.page.active .admin-form-grid,
.page.active .table-wrapper,
.page.active .card {
  display: block;
}

/* Admin form grid layout */
.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

/* Admin table wrapper */
.table-wrapper {
  overflow-x: auto;
}

/* Prevent main from hiding content */
.main {
  overflow: visible;
}


/* ===================== SIDEBAR NAV UI ===================== */

.group-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 6px;
  font-weight: 600;
  border-radius: 10px;
  background: transparent;
  color: #e5e7eb;
  cursor: pointer;
  transition: all 0.2s ease;
}

.group-btn .icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

.group-btn:hover {
  background: rgba(255,255,255,0.08);
}

.nav-group-title {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 14px 6px;
  margin-top: 8px;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 700;
}

.group-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37,99,235,0.35);
}

/* -------- Sub pages -------- */

.nav-group-items {
  margin-left: 8px;
  padding-left: 6px;
  border-left: 2px solid rgba(255,255,255,0.08);
}

.nav-subgroup-toggle {
  width: 100%;
  margin: 12px 0 4px;
  padding: 5px 10px 5px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #93a4bd;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.nav-subgroup-toggle::after {
  content: ">";
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}

.nav-subgroup-toggle.expanded::after {
  transform: rotate(90deg);
}

.nav-subgroup-toggle:hover {
  background: rgba(255,255,255,0.06);
  color: #dbeafe;
}

.nav-subgroup-title {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 9px 12px 5px;
  margin-top: 6px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-subgroup-toggle:first-child {
  margin-top: 4px;
}

.nav-subgroup-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-subgroup-items.collapsed {
  display: none;
}

.page-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin: 4px 0;
  font-size: 14px;
  border-radius: 8px;
  color: #d1d5db;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn .icon {
  width: 20px;
  text-align: center;
  opacity: 0.85;
}

.page-btn:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.page-btn.active {
  background: rgba(59,130,246,0.15);
  color: #93c5fd;
  border-left: 3px solid #3b82f6;
  padding-left: 9px;
}

.group-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.page-btn.active {
  background: rgba(37,99,235,0.12);
  color: #1d4ed8;
}

/* -------- Sub-page highlight follows group color -------- */
.group-btn.invoicing.active {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ecfdf5;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.35);
}

.group-btn.admin.active {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #eef2ff;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35);
}

/* ===============================
   DEEPERP-STYLE SIDEBAR
================================ */
.sidebar {
  margin: 18px 0 18px 18px;
  height: calc(100vh - 36px);
  position: sticky;
  top: 18px;
  overflow: hidden;
  border-radius: 24px;
  padding: 0;
  gap: 0;
  background: linear-gradient(180deg, #1f4292 0%, #102c73 42%, #0a1f5a 100%);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.28);
}

.sidebar-header {
  min-height: 74px;
  padding: 14px 18px;
  border-radius: 0;
  background: rgba(7, 23, 70, 0.28);
}

.logo-circle {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #4f8df7, #2458d2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.logo-title {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
}

.logo-subtitle {
  color: #bfdbfe;
  opacity: 1;
}

.logo-developer {
  color: #93c5fd;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.10);
  color: #dbeafe;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px 14px;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 800;
}

.sidebar-user-text {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.sidebar-user-text strong {
  color: #ffffff;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-text span {
  color: #bfdbfe;
  font-size: 11px;
  text-transform: capitalize;
}

.sidebar-logout {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 6px 12px;
  font-size: 12px;
  box-shadow: none;
}

.nav {
  gap: 0;
  padding: 18px 0 8px;
  overflow-y: auto;
}

.sidebar-section-label {
  padding: 14px 22px 7px;
  color: #8da9dc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-group {
  margin: 0;
}

.group-btn {
  min-height: 48px;
  margin: 0;
  padding: 13px 18px;
  border-radius: 0;
  color: #eef4ff;
  font-size: 14px;
  border: 0 !important;
  outline: 0;
  box-shadow: none;
}

.group-btn::before {
  content: attr(data-icon);
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  background: rgba(255, 255, 255, 0.10);
  color: #dbeafe;
  font-size: 15px;
  font-weight: 900;
  display: none;
}

.group-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.group-btn.active,
.group-btn.invoicing.active,
.group-btn.admin.active {
  background: linear-gradient(90deg, #3557b8, rgba(53, 87, 184, 0.72));
  color: #ffffff;
  box-shadow: inset 4px 0 0 #60a5fa;
}

.nav-group-items {
  margin: 0;
  padding: 4px 0 8px;
  border-left: none;
  background: rgba(8, 27, 82, 0.24);
}

.nav-subgroup-toggle {
  margin: 8px 0 2px;
  padding: 7px 22px;
  border-radius: 0;
  color: #9fb7e7;
  font-size: 10px;
}

.nav-subgroup-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-link {
  margin: 1px 12px;
  padding: 10px 14px 10px 36px;
  border-radius: 0 12px 12px 0;
  color: #e5efff;
  font-size: 13px;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-group-items .nav-link.active {
  background: rgba(96, 165, 250, 0.20);
  color: #ffffff;
  border-left: 4px solid #60a5fa;
}

.group-btn.invoicing.active ~ .nav-group-items .nav-link.active,
.group-btn.admin.active ~ .nav-group-items .nav-link.active,
.group-btn.inventory.active ~ .nav-group-items .nav-link.active,
.group-btn.store-sales.active ~ .nav-group-items .nav-link.active {
  background: rgba(96, 165, 250, 0.20);
  color: #ffffff;
  border-left: 4px solid #60a5fa;
}

.sidebar-footer {
  margin: auto 14px 14px;
  background: rgba(10, 31, 90, 0.58);
  border: 1px solid rgba(147, 197, 253, 0.18);
  color: #c7d2fe;
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 0;
}

.app-shell.sidebar-collapsed .sidebar-header {
  min-height: 68px;
  padding: 12px 8px;
}

.app-shell.sidebar-collapsed .sidebar-section-label {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-user-card {
  justify-content: center;
  padding: 8px;
  background: transparent;
}

.app-shell.sidebar-collapsed .sidebar-user-avatar,
.app-shell.sidebar-collapsed .sidebar-user-text {
  display: none;
}

.app-shell.sidebar-collapsed .group-btn {
  padding: 13px 8px;
}

.app-shell.sidebar-collapsed .group-btn::before {
  display: grid;
  margin: 0 auto;
}

.app-shell.sidebar-collapsed .group-btn::after {
  content: none;
}

.sidebar-theme-card {
  margin: 12px 18px 4px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 0;
}

.sidebar-theme-title {
  display: block;
  margin-bottom: 6px;
  color: #bfdbfe;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-theme-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.sidebar-theme-options label {
  cursor: pointer;
}

.sidebar-theme-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sidebar-theme-options span {
  display: grid;
  place-items: center;
  min-height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  color: #dbeafe;
  font-size: 11px;
  font-weight: 800;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-theme-options input:checked + span {
  background: #ffffff;
  color: #1d4ed8;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
}

.app-shell.sidebar-collapsed .sidebar-theme-card {
  display: none;
}

.app-shell.sidebar-theme-blue .sidebar {
  background: linear-gradient(180deg, #1f4292 0%, #102c73 42%, #0a1f5a 100%);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.28);
}

.app-shell.sidebar-theme-blue .sidebar-header {
  background: rgba(7, 23, 70, 0.28);
}

.app-shell.sidebar-theme-blue .sidebar-user-card {
  background: rgba(255, 255, 255, 0.07);
}

.app-shell.sidebar-theme-blue .sidebar-theme-card,
.app-shell.sidebar-theme-blue .nav-group-items {
  background: rgba(8, 27, 82, 0.24);
}

.app-shell.sidebar-theme-dark .sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #111827 52%, #020617 100%);
  box-shadow: 0 18px 38px rgba(2, 6, 23, 0.34);
}

.app-shell.sidebar-theme-dark .sidebar-header {
  background: rgba(30, 41, 59, 0.62);
}

.app-shell.sidebar-theme-dark .logo-circle {
  background: linear-gradient(135deg, #64748b, #1e293b);
}

.app-shell.sidebar-theme-dark .sidebar-user-card,
.app-shell.sidebar-theme-dark .sidebar-theme-card {
  background: rgba(148, 163, 184, 0.10);
}

.app-shell.sidebar-theme-dark .nav-group-items {
  background: rgba(15, 23, 42, 0.45);
}

.app-shell.sidebar-theme-dark .group-btn.active,
.app-shell.sidebar-theme-dark .group-btn.invoicing.active,
.app-shell.sidebar-theme-dark .group-btn.admin.active {
  background: linear-gradient(90deg, #334155, rgba(51, 65, 85, 0.70));
  box-shadow: inset 4px 0 0 #94a3b8;
}

.app-shell.sidebar-theme-light .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #eef5ff 56%, #dbeafe 100%);
  color: #0f172a;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
}

.app-shell.sidebar-theme-light .sidebar-header {
  background: rgba(37, 99, 235, 0.08);
}

.app-shell.sidebar-theme-light .logo-title,
.app-shell.sidebar-theme-light .sidebar-user-text strong,
.app-shell.sidebar-theme-light .group-btn,
.app-shell.sidebar-theme-light .nav-group-title,
.app-shell.sidebar-theme-light .nav-link {
  color: #0f172a;
  border: 0 !important;
}

.app-shell.sidebar-theme-light .logo-subtitle,
.app-shell.sidebar-theme-light .sidebar-user-text span,
.app-shell.sidebar-theme-light .sidebar-section-label,
.app-shell.sidebar-theme-light .nav-subgroup-toggle,
.app-shell.sidebar-theme-light .nav-subgroup-title,
.app-shell.sidebar-theme-light .sidebar-theme-title {
  color: #475569;
}

.app-shell.sidebar-theme-light .nav-group-items .nav-link.active {
  background: rgba(37, 99, 235, 0.14);
  color: #1e3a8a;
  border-left: 4px solid #2563eb;
}

.app-shell.sidebar-theme-light .sidebar-user-card,
.app-shell.sidebar-theme-light .sidebar-theme-card,
.app-shell.sidebar-theme-light .nav-group-items {
  background: rgba(37, 99, 235, 0.06);
}

.app-shell.sidebar-theme-light .group-btn::before {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.app-shell.sidebar-theme-light .sidebar-theme-card {
  border: 0;
}

.app-shell.sidebar-theme-light .sidebar-theme-options span {
  background: rgba(37, 99, 235, 0.08);
  color: #334155;
}

.app-shell.sidebar-theme-light .sidebar-theme-options input:checked + span {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.22);
}

.app-shell.sidebar-theme-light .sidebar-toggle {
  background: #ffffff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.app-shell.sidebar-theme-light .group-btn:hover,
.app-shell.sidebar-theme-light .nav-link:hover,
.app-shell.sidebar-theme-light .nav-subgroup-toggle:hover {
  background: rgba(37, 99, 235, 0.10);
  color: #1d4ed8;
}

.app-shell.sidebar-theme-light .group-btn.active,
.app-shell.sidebar-theme-light .group-btn.invoicing.active,
.app-shell.sidebar-theme-light .group-btn.admin.active {
  background: linear-gradient(90deg, #dbeafe, rgba(219, 234, 254, 0.68));
  color: #1e3a8a;
  box-shadow: inset 4px 0 0 #2563eb;
}

.app-shell.sidebar-theme-light .nav-group {
  border: 0 !important;
}

.app-shell.sidebar-theme-light .nav-group + .nav-group {
  border-top: 0;
}

.app-shell.sidebar-theme-light .group-btn.invoicing.active ~ .nav-group-items .nav-link.active,
.app-shell.sidebar-theme-light .group-btn.admin.active ~ .nav-group-items .nav-link.active,
.app-shell.sidebar-theme-light .group-btn.inventory.active ~ .nav-group-items .nav-link.active,
.app-shell.sidebar-theme-light .group-btn.store-sales.active ~ .nav-group-items .nav-link.active {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border-left-color: #2563eb;
}

.app-shell.sidebar-theme-light .sidebar-footer {
  background: rgba(37, 99, 235, 0.06);
  color: #334155;
  border-color: rgba(37, 99, 235, 0.16);
}

/* ===============================
   LIGHT DASHBOARD THEME
================================ */

#dashboard.page.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#dashboard .card {
  border-radius: 12px;
}

#dashboard.page.active .dashboard-filter-card {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  box-shadow: none;
}

.dashboard-card-title {
  min-width: 0;
}

.dashboard-card-title h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.dashboard-card-title span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.dashboard-quick-filters {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -6px;
}

.dashboard-quick-filters button {
  height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
}

.dashboard-quick-filters button:hover,
.dashboard-quick-filters button.active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
}

.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-decision-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr) minmax(320px, 1.1fr);
  gap: 12px;
  align-items: stretch;
}

#dashboard .card.metric {
  border-radius: 18px;
  padding: 18px;
  border: none;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  transition: transform .2s ease, box-shadow .2s ease;
}


#dashboard .card.metric:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0,0,0,.12);
}

#dashboard .card.metric .metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--metric-text-sub);
}

#dashboard .card.metric .metric-value {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
  color: var(--metric-text-main);
}

#dashboard .card.metric.status-kpi {
  padding: 14px 16px;
}

#dashboard .card.metric.status-kpi .metric-value {
  font-size: 24px;
}

#dashboard .card.metric.decision-kpi {
  padding: 15px 16px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

#dashboard .card.metric.decision-kpi .metric-value {
  font-size: 21px;
  color: #0f172a;
}

.metric-delta {
  margin-top: 7px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
}

.metric-delta.good {
  color: #059669;
}

.metric-delta.bad {
  color: #dc2626;
}

.metric-delta.neutral {
  color: #64748b;
}

.dashboard-action-card {
  padding: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.dashboard-action-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.dashboard-action-header h3 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
}

.dashboard-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.action-list-card {
  min-width: 0;
  padding: 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.action-list-card h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #0f172a;
}

.dashboard-action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dashboard-action-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.dashboard-action-item strong,
.dashboard-action-item span,
.action-item-side b,
.action-item-side em {
  display: block;
}

.dashboard-action-item strong {
  color: #0f172a;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-action-item span,
.action-item-side em,
.dashboard-action-empty {
  color: #64748b;
  font-size: 11px;
}

.action-item-side {
  text-align: right;
  min-width: 92px;
}

.action-item-side b {
  color: #1d4ed8;
  font-size: 12px;
}

.dashboard-action-empty {
  padding: 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px dashed #cbd5e1;
}

.search-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-kpi-panel {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.search-kpi {
  min-width: 140px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.search-kpi span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.search-kpi strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1;
  color: #0f172a;
}

.card-sales-trend {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
  min-width: 0;
}

.card-sales-trend .card-header {
  align-items: flex-start;
  gap: 12px;
}

.card-sales-trend h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.sales-trend-insight {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.sales-trend-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 580px;
}

.sales-trend-segment {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
}

.sales-trend-segment button,
.sales-trend-export {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.sales-trend-segment button.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.sales-trend-compare,
.sales-trend-target {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #ffffff;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  color: #475569;
}

.sales-trend-compare input {
  width: 14px;
  height: 14px;
  accent-color: #2563eb;
}

.sales-trend-target input {
  width: 86px;
  min-width: 0;
  border: 0;
  outline: 0;
  font-size: 12px;
  font-weight: 800;
  color: #0f172a;
}

.sales-trend-export {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.sales-trend-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.sales-trend-kpis > div {
  min-width: 0;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 11px;
}

.sales-trend-kpis span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
}

.sales-trend-kpis strong {
  display: block;
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.25;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sales-trend-kpis strong.good {
  color: #059669;
}

.sales-trend-kpis strong.bad {
  color: #dc2626;
}

.sales-trend-kpis strong.neutral {
  color: #64748b;
}

.card-subtitle {
  font-size: 12px;
  color: #64748b;
}

.card-side-kpi {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
  min-width: 0;
}

.card-side-kpi h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #0f172a;
}

.kpi-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13px;
  color: #334155;
  border-bottom: 1px dashed #e5e7eb;
}

.kpi-row:last-child {
  border-bottom: none;
}

.kpi-row b {
  font-weight: 700;
  color: #2563eb; /* professional blue */
}
.card-wide {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.card-wide h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
}


:root {
  /* Background Gradients (Light Tone) */
  --pastel-green: linear-gradient(135deg, #d1fae5, #a7f3d0);
  --pastel-orange: linear-gradient(135deg, #ffedd5, #fed7aa);
  --pastel-blue: linear-gradient(135deg, #dbeafe, #bfdbfe);
  --pastel-purple: linear-gradient(135deg, #ede9fe, #ddd6fe);
  --pastel-red: linear-gradient(135deg, #fee2e2, #fecaca);
}

.pastel-green {
  background: var(--pastel-green);
  color: #065f46;   /* dark emerald */
}

.pastel-orange {
  background: var(--pastel-orange);
  color: #9a3412;   /* dark orange */
}

.pastel-blue {
  background: var(--pastel-blue);
  color: #1e3a8a;   /* dark blue */
}

.pastel-purple {
  background: var(--pastel-purple);
  color: #5b21b6;   /* dark purple */
}

.pastel-red {
  background: var(--pastel-red);
  color: #991b1b;
}

.metric-title {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
}

.metric-value {
  font-size: 30px;
  font-weight: 800;
}

.dashboard-top10 {
  margin-top: 0;
}

.card-top10 {
  background: #ffffff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}

.card-top10 .card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.card-top10 h3 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.card-top10 .card-subtitle {
  font-size: 12px;
  color: #64748b;
}

/* TABLE */
.table-top10 {
  width: 100%;
  border-collapse: collapse;
}

.table-top10 th {
  text-align: left;
  font-size: 12px;
  color: #64748b;
  padding: 8px 6px;
}

.table-top10 td {
  padding: 10px 6px;
  font-size: 13px;
  border-top: 1px solid #e5e7eb;
  color: #0f172a;
}

.table-top10 tbody tr:hover {
  background: #f8fafc;
}

/* Rank badge */
.table-top10 td:first-child {
  font-weight: 700;
  color: #6366f1;
}

/* ===============================
   DASHBOARD â€“ RETURN (RED)
================================ */

/* Return numbers */
#dashboard .card-side-kpi b.negative {
  color: #dc2626; /* red-600 */
  font-weight: 700;
}

/* Optional: make the label slightly muted */
#dashboard .card-side-kpi .kpi-row {
  color: #334155; /* slate-700 */
}

/* Optional: subtle divider between sections */
#dashboard .card-side-kpi h3 + .kpi-row {
  margin-top: 6px;
}

#dashboard .card-side-kpi h3 {
  margin-top: 14px;
  color: #0f172a;
}


.dashboard-card canvas {
  max-height: 220px;
}

.pie-wrapper {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pie-wrapper canvas {
  max-width: 100% !important;
  max-height: 100% !important;
}

.chart-wide-container {
  position: relative;
  width: 100%;
  height: 380px;   /* Try 350â€“420 */
}

.no-lpo-card {
  padding: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.wide-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.wide-card-header h3 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.wide-card-header span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.wide-card-controls {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
}

.wide-card-controls button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.wide-card-controls button.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.no-lpo-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.no-lpo-kpis > div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.no-lpo-kpis span {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.no-lpo-kpis strong {
  display: block;
  margin-top: 5px;
  color: #0f172a;
  font-size: 18px;
  line-height: 1;
}

.no-lpo-content {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(270px, 0.8fr);
  gap: 14px;
  align-items: stretch;
}

.no-lpo-chart-wrap {
  height: 320px;
  margin: 0;
}

.no-lpo-watchlist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.no-lpo-panel-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 2px;
}

.no-lpo-panel-title strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.no-lpo-panel-title span {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.no-lpo-customer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.no-lpo-customer-row:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.no-lpo-customer-row span,
.no-lpo-customer-row strong,
.no-lpo-customer-row em,
.no-lpo-customer-row b {
  display: block;
}

.no-lpo-customer-row strong {
  color: #0f172a;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-lpo-customer-row em {
  margin-top: 3px;
  color: #64748b;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.no-lpo-customer-row b {
  padding: 4px 7px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.no-lpo-group {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.no-lpo-group.focused {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.no-lpo-group summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  list-style: none;
}

.no-lpo-group summary::-webkit-details-marker {
  display: none;
}

.no-lpo-group summary span,
.no-lpo-group summary strong,
.no-lpo-group summary em,
.no-lpo-group summary b {
  display: block;
}

.no-lpo-group summary strong {
  color: #0f172a;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-lpo-group summary em {
  margin-top: 3px;
  color: #64748b;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.no-lpo-group summary b {
  padding: 4px 7px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.no-lpo-branch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 8px 8px;
}

.no-lpo-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.no-lpo-item strong,
.no-lpo-item span,
.no-lpo-side b,
.no-lpo-side em {
  display: block;
}

.no-lpo-item strong {
  color: #0f172a;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-lpo-item span {
  margin-top: 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.no-lpo-side {
  text-align: right;
}

.no-lpo-side b {
  color: #b45309;
  font-size: 11px;
  text-transform: capitalize;
  white-space: nowrap;
}

.no-lpo-side em {
  margin-top: 2px;
  color: #64748b;
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
}

.no-lpo-item.dropped-this-period {
  border-color: #fed7aa;
  background: #fff7ed;
}

.no-lpo-item.new-no-history,
.no-lpo-item.stale {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.no-lpo-modal-box {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100vw - 64px));
  max-height: min(760px, calc(100vh - 64px));
  overflow: hidden;
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.no-lpo-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.no-lpo-modal-header h3 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
}

.no-lpo-modal-header span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.no-lpo-modal-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.no-lpo-modal-summary > div {
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.no-lpo-modal-summary span,
.no-lpo-modal-summary strong {
  display: block;
}

.no-lpo-modal-summary span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.no-lpo-modal-summary strong {
  margin-top: 5px;
  color: #0f172a;
  font-size: 18px;
}

.no-lpo-modal-branches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}


.top10-card {
  padding: 16px;
  border-radius: 8px;
}

.top10-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.top10-header h3 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.subtitle {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.top10-select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: white;
}

.top10-insight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.top10-insight-strip > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.top10-insight-strip span {
  display: block;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
}

.top10-insight-strip strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top10-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top10-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  transition: 0.2s ease;
  cursor: pointer;
}

.top10-row:hover {
  background: #eef2ff;
}

.rank-badge {
  flex: 0 0 28px;
  font-weight: 700;
  font-size: 14px;
  width: 28px;
  padding-top: 2px;
  text-align: center;
}

.rank-1 { color: #2563eb; }
.rank-2 { color: #059669; }
.rank-3 { color: #d97706; }

.customer-info {
  flex: 1;
  margin-left: 12px;
  min-width: 0;
}

.customer-name {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top10-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.top10-tag {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  border-radius: 999px;
  padding: 0 7px;
  font-size: 10px;
  font-weight: 800;
  background: #e2e8f0;
  color: #475569;
}

.top10-tag.good {
  background: #ecfdf5;
  color: #059669;
}

.top10-tag.warn {
  background: #fffbeb;
  color: #b45309;
}

.top10-tag.bad {
  background: #fef2f2;
  color: #dc2626;
}

.top10-secondary {
  margin-top: 3px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.top10-row .amount-section {
  min-width: 190px;
}

.customer-meta {
  font-size: 12px;
  color: #64748b;
}

.amount-section {
  text-align: right;
  min-width: 160px;
}

.amount-value {
  font-weight: 600;
  font-size: 14px;
}

.progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 4px;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 4px;
}

.summary-card {
  padding: 16px;
  border-radius: 8px;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.summary-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.summary-header span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.summary-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 8px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
}

.summary-status.good {
  background: #ecfdf5;
  color: #059669;
}

.summary-status.warn {
  background: #fffbeb;
  color: #b45309;
}

.summary-status.bad {
  background: #fef2f2;
  color: #dc2626;
}

.summary-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  margin-bottom: 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
}

.summary-hero span,
.summary-planning span {
  display: block;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.summary-hero strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 21px;
  line-height: 1.1;
}

.summary-hero em {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.summary-rate {
  flex: 0 0 auto;
  min-width: 76px;
  border-radius: 8px;
  padding: 8px 9px;
  text-align: center;
  background: #ffffff;
  color: #2563eb;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.08);
}

.summary-rate::after {
  content: " returns";
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 9px;
  font-weight: 800;
}

.summary-rate.good {
  color: #059669;
}

.summary-rate.warn {
  color: #b45309;
}

.summary-rate.bad {
  color: #dc2626;
}

.summary-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.summary-kpi {
  background: #f9fafb;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 11px 10px 13px;
  margin-bottom: 0;
  position: relative;
  transition: 0.2s ease;
  min-width: 0;
}

.summary-kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

/* LEFT COLOR STRIP */
.summary-kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
}

.summary-kpi.sales::before {
  background: #2563eb;
}

.summary-kpi.average::before {
  background: #10b981;
}

.summary-kpi.returns::before {
  background: #ef4444;
}

.summary-kpi.invoice::before {
  background: #8b5cf6;
}

.kpi-label {
  font-size: 11px;
  font-weight: 800;
  color: #6b7280;
  margin-bottom: 5px;
}

.kpi-main {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 900;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: 10px;
  color: #9ca3af;
  margin-top: 4px;
  font-weight: 700;
}

.summary-planning {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.summary-planning strong {
  display: block;
  margin-top: 4px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.summary-planning p {
  margin: 0;
  color: #475569;
  font-size: 11px;
  line-height: 1.4;
  font-weight: 700;
}

.category-breakdown {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f8fafc;
}

.category-name {
  font-weight: 500;
}

.category-value {
  font-weight: 600;
}
.card-header-simple {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  font-weight: 600;
  margin-bottom: 12px;
}

.card-header-simple h3 {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
}

.card-header-simple span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: #64748b;
}

.item-category-controls {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  padding: 2px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
}

.item-category-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.item-category-controls button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.item-category-controls button.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.item-category-detail-btn {
  min-height: 32px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.item-category-detail-btn:hover {
  background: #dbeafe;
}

.item-category-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.item-category-kpis > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.item-category-kpis span {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
}

.item-category-kpis strong {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.25;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pie-wrapper {
  position: relative;
  height: 250px;
  margin: 8px 0 0;
}

.category-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow: hidden;
}

.category-breakdown.show-all {
  max-height: 440px;
  overflow-y: auto;
  padding-right: 3px;
}

.category-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13px;
  transition: 0.2s ease;
}

.category-row.uncategorized {
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.category-row.other {
  border-style: dashed;
  background: #ffffff;
}

.category-row:hover {
  background: #eef2f7;
}

.category-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 500;
}

.category-name > div {
  min-width: 0;
}

.category-name strong {
  display: block;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-name em {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
}

.category-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.category-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.category-value strong {
  color: #0f172a;
  font-size: 11px;
}

.category-value span,
.category-empty {
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.category-empty {
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  text-align: center;
}

.category-breakdown-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.category-breakdown-footer span {
  min-width: 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.category-breakdown-footer button {
  flex: 0 0 auto;
  min-height: 28px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.item-category-modal-box {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 64px));
  max-height: min(780px, calc(100vh - 64px));
  overflow: hidden;
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.item-category-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.item-category-modal-header h3 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  font-weight: 800;
}

.item-category-modal-header span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.item-category-modal-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.item-category-modal-summary > div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.item-category-modal-summary span,
.item-category-modal-summary strong {
  display: block;
}

.item-category-modal-summary span {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.item-category-modal-summary strong {
  margin-top: 5px;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-category-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
  padding-right: 2px;
}


#dashboard .dashboard-filters {
  display: grid;
  grid-template-columns: minmax(270px, 1.35fr) minmax(190px, 1fr) minmax(140px, .7fr) minmax(140px, .7fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

#dashboard .dashboard-filters .date-filter {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#dashboard .dashboard-filters .date-filter span {
  white-space: nowrap;
}

#dashboard .dashboard-filters input,
#dashboard .dashboard-filters select {
  width: 100%;
  min-width: 0;
  height: 36px;
  box-sizing: border-box;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 14px;
  background: white;
}

#dashboard .dashboard-filters button {
  height: 36px;
  padding: 6px 16px;
  border-radius: 8px;
  border: none;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.sales-trend-wrapper {
  position: relative;
  height: 320px;
  width: 100%;
}

.store-dashboard-filter-card {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.store-dashboard-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(130px, 1fr)) minmax(180px, 1.2fr) auto;
  gap: 10px;
  align-items: center;
}

.store-dashboard-filters input,
.store-dashboard-filters select {
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
}

.store-dashboard-quick-filters {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -4px;
}

.store-dashboard-quick-filters button {
  height: 30px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.store-dashboard-quick-filters button:hover,
.store-dashboard-quick-filters button.active {
  border-color: #10b981;
  background: #d1fae5;
  color: #047857;
}

.store-dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.store-dashboard-kpi-grid .metric {
  border: none;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
}

.store-dashboard-sync {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 600;
}

.store-dashboard-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr);
  gap: 12px;
  margin-top: 12px;
}

.store-dashboard-chart-card {
  padding: 18px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.store-dashboard-chart-wrap {
  position: relative;
  height: 320px;
  width: 100%;
}

.store-dashboard-chart-wrap.compact {
  height: 230px;
}

.store-dashboard-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.store-dashboard-breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  font-size: 13px;
}

.store-dashboard-breakdown-row span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #334155;
  font-weight: 600;
}

.store-dashboard-breakdown-row i {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
}

.store-dashboard-breakdown-row b {
  color: #0f172a;
  white-space: nowrap;
}

.store-dashboard-breakdown-row em {
  color: #64748b;
  font-size: 11px;
  font-style: normal;
}

@media (max-width: 1400px) {
  .dashboard-panel-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  }

  .dashboard-panel-grid .card-side-kpi {
    grid-column: 1 / -1;
  }

  .store-dashboard-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .card-sales-trend .card-header {
    flex-direction: column;
  }

  .sales-trend-actions {
    justify-content: flex-start;
    max-width: none;
    width: 100%;
  }

  .sales-trend-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-header-simple {
    flex-direction: column;
  }

  .item-category-actions {
    width: 100%;
  }

  .item-category-controls {
    width: 100%;
  }

  .item-category-controls button {
    flex: 1;
  }

  .item-category-detail-btn {
    flex: 0 0 auto;
  }

  .item-category-modal-box {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 28px);
  }

  .item-category-modal-header {
    flex-direction: column;
  }

  .item-category-modal-summary {
    grid-template-columns: 1fr;
  }

  .wide-card-header {
    flex-direction: column;
  }

  .wide-card-controls {
    width: 100%;
  }

  .wide-card-controls button {
    flex: 1;
  }

  .no-lpo-content {
    grid-template-columns: 1fr;
  }

  .no-lpo-kpis {
    grid-template-columns: 1fr;
  }

  .no-lpo-modal-box {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 28px);
  }

  .no-lpo-modal-header {
    flex-direction: column;
  }

  .no-lpo-modal-summary,
  .no-lpo-modal-branches {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .sales-trend-actions,
  .sales-trend-segment,
  .sales-trend-compare,
  .sales-trend-target,
  .sales-trend-export {
    width: 100%;
  }

  .sales-trend-segment button {
    flex: 1;
  }

  .sales-trend-target input {
    flex: 1;
    width: auto;
  }

  .sales-trend-kpis {
    grid-template-columns: 1fr;
  }

  .item-category-kpis {
    grid-template-columns: 1fr;
  }

  .category-row {
    flex-direction: column;
  }

  .category-value {
    align-items: flex-start;
    text-align: left;
    white-space: normal;
  }
}

@keyframes productDetailFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 6px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (max-width: 1100px) {
  #dashboard.page.active .dashboard-filter-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .dashboard-quick-filters {
    grid-column: auto;
    margin-top: 0;
  }

  #dashboard .dashboard-filters {
    grid-template-columns: minmax(260px, 1fr) minmax(180px, 1fr) minmax(150px, .8fr) minmax(150px, .8fr);
  }

  .dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-decision-grid,
  .dashboard-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .store-dashboard-filter-card,
  .store-dashboard-chart-grid {
    grid-template-columns: 1fr;
  }

  .store-dashboard-quick-filters {
    grid-column: auto;
    margin-top: 0;
  }

  .store-dashboard-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-panel-grid,
  .dashboard-top10 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  #dashboard .dashboard-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .store-dashboard-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #dashboard .dashboard-filters .date-filter {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-decision-grid,
  .dashboard-action-grid {
    grid-template-columns: 1fr;
  }

  .store-dashboard-filters,
  .store-dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }

  .invoice-change-item-card {
    grid-template-columns: 1fr;
  }

  #dashboard .dashboard-filters,
  #dashboard .dashboard-filters .date-filter {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  #dashboard .dashboard-filters input,
  #dashboard .dashboard-filters select,
  #dashboard .dashboard-filters button {
    width: 100%;
  }

  .top10-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .top10-insight-strip {
    grid-template-columns: 1fr;
  }

  .top10-row {
    flex-wrap: wrap;
  }

  .top10-row .amount-section {
    width: 100%;
    min-width: 0;
    margin-left: 40px;
    text-align: left;
  }

  .top10-secondary {
    white-space: normal;
  }
}

@media (max-width: 980px) {
  .product-detail-modal-box {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  .product-detail-header {
    flex-direction: column;
  }

  .product-detail-actions {
    justify-content: flex-start;
  }

  .product-detail-grid,
  .product-detail-split {
    grid-template-columns: 1fr;
  }

  .product-detail-title-row h3 {
    max-width: 100%;
    font-size: 18px;
  }
}


.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-card {
  width: 900px;
  max-width: 95%;
  background: #ffffff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
}

.modal-chart-container {
  height: 400px;
  margin-top: 20px;
}

.modal-summary {
  display: flex;
  gap: 30px;
  margin-top: 10px;
  font-weight: 600;
}

.clickable {
  cursor: pointer;
}
.clickable:hover {
  text-decoration: underline;
}

.modal-toggle {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}

.toggle-btn {
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  background: #f1f5f9;
  font-weight: 600;
}

.toggle-btn.active {
  background: #3b82f6;
  color: white;
}

.import-progress {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border: 1px solid #bfd2ee;
  border-radius: 14px;
  background: #f8fbff;
}

.import-progress.hidden {
  display: none;
}

.import-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #18345c;
  font-size: 13px;
}

.import-progress-row strong {
  min-width: 46px;
  text-align: right;
  color: #1d4ed8;
  font-size: 15px;
}

.import-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe8f8;
}

.import-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  transition: width 0.2s ease;
}

/* Shared document loading/saving feedback */
.document-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(2px);
}

.document-loading-overlay.is-visible {
  display: flex;
}

.document-loading-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  padding: 18px 22px;
  border-radius: 14px;
  background: #ffffff;
  color: #10233f;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
  font-weight: 700;
}

.document-loading-spinner {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  border: 3px solid #c7dcff;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: document-loading-spin 0.75s linear infinite;
}

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