/* =====================================================
   modern.css — Dashboard Redesign
   Scoped to .dashboard-modern — does not break other pages
   Color palette: Teal #20808D / Dark Teal #1B474D / Gold #FFC553
   ===================================================== */

/* --- Custom Properties --- */
.dashboard-modern {
  --dm-teal:        #20808D;
  --dm-teal-dark:   #1B474D;
  --dm-teal-light:  #e8f5f7;
  --dm-gold:        #FFC553;
  --dm-gold-light:  #fff8e6;
  --dm-red:         #e74c3c;
  --dm-red-light:   #fdecea;
  --dm-green:       #27ae60;
  --dm-green-light: #eafaf1;
  --dm-surface:     #ffffff;
  --dm-bg:          #f4f6f8;
  --dm-border:      #e2e8ec;
  --dm-text:        #2c3e50;
  --dm-text-muted:  #7f8c9a;
  --dm-radius:      8px;
  --dm-shadow:      0 1px 4px rgba(0,0,0,.08), 0 2px 12px rgba(0,0,0,.05);
  --dm-shadow-hover:0 4px 20px rgba(0,0,0,.13);
  --dm-font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === Base reset inside wrapper === */
.dashboard-modern {
  font-family: var(--dm-font);
  color: var(--dm-text);
}

/* =====================================================
   SECTION SPACING
   ===================================================== */
.dashboard-modern .dm-section {
  margin-bottom: 22px;
}

/* =====================================================
   CARD BASE
   ===================================================== */
.dashboard-modern .dm-card {
  background: var(--dm-surface);
  border-radius: var(--dm-radius);
  box-shadow: var(--dm-shadow);
  border: 1px solid var(--dm-border);
  overflow: hidden;
  transition: box-shadow .18s ease;
}

.dashboard-modern .dm-card:hover {
  box-shadow: var(--dm-shadow-hover);
}

.dashboard-modern .dm-card-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--dm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dm-surface);
}

.dashboard-modern .dm-card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--dm-text-muted);
  margin: 0;
}

.dashboard-modern .dm-card-body {
  padding: 16px 18px;
}

/* =====================================================
   ROW 1: KPI CARDS
   ===================================================== */
.dashboard-modern .kpi-card {
  background: var(--dm-surface);
  border-radius: var(--dm-radius);
  box-shadow: var(--dm-shadow);
  border: 1px solid var(--dm-border);
  padding: 18px 20px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow .18s ease, transform .18s ease;
  position: relative;
  overflow: hidden;
}

.dashboard-modern .kpi-card:hover {
  box-shadow: var(--dm-shadow-hover);
  transform: translateY(-1px);
}

/* Left border accent */
.dashboard-modern .kpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: var(--dm-radius) 0 0 var(--dm-radius);
}

.dashboard-modern .kpi-card.kpi-teal::before    { background: var(--dm-teal); }
.dashboard-modern .kpi-card.kpi-repair::before  { background: var(--dm-gold); }
.dashboard-modern .kpi-card.kpi-alert::before   { background: var(--dm-red); }
.dashboard-modern .kpi-card.kpi-customers::before { background: var(--dm-green); }

.dashboard-modern .kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  margin-left: 4px;
}

.dashboard-modern .kpi-teal    .kpi-icon { background: var(--dm-teal-light);  color: var(--dm-teal); }
.dashboard-modern .kpi-repair  .kpi-icon { background: var(--dm-gold-light);  color: #b58000; }
.dashboard-modern .kpi-alert   .kpi-icon { background: var(--dm-red-light);   color: var(--dm-red); }
.dashboard-modern .kpi-customers .kpi-icon { background: var(--dm-green-light); color: var(--dm-green); }

.dashboard-modern .kpi-body {
  flex: 1;
  min-width: 0;
}

.dashboard-modern .kpi-number {
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--dm-text);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-modern .kpi-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--dm-text-muted);
  margin: 0;
}

.dashboard-modern .kpi-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.dashboard-modern .kpi-trend.up   { color: var(--dm-green); }
.dashboard-modern .kpi-trend.down { color: var(--dm-red); }
.dashboard-modern .kpi-trend.neutral { color: var(--dm-text-muted); }

/* =====================================================
   ROW 2: REVENUE CHART
   ===================================================== */
.dashboard-modern .revenue-chart-card .dm-card-header {
  background: linear-gradient(135deg, var(--dm-teal-dark) 0%, var(--dm-teal) 100%);
  border-bottom: none;
}

.dashboard-modern .revenue-chart-card .dm-card-title {
  color: rgba(255,255,255,.8);
  font-size: 12px;
}

.dashboard-modern .revenue-chart-card .dm-chart-heading {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.dashboard-modern #hero-area {
  min-height: 350px;
  background: var(--dm-surface);
}

/* Morris overrides */
.dashboard-modern .morris-hover {
  border-radius: 6px;
  font-family: var(--dm-font) !important;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
}

/* =====================================================
   ROW 3 LEFT: RECENT SALES TABLE
   ===================================================== */
.dashboard-modern .sales-table-wrap {
  overflow-x: auto;
}

.dashboard-modern .dm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dashboard-modern .dm-table thead tr {
  background: var(--dm-bg);
}

.dashboard-modern .dm-table thead th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--dm-text-muted);
  border-bottom: 2px solid var(--dm-border);
  white-space: nowrap;
}

.dashboard-modern .dm-table tbody tr {
  border-bottom: 1px solid var(--dm-border);
  transition: background .12s;
}

.dashboard-modern .dm-table tbody tr:hover {
  background: var(--dm-bg);
}

.dashboard-modern .dm-table tbody td {
  padding: 9px 12px;
  vertical-align: middle;
  color: var(--dm-text);
}

.dashboard-modern .dm-table tfoot tr {
  background: var(--dm-bg);
}

.dashboard-modern .dm-table tfoot td,
.dashboard-modern .dm-table tfoot th {
  padding: 9px 12px;
  font-weight: 700;
  color: var(--dm-teal-dark);
  border-top: 2px solid var(--dm-border);
}

.dashboard-modern .dm-sale-id {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--dm-teal);
  font-weight: 600;
}

.dashboard-modern .dm-view-all {
  font-size: 12px;
  color: var(--dm-teal);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dashboard-modern .dm-view-all:hover {
  color: var(--dm-teal-dark);
  text-decoration: underline;
}

/* =====================================================
   ROW 3 RIGHT: QUICK ACTIONS ACCORDION
   ===================================================== */
.dashboard-modern .quick-actions-card .dm-card-body {
  padding: 0;
}

.dashboard-modern .qa-section {
  border-bottom: 1px solid var(--dm-border);
}

.dashboard-modern .qa-section:last-child {
  border-bottom: none;
}

.dashboard-modern .qa-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 13px 18px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--dm-text);
  transition: background .12s;
}

.dashboard-modern .qa-toggle:hover {
  background: var(--dm-bg);
}

.dashboard-modern .qa-toggle .qa-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  margin-right: 10px;
  flex-shrink: 0;
}

.dashboard-modern .qa-toggle.qa-sale .qa-icon    { background: var(--dm-teal-light); color: var(--dm-teal); }
.dashboard-modern .qa-toggle.qa-repair .qa-icon  { background: var(--dm-gold-light); color: #b58000; }
.dashboard-modern .qa-toggle.qa-customer .qa-icon{ background: var(--dm-green-light); color: var(--dm-green); }

.dashboard-modern .qa-caret {
  color: var(--dm-text-muted);
  font-size: 11px;
  transition: transform .2s;
}

.dashboard-modern .qa-section.open .qa-caret {
  transform: rotate(180deg);
}

.dashboard-modern .qa-body {
  display: none;
  padding: 12px 18px 16px;
  background: var(--dm-bg);
}

.dashboard-modern .qa-section.open .qa-body {
  display: block;
}

.dashboard-modern .qa-input-wrap {
  position: relative;
  margin-bottom: 10px;
}

.dashboard-modern .qa-input-wrap .qa-scan-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dm-text-muted);
  font-size: 14px;
  pointer-events: none;
}

.dashboard-modern .qa-input-wrap input,
.dashboard-modern .qa-input-wrap select {
  height: 42px;
  padding-left: 36px;
  border-radius: 6px;
  border: 1px solid var(--dm-border);
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
  background: var(--dm-surface);
  transition: border-color .15s, box-shadow .15s;
}

.dashboard-modern .qa-input-wrap input:focus,
.dashboard-modern .qa-input-wrap select:focus {
  border-color: var(--dm-teal);
  box-shadow: 0 0 0 3px rgba(32,128,141,.15);
  outline: none;
}

.dashboard-modern .qa-btn {
  width: 100%;
  height: 40px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--dm-teal);
  color: #fff;
  transition: background .15s, transform .1s;
}

.dashboard-modern .qa-btn:hover {
  background: var(--dm-teal-dark);
  transform: translateY(-1px);
}

.dashboard-modern .qa-result {
  display: none;
  margin-top: 10px;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  font-size: 13px;
}

/* Select2 wrapper */
.dashboard-modern .qa-select2-wrap .select2-container {
  width: 100% !important;
}

.dashboard-modern .qa-select2-wrap .select2-selection--single {
  height: 42px !important;
  border-radius: 6px !important;
  border-color: var(--dm-border) !important;
  padding-left: 30px;
}

.dashboard-modern .qa-select2-wrap .select2-selection__rendered {
  line-height: 42px !important;
  font-size: 13px;
}

.dashboard-modern .qa-select2-wrap .select2-selection__arrow {
  height: 40px !important;
}

/* =====================================================
   ROW 4: STOCK OVERVIEW
   ===================================================== */
.dashboard-modern .stock-overview-row {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.dashboard-modern .stock-chart-wrap {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
}

.dashboard-modern #chartjs-pie {
  max-width: 180px;
  max-height: 180px;
}

.dashboard-modern .stock-stats {
  flex: 1;
  min-width: 160px;
}

.dashboard-modern .stock-stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--dm-border);
}

.dashboard-modern .stock-stat-item:last-child {
  border-bottom: none;
}

.dashboard-modern .stock-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.dashboard-modern .stock-dot.dot-price  { background: var(--dm-teal); }
.dashboard-modern .stock-dot.dot-cost   { background: var(--dm-teal-dark); }
.dashboard-modern .stock-dot.dot-profit { background: var(--dm-gold); }

.dashboard-modern .stock-stat-label {
  font-size: 12px;
  color: var(--dm-text-muted);
  flex: 1;
}

.dashboard-modern .stock-stat-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--dm-text);
  font-variant-numeric: tabular-nums;
}

/* =====================================================
   ROW 5: LOW STOCK ALERT BANNER
   ===================================================== */
.dashboard-modern .low-stock-banner {
  background: linear-gradient(135deg, #fdecea 0%, #fff8e6 100%);
  border: 1px solid #f5c6cb;
  border-radius: var(--dm-radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.dashboard-modern .low-stock-banner-icon {
  font-size: 22px;
  color: var(--dm-red);
  flex-shrink: 0;
}

.dashboard-modern .low-stock-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--dm-red);
  margin-right: 8px;
  white-space: nowrap;
}

.dashboard-modern .low-stock-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.dashboard-modern .low-stock-cat {
  background: rgba(255,255,255,.8);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dm-text);
  white-space: nowrap;
}

.dashboard-modern .low-stock-cat .cat-count {
  display: inline-block;
  background: var(--dm-red);
  color: #fff;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
  line-height: 16px;
}

.dashboard-modern .low-stock-banner-link {
  margin-left: auto;
  background: var(--dm-red);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  padding: 6px 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s;
}

.dashboard-modern .low-stock-banner-link:hover {
  background: #c0392b;
  color: #fff;
  text-decoration: none;
}

/* =====================================================
   ROW 6: HERO ACTION BUTTONS
   ===================================================== */
.dashboard-modern .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.dashboard-modern .hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--dm-radius);
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background .18s, transform .12s, box-shadow .18s;
  box-shadow: var(--dm-shadow);
  min-width: 160px;
  position: relative;
}

.dashboard-modern .hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--dm-shadow-hover);
  text-decoration: none;
}

.dashboard-modern .hero-btn:active {
  transform: translateY(0);
}

.dashboard-modern .hero-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: rgba(255,255,255,.2);
}

.dashboard-modern .hero-btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.dashboard-modern .hero-btn-label {
  line-height: 1;
  margin-bottom: 2px;
}

.dashboard-modern .hero-btn-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: .75;
}

.dashboard-modern .hero-btn.btn-repair {
  background: linear-gradient(135deg, var(--dm-teal) 0%, var(--dm-teal-dark) 100%);
  color: #fff;
}

.dashboard-modern .hero-btn.btn-pos {
  background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
  color: #fff;
}

.dashboard-modern .hero-btn.btn-alerts {
  background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
  color: #fff;
}

.dashboard-modern .hero-btn .btn-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: var(--dm-gold);
  color: #333;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  line-height: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* =====================================================
   MESSAGE BOARD
   ===================================================== */
.dashboard-modern .board-card .qa-input-wrap input {
  height: 38px;
}

.dashboard-modern #chatbox {
  max-height: 200px;
  overflow-y: auto;
  font-size: 13px;
  padding: 4px 0;
}

/* =====================================================
   COMMISSION MINI CARDS
   ===================================================== */
.dashboard-modern .commission-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-modern .commission-chip {
  flex: 1;
  min-width: 80px;
  background: var(--dm-teal-light);
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
}

.dashboard-modern .commission-chip .chip-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--dm-teal-dark);
}

.dashboard-modern .commission-chip .chip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--dm-text-muted);
  margin-top: 2px;
}

/* =====================================================
   REPAIR STAT CHIPS
   ===================================================== */
.dashboard-modern .repair-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-modern .repair-chip {
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
}

.dashboard-modern .repair-chip.chip-active    { background: var(--dm-gold-light); }
.dashboard-modern .repair-chip.chip-7day      { background: var(--dm-teal-light); }
.dashboard-modern .repair-chip.chip-30day     { background: var(--dm-green-light); }

.dashboard-modern .repair-chip .chip-val {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.dashboard-modern .repair-chip.chip-active  .chip-val { color: #b58000; }
.dashboard-modern .repair-chip.chip-7day   .chip-val  { color: var(--dm-teal); }
.dashboard-modern .repair-chip.chip-30day  .chip-val  { color: var(--dm-green); }

.dashboard-modern .repair-chip .chip-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--dm-text-muted);
  margin-top: 4px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
  .dashboard-modern .kpi-number {
    font-size: 24px;
  }

  .dashboard-modern .hero-actions {
    flex-direction: column;
  }

  .dashboard-modern .hero-btn {
    width: 100%;
  }

  .dashboard-modern .stock-overview-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-modern .stock-chart-wrap {
    width: 140px;
    height: 140px;
    margin: 0 auto;
  }

  .dashboard-modern .low-stock-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-modern .low-stock-banner-link {
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .dashboard-modern .kpi-card {
    padding: 14px 12px 12px;
  }

  .dashboard-modern .kpi-number {
    font-size: 20px;
  }

  .dashboard-modern .dm-card-body {
    padding: 12px;
  }
}
