/* Compact CRM dashboard. All rules scoped to admin. */
#dashboardHome .dash-stats {
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 13px;
  margin: 18px 0 22px;
}
#dashboardHome .dash-stats > div {
  min-height: 82px;
  padding: 14px 18px;
  grid-template-columns: 44px 1fr;
  border-radius: 13px;
}
#dashboardHome .dash-stats strong {font-size:27px}
#dashboardHome .dash-stats span {font-size:12px}
#dashboardHome .dash-stats > div:last-child svg {color:#078b3c}
#dashboardHome .dash-stats > div:nth-child(3) svg {color:#0b73c5}
#dashboardHome .dash-stats .crm-warehouse-icon {
  grid-row:1/3;
  display:flex;
  align-items:center;
  color:#0b73c5;
}
#dashboardHome .dash-stats .crm-warehouse-icon svg {width:34px;height:34px}

#dashboardHome .dash-columns {display:none !important}
#dashboardHome #crmQuickNav {
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:14px;
  margin:0 0 28px;
}
#dashboardHome #crmQuickNav > button.dash-tile {
  display:flex !important;
  min-height:142px;
  padding:16px 18px;
  border-radius:16px;
  gap:6px;
  position:relative;
  border:1px solid #c9def8;
  background:linear-gradient(135deg,#f9fcff,#e8f2ff);
  box-shadow:0 2px 7px rgba(12,70,127,.06);
  text-align:left;
  align-items:flex-start;
}
#dashboardHome #crmQuickNav > button.dash-tile:hover {
  background:linear-gradient(135deg,#fff,#deedff);
  transform:translateY(-2px);
}
#dashboardHome #crmQuickNav .dash-tile-icon {
  width:40px;height:40px;margin:0 0 2px;
  border-radius:11px;
  display:grid;place-items:center;
  background:#e0f0ff;color:#0672be;
  box-shadow:none;
}
#dashboardHome #crmQuickNav .dash-tile-icon svg {width:27px;height:27px}
#dashboardHome #crmQuickNav .dash-tile strong {
  font-size:16px;
  padding:0;
  color:#112b51;
}
#dashboardHome #crmQuickNav .dash-tile small {
  font-size:11px;
  color:#54708e;
}
#dashboardHome #crmQuickNav .dash-tile-chevron {display:none}

#crmSettingsMenu {
  position:relative;
  flex-shrink:0;
  z-index:10;
}
#crmSettingsMenu > summary {
  list-style:none;
  border:1px solid #a6c9ee;
  color:#07589f;
  padding:10px 14px;
  border-radius:9px;
  background:#fff;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
}
#crmSettingsMenu > summary::-webkit-details-marker {display:none}
#crmSettingsMenu > #dashboardSettings {
  position:absolute;
  top:100%;right:0;
  width:min(360px,85vw);
  max-height:70vh;
  overflow:auto;
  border:1px solid #cbdbea;
  border-radius:12px;
  background:#fff;
  padding:12px;
  box-shadow:0 12px 25px rgba(10,39,74,.14);
}
#crmSettingsMenu .crm-deprecated-settings {display:none}

#crmShipmentsSearch {
  display:block;
  width:min(340px,100%);
  margin:12px 0 14px auto;
  box-sizing:border-box;
  border:1px solid #c5d9ef;
  border-radius:9px;
  padding:10px 12px;
  background:#fff;
  font-size:13px;
}
#shipmentsPanel {margin-top:12px}
#shipmentsPanel table {font-size:12px}
#shipmentsPanel table th,#shipmentsPanel table td {padding:9px 8px}
#shipmentsPanel tbody tr[hidden] {display:none !important}

#crmFutureScreen {
  margin:18px 0;
  padding:22px;
  background:#fff;
  border:1px solid #cbdbea;
  border-radius:13px;
  color:#29405f;
}
.crm-future-header {display:flex;align-items:center;gap:15px}
.crm-future-header h2 {margin:0}
#crmFutureScreen p {margin:18px 0 0;line-height:1.6}

@media(max-width:1100px) {
  #dashboardHome #crmQuickNav {grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:700px) {
  #dashboardHome .dash-stats {grid-template-columns:repeat(2,minmax(0,1fr))}
  #dashboardHome #crmQuickNav {grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  #dashboardHome #crmQuickNav > button.dash-tile {min-height:120px;padding:13px}
  #crmSettingsMenu > #dashboardSettings {right:-40px}
}


/* ==========================================
   CRM MOBILE ADMIN — PREMIUM REDESIGN
   Desktop remains unchanged
========================================== */

@media (max-width: 700px) {

  #admin .adminbox {
    padding: 0 12px 20px !important;
  }

  #adminContent {
    min-width: 0;
  }

  /* HEADER */

  #adminContent > .bar.dash-hero {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 12px !important;
    margin-top: 10px !important;
    border-radius: 14px !important;
  }

  .dash-hero-title {
    gap: 10px !important;
    min-width: 0 !important;
  }

  .dash-hero-title h2 {
    font-size: 17px !important;
    line-height: 1.25 !important;
  }

  .dash-hero-title p {
    display: none !important;
  }

  .dash-hero-badge {
    width: 42px !important;
    height: 42px !important;
    border-radius: 11px !important;
  }

  #crmSettingsMenu > summary {
    padding: 9px 10px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }

  #crmSettingsMenu > #dashboardSettings {
    right: 0 !important;
    width: min(340px, calc(100vw - 32px)) !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
    z-index: 100 !important;
  }

  #logout.alt {
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 8px !important;
    display: grid !important;
    place-items: center !important;
    flex-shrink: 0 !important;
  }

  /* STATISTICS */

  #dashboardHome .dash-stats {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin: 14px 0 20px !important;
  }

  #dashboardHome .dash-stats > div {
    min-width: 0 !important;
    min-height: 78px !important;
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 5px !important;
    text-align: left !important;
    border-radius: 13px !important;
    box-sizing: border-box !important;
  }

  #dashboardHome .dash-stats > div svg {
    display: none !important;
  }

  #dashboardHome .dash-stats strong {
    font-size: 25px !important;
    line-height: 1.1 !important;
  }

  #dashboardHome .dash-stats span {
    font-size: 12px !important;
    margin: 0 !important;
  }

  /* QUICK NAVIGATION */

  #dashboardHome #crmQuickNav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin: 0 0 22px !important;
    width: 100% !important;
  }

  #dashboardHome #crmQuickNav > button.dash-tile {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 116px !important;
    padding: 13px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 7px !important;
    border-radius: 13px !important;
    box-sizing: border-box !important;
    text-align: left !important;
  }

  #dashboardHome #crmQuickNav .dash-tile-icon {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 10px !important;
    margin: 0 !important;
  }

  #dashboardHome #crmQuickNav .dash-tile-icon svg {
    width: 23px !important;
    height: 23px !important;
  }

  #dashboardHome #crmQuickNav .dash-tile strong {
    font-size: 14px !important;
    line-height: 1.2 !important;
    padding: 0 !important;
    overflow-wrap: anywhere !important;
  }

  #dashboardHome #crmQuickNav .dash-tile small {
    font-size: 10px !important;
    line-height: 1.3 !important;
  }

  /* SETTINGS */

  #dashboardHome .dash-details {
    border-radius: 12px !important;
    margin: 9px 0 !important;
  }

  #dashboardHome .dash-details > summary {
    min-height: 46px !important;
    padding: 11px 12px !important;
    font-size: 13px !important;
    gap: 9px !important;
  }

  #dashboardHome .dash-details .category-box {
    padding: 12px !important;
    min-width: 0 !important;
  }

  #dashboardHome .dash-details input,
  #dashboardHome .dash-details select {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  #dashboardHome .dash-details button {
    min-height: 40px !important;
  }

  /* SHIPMENTS SEARCH */

  #crmShipmentsSearch {
    width: 100% !important;
    max-width: none !important;
    margin: 12px 0 !important;
    min-height: 44px !important;
    box-sizing: border-box !important;
  }

  #shipmentsPanel {
    min-width: 0 !important;
    margin-top: 12px !important;
  }

  /* FUTURE SCREENS */

  #crmFutureScreen {
    padding: 15px !important;
    margin: 14px 0 !important;
    border-radius: 13px !important;
  }

}

@media (max-width: 390px) {

  #adminContent > .bar.dash-hero {
    gap: 5px !important;
    padding: 10px !important;
  }

  .dash-hero-title h2 {
    font-size: 15px !important;
  }

  #crmSettingsMenu > summary {
    padding: 8px !important;
    font-size: 11px !important;
  }

  #dashboardHome #crmQuickNav > button.dash-tile {
    min-height: 108px !important;
    padding: 11px !important;
  }

}


/* CRM MOBILE ADMIN — UNIFIED POLISH */
@media(max-width:700px) {

  body.admin-mobile-dashboard #dashboardHome {
    width:100%;
    box-sizing:border-box;
  }

  body.admin-mobile-dashboard #dashboardHome .dash-stats {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:11px !important;
    margin:16px 0 20px !important;
  }

  body.admin-mobile-dashboard #dashboardHome .dash-stats > div {
    min-width:0;
    min-height:88px !important;
    padding:13px !important;
    border-radius:15px !important;
    box-sizing:border-box;
    box-shadow:0 4px 15px rgba(20,65,110,.07);
  }

  body.admin-mobile-dashboard #dashboardHome .dash-stats strong {
    font-size:26px !important;
    line-height:1.1;
  }

  body.admin-mobile-dashboard #dashboardHome #crmQuickNav {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:11px !important;
  }

  body.admin-mobile-dashboard #dashboardHome #crmQuickNav > .dash-tile {
    min-height:120px !important;
    padding:14px !important;
    border-radius:15px !important;
    border:1px solid #d7e5f3;
    box-shadow:0 4px 14px rgba(20,65,110,.07);
  }

  body.admin-mobile-dashboard #dashboardHome #crmQuickNav .dash-tile-icon {
    width:39px !important;
    height:39px !important;
    flex-shrink:0;
  }

  body.admin-mobile-dashboard #dashboardHome #crmQuickNav .dash-tile strong {
    font-size:15px !important;
    line-height:1.25;
  }

  body.admin-mobile-dashboard #crmShipmentsSearch {
    min-height:46px;
    border-radius:11px;
    font-size:14px;
  }

  body.admin-mobile-dashboard #shipmentsPanel tbody tr {
    border:1px solid #dce7f2;
    border-radius:14px;
    padding:13px;
    margin-bottom:12px;
    box-shadow:0 3px 12px rgba(20,65,110,.06);
  }

  body.admin-mobile-dashboard #shipmentsPanel tbody td {
    overflow-wrap:anywhere;
  }

  body.admin-mobile-dashboard #crmFutureScreen {
    border-radius:15px;
    padding:16px;
  }
}

/* CUSTOMER MANAGEMENT */
#crmCustomersScreen {
  margin-top: 20px;
  padding: 26px;
  background:#fff;
  border:1px solid #cbdff3;
  border-radius:16px;
  box-shadow:0 5px 20px rgba(20,65,110,.06);
  color:#17365d;
}
.crm-customers-header {
  display:flex;
  align-items:center;
  gap:18px;
  margin-bottom:24px;
}
.crm-customers-header h2 {margin:0;font-size:25px;color:#17365d}
.crm-customer-stats {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin-bottom:20px;
}
.crm-customer-stats > div {
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:16px;
  border:1px solid #d4e5f5;
  border-radius:12px;
  background:linear-gradient(135deg,#f8fbff,#eaf4ff);
}
.crm-customer-stats strong {font-size:26px;color:#0872bd}
.crm-customer-stats span {font-size:12px;color:#526e8c}
.crm-customer-toolbar {
  display:grid;
  grid-template-columns:minmax(200px,1fr) 220px 180px;
  gap:10px;
  margin-bottom:14px;
}
.crm-customer-toolbar input,
.crm-customer-toolbar select {
  width:100%;
  min-height:44px;
  padding:10px 12px;
  border:1px solid #cbdced;
  border-radius:9px;
  background:#fff;
  color:#17365d;
  box-sizing:border-box;
}
.crm-customer-exports {
  display:flex;
  flex-wrap:wrap;
  gap:9px;
  margin:14px 0;
}
.crm-customer-exports button,
.crm-customer-actions button {
  border:1px solid #b9d4ed;
  border-radius:8px;
  background:#edf6ff;
  color:#075da5;
  padding:9px 13px;
  font-weight:700;
  cursor:pointer;
}
.crm-customer-exports button:hover,
.crm-customer-actions button:hover {background:#dceeff}
.crm-customer-table-wrap {width:100%;overflow-x:auto}
.crm-customer-table {
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
.crm-customer-table th {
  padding:12px 10px;
  text-align:left;
  background:#edf5fc;
  color:#24496e;
  border-bottom:1px solid #d2e1ef;
  white-space:nowrap;
}
.crm-customer-table td {
  padding:12px 10px;
  border-bottom:1px solid #e4edf5;
  color:#294968;
  vertical-align:middle;
}
.crm-customer-table tbody tr:hover {background:#f7fbff}
.crm-customer-actions {display:flex;gap:6px;flex-wrap:wrap}
.crm-customer-actions button {font-size:11px;padding:7px 9px}
.crm-vip-cell {color:#078b3c !important;font-weight:900}
#crmCustomersMessage {min-height:20px;color:#58718b;font-size:13px}
#crmCustomersMessage.error {color:#c0392b}
.crm-customer-orders {
  margin-top:24px;
  padding:18px;
  border:1px solid #cbdff3;
  border-radius:12px;
  background:#fbfdff;
  overflow-x:auto;
}
.crm-customer-orders h3 {margin:0 0 14px;color:#17365d}
@media(max-width:750px) {
  #crmCustomersScreen {padding:16px}
  .crm-customer-stats {grid-template-columns:repeat(2,minmax(0,1fr))}
  .crm-customer-toolbar {grid-template-columns:1fr}
  .crm-customers-header {flex-wrap:wrap}
  .crm-customers-header h2 {font-size:21px}
}


/* CRM CUSTOMERS PAGINATION AND DELETE */
.crm-customers-pagination {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:12px;
  margin-top:18px;
  color:#496582;
  font-size:13px;
}
.crm-customers-pagination button {
  border:1px solid #bad4ed;
  border-radius:9px;
  background:#f0f7ff;
  color:#075da5;
  padding:9px 14px;
  font-weight:700;
  cursor:pointer;
}
.crm-customers-pagination button:disabled {
  opacity:.45;
  cursor:default;
}
#crmCustomersScreen .crm-customer-actions .crm-customer-delete {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:34px;
  height:34px;
  padding:0;
  background:#fff;
  color:#c02e39;
  border:1px solid #edc7cb;
  border-radius:9px;
}
#crmCustomersScreen .crm-customer-actions .crm-customer-delete:hover {
  background:#fff0f1;
}
#crmCustomersScreen .crm-customer-actions .crm-customer-delete:disabled {
  opacity:.5;
}


/* VIP DISCOUNT EDITOR */
#crmVipOverlay[hidden] { display:none !important; }
#crmVipOverlay {
  position:fixed;
  inset:0;
  z-index:100000;
  background:rgba(15,39,70,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  box-sizing:border-box;
}
#crmVipOverlay .crm-vip-dialog {
  width:min(720px,100%);
  max-height:90vh;
  overflow-y:auto;
  background:#fff;
  border:1px solid #c9dff3;
  border-radius:16px;
  box-shadow:0 16px 60px rgba(0,0,0,.22);
  padding:24px;
  box-sizing:border-box;
  color:#17365d;
}
#crmVipOverlay .crm-vip-heading {
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}
#crmVipOverlay .crm-vip-heading h2 {
  margin:0 0 5px;
  color:#17365d;
}
#crmVipOverlay .crm-vip-heading p {
  margin:0;
  color:#55718e;
}
#crmVipOverlay .crm-vip-close {
  font-size:26px;
  border:0;
  background:none;
  cursor:pointer;
}
#crmVipOverlay h3 {
  margin:20px 0 12px;
  color:#17365d;
}
#crmVipOverlay .crm-vip-notice {
  padding:12px;
  background:#fff6e4;
  border-radius:9px;
}
#crmVipOverlay .crm-vip-hint {
  color:#617b96;
  font-size:13px;
}
#crmVipOverlay .crm-vip-warehouses {
  display:grid;
  gap:8px;
}
#crmVipOverlay .crm-vip-warehouse {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:12px;
  border:1px solid #d7e6f4;
  border-radius:10px;
}
#crmVipOverlay .crm-vip-percent {
  display:flex;
  align-items:center;
  gap:6px;
}
#crmVipOverlay .crm-vip-percent input {
  width:92px;
  padding:9px;
  border:1px solid #bdd3e9;
  border-radius:8px;
}
#crmVipOverlay .crm-vip-controls {
  display:grid;
  grid-template-columns:1fr 200px;
  gap:10px;
  margin:12px 0;
}
#crmVipOverlay .crm-vip-controls input,
#crmVipOverlay .crm-vip-controls select {
  width:100%;
  min-width:0;
  box-sizing:border-box;
  padding:10px;
  border:1px solid #bdd3e9;
  border-radius:8px;
  background:#fff;
  color:#17365d;
}
#crmVipOverlay .crm-vip-products {
  max-height:290px;
  overflow:auto;
  border:1px solid #d7e6f4;
  border-radius:10px;
}
#crmVipOverlay .crm-vip-product {
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid #edf2f8;
  cursor:pointer;
}
#crmVipOverlay .crm-vip-product:last-child {
  border-bottom:0;
}
#crmVipOverlay .crm-vip-product input {
  flex-shrink:0;
}
#crmVipOverlay .crm-vip-product span {
  flex:1;
  overflow-wrap:anywhere;
}
#crmVipOverlay .crm-vip-product small {
  color:#a45d15;
}
#crmVipOverlay .crm-vip-footer {
  display:flex;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:10px;
  margin-top:18px;
}
#crmVipOverlay .crm-vip-footer button {
  padding:11px 17px;
  border-radius:9px;
  border:1px solid #bdd3e9;
  cursor:pointer;
}
#crmVipOverlay .crm-vip-save {
  background:#0872bd;
  color:white;
  border-color:#0872bd !important;
}
#crmVipOverlay .crm-vip-status {
  min-height:18px;
  color:#c0392b;
  font-size:13px;
}
#crmCustomersScreen .crmVipSettingsButton {
  background:#e4f1ff;
  color:#075da5;
  border-color:#afd1f2;
}
@media(max-width:650px) {
  #crmVipOverlay .crm-vip-dialog { padding:16px; }
  #crmVipOverlay .crm-vip-controls { grid-template-columns:1fr; }
}
