/* -------------------------------------------------------------------
   Stage 105.0F CLEAN — UI v2 Customer Directory / List Pages Foundation
   Frontend-only CSS polish for customer directory/list/profile surfaces.
   This file intentionally contains styling only. It does not change routes,
   API calls, popup behaviour, save behaviour, or customer business logic.
------------------------------------------------------------------- */

:root{
  --ui2-custdir-page-bg: linear-gradient(135deg, rgba(248,250,252,.96), rgba(239,246,255,.72));
  --ui2-custdir-card: rgba(255,255,255,.985);
  --ui2-custdir-soft: rgba(248,250,252,.92);
  --ui2-custdir-border: rgba(148,163,184,.24);
  --ui2-custdir-text: #0f172a;
  --ui2-custdir-muted: #64748b;
  --ui2-custdir-accent: #2563eb;
  --ui2-custdir-accent-soft: rgba(37,99,235,.10);
  --ui2-custdir-ok: #16a34a;
  --ui2-custdir-warn: #d97706;
  --ui2-custdir-danger: #dc2626;
  --ui2-custdir-shadow: 0 18px 46px rgba(15,23,42,.085);
  --ui2-custdir-shadow-soft: 0 10px 28px rgba(15,23,42,.060);
}

html[data-theme="dark"], body.dark, body.theme-dark{
  --ui2-custdir-page-bg: linear-gradient(135deg, rgba(15,23,42,.88), rgba(30,41,59,.70));
  --ui2-custdir-card: rgba(15,23,42,.94);
  --ui2-custdir-soft: rgba(30,41,59,.72);
  --ui2-custdir-border: rgba(148,163,184,.22);
  --ui2-custdir-text: #e5edf8;
  --ui2-custdir-muted: #9fb0c5;
  --ui2-custdir-accent: #60a5fa;
  --ui2-custdir-accent-soft: rgba(96,165,250,.14);
  --ui2-custdir-shadow: 0 20px 54px rgba(0,0,0,.30);
  --ui2-custdir-shadow-soft: 0 12px 34px rgba(0,0,0,.22);
}

/* The marker class is applied only on customer-directory style routes. */
body.ispforge-ui-v2-customer-directory-active #page,
body.ispforge-ui-v2-customer-directory-active main,
body.ispforge-ui-v2-customer-directory-active .main-content,
body.ispforge-ui-v2-customer-directory-active .content,
body.ispforge-ui-v2-customer-directory-active .page{
  background: var(--ui2-custdir-page-bg) !important;
}

body.ispforge-ui-v2-customer-directory-active .page-title-row{
  position: relative !important;
  isolation: isolate !important;
  margin-bottom: 18px !important;
  padding: 20px 22px !important;
  border: 1px solid var(--ui2-custdir-border) !important;
  border-radius: 26px !important;
  background:
    radial-gradient(circle at top right, rgba(37,99,235,.13), transparent 32%),
    var(--ui2-custdir-card) !important;
  box-shadow: var(--ui2-custdir-shadow) !important;
  overflow: hidden !important;
}

body.ispforge-ui-v2-customer-directory-active .page-title-row::before{
  content: "" !important;
  position: absolute !important;
  inset: 0 auto 0 0 !important;
  width: 5px !important;
  border-radius: 26px 0 0 26px !important;
  background: linear-gradient(180deg, #38bdf8, #2563eb 54%, #7c3aed) !important;
  z-index: -1 !important;
}

body.ispforge-ui-v2-customer-directory-active .page-title-row h1{
  color: var(--ui2-custdir-text) !important;
  font-size: clamp(27px, 2.2vw, 38px) !important;
  font-weight: 950 !important;
  line-height: 1.02 !important;
  letter-spacing: -.052em !important;
  margin-bottom: 5px !important;
}

body.ispforge-ui-v2-customer-directory-active .page-title-row p{
  color: var(--ui2-custdir-muted) !important;
  max-width: 760px !important;
  font-size: 13.5px !important;
  line-height: 1.55 !important;
}

body.ispforge-ui-v2-customer-directory-active .page-actions{
  gap: 9px !important;
  align-items: center !important;
  flex-wrap: wrap !important;
}

/* Customer directory KPIs. */
body.ispforge-ui-v2-customer-directory-active .kpi-row{
  display: grid !important;
  grid-template-columns: repeat(4, minmax(170px, 1fr)) !important;
  gap: 14px !important;
  margin-bottom: 18px !important;
}

body.ispforge-ui-v2-customer-directory-active .kpi{
  position: relative !important;
  overflow: hidden !important;
  min-height: 104px !important;
  padding: 18px 18px 16px !important;
  border-radius: 24px !important;
  border: 1px solid var(--ui2-custdir-border) !important;
  background: var(--ui2-custdir-card) !important;
  box-shadow: var(--ui2-custdir-shadow-soft) !important;
}

body.ispforge-ui-v2-customer-directory-active .kpi::after{
  content: "" !important;
  position: absolute !important;
  width: 88px !important;
  height: 88px !important;
  right: -28px !important;
  top: -30px !important;
  border-radius: 999px !important;
  background: var(--ui2-custdir-accent-soft) !important;
}

body.ispforge-ui-v2-customer-directory-active .kpi span{
  color: var(--ui2-custdir-muted) !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: .085em !important;
  text-transform: uppercase !important;
}

body.ispforge-ui-v2-customer-directory-active .kpi strong{
  color: var(--ui2-custdir-text) !important;
  font-size: clamp(23px, 2.0vw, 32px) !important;
  font-weight: 950 !important;
  letter-spacing: -.045em !important;
  line-height: 1.1 !important;
}

/* Customer list panel and search. */
body.ispforge-ui-v2-customer-directory-active .panel{
  border-radius: 24px !important;
  border: 1px solid var(--ui2-custdir-border) !important;
  background: var(--ui2-custdir-card) !important;
  box-shadow: var(--ui2-custdir-shadow) !important;
  overflow: hidden !important;
}

body.ispforge-ui-v2-customer-directory-active .panel-header{
  min-height: 64px !important;
  padding: 16px 18px !important;
  border-bottom: 1px solid var(--ui2-custdir-border) !important;
  background: linear-gradient(180deg, rgba(248,250,252,.98), rgba(241,245,249,.72)) !important;
  gap: 12px !important;
}

html[data-theme="dark"] body.ispforge-ui-v2-customer-directory-active .panel-header,
body.dark.ispforge-ui-v2-customer-directory-active .panel-header,
body.theme-dark.ispforge-ui-v2-customer-directory-active .panel-header{
  background: linear-gradient(180deg, rgba(30,41,59,.92), rgba(15,23,42,.72)) !important;
}

body.ispforge-ui-v2-customer-directory-active .panel-header h2{
  color: var(--ui2-custdir-text) !important;
  font-size: 17px !important;
  font-weight: 950 !important;
  letter-spacing: -.025em !important;
}

body.ispforge-ui-v2-customer-directory-active #customer-search,
body.ispforge-ui-v2-customer-directory-active .panel-header input[type="search"],
body.ispforge-ui-v2-customer-directory-active .panel-header input[type="text"]{
  min-width: min(460px, 100%) !important;
  min-height: 42px !important;
  border-radius: 999px !important;
  border: 1px solid var(--ui2-custdir-border) !important;
  background: var(--ui2-custdir-card) !important;
  color: var(--ui2-custdir-text) !important;
  padding: 10px 16px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 8px 18px rgba(15,23,42,.055) !important;
}

body.ispforge-ui-v2-customer-directory-active #customer-search:focus{
  outline: none !important;
  border-color: rgba(37,99,235,.48) !important;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12), 0 10px 22px rgba(15,23,42,.08) !important;
}

/* Customer table: demo-friendly density, clearer action column. */
body.ispforge-ui-v2-customer-directory-active .table-wrap{
  border-radius: 0 0 24px 24px !important;
  border: 0 !important;
  box-shadow: none !important;
  overflow: auto !important;
}

body.ispforge-ui-v2-customer-directory-active table{
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

body.ispforge-ui-v2-customer-directory-active table thead th{
  position: sticky !important;
  top: 0 !important;
  z-index: 2 !important;
  padding: 13px 12px !important;
  border-bottom: 1px solid var(--ui2-custdir-border) !important;
  background: var(--ui2-custdir-soft) !important;
  color: var(--ui2-custdir-muted) !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  letter-spacing: .07em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

body.ispforge-ui-v2-customer-directory-active table tbody td{
  padding: 12px !important;
  border-bottom: 1px solid rgba(148,163,184,.16) !important;
  color: var(--ui2-custdir-text) !important;
  vertical-align: middle !important;
}

body.ispforge-ui-v2-customer-directory-active table tbody tr{
  transition: background .14s ease, transform .14s ease !important;
}

body.ispforge-ui-v2-customer-directory-active table tbody tr:hover{
  background: rgba(37,99,235,.055) !important;
}

body.ispforge-ui-v2-customer-directory-active table tbody td strong{
  font-weight: 900 !important;
  letter-spacing: -.01em !important;
}

body.ispforge-ui-v2-customer-directory-active table tbody td:last-child{
  white-space: nowrap !important;
  min-width: 214px !important;
}

/* Status badges used by customer list/profile pages. */
body.ispforge-ui-v2-customer-directory-active .badge{
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 28px !important;
  padding: 6px 11px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  letter-spacing: .02em !important;
  border: 1px solid transparent !important;
}

body.ispforge-ui-v2-customer-directory-active .badge.ok{
  color: #047857 !important;
  background: rgba(16,185,129,.12) !important;
  border-color: rgba(16,185,129,.22) !important;
}

body.ispforge-ui-v2-customer-directory-active .badge.warn{
  color: #b45309 !important;
  background: rgba(245,158,11,.14) !important;
  border-color: rgba(245,158,11,.24) !important;
}

body.ispforge-ui-v2-customer-directory-active .badge.no{
  color: #b91c1c !important;
  background: rgba(239,68,68,.12) !important;
  border-color: rgba(239,68,68,.24) !important;
}

html[data-theme="dark"] body.ispforge-ui-v2-customer-directory-active .badge.ok,
body.dark.ispforge-ui-v2-customer-directory-active .badge.ok,
body.theme-dark.ispforge-ui-v2-customer-directory-active .badge.ok{
  color: #86efac !important;
}

html[data-theme="dark"] body.ispforge-ui-v2-customer-directory-active .badge.warn,
body.dark.ispforge-ui-v2-customer-directory-active .badge.warn,
body.theme-dark.ispforge-ui-v2-customer-directory-active .badge.warn{
  color: #fcd34d !important;
}

html[data-theme="dark"] body.ispforge-ui-v2-customer-directory-active .badge.no,
body.dark.ispforge-ui-v2-customer-directory-active .badge.no,
body.theme-dark.ispforge-ui-v2-customer-directory-active .badge.no{
  color: #fca5a5 !important;
}

/* Buttons on customer list/profile legacy pages. */
body.ispforge-ui-v2-customer-directory-active button.primary,
body.ispforge-ui-v2-customer-directory-active button.secondary,
body.ispforge-ui-v2-customer-directory-active button.danger{
  min-height: 35px !important;
  border-radius: 999px !important;
  padding: 9px 14px !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  letter-spacing: .01em !important;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease !important;
}

body.ispforge-ui-v2-customer-directory-active button.secondary{
  background: var(--ui2-custdir-soft) !important;
  color: var(--ui2-custdir-text) !important;
  border: 1px solid var(--ui2-custdir-border) !important;
  box-shadow: 0 8px 18px rgba(15,23,42,.055) !important;
}

body.ispforge-ui-v2-customer-directory-active button.primary{
  background: linear-gradient(135deg, #2563eb, #0ea5e9) !important;
  color: #fff !important;
  border: 1px solid rgba(37,99,235,.36) !important;
  box-shadow: 0 11px 24px rgba(37,99,235,.25) !important;
}

body.ispforge-ui-v2-customer-directory-active button.danger{
  background: linear-gradient(135deg, #dc2626, #f97316) !important;
  color: #fff !important;
  border: 1px solid rgba(220,38,38,.32) !important;
  box-shadow: 0 11px 24px rgba(220,38,38,.18) !important;
}

body.ispforge-ui-v2-customer-directory-active button.primary:hover,
body.ispforge-ui-v2-customer-directory-active button.secondary:hover,
body.ispforge-ui-v2-customer-directory-active button.danger:hover{
  transform: translateY(-1px) !important;
  filter: none !important;
}

/* Customer profile legacy page surfaces. */
body.ispforge-ui-v2-customer-directory-active .profile-grid{
  gap: 16px !important;
}

body.ispforge-ui-v2-customer-directory-active .detail-list{
  display: grid !important;
  gap: 0 !important;
}

body.ispforge-ui-v2-customer-directory-active .detail-list > div,
body.ispforge-ui-v2-customer-directory-active .detail-row{
  padding: 10px 0 !important;
  border-bottom: 1px solid rgba(148,163,184,.16) !important;
}

body.ispforge-ui-v2-customer-directory-active .notes-box{
  border-radius: 18px !important;
  border: 1px solid var(--ui2-custdir-border) !important;
  background: var(--ui2-custdir-soft) !important;
  color: var(--ui2-custdir-text) !important;
  padding: 16px !important;
  min-height: 110px !important;
  line-height: 1.58 !important;
}

body.ispforge-ui-v2-customer-directory-active .profile-actions{
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
}

/* Empty states created by legacy table/list pages. */
body.ispforge-ui-v2-customer-directory-active .empty-state,
body.ispforge-ui-v2-customer-directory-active .no-data,
body.ispforge-ui-v2-customer-directory-active .loading{
  border-radius: 20px !important;
  border: 1px dashed var(--ui2-custdir-border) !important;
  background: var(--ui2-custdir-soft) !important;
  color: var(--ui2-custdir-muted) !important;
  padding: 22px !important;
}

@media (max-width: 1100px){
  body.ispforge-ui-v2-customer-directory-active .kpi-row{
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body.ispforge-ui-v2-customer-directory-active .page-title-row{
    align-items: flex-start !important;
  }
}

@media (max-width: 720px){
  body.ispforge-ui-v2-customer-directory-active .page-title-row{
    padding: 18px !important;
    border-radius: 22px !important;
  }

  body.ispforge-ui-v2-customer-directory-active .kpi-row{
    grid-template-columns: 1fr !important;
  }

  body.ispforge-ui-v2-customer-directory-active .panel-header{
    align-items: stretch !important;
    flex-direction: column !important;
  }

  body.ispforge-ui-v2-customer-directory-active #customer-search{
    width: 100% !important;
    min-width: 0 !important;
  }
}
