/* ================================================================
   CRS-PDVS — Admin Shell Shared Styles
   All sidebar, topbar, and layout styles used across the admin area.
   Import this after base.css on every admin page.
   ================================================================ */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }

/* ---- Root layout ---- */
body { margin: 0; background: #f0f2f5; font-family: var(--font-family, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); }

.adm-wrap {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.adm-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #141762 0%, #1e2275 100%);
  color: white;
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: width 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 100;
  position: relative;
}
.adm-sidebar.collapsed { width: 64px; }

@media (max-width: 1024px) {
  .adm-sidebar {
    position: fixed;
    top: 0; left: 0;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    width: 240px !important;
  }
  .adm-sidebar.mobile-open { transform: translateX(0); }
}

/* Overlay */
.adm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 190;
  backdrop-filter: blur(2px);
}
.adm-overlay.visible { display: block; }

/* ---- Brand ---- */
.adm-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 60px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}
.adm-brand__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
  opacity: 0.95;
  flex-shrink: 0;
}
.adm-brand__text { overflow: hidden; }
.adm-brand__name {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: white;
}
.adm-brand__sub {
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* ---- Nav ---- */
.adm-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}
.adm-nav-section {
  padding: 14px 16px 4px;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.adm-sidebar.collapsed .adm-nav-section { opacity: 0; }

.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  cursor: pointer;
  color: #ffffff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.adm-nav-item:hover { background: rgba(255, 255, 255, 0.07); color: white; }
.adm-nav-item.active {
  background: rgba(173, 184, 236, 0.12);
  color: #adb8ec;
}
.adm-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: #adb8ec;
  border-radius: 0 2px 2px 0;
}

.adm-nav-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  transition: background 0.15s;
}
.adm-nav-item:hover .adm-nav-icon    { background: rgba(255, 255, 255, 0.08); }
.adm-nav-item.active .adm-nav-icon   { background: rgba(173, 184, 236, 0.15); }

.adm-nav-label {
  flex: 1;
  overflow: hidden;
  transition: opacity 0.15s;
}
.adm-sidebar.collapsed .adm-nav-label { opacity: 0; }

.adm-nav-badge {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.adm-sidebar.collapsed .adm-nav-badge { opacity: 0; }

/* ---- Sidebar user footer ---- */
.adm-sidebar-user {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  overflow: hidden;
}
.adm-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(173, 184, 236, 0.15);
  color: #adb8ec;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.adm-user-info { flex: 1; overflow: hidden; }
.adm-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: white;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.adm-user-role {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.38);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.adm-sidebar.collapsed .adm-user-info { opacity: 0; }

.adm-logout-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 0.15s;
  line-height: 0;
}
.adm-logout-btn:hover { color: #f87171; }
.adm-sidebar.collapsed .adm-logout-btn { opacity: 0; pointer-events: none; }

/* ================================================================
   MAIN AREA
   ================================================================ */
.adm-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ---- Topbar ---- */
.adm-topbar {
  height: 60px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 50;
}
.adm-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  line-height: 0;
}
.adm-toggle:hover { background: #f3f4f6; }

.adm-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
  min-width: 0;
}
.adm-breadcrumb a {
  color: #6b7280;
  text-decoration: none;
  transition: color 0.15s;
}
.adm-breadcrumb a:hover { color: #111827; }
.adm-breadcrumb strong { color: #111827; font-weight: 600; }

.adm-cycle-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  background: #f0f2fc;
  border: 1px solid #dde2f6;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--crs-blue-600);
  white-space: nowrap;
  flex-shrink: 0;
}
.adm-cycle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2b35b5;
  animation: adm-pulse 2.4s infinite;
  flex-shrink: 0;
}
@keyframes adm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.adm-role-badge {
  padding: 5px 12px;
  border-radius: 20px;
  background: #f0f2fc;
  border: 1px solid #dde2f6;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--crs-blue-600);
  white-space: nowrap;
  flex-shrink: 0;
}

.adm-topbar-demo {
  padding: 4px 10px;
  border-radius: 20px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  font-size: 10.5px;
  font-weight: 700;
  color: #92400e;
  letter-spacing: 0.04em;
}

.adm-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6b7280;
  transition: background 0.15s, color 0.15s;
  position: relative;
  line-height: 0;
  text-decoration: none;
  flex-shrink: 0;
}
.adm-icon-btn:hover { background: #f3f4f6; color: #111827; }
.adm-alert-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ef4444;
  border: 1.5px solid white;
}

/* ---- Content area ---- */
.adm-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 56px;
  background: #f0f2f5;
}

/* ================================================================
   SHARED PAGE COMPONENTS
   ================================================================ */

/* Page header */
.adm-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}
.adm-page-header__left h1 {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 3px;
  letter-spacing: -0.02em;
}
.adm-page-header__left p {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

/* Cards */
.adm-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.adm-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}
.adm-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #111827;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.adm-card-body { padding: 20px; }

/* Table */
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #f3f4f6;
  background: #fafafa;
  white-space: nowrap;
}
.adm-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f9fafb;
  color: #374151;
  vertical-align: middle;
}
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover td { background: #fafafa; }
.adm-table--clickable tbody tr { cursor: pointer; }

/* Cell helpers */
.cell-primary   { font-weight: 600; color: #111827; font-size: 13.5px; }
.cell-secondary { font-size: 11px; color: #9ca3af; margin-top: 2px; }
.cell-mono      { font-family: monospace; font-size: 12px; color: #6b7280; }

/* Status chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.chip__dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip--verified  { background: #f0fdf4; color: #15803d; }
.chip--pending   { background: #fffbeb; color: #b45309; }
.chip--failed    { background: #fff1f2; color: #b91c1c; }
.chip--referred  { background: #f5f3ff; color: #6d28d9; }
.chip--awaiting  { background: #eff6ff; color: var(--crs-blue-600); }
.chip--active    { background: #f0fdf4; color: #15803d; }
.chip--inactive  { background: #f3f4f6; color: #6b7280; }
.chip--self      { background: #f0f2fc; color: var(--crs-blue-600); }
.chip--assisted  { background: #f0fdfa; color: #0d9488; }
.chip--info      { background: #eff6ff; color: var(--crs-blue-600); }
.chip--warning   { background: #fffbeb; color: #b45309; }
.chip--critical  { background: #fff1f2; color: #b91c1c; }
.chip--escalated { background: #fff1f2; color: #b91c1c; }
.chip--low-conf  { background: #fef3c7; color: #92400e; }
.chip--phys-lim  { background: #f5f3ff; color: #6d28d9; }
.chip--in-prog   { background: #eff6ff; color: #1d4ed8; }
.chip--resolved  { background: #f0fdf4; color: #15803d; }

/* Buttons */
.adm-btn-primary {
  padding: 8px 18px;
  border-radius: 8px;
  background: var(--crs-blue-600);
  color: white;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.adm-btn-primary:hover { background: #141762; }
.adm-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.adm-btn-secondary {
  padding: 8px 16px;
  border-radius: 8px;
  background: white;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.adm-btn-secondary:hover { background: #f3f4f6; }

/* Toolbar / filter row */
.adm-toolbar {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 13px 18px;
  margin-bottom: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.adm-search {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
}
.adm-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #111827;
  outline: none;
}
.adm-search input::placeholder { color: #9ca3af; }
.adm-filter {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  outline: none;
}
.adm-filter:focus { border-color: #2b35b5; }

/* Table footer */
.adm-table-footer {
  padding: 11px 20px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
  font-size: 12px;
  color: #6b7280;
}

/* Action link */
.adm-link {
  color: var(--crs-blue-600);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.adm-link:hover { text-decoration: underline; }

/* Action buttons (for tables) */
.adm-act-btn {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}
.adm-act-btn:hover { opacity: 0.8; }
.adm-act-btn--review   { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.adm-act-btn--approve  { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.adm-act-btn--escalate { background: #fff1f2; border-color: #fecaca; color: #b91c1c; }
.adm-act-btn--refer    { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.adm-act-row { display: flex; gap: 5px; flex-wrap: wrap; }

/* Stat cards row */
.adm-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
@media (max-width: 1200px) { .adm-stat-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .adm-stat-row { grid-template-columns: 1fr; } }

.adm-stat-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px 24px;
  border-top: 3px solid transparent;
  position: relative;
  display: flex; flex-direction: column; justify-content: center;
}
.adm-stat-card.accent--blue    { border-top-color: var(--crs-blue-600); }
.adm-stat-card.accent--green   { border-top-color: #16a34a; }
.adm-stat-card.accent--amber   { border-top-color: #d97706; }
.adm-stat-card.accent--red     { border-top-color: #dc2626; }
.adm-stat-card.accent--teal    { border-top-color: #0d9488; }
.adm-stat-card.accent--violet  { border-top-color: #7c3aed; }
.adm-stat-card.accent--slate   { border-top-color: #64748b; }
.adm-stat-val { font-size: 34px; font-weight: 800; color: #111827; letter-spacing: -0.02em; line-height: 1; margin-bottom: 8px; }
.adm-stat-lbl { font-size: 13px; color: #6b7280; font-weight: 500; }
.adm-stat-delta { font-size: 11px; margin-top: 6px; font-weight: 600; }
.delta-up   { color: #15803d; }
.delta-down { color: #dc2626; }

/* Stat card hover */
.adm-stat-card {
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.adm-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}

/* Table row hover — stronger tint on grey content bg */
.adm-table tbody tr:hover td { background: #f0f4ff; }

/* Responsive grid */
.adm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.adm-grid-2--aside { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) {
  .adm-grid-2, .adm-grid-2--aside { grid-template-columns: 1fr; }
}
