/* ============================================================
   JDC Portal — Dashboard styles v2
   Rich visual design with colored cards, strong shadows
   ============================================================ */

/* Page background */
.jdc-portal {
  background: #f4f6f4;
  min-height: 100vh;
}

/* Header */
.jdc-header-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 2px solid rgba(28,54,50,.08);
  box-shadow: 0 4px 20px rgba(28,54,50,.07);
  margin-bottom: 0;
}
.jdc-header-inner {
  max-width: none;
  margin: 0;
  padding: 16px 24px;
}

/* Top bar — fluid layout: avatar and hamburger are fixed-size and never
   shrink; the brand and user-info blocks shrink with min-width:0 and
   truncate their text with ellipsis, so the whole row stays on one line
   even when the viewport goes down to ~320px without wrapping. */
.jdc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  gap: 12px;
  flex-wrap: nowrap;
  min-width: 0;
}
.jdc-topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none !important;
  min-width: 0;
  flex: 0 1 auto;
}
.jdc-topbar-brand img { height: 36px; width: auto; flex-shrink: 0; }
.jdc-topbar-brand > div { min-width: 0; overflow: hidden; }
.jdc-topbar-brand-label {
  font-family: var(--jdc-font-title);
  font-weight: 700;
  font-size: 16px;
  color: var(--jdc-secondary);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jdc-topbar-brand-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--jdc-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jdc-topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 0 1 auto;
}
.jdc-topbar-user-info {
  text-align: right;
  min-width: 0;
  overflow: hidden;
}
.jdc-topbar-user-name {
  font-family: var(--jdc-font-title);
  font-weight: 700;
  font-size: 14px;
  color: var(--jdc-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jdc-topbar-user-company {
  font-size: 12px;
  color: var(--jdc-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jdc-user-avatar,
.jdc-hamburger-btn { flex-shrink: 0; }

/* Dashboard layout: sidenav + content */
.jdc-dash-layout {
  display: flex;
  /* The header is ~70px (36px logo + 2×16px padding + 2px border), but the
     min-height math is better left flexible — .jdc-portal already covers
     the viewport with its own bg. Drop the hard subtraction to avoid a
     thin theme-bg strip peeking through at odd breakpoints. */
  min-height: 0;
}
.jdc-dash-content {
  flex: 1;
  min-width: 0;
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 28px;
}
@media (min-width: 1200px) {
  .jdc-dash-content { padding: 32px 48px; }
}

/* Side navigation */
.jdc-sidenav {
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid rgba(28,54,50,.08);
  padding: 16px 10px;
  position: sticky;
  top: 64px;
  z-index: 50;
  height: calc(100vh - 64px);
  overflow-x: hidden;
  overflow-y: auto;
  transition: width .2s ease;
}
.jdc-sidenav.is-collapsed { width: 56px; padding: 16px 6px; }

.jdc-sidenav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 6px;
  margin-bottom: 8px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  color: var(--jdc-muted);
  transition: all .15s;
}
.jdc-sidenav-toggle:hover { background: rgba(28,54,50,.04); color: var(--jdc-secondary); }
.jdc-sidenav-toggle svg { transition: transform .2s ease; }
.jdc-sidenav.is-collapsed .jdc-sidenav-toggle svg { transform: rotate(180deg); }

.jdc-sidenav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.jdc-sidenav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--jdc-font-title);
  color: var(--jdc-muted);
  text-align: left;
  transition: all .12s;
  overflow: hidden;
}
.jdc-sidenav:not(.is-collapsed) .jdc-sidenav-item {
  white-space: normal;
  line-height: 1.3;
}
.jdc-sidenav.is-collapsed .jdc-sidenav-item {
  padding: 10px;
  justify-content: center;
  overflow: visible;
  white-space: nowrap;
}
.jdc-sidenav.is-collapsed { overflow: visible; }
.jdc-sidenav-item:hover {
  background: rgba(28,54,50,.04);
  color: var(--jdc-secondary);
}
.jdc-sidenav-item.is-active {
  background: var(--jdc-secondary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(28,54,50,.18);
}
.jdc-sidenav-item.is-active svg { opacity: 1; }
.jdc-sidenav-item svg { opacity: .5; flex-shrink: 0; }
.jdc-sidenav-item span:first-of-type { flex: 1; min-width: 0; }
.jdc-sidenav.is-collapsed .jdc-sidenav-item span,
.jdc-sidenav.is-collapsed .jdc-sidenav-badge { display: none; }

/* Tooltip on collapsed sidebar */
.jdc-sidenav.is-collapsed .jdc-sidenav-item {
  position: relative;
}
.jdc-sidenav.is-collapsed .jdc-sidenav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--jdc-secondary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--jdc-font-title);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
  z-index: 100;
}
.jdc-sidenav.is-collapsed .jdc-sidenav-item:hover::after {
  opacity: 1;
}
.jdc-sidenav-badge {
  flex-shrink: 0;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(28,54,50,.08);
  color: var(--jdc-secondary);
  font-weight: 700;
}
.jdc-sidenav-item.is-active .jdc-sidenav-badge {
  background: rgba(255,255,255,.20);
  color: #fff;
}

/* Views & stats panels */
.jdc-view { display: none; }
.jdc-view.is-active { display: block; }
.jdc-stats-panel { display: none; }
.jdc-stats-panel.is-active { display: block; }

/* Mobile */
@media (max-width: 768px) {
  .jdc-dash-layout { flex-direction: column; }
  .jdc-sidenav {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid rgba(28,54,50,.08);
    padding: 8px 10px;
    overflow-x: auto;
  }
  .jdc-sidenav-toggle { display: none; }
  .jdc-sidenav-list { flex-direction: row; gap: 4px; }
  .jdc-sidenav-item { padding: 8px 12px; white-space: nowrap; font-size: 12px; }
  .jdc-sidenav-badge { padding: 1px 6px; font-size: 10px; }
  .jdc-dash-content { padding: 16px 14px; }
  .jdc-dash-greeting { margin-bottom: 22px; }
  .jdc-dash-greeting h1 { font-size: 22px; margin-bottom: 6px; }
  .jdc-dash-greeting p { font-size: 13px; line-height: 1.5; }
  .jdc-stats-panel { margin-bottom: 16px; }
  .jdc-stats-grid { gap: 10px; }
  .jdc-stat-card { padding: 14px 16px; border-radius: 12px; }
  .jdc-stat-value { font-size: 28px; }
  .jdc-stat-label { font-size: 10px; margin-bottom: 4px; }
  .jdc-stat-icon { font-size: 22px; }
  .jdc-stat-icon svg { width: 22px; height: 22px; }
  .jdc-dash-section { padding: 16px 14px 14px; border-radius: 14px; margin-bottom: 14px; }
  .jdc-section-header { margin-bottom: 14px; }
  .jdc-section-header-left h2 { font-size: 16px; }
  .jdc-section-header-left p { font-size: 12px; }
  .jdc-toolbar { gap: 8px; margin-bottom: 12px; }
  .jdc-toolbar-search { min-width: 0; }
  .jdc-filter-panel { grid-template-columns: 1fr; padding: 12px; gap: 8px; }
  .jdc-table th { padding: 8px 10px; font-size: 10px; }
  .jdc-table td { padding: 10px 10px; font-size: 13px; }
  .jdc-user-avatar { width: 32px; height: 32px; font-size: 11px; border-radius: 10px; }
  .jdc-user-name { font-size: 13px; }
  .jdc-user-email { font-size: 11px; }
  .jdc-user-company { font-size: 11px; }
  .jdc-pagination { padding-top: 12px; margin-top: 12px; }
  .jdc-pagination-info { font-size: 12px; }
  .jdc-page-btn { width: 30px; height: 30px; font-size: 12px; }
  .jdc-add-user-form { padding: 12px; }
  .jdc-header-inner { padding: 12px 14px; }
  .jdc-topbar-brand img { height: 28px; }
  .jdc-topbar-brand-label { font-size: 14px; }
  .jdc-topbar-user-name { font-size: 13px; }
  .jdc-topbar-brand-sub { font-size: 10px; }
  .jdc-topbar-user-company { font-size: 11px; }
  .jdc-user-avatar { width: 32px; height: 32px; }
  .jdc-livesearch { min-width: 0 !important; }
}

/* iPhone SE / very narrow phones: stat cards shrink + wrap toolbar tighter */
@media (max-width: 400px) {
  .jdc-stat-card { padding: 10px 12px; }
  .jdc-stat-value { font-size: 24px; }
  .jdc-stat-label { font-size: 9px; }
  .jdc-stat-icon svg { width: 18px; height: 18px; }
  .jdc-dash-content { padding: 14px 10px; }
  .jdc-section-header-left h2 { font-size: 15px; }
}

/* Tablets and phones: collapse tables into per-row cards. Matches the
   breakpoint where the sidenav goes horizontal, so "is this mobile?"
   means the same thing everywhere in the layout. The inline `min-width`
   on <table> is overridden; each <td> should have `data-label="Column
   label"` so the pseudo-element shows the header. */
@media (max-width: 768px) {
  .jdc-table-wrap { overflow: visible; margin-top: 8px; }
  .jdc-table { min-width: 0 !important; border-collapse: separate; border-spacing: 0; }
  .jdc-table thead { display: none; }
  .jdc-table tbody, .jdc-table tr, .jdc-table td { display: block; }
  .jdc-table tr {
    background: #fff;
    border: 1px solid rgba(28,54,50,.08);
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.03);
  }
  .jdc-table tr:hover td { background: transparent; }
  .jdc-table tr:last-child td { border-bottom: 1px solid rgba(28,54,50,.06); }
  .jdc-table td {
    padding: 8px 0;
    border-bottom: 1px solid rgba(28,54,50,.06);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: right;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip;
    max-width: none !important;
    overflow-wrap: anywhere;
    min-width: 0;
  }
  .jdc-table td > * { max-width: 100%; overflow-wrap: anywhere; min-width: 0; }
  .jdc-table td:first-child { padding-top: 0; }
  .jdc-table td:last-child { padding-bottom: 0; border-bottom: none; }
  .jdc-table td[data-label]::before {
    content: attr(data-label);
    font-family: var(--jdc-font-title);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--jdc-muted);
    flex: 0 0 auto;
    text-align: left;
    padding-right: 10px;
  }
  /* Cells containing stacked content (user avatar+name+email, serial+product)
     should span full width rather than squeeze into the right column. */
  .jdc-table td[data-label="__full"],
  .jdc-table td.jdc-cell-full {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 4px;
  }
  .jdc-table td[data-label="__full"]::before,
  .jdc-table td.jdc-cell-full::before { display: none; }
  /* Loading / empty-state rows span full row without pseudo-label */
  .jdc-table tr td[colspan] { text-align: center; padding: 16px 0; }
  .jdc-table tr td[colspan]::before { display: none; }
  /* Actions float in the card's top-right corner (icon-only) so the
     first row (avatar + name) sits beside them instead of below.
     The padding-right only goes on the cell they overlap with,
     otherwise the other cells would have a dead 58px gutter on the right. */
  .jdc-table tr { position: relative; }
  .jdc-table td.jdc-cell-full { padding-right: 58px; }
  .jdc-table td.jdc-cell-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0;
    margin: 0;
    border: none;
    width: auto;
    justify-content: flex-end;
    gap: 4px;
  }
  .jdc-table td.jdc-cell-actions::before { display: none; }
  .jdc-table td.jdc-cell-actions .jdc-btn { padding: 6px; min-width: 0; }
  .jdc-table td.jdc-cell-actions .jdc-btn-label { display: none; }
  .jdc-actions-inline { flex-wrap: nowrap; justify-content: flex-end; gap: 4px; }

  /* Softer 'card-in-card' stack: drop the section border/shadow on mobile
     so each row-card stands alone. Section keeps its padding for the
     heading + toolbar. */
  .jdc-dash-section {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
  }

  /* No hide rules for the topbar — it's fluid via flex:0 1 auto +
     min-width:0 + ellipsis. Just shrink the logo/label a touch. */
  .jdc-topbar-brand img { height: 30px; }
  .jdc-topbar-brand-label { font-size: 14px; }
  .jdc-topbar-user { gap: 8px; }
}

/* Greeting — hero band above the stats grid. Generous spacing on
   desktop, scales down on narrow viewports via the mobile block. */
.jdc-dash-greeting {
  padding: 4px 0 0;
  margin-bottom: 28px;
}
.jdc-dash-greeting h1 {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: var(--jdc-secondary);
}
.jdc-dash-greeting p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--jdc-muted);
  max-width: 60ch;
}

/* Stats grid */
.jdc-stats-panel { margin-bottom: 24px; }
.jdc-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 4px;
}
@media (min-width: 700px) {
  .jdc-stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

.jdc-stat-card {
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  overflow: hidden;
  border: none;
}
.jdc-stat-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
}

/* Stat card variants — white fill, strong 2px coloured border, vivid
   value + icon. Meaning at a glance:
     primary → brand dark (totals)       accent  → success green (active)
     light   → danger red (inactive)     yellow  → warning amber (pending) */
.jdc-stat-card-primary,
.jdc-stat-card-yellow,
.jdc-stat-card-accent,
.jdc-stat-card-light {
  background: #fff;
  box-shadow: 0 2px 10px rgba(28,54,50,.05);
  border: 2px solid var(--jdc-border);
}
.jdc-stat-card-primary .jdc-stat-label,
.jdc-stat-card-yellow .jdc-stat-label,
.jdc-stat-card-accent .jdc-stat-label,
.jdc-stat-card-light .jdc-stat-label { color: var(--jdc-muted); }

.jdc-stat-card-primary {
  border-color: rgba(28,54,50,.25);
}
.jdc-stat-card-primary .jdc-stat-value,
.jdc-stat-card-primary .jdc-stat-icon { color: var(--jdc-secondary); }

.jdc-stat-card-accent {
  border-color: #1a7f37;
}
.jdc-stat-card-accent .jdc-stat-value,
.jdc-stat-card-accent .jdc-stat-icon { color: #1a7f37; }

.jdc-stat-card-light {
  border-color: #d92d20;
}
.jdc-stat-card-light .jdc-stat-value,
.jdc-stat-card-light .jdc-stat-icon { color: #d92d20; }

.jdc-stat-card-yellow {
  border-color: #d97706;
}
.jdc-stat-card-yellow .jdc-stat-value,
.jdc-stat-card-yellow .jdc-stat-icon { color: #d97706; }

.jdc-stat-card .jdc-stat-icon { opacity: .9; }

.jdc-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: var(--jdc-font-title);
  margin-bottom: 8px;
}
.jdc-stat-value {
  font-size: 38px;
  font-weight: 700;
  font-family: var(--jdc-font-title);
  line-height: 1;
  letter-spacing: -0.02em;
}
.jdc-stat-icon {
  font-size: 28px;
  opacity: .5;
  flex-shrink: 0;
}

/* Docs indicator icon */
.jdc-docs-indicator {
  display: inline-flex;
  align-items: center;
  color: var(--jdc-success);
  margin-left: 6px;
  vertical-align: middle;
  position: relative;
  cursor: help;
}
.jdc-docs-indicator::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--jdc-secondary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--jdc-font-title);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
  z-index: 10;
}
.jdc-docs-indicator:hover::after { opacity: 1; }

/* Section cards */
.jdc-dash-section {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(28,54,50,.07);
  padding: 24px 24px 20px;
  margin-bottom: 20px;
  border: 1px solid rgba(28,54,50,.06);
}

/* Section header */
.jdc-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.jdc-section-header-left h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.jdc-section-header-left p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--jdc-muted);
}

.jdc-section-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--jdc-font-title);
  background: var(--jdc-secondary);
  color: #fff;
  letter-spacing: .05em;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.jdc-section-badge-admin {
  background: linear-gradient(90deg, #FECB00, #f5b800);
  color: #1C3632;
}

/* Chip toggles (filter pills) */
.jdc-chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--jdc-border);
  background: var(--jdc-surface);
  font-size: 13px;
  color: var(--jdc-secondary);
  cursor: pointer;
  user-select: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.jdc-chip-toggle:hover { background: rgba(28,54,50,.05); }
.jdc-chip-toggle input[type="checkbox"] { margin: 0; cursor: pointer; }
.jdc-chip-toggle:has(input:checked) {
  background: rgba(254,203,0,.12);
  border-color: var(--jdc-primary);
  color: var(--jdc-secondary);
  font-weight: 600;
}

/* Toolbar */
.jdc-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.jdc-toolbar-search {
  position: relative;
  flex: 1;
  min-width: 180px;
}
.jdc-toolbar-search input { padding-left: 38px; }
.jdc-toolbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--jdc-muted);
  pointer-events: none;
  font-size: 15px;
}
.jdc-filter-panel {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 16px;
  border-radius: 12px;
  background: #f4f6f4;
  margin-bottom: 14px;
  border: 1px solid rgba(28,54,50,.08);
}
.jdc-filter-panel.is-open { display: grid; }

/* Table */
.jdc-table-wrap { overflow: auto; margin-top: 4px; }
.jdc-table { width: 100%; border-collapse: collapse; }
.jdc-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--jdc-font-title);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--jdc-muted);
  border-bottom: 2px solid rgba(28,54,50,.08);
}
.jdc-table td {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(28,54,50,.06);
  font-size: 14px;
  vertical-align: middle;
}
.jdc-table tr:last-child td { border-bottom: none; }
.jdc-table tr:hover td { background: rgba(28,54,50,.02); }

/* Sortable columns */
.jdc-table th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.jdc-table th[data-sort]:hover {
  color: var(--jdc-secondary);
}
.jdc-table th[data-sort]::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-left: 4px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 15l5 5 5-5'/%3E%3Cpath d='M7 9l5-5 5 5'/%3E%3C/svg%3E") no-repeat center;
  opacity: .4;
}
.jdc-table th[data-sort].sort-asc::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231C3632' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9l5-5 5 5'/%3E%3C/svg%3E");
  opacity: 1;
}
.jdc-table th[data-sort].sort-desc::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231C3632' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 15l5 5 5-5'/%3E%3C/svg%3E");
  opacity: 1;
}

/* Equipment cells */
.jdc-eq-serial {
  font-family: var(--jdc-font-title);
  font-weight: 700;
  font-size: 13px;
  color: var(--jdc-secondary);
}
.jdc-eq-product { font-size: 12px; color: var(--jdc-muted); margin-top: 3px; }
.jdc-eq-family  { font-size: 13px; color: var(--jdc-secondary); }
.jdc-eq-project { font-size: 12px; color: var(--jdc-muted); }

/* Pagination */
.jdc-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(28,54,50,.08);
}
.jdc-pagination-info { font-size: 13px; color: var(--jdc-muted); }
.jdc-pagination-pages { display: flex; gap: 4px; align-items: center; }
.jdc-page-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(28,54,50,.12);
  background: #fff;
  color: var(--jdc-secondary);
  cursor: pointer;
  font-size: 13px;
  font-family: var(--jdc-font-title);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.jdc-page-btn:hover { background: #f4f6f4; border-color: rgba(28,54,50,.20); }
.jdc-page-btn.is-active {
  background: var(--jdc-secondary);
  color: #fff;
  border-color: var(--jdc-secondary);
  box-shadow: 0 4px 10px rgba(28,54,50,.20);
}
.jdc-page-btn:disabled { opacity: .35; cursor: not-allowed; }

/* User cells */
.jdc-user-cell { display: flex; align-items: center; gap: 12px; }
.jdc-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1C3632, #2a5048);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--jdc-font-title);
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(28,54,50,.20);
}
.jdc-user-name  { font-weight: 700; font-size: 14px; color: var(--jdc-secondary); }
.jdc-user-email { font-size: 12px; color: var(--jdc-muted); margin-top: 1px; }
.jdc-user-company { font-size: 12px; color: var(--jdc-secondary); font-weight: 600; margin-top: 2px; }

.jdc-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--jdc-font-title);
  line-height: 1;
}
.jdc-role-admin {
  background: var(--jdc-secondary);
  color: #fff;
  border: 1px solid var(--jdc-secondary);
}
.jdc-role-master {
  background: linear-gradient(90deg, rgba(254,203,0,.25), rgba(245,184,0,.15));
  color: #7a5a00;
  border: 1px solid rgba(254,203,0,.50);
}
.jdc-role-user {
  background: rgba(28,54,50,.06);
  color: var(--jdc-secondary);
  border: 1px solid rgba(28,54,50,.12);
}
.jdc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--jdc-font-title);
  line-height: 1;
}
.jdc-status-active {
  background: rgba(26,127,55,.08);
  color: #1a7f37;
  border: 1px solid rgba(26,127,55,.20);
}
.jdc-status-inactive {
  background: rgba(28,54,50,.04);
  color: var(--jdc-muted);
  border: 1px solid rgba(28,54,50,.10);
}
.jdc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Cache warm progress (admin-only) */
.jdc-warm-progress {
  margin: 14px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(28,54,50,.12);
  border-radius: 12px;
  background: rgba(28,54,50,.04);
}
.jdc-warm-progress.is-done   { border-color: rgba(26,127,55,.40); background: rgba(26,127,55,.06); }
.jdc-warm-progress.is-failed,
.jdc-warm-progress.is-stuck  { border-color: rgba(181,71,8,.40); background: rgba(181,71,8,.06); }
.jdc-warm-progress-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--jdc-secondary);
  margin-bottom: 8px;
}
.jdc-warm-progress-label { font-weight: 600; flex: 1; min-width: 0; }
.jdc-warm-progress-step  { color: var(--jdc-muted); font-size: 12px; white-space: nowrap; }
.jdc-warm-progress-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(28,54,50,.20);
  border-top-color: var(--jdc-secondary);
  border-radius: 50%;
  animation: jdc-warm-spin .8s linear infinite;
  flex-shrink: 0;
}
.jdc-warm-progress.is-done    .jdc-warm-progress-spinner { border: 2px solid var(--jdc-success); border-top-color: var(--jdc-success); animation: none; }
.jdc-warm-progress.is-failed  .jdc-warm-progress-spinner,
.jdc-warm-progress.is-stuck   .jdc-warm-progress-spinner { border: 2px solid var(--jdc-warning); border-top-color: var(--jdc-warning); animation: none; }
.jdc-warm-progress-cancel {
  margin-left: auto;
  border: 1px solid rgba(180,35,24,.35);
  background: #fff;
  color: var(--jdc-danger);
  font-family: var(--jdc-font-title);
  font-weight: 600;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.jdc-warm-progress-cancel:hover { background: rgba(180,35,24,.08); }
.jdc-warm-progress-bar {
  height: 6px;
  background: rgba(28,54,50,.10);
  border-radius: 3px;
  overflow: hidden;
}
.jdc-warm-progress-fill {
  height: 100%;
  background: var(--jdc-secondary);
  transition: width .3s ease;
}
.jdc-warm-progress.is-done   .jdc-warm-progress-fill { background: var(--jdc-success); }
.jdc-warm-progress.is-failed .jdc-warm-progress-fill { background: var(--jdc-danger);  }
@keyframes jdc-warm-spin { to { transform: rotate(360deg); } }

/* Add user form */
.jdc-add-user-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 20px;
  padding: 16px;
  background: #f4f6f4;
  border-radius: 14px;
  border: 1px solid rgba(28,54,50,.08);
}
/* Submit button cell: grid align-items:end already bottom-aligns the
   button with the inputs. Keep the button at its natural size so the
   icon doesn't float in a chunky oversized box. */
.jdc-add-user-submit { display: flex; align-items: flex-end; }
.jdc-add-user-form:has(.jdc-role-selector) {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, auto) minmax(0, 1fr) minmax(0, 1fr) auto;
}

/* Segmented control for role selection */
.jdc-role-selector {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--jdc-border);
  border-radius: 10px;
}
.jdc-role-btn {
  padding: 8px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--jdc-font-title);
  color: var(--jdc-muted);
  transition: background .15s, color .15s;
  white-space: nowrap;
  user-select: none;
}
.jdc-role-btn input { position: absolute; opacity: 0; pointer-events: none; }
.jdc-role-btn:hover { color: var(--jdc-secondary); }
.jdc-role-btn:has(input:checked) {
  background: var(--jdc-secondary);
  color: #fff;
}
@media (max-width: 700px) {
  /* Both selectors needed: the :has() variant has higher specificity
     than a plain .jdc-add-user-form, so it ignores the mobile override
     unless we explicitly target it too. */
  .jdc-add-user-form,
  .jdc-add-user-form:has(.jdc-role-selector) {
    grid-template-columns: 1fr;
  }
  .jdc-role-selector { display: flex; flex-wrap: wrap; width: 100%; }
  .jdc-role-btn { flex: 1 1 auto; text-align: center; padding: 8px 10px; font-size: 12px; }
}

/* Livesearch */
.jdc-livesearch { position: relative; }
.jdc-livesearch-input-wrap { position: relative; }
.jdc-livesearch-input-wrap input { padding-right: 32px; }
.jdc-livesearch-clear {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer;
  color: var(--jdc-muted);
  font-size: 16px; padding: 0;
  line-height: 1; display: none;
}
.jdc-livesearch-clear.is-visible { display: block; }
.jdc-livesearch-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid rgba(28,54,50,.12);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(28,54,50,.12);
  z-index: 999;
  max-height: 280px;
  overflow-y: auto;
}
.jdc-livesearch-dropdown.is-open { display: block; }
.jdc-livesearch-option {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(28,54,50,.06);
  transition: background .1s;
}
.jdc-livesearch-option:last-child { border-bottom: none; }
.jdc-livesearch-option:hover,
.jdc-livesearch-option.is-focused { background: #f4f6f4; }
.jdc-livesearch-option-name { font-weight: 700; font-size: 14px; color: var(--jdc-secondary); }
.jdc-livesearch-option-sub  { font-size: 12px; color: var(--jdc-muted); margin-top: 2px; }
.jdc-livesearch-empty { padding: 16px; font-size: 13px; color: var(--jdc-muted); text-align: center; }
.jdc-livesearch-selected {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(28,54,50,.06);
  border: 1px solid rgba(28,54,50,.12);
  font-size: 13px;
  font-weight: 700;
  color: var(--jdc-secondary);
  margin-top: 8px;
}


/* Status badges: pending / expired */
.jdc-status-pending {
  background: rgba(254,203,0,.12);
  color: #7a5a00;
  border: 1px solid rgba(254,203,0,.40);
}
.jdc-status-expired {
  background: rgba(180,35,24,.06);
  color: #922018;
  border: 1px solid rgba(180,35,24,.18);
}
