/* ============================================================================
   EasyVisit Dashboard — Design System
   Drop this file into wwwroot/css/easyvisit-redesign.css and include it in
   _Layout.cshtml AFTER bootstrap and AdminLTE so its rules win.
   ============================================================================ */

/* ── Tokens ────────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --ev-brand:        #003597;
  --ev-brand-700:    #002b7d;
  --ev-brand-soft:   rgba(0, 53, 151, 0.07);
  --ev-brand-tint:   rgba(0, 53, 151, 0.10);
  --ev-brand-line:   rgba(0, 53, 151, 0.30);

  /* Semantic */
  --ev-success:      #10b981;
  --ev-success-soft: rgba(16, 185, 129, 0.12);
  --ev-success-fg:   #047857;
  --ev-warning:      #f59e0b;
  --ev-warning-soft: rgba(245, 158, 11, 0.14);
  --ev-warning-fg:   #b45309;
  --ev-danger:       #ef4444;
  --ev-danger-soft:  rgba(239, 68, 68, 0.12);
  --ev-danger-fg:    #b91c1c;
  --ev-info:         #3b82f6;
  --ev-info-soft:    rgba(59, 130, 246, 0.12);
  --ev-info-fg:      #1d4ed8;

  /* Surfaces */
  --ev-bg:           #f6f8fb;
  --ev-bg-soft:      #f7f8fb;
  --ev-bg-subtle:    #fafbfc;
  --ev-card:         #ffffff;
  --ev-overlay-hover:rgba(15, 23, 42, 0.04);

  /* Text */
  --ev-text:         #0f172a;
  --ev-text-muted:   #64748b;
  --ev-text-soft:    #94a3b8;
  --ev-text-faint:   #cbd5e1;

  /* Borders */
  --ev-border:       rgba(15, 23, 42, 0.06);
  --ev-border-md:    rgba(15, 23, 42, 0.08);
  --ev-border-strong:rgba(15, 23, 42, 0.10);

  /* Radii */
  --ev-radius-sm:    7px;
  --ev-radius:       9px;
  --ev-radius-lg:    14px;
  --ev-radius-pill:  999px;

  /* Shadows */
  --ev-shadow-sm:    0 1px 2px rgba(15, 23, 42, 0.05);
  --ev-shadow:       0 2px 8px rgba(15, 23, 42, 0.06);
  --ev-shadow-md:    0 8px 24px rgba(15, 23, 42, 0.12);
  --ev-shadow-brand: 0 4px 12px rgba(0, 53, 151, 0.22);

  /* Layout */
  --ev-sidebar-w:    252px;
  --ev-topbar-h:     64px;

  /* Type */
  --ev-font: 'Inter', 'Source Sans Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ── Base scope ────────────────────────────────────────────────────────── */
body.ev-redesign,
.ev {
  font-family: var(--ev-font);
  color: var(--ev-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--ev-bg);
}
body.ev-redesign * { box-sizing: border-box; }
.ev * { box-sizing: border-box; }
body.ev-redesign a { color: var(--ev-brand); text-decoration: none; }
body.ev-redesign a:hover { text-decoration: underline; }

/* ── Shell layout (overrides AdminLTE wrapper) ─────────────────────────── */
body.ev-redesign .wrapper { background: var(--ev-bg); min-height: 100vh; }
body.ev-redesign .content-wrapper {
  background: var(--ev-bg) !important;
  margin-left: var(--ev-sidebar-w) !important;
  min-height: calc(100vh - var(--ev-topbar-h));
  padding-top: 0;
}
body.ev-redesign .main-footer {
  margin-left: var(--ev-sidebar-w) !important;
  background: var(--ev-card);
  border-top: 1px solid var(--ev-border);
  padding: 14px 24px;
  font-size: 12px;
  color: var(--ev-text-muted);
}
body.ev-redesign.no-sidebar .content-wrapper,
body.ev-redesign.no-sidebar .main-footer { margin-left: 0 !important; }

/* ╔══════════════════════════════════════════════════════════════════════╗
   ║ SIDEBAR                                                              ║
   ╚══════════════════════════════════════════════════════════════════════╝ */
body.ev-redesign .main-sidebar.ev-sidebar {
  width: var(--ev-sidebar-w);
  background: var(--ev-card) !important;
  border-right: 1px solid var(--ev-border);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  z-index: 1038;
}
body.ev-redesign .main-sidebar.ev-sidebar .brand-link,
.ev-sidebar-brand {
  height: var(--ev-topbar-h);
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--ev-border);
  background: var(--ev-card);
  color: var(--ev-text);
  text-decoration: none;
}
.ev-sidebar-brand:hover { text-decoration: none; }
.ev-sidebar-brand .ev-brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--ev-brand), var(--ev-brand-700));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -0.02em;
  box-shadow: var(--ev-shadow-brand);
  flex-shrink: 0;
}
.ev-sidebar-brand .ev-brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.ev-sidebar-brand .ev-brand-name { font-weight: 700; font-size: 15.5px; color: var(--ev-text); letter-spacing: -0.01em; }
.ev-sidebar-brand .ev-brand-sub  { font-size: 10.5px; color: var(--ev-text-muted); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

.ev-sidebar-search {
  margin: 14px 14px 6px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--ev-bg-soft);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-sm);
  color: var(--ev-text-muted);
  font-size: 13px;
  cursor: text;
  transition: border-color 150ms, background 150ms;
}
.ev-sidebar-search:hover { border-color: var(--ev-brand-line); }
.ev-sidebar-search .ev-kbd {
  font-size: 10px; font-weight: 600; padding: 2px 6px;
  background: #eef1f7;
  border: 1px solid var(--ev-border);
  border-radius: 4px;
  color: var(--ev-text-muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.ev-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
}
.ev-sidebar-nav::-webkit-scrollbar { width: 6px; }
.ev-sidebar-nav::-webkit-scrollbar-thumb { background: rgba(100,116,139,.18); border-radius: 999px; }
.ev-sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.32); }

.ev-sidebar-group { margin-bottom: 4px; }
.ev-sidebar-group-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ev-text-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 12px 6px;
}

/* Single item — used both for top-level entries and for parent "section" toggles */
.ev-sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--ev-radius-sm);
  color: var(--ev-text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  margin-bottom: 1px;
  transition: background 140ms;
}
.ev-sidebar-item:hover { background: var(--ev-overlay-hover); text-decoration: none; color: var(--ev-text); }
.ev-sidebar-item .ev-sidebar-icon {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ev-text-muted);
  flex-shrink: 0;
}
.ev-sidebar-item .ev-sidebar-icon i { font-size: 16px; }
.ev-sidebar-item .ev-sidebar-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-sidebar-item .ev-sidebar-chev {
  color: var(--ev-text-soft);
  font-size: 11px;
  transition: transform 200ms;
}
.ev-sidebar-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  background: var(--ev-brand-tint);
  color: var(--ev-brand);
  border-radius: var(--ev-radius-pill);
  line-height: 1.4;
}

/* Active parent (any descendant active) */
.ev-sidebar-item.is-open,
.ev-sidebar-item[aria-expanded="true"] {
  background: var(--ev-brand-soft);
  font-weight: 600;
}
.ev-sidebar-item.is-open .ev-sidebar-icon,
.ev-sidebar-item[aria-expanded="true"] .ev-sidebar-icon { color: var(--ev-brand); }
.ev-sidebar-item.is-open .ev-sidebar-chev,
.ev-sidebar-item[aria-expanded="true"] .ev-sidebar-chev { transform: rotate(90deg); }

/* Children */
.ev-sidebar-children {
  position: relative;
  padding-left: 12px;
  margin: 2px 0 2px;
}
.ev-sidebar-children::before {
  content: "";
  position: absolute;
  left: 21px; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--ev-border);
}
.ev-sidebar-child {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px 7px 22px;
  background: transparent;
  border-radius: var(--ev-radius-sm);
  color: var(--ev-text-muted);
  font-size: 12.8px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 1px;
  transition: background 140ms, color 140ms;
}
.ev-sidebar-child:hover { background: var(--ev-overlay-hover); color: var(--ev-text); text-decoration: none; }
.ev-sidebar-child::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--ev-text-soft);
  flex-shrink: 0;
  transition: background 140ms, border-color 140ms;
}
.ev-sidebar-child.active {
  background: var(--ev-brand-tint);
  color: var(--ev-brand);
  font-weight: 600;
}
.ev-sidebar-child.active::before { background: var(--ev-brand); border-color: var(--ev-brand); }

/* User card at bottom */
.ev-sidebar-user {
  margin: 10px 12px 14px;
  padding: 12px;
  background: var(--ev-bg-soft);
  border: 1px solid var(--ev-border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.ev-sidebar-user-info { flex: 1; min-width: 0; }
.ev-sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--ev-text); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-sidebar-user-role { font-size: 11px; color: var(--ev-text-muted); margin-top: 2px; }
.ev-presence-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
  flex-shrink: 0;
}

/* ╔══════════════════════════════════════════════════════════════════════╗
   ║ TOP BAR                                                              ║
   ╚══════════════════════════════════════════════════════════════════════╝ */
body.ev-redesign .main-header.ev-topbar,
.ev-topbar {
  height: var(--ev-topbar-h);
  background: var(--ev-card) !important;
  border-bottom: 1px solid var(--ev-border) !important;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  margin-left: var(--ev-sidebar-w);
  position: sticky; top: 0;
  z-index: 1037;
  box-shadow: none !important;
}
body.ev-redesign.no-sidebar .main-header.ev-topbar { margin-left: 0; }

.ev-topbar .ev-icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ev-text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 140ms;
}
.ev-topbar .ev-icon-btn:hover { background: var(--ev-overlay-hover); color: var(--ev-text); }
.ev-topbar .ev-icon-btn .ev-badge-dot {
  position: absolute; top: 5px; right: 5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--ev-danger);
  color: #fff;
  font-size: 9.5px; font-weight: 700;
  border-radius: var(--ev-radius-pill);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--ev-card);
  line-height: 1;
}

.ev-breadcrumb {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  min-width: 0;
}
.ev-breadcrumb .ev-crumb-section { font-size: 13px; color: var(--ev-text-soft); font-weight: 500; white-space: nowrap; }
.ev-breadcrumb .ev-crumb-sep { color: var(--ev-text-faint); font-size: 11px; }
.ev-breadcrumb .ev-crumb-page  { font-size: 14.5px; color: var(--ev-text); font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }

.ev-topbar-search {
  flex: 1;
  display: flex; justify-content: center;
  min-width: 0;
}
.ev-topbar-search .ev-search-box {
  width: min(440px, 100%);
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--ev-bg-soft);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius);
  color: var(--ev-text-soft);
  font-size: 13px;
  cursor: text;
  transition: border-color 150ms, background 150ms;
}
.ev-topbar-search .ev-search-box:hover { border-color: var(--ev-brand-line); background: var(--ev-card); }
.ev-topbar-search .ev-kbd {
  font-size: 10px; font-weight: 600; padding: 2px 6px;
  background: var(--ev-card);
  border: 1px solid var(--ev-border-md);
  border-radius: 4px;
  color: var(--ev-text-muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.ev-topbar-right {
  display: flex; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.ev-topbar-divider {
  width: 1px; height: 22px;
  background: var(--ev-border-md);
  margin: 0 8px;
}
.ev-user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 5px 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ev-radius-pill);
  cursor: pointer;
  transition: all 140ms;
}
.ev-user-pill:hover { background: var(--ev-bg-soft); border-color: var(--ev-border-md); }
.ev-user-pill-text { display: flex; flex-direction: column; line-height: 1.15; align-items: flex-start; }
.ev-user-pill-name { font-size: 12.8px; font-weight: 600; color: var(--ev-text); white-space: nowrap; }
.ev-user-pill-role { font-size: 10.5px; color: var(--ev-text-muted); margin-top: 2px; white-space: nowrap; }

/* Narrow viewport: hide center search + user role */
@media (max-width: 1100px) {
  .ev-topbar-search { display: none; }
  .ev-user-pill-text { display: none; }
}

/* ╔══════════════════════════════════════════════════════════════════════╗
   ║ PAGE PRIMITIVES                                                      ║
   ╚══════════════════════════════════════════════════════════════════════╝ */
.ev-page { padding: 28px 32px; }
.ev-page-inner { max-width: 1400px; margin: 0 auto; }

.ev-page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.ev-page-title  { font-size: 26px; font-weight: 700; color: var(--ev-text); letter-spacing: -0.02em; margin: 0; }
.ev-page-subtitle { font-size: 13.5px; color: var(--ev-text-muted); margin: 6px 0 0; }
.ev-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Card */
.ev-card {
  background: var(--ev-card);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-lg);
  padding: 20px;
}
.ev-card.flush { padding: 0; }
.ev-card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--ev-border);
  display: flex; align-items: center; justify-content: space-between;
}
.ev-card-title { font-size: 15px; font-weight: 700; color: var(--ev-text); margin: 0; }
.ev-card-subtitle { font-size: 12px; color: var(--ev-text-muted); margin-top: 3px; }

/* Buttons */
.ev-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: var(--ev-radius-sm);
  font-size: 13px; font-weight: 600;
  font-family: var(--ev-font);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform 120ms, box-shadow 200ms, background 140ms, border-color 140ms, color 140ms;
  width: auto;
  line-height: 1.4;
}
.ev-btn:focus-visible { outline: 2px solid var(--ev-brand); outline-offset: 2px; }
.ev-btn.primary   { background: var(--ev-brand); color: #fff; box-shadow: var(--ev-shadow-sm), var(--ev-shadow-brand); }
.ev-btn.primary:hover   { background: var(--ev-brand-700); color: #fff; text-decoration: none; transform: translateY(-1px); }
.ev-btn.secondary { background: var(--ev-card); color: var(--ev-text); border-color: var(--ev-border-strong); }
.ev-btn.secondary:hover { background: var(--ev-bg-soft); color: var(--ev-text); text-decoration: none; }
.ev-btn.ghost     { background: transparent; color: var(--ev-text-muted); }
.ev-btn.ghost:hover { background: var(--ev-overlay-hover); color: var(--ev-text); text-decoration: none; }
.ev-btn.danger    { background: var(--ev-card); color: var(--ev-danger); border-color: rgba(239,68,68,0.3); }
.ev-btn.danger:hover { background: rgba(239,68,68,0.05); color: var(--ev-danger); text-decoration: none; }
.ev-btn.success   { background: var(--ev-success); color: #fff; border: none; }
.ev-btn.success:hover { background: #059669; color: #fff; text-decoration: none; }
.ev-btn.sm { padding: 6px 10px; font-size: 12.5px; }
.ev-btn.lg { padding: 10px 18px; font-size: 14px; }
.ev-btn.block { display: flex; width: 100%; justify-content: center; }
.ev-btn i { font-size: 13px; }

/* Badges (status pills) */
.ev-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  background: #f1f5f9;
  color: #475569;
  border-radius: var(--ev-radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}
.ev-badge .ev-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ev-badge.success { background: var(--ev-success-soft); color: var(--ev-success-fg); }
.ev-badge.warning { background: var(--ev-warning-soft); color: var(--ev-warning-fg); }
.ev-badge.danger  { background: var(--ev-danger-soft);  color: var(--ev-danger-fg); }
.ev-badge.info    { background: var(--ev-info-soft);    color: var(--ev-info-fg); }
.ev-badge.brand   { background: var(--ev-brand-tint);   color: var(--ev-brand); }

/* Avatar */
.ev-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ev-brand), var(--ev-brand-700));
  color: #fff;
  font-weight: 700; font-size: 11.5px;
  flex-shrink: 0;
  text-transform: uppercase;
  overflow: hidden;
}
.ev-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ev-avatar.sm { width: 24px; height: 24px; font-size: 9.5px; }
.ev-avatar.lg { width: 44px; height: 44px; font-size: 14px; }
.ev-avatar.xl { width: 56px; height: 56px; font-size: 18px; }
.ev-avatar.p-violet { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
.ev-avatar.p-indigo { background: linear-gradient(135deg, #6366f1, #3730a3); }
.ev-avatar.p-teal   { background: linear-gradient(135deg, #0e7490, #155e75); }
.ev-avatar.p-orange { background: linear-gradient(135deg, #ea580c, #9a3412); }
.ev-avatar.p-rose   { background: linear-gradient(135deg, #dc2626, #991b1b); }
.ev-avatar.p-cyan   { background: linear-gradient(135deg, #0891b2, #155e75); }

/* KPI card */
.ev-kpi { padding: 18px; }
.ev-kpi-label {
  font-size: 11.5px; color: var(--ev-text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.ev-kpi-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.ev-kpi-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--ev-brand-tint); color: var(--ev-brand);
  display: flex; align-items: center; justify-content: center;
}
.ev-kpi-icon.success { background: var(--ev-success-soft); color: var(--ev-success-fg); }
.ev-kpi-icon.warning { background: var(--ev-warning-soft); color: var(--ev-warning-fg); }
.ev-kpi-icon.info    { background: var(--ev-info-soft); color: var(--ev-info-fg); }
.ev-kpi-value {
  font-size: 32px; font-weight: 700; color: var(--ev-text); letter-spacing: -0.02em;
}
.ev-kpi-delta {
  font-size: 12.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 3px;
}
.ev-kpi-delta.up   { color: var(--ev-success-fg); }
.ev-kpi-delta.down { color: var(--ev-danger-fg); }
.ev-kpi-foot {
  font-size: 11.5px; color: var(--ev-text-soft); margin-top: 4px;
}

/* Grid helpers */
.ev-grid { display: grid; gap: 16px; }
.ev-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.ev-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.ev-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.ev-grid.cols-main { grid-template-columns: 1.7fr 1fr; align-items: flex-start; }
.ev-grid.cols-main-3 { grid-template-columns: 1.4fr 1fr; align-items: flex-start; }
@media (max-width: 992px) {
  .ev-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .ev-grid.cols-main, .ev-grid.cols-main-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ev-grid.cols-3, .ev-grid.cols-2, .ev-grid.cols-4 { grid-template-columns: 1fr; }
}

/* ── Data table ────────────────────────────────────────────────────────── */
.ev-table-wrap { overflow: auto; }
.ev-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ev-table thead tr { background: var(--ev-bg-subtle); }
.ev-table th {
  text-align: left;
  padding: 11px 18px;
  font-size: 10.8px;
  font-weight: 700;
  color: var(--ev-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--ev-border);
  white-space: nowrap;
}
.ev-table th.right { text-align: right; }
.ev-table td {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(15,23,42,0.04);
  color: var(--ev-text);
  vertical-align: middle;
}
.ev-table tr:last-child td { border-bottom: none; }
.ev-table .ev-cell-primary {
  display: flex; align-items: center; gap: 10px;
}
.ev-table .ev-cell-primary .ev-cell-name { font-size: 13.3px; font-weight: 600; color: var(--ev-text); }
.ev-table .ev-cell-primary .ev-cell-sub  { font-size: 11.5px; color: var(--ev-text-muted); margin-top: 2px; }
.ev-table .mono { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12.5px; color: #475569; }
.ev-table td.right { text-align: right; }
.ev-table .ev-table-actions { display: inline-flex; gap: 4px; }
.ev-table .ev-table-actions .ev-icon-btn { width: 30px; height: 30px; border-radius: 6px; color: var(--ev-text-muted); }
.ev-table .ev-table-actions .ev-icon-btn:hover { background: var(--ev-overlay-hover); color: var(--ev-text); }

/* Status tabs (above table) */
.ev-status-tabs {
  display: flex; gap: 4px;
  padding: 0 18px 14px;
  border-bottom: 1px solid var(--ev-border);
}
.ev-status-tab {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: 7px;
  font-size: 12.8px; font-weight: 600;
  color: var(--ev-text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
.ev-status-tab:hover { background: var(--ev-overlay-hover); color: var(--ev-text); text-decoration: none; }
.ev-status-tab.active { background: var(--ev-brand-soft); color: var(--ev-brand); }
.ev-status-tab .ev-count {
  font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
  background: #f1f5f9; color: var(--ev-text-muted);
}
.ev-status-tab.active .ev-count { background: var(--ev-brand-tint); color: var(--ev-brand); }

/* Filter bar / chips */
.ev-filter-bar {
  padding: 14px 18px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ev-filter-search {
  flex: 1; min-width: 240px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--ev-bg);
  border: 1px solid var(--ev-border);
  border-radius: var(--ev-radius-sm);
  color: var(--ev-text-soft);
  font-size: 13px;
}
.ev-filter-search input {
  flex: 1; border: 0; outline: 0; background: transparent;
  color: var(--ev-text); font-size: 13px; font-family: inherit;
}
.ev-filter-search input::placeholder { color: var(--ev-text-soft); }
.ev-filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: var(--ev-card);
  border: 1px solid var(--ev-border-strong);
  border-radius: var(--ev-radius-sm);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--ev-text);
}
.ev-filter-chip:hover { border-color: var(--ev-brand-line); }
.ev-filter-chip .ev-chip-label { color: var(--ev-text-muted); }
.ev-filter-chip .ev-chip-value { color: var(--ev-text); font-weight: 600; }
.ev-filter-chip i { color: var(--ev-text-soft); font-size: 11px; }

/* Pagination */
.ev-pagination {
  padding: 14px 18px;
  border-top: 1px solid var(--ev-border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--ev-text-muted);
  flex-wrap: wrap; gap: 10px;
}
.ev-pagination strong { color: var(--ev-text); font-weight: 600; }
.ev-pagination-pages { display: flex; gap: 6px; }
.ev-page-num {
  min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600;
  background: var(--ev-card);
  color: #475569;
  border: 1px solid var(--ev-border-md);
  cursor: pointer;
  text-decoration: none;
}
.ev-page-num:hover { background: var(--ev-bg-soft); color: var(--ev-text); text-decoration: none; }
.ev-page-num.active {
  background: var(--ev-brand-tint);
  color: var(--ev-brand);
  border-color: transparent;
}

/* ── Stepper ──────────────────────────────────────────────────────────── */
.ev-stepper { display: flex; align-items: center; gap: 0; }
.ev-step {
  display: flex; align-items: center; gap: 11px;
}
.ev-step-num {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: #f1f5f9; color: var(--ev-text-soft);
  flex-shrink: 0;
}
.ev-step.done .ev-step-num { background: var(--ev-success); color: #fff; }
.ev-step.current .ev-step-num {
  background: var(--ev-brand); color: #fff;
  box-shadow: 0 0 0 3px var(--ev-brand-tint);
}
.ev-step-label { font-size: 13px; font-weight: 600; color: var(--ev-text-soft); }
.ev-step.done .ev-step-label, .ev-step.current .ev-step-label { color: var(--ev-text); }
.ev-step-meta { font-size: 11px; color: var(--ev-text-soft); margin-top: 1px; }
.ev-step-bar {
  flex: 1; height: 2px;
  background: #f1f5f9;
  margin: 0 16px;
}
.ev-step.done + .ev-step-bar { background: rgba(16,185,129,0.4); }

/* ── Form fields ──────────────────────────────────────────────────────── */
.ev-field { display: block; }
.ev-field + .ev-field { margin-top: 14px; }
.ev-field-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ev-field label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; color: #334155;
  margin-bottom: 6px;
}
.ev-field .ev-required { color: var(--ev-danger); }
.ev-input,
.ev-field input[type="text"],
.ev-field input[type="email"],
.ev-field input[type="password"],
.ev-field input[type="tel"],
.ev-field input[type="number"],
.ev-field input[type="date"],
.ev-field input[type="time"],
.ev-field select,
.ev-field textarea {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: var(--ev-card);
  border: 1px solid var(--ev-border-strong);
  border-radius: var(--ev-radius-sm);
  font-size: 13.5px;
  color: var(--ev-text);
  font-family: inherit;
  transition: border-color 140ms, box-shadow 140ms;
  outline: none;
}
.ev-field input:focus,
.ev-field select:focus,
.ev-field textarea:focus,
.ev-input:focus-within { border-color: var(--ev-brand); box-shadow: 0 0 0 3px var(--ev-brand-tint); }
.ev-field textarea { min-height: 86px; resize: vertical; }
.ev-input { padding-left: 12px; }
.ev-input i { color: var(--ev-text-soft); font-size: 14px; }
.ev-input input { border: 0; padding: 0; box-shadow: none !important; background: transparent; }

/* Inline option chips (e.g. visit reason) */
.ev-option-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px;
  background: var(--ev-card);
  border: 1px solid var(--ev-border-strong);
  border-radius: var(--ev-radius-sm);
  font-size: 13px; font-weight: 600;
  color: #475569;
  cursor: pointer;
}
.ev-option-chip:hover { border-color: var(--ev-brand-line); }
.ev-option-chip.active { background: var(--ev-brand-soft); border-color: var(--ev-brand-line); color: var(--ev-brand); }

/* ── Empty state ──────────────────────────────────────────────────────── */
.ev-empty {
  padding: 60px 40px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.ev-empty-art {
  width: 160px; height: 140px; margin-bottom: 24px;
  position: relative;
}
.ev-empty-title { font-size: 20px; font-weight: 700; color: var(--ev-text); margin: 0; letter-spacing: -0.01em; }
.ev-empty-body { font-size: 14px; color: var(--ev-text-muted); margin: 8px 0 24px; max-width: 460px; line-height: 1.5; }
.ev-empty-tips {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin-top: 48px; padding-top: 32px;
  border-top: 1px solid var(--ev-border);
  width: 100%; max-width: 760px;
  text-align: left;
}
.ev-empty-tip-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--ev-brand-tint); color: var(--ev-brand);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.ev-empty-tip-title { font-size: 13px; font-weight: 700; color: var(--ev-text); }
.ev-empty-tip-body { font-size: 12px; color: var(--ev-text-muted); margin-top: 4px; line-height: 1.45; }
@media (max-width: 768px) {
  .ev-empty-tips { grid-template-columns: 1fr; }
}

/* ── Loading panel (refines existing #overlay spinner) ─────────────────── */
body.ev-redesign #overlay { background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(2px); }

/* ── Cleanup: hide AdminLTE rules we don't need ────────────────────────── */
body.ev-redesign .main-sidebar.ev-sidebar .nav-sidebar .nav-link.bg-primary,
body.ev-redesign .main-sidebar.ev-sidebar .nav-sidebar .nav-link.bg-success {
  background: transparent !important;
  color: var(--ev-text) !important;
}
body.ev-redesign .nav-user-btn,
body.ev-redesign .nav-logout-btn { /* legacy top-bar buttons hidden under redesign */
  display: none !important;
}
