/* ============================================================
   ESVARBON — Surveyor User Portal  |  portal.css
   Modern UI/UX  •  Bootstrap 5  •  Tabler Icons
   ============================================================ */

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --esv-primary:       #1a3c5e;
  --esv-primary-light: #2460a7;
  --esv-primary-soft:  #e8f0fb;
  --esv-accent:        #f5a623;
  --esv-accent-light:  #fff4e0;
  --esv-success:       #22c55e;
  --esv-success-soft:  #dcfce7;
  --esv-warning:       #f59e0b;
  --esv-warning-soft:  #fef3c7;
  --esv-danger:        #ef4444;
  --esv-danger-soft:   #fee2e2;
  --esv-info:          #3b82f6;
  --esv-info-soft:     #dbeafe;

  /* Layout */
  --sidebar-w:         260px;
  --topbar-h:          64px;

  /* Neutral */
  --bg-body:           #f0f4f8;
  --bg-card:           #ffffff;
  --text-primary:      #0f172a;
  --text-secondary:    #475569;
  --text-muted:        #94a3b8;
  --border:            #e2e8f0;
  --border-focus:      var(--esv-primary-light);

  /* Radius / Shadow */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.12);

  /* Transition */
  --tx: .2s ease;
}

html { scroll-behavior: smooth; }
body.portal-body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-body);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.portal-sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--esv-primary);
  display: flex; flex-direction: column;
  z-index: 1040;
  transition: transform var(--tx);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.portal-sidebar::-webkit-scrollbar { width: 4px; }
.portal-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

/* Brand */
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: 72px;
}
.sb-logo {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 8px; overflow: hidden;
}
.sb-logo img { width: 100%; height: 100%; object-fit: contain; }
.sb-name { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: .5px; }
.sb-sub  { font-size: 10px; color: rgba(255,255,255,.55); letter-spacing: .5px; text-transform: uppercase; }
.sb-close {
  margin-left: auto; background: none; border: none;
  color: rgba(255,255,255,.6); cursor: pointer; font-size: 18px; padding: 4px;
}

/* Profile mini */
.sidebar-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  background: rgba(255,255,255,.06);
  margin: 12px 12px 4px;
  border-radius: var(--radius-md);
  position: relative;
}
.sp-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--esv-accent);
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sp-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.sp-reg  { font-size: 10px; color: rgba(255,255,255,.5); }
.sp-notif-badge {
  position: absolute; top: 8px; right: 10px;
  background: var(--esv-accent);
  color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; text-decoration: none;
}

/* Nav */
.sidebar-nav { padding: 8px 0; flex: 1; }
.nav-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: rgba(255,255,255,.35);
  padding: 14px 22px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px; margin: 2px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.7);
  text-decoration: none; font-size: 13.5px; font-weight: 500;
  transition: background var(--tx), color var(--tx);
  position: relative;
}
.nav-item i { font-size: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,.15); color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--esv-accent);
  border-radius: 0 3px 3px 0;
}
.nav-badge {
  margin-left: auto; background: var(--esv-accent);
  color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 12px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column; gap: 4px;
}
.sb-view-site, .sb-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 12.5px; text-decoration: none; transition: background var(--tx);
}
.sb-view-site { color: rgba(255,255,255,.6); }
.sb-view-site:hover { background: rgba(255,255,255,.1); color: #fff; }
.sb-logout { color: #fca5a5; }
.sb-logout:hover { background: rgba(239,68,68,.2); color: #fff; }

/* Overlay */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1039;
}
.sidebar-overlay.show { display: block; }

/* ── Main Area ───────────────────────────────────────────── */
.portal-main {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin var(--tx);
}

/* ── Top Bar ─────────────────────────────────────────────── */
.portal-topbar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}
.sidebar-toggle-btn {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px;
  cursor: pointer; color: var(--text-secondary);
  font-size: 18px; line-height: 1;
  transition: background var(--tx);
}
.sidebar-toggle-btn:hover { background: var(--bg-body); }

.portal-breadcrumb { display: flex; align-items: center; gap: 6px; }
.bc-root { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.bc-sep  { font-size: 12px; color: var(--text-muted); }
.bc-current { font-size: 13px; color: var(--text-primary); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-icon-btn {
  position: relative;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
  cursor: pointer; color: var(--text-secondary); font-size: 18px;
  line-height: 1; transition: background var(--tx);
}
.topbar-icon-btn:hover { background: var(--bg-body); }
.topbar-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--esv-danger); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

.topbar-user-btn {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 6px 12px 6px 6px;
  cursor: pointer; text-decoration: none;
  transition: background var(--tx); color: var(--text-primary);
}
.topbar-user-btn::after { display: none; }
.topbar-user-btn:hover { background: var(--bg-body); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--esv-primary);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-role { font-size: 10px; color: var(--text-muted); }

/* Notification dropdown */
.notif-dropdown {
  width: 320px; padding: 0; border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; font-weight: 600; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.notif-count {
  font-size: 11px; font-weight: 700;
  background: var(--esv-accent-light); color: var(--esv-accent);
  padding: 2px 8px; border-radius: 20px;
}
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--border);
  transition: background var(--tx);
}
.notif-item:hover { background: var(--bg-body); }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--esv-primary-light); flex-shrink: 0; margin-top: 4px;
}
.notif-title { font-size: 12.5px; font-weight: 500; line-height: 1.3; }
.notif-time  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-empty {
  padding: 32px 16px; text-align: center;
  color: var(--text-muted); font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.notif-empty i { font-size: 28px; opacity: .4; }
.notif-footer {
  display: block; text-align: center; padding: 12px;
  font-size: 12.5px; font-weight: 600; color: var(--esv-primary-light);
  text-decoration: none; border-top: 1px solid var(--border);
  transition: background var(--tx);
}
.notif-footer:hover { background: var(--bg-body); }

/* User dropdown */
.portal-user-menu {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); min-width: 180px; padding: 6px;
}
.portal-user-menu .dropdown-item {
  border-radius: var(--radius-sm); font-size: 13px; padding: 8px 12px;
  display: flex; align-items: center;
  transition: background var(--tx);
}

/* ── Portal Content ──────────────────────────────────────── */
.portal-content { flex: 1; padding: 28px 28px 40px; }

/* Page header */
.page-header {
  margin-bottom: 24px;
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.page-header-left {}
.page-title {
  font-size: 22px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 2px;
}
.page-subtitle { font-size: 13px; color: var(--text-muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 16px;
  transition: box-shadow var(--tx), transform var(--tx);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.stat-icon.blue   { background: var(--esv-info-soft);    color: var(--esv-info); }
.stat-icon.green  { background: var(--esv-success-soft);  color: var(--esv-success); }
.stat-icon.yellow { background: var(--esv-warning-soft);  color: var(--esv-warning); }
.stat-icon.navy   { background: var(--esv-primary-soft);  color: var(--esv-primary); }
.stat-icon.orange { background: var(--esv-accent-light);  color: var(--esv-accent); }
.stat-icon.red    { background: var(--esv-danger-soft);   color: var(--esv-danger); }
/* .stat-value { font-size: 16px; font-weight: 700; line-height: 1; margin-bottom: 4px; } */
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ── Cards ───────────────────────────────────────────────── */
.portal-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  gap: 12px;
}
.card-title-bar {
  font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px;
}
.card-title-bar i { color: var(--esv-primary-light); font-size: 18px; }
.card-body-pad { padding: 22px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-label {
  font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
  display: block;
}
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 13px; font-size: 13.5px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color var(--tx), box-shadow var(--tx);
  width: 100%;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(36,96,167,.12);
}
.form-control::placeholder { color: var(--text-muted); }
.input-group .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .input-group-text {
  background: var(--bg-body); border: 1.5px solid var(--border);
  border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-muted); font-size: 16px; padding: 0 12px;
}
.form-section {
  border-radius: var(--radius-md); padding: 22px;
  background: var(--bg-body); margin-bottom: 20px;
}
.form-section-title {
  font-size: 13px; font-weight: 700;
  color: var(--esv-primary); margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}
.form-section-title i { font-size: 16px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 11.5px; color: var(--esv-danger); margin-top: 4px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-portal {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all var(--tx); text-decoration: none;
  white-space: nowrap;
}
.btn-portal i { font-size: 17px; }
.btn-primary-portal {
  background: var(--esv-primary); color: #fff;
}
.btn-primary-portal:hover {
  background: var(--esv-primary-light); color: #fff;
  box-shadow: 0 4px 12px rgba(26,60,94,.3);
}
.btn-accent-portal {
  background: var(--esv-accent); color: #fff;
}
.btn-accent-portal:hover { filter: brightness(1.08); }
.btn-outline-portal {
  background: transparent; color: var(--text-secondary);
  border: 1.5px solid var(--border);
}
.btn-outline-portal:hover { background: var(--bg-body); color: var(--text-primary); }
.btn-danger-portal {
  background: var(--esv-danger); color: #fff;
}
.btn-danger-portal:hover { filter: brightness(.92); }
.btn-sm-portal { padding: 6px 14px; font-size: 12.5px; }
.btn-lg-portal { padding: 12px 28px; font-size: 15px; }

/* ── Status / Badge ──────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.pill-approved { background: var(--esv-success-soft); color: #16a34a; }
.pill-approved::before { background: #16a34a; }
.pill-pending  { background: var(--esv-warning-soft); color: #b45309; }
.pill-pending::before  { background: #b45309; }
.pill-rejected { background: var(--esv-danger-soft);  color: #dc2626; }
.pill-rejected::before { background: #dc2626; }
.pill-inactive { background: #f1f5f9; color: var(--text-muted); }
.pill-inactive::before { background: var(--text-muted); }

/* ── Alert banners ───────────────────────────────────────── */
.alert-portal {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--radius-md);
  font-size: 13px; margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert-portal i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--esv-success-soft); color: #15803d; border-color: #bbf7d0; }
.alert-warning { background: var(--esv-warning-soft); color: #92400e; border-color: #fde68a; }
.alert-danger  { background: var(--esv-danger-soft);  color: #b91c1c; border-color: #fecaca; }
.alert-info    { background: var(--esv-info-soft);    color: #1d4ed8; border-color: #bfdbfe; }

/* ── Profile Page ────────────────────────────────────────── */
.profile-hero {
  background: linear-gradient(135deg, var(--esv-primary) 0%, var(--esv-primary-light) 100%);
  border-radius: var(--radius-lg); padding: 32px 28px;
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 24px; color: #fff;
  flex-wrap: wrap;
}
.profile-avatar-wrap { position: relative; flex-shrink: 0; }
.profile-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--esv-accent);
  color: #fff; font-size: 34px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 4px solid rgba(255,255,255,.3);
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-edit {
  position: absolute; bottom: 0; right: 0;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--esv-accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer; border: 2px solid #fff;
  transition: transform var(--tx);
}
.profile-photo-edit:hover { transform: scale(1.1); }
.profile-hero-info .ph-name  { font-size: 22px; font-weight: 700; }
.profile-hero-info .ph-title { font-size: 13px; opacity: .75; margin-top: 2px; }
.profile-hero-info .ph-tags  { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ph-tag {
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  background: rgba(255,255,255,.15); color: #fff;
}
.profile-hero-stats {
  margin-left: auto; display: flex; gap: 28px; flex-wrap: wrap;
}
.phs-item { text-align: center; }
.phs-val  { font-size: 22px; font-weight: 700; }
.phs-lbl  { font-size: 10px; opacity: .65; text-transform: uppercase; letter-spacing: .5px; }

/* Completion meter */
.completion-bar-wrap {
  background: rgba(255,255,255,.15); border-radius: 20px;
  height: 6px; margin-top: 12px; overflow: hidden; width: 200px; max-width: 100%;
}
.completion-bar {
  height: 100%; border-radius: 20px;
  background: var(--esv-accent);
  transition: width 1s ease;
}

/* ── Licence Card ────────────────────────────────────────── */
.licence-card-wrap { perspective: 1000px; }
.licence-card {
  background: linear-gradient(135deg, var(--esv-primary) 0%, #0f2742 100%);
  border-radius: var(--radius-xl); padding: 28px;
  color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow-lg);
  min-height: 200px;
}
.licence-card::before {
  content: '';
  position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.licence-card::after {
  content: '';
  position: absolute; bottom: -40px; left: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: rgba(245,166,35,.08);
}
.lc-brand { font-size: 11px; opacity: .6; letter-spacing: 2px; text-transform: uppercase; }
.lc-number { font-size: 28px; font-weight: 700; letter-spacing: 3px; margin: 10px 0 4px; }
.lc-name   { font-size: 15px; font-weight: 600; opacity: .9; }
.lc-meta   { display: flex; gap: 28px; margin-top: 22px; }
.lc-meta-item .lm-label { font-size: 9px; opacity: .5; text-transform: uppercase; letter-spacing: 1px; }
.lc-meta-item .lm-value { font-size: 13px; font-weight: 600; margin-top: 2px; }
.lc-logo {
  position: absolute; top: 22px; right: 24px;
  opacity: .8;
}
.lc-status-badge {
  position: absolute; bottom: 24px; right: 24px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
}
.lc-status-badge.valid { background: var(--esv-success-soft); color: #15803d; }
.lc-status-badge.expired { background: var(--esv-danger-soft); color: #dc2626; }
.lc-status-badge.pending { background: var(--esv-warning-soft); color: #92400e; }

/* ── Document uploader ───────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 36px 20px; text-align: center;
  cursor: pointer; transition: all var(--tx);
  background: var(--bg-body);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--esv-primary-light);
  background: var(--esv-primary-soft);
}
.drop-zone i { font-size: 36px; color: var(--text-muted); margin-bottom: 8px; }
.drop-zone p { font-size: 13px; color: var(--text-muted); }
.drop-zone strong { color: var(--esv-primary-light); }

/* ── Table ───────────────────────────────────────────────── */
.portal-table { width: 100%; border-collapse: collapse; }
.portal-table th {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted);
  padding: 10px 16px; border-bottom: 2px solid var(--border);
  background: var(--bg-body); text-align: left;
}
.portal-table td {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
.portal-table tr:last-child td { border-bottom: none; }
.portal-table tbody tr:hover { background: rgba(36,96,167,.03); }

/* Mobile card-stacking for data tables (Finance, Credit Unit, Documents,
   Licence History, ...). Every stackable row's <td> carries a
   data-label="..." attribute — on narrow screens the header row is
   hidden and each cell becomes its own labelled line instead of forcing
   a sideways scroll to read Status/Action columns. Key-value tables
   (e.g. the Registration Details table on My Licence, where column 1
   already *is* the label) opt out via .portal-table-kv, since they're
   already narrow-screen friendly as a plain 2-column table. */
@media (max-width: 767.98px) {
  .portal-table:not(.portal-table-kv) thead { display: none; }
  .portal-table:not(.portal-table-kv),
  .portal-table:not(.portal-table-kv) tbody,
  .portal-table:not(.portal-table-kv) tr,
  .portal-table:not(.portal-table-kv) td { display: block; width: 100%; }
  .portal-table:not(.portal-table-kv) tr {
    margin-bottom: 12px; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: var(--radius-md);
  }
  .portal-table:not(.portal-table-kv) tr:last-child { margin-bottom: 0; }
  .portal-table:not(.portal-table-kv) td {
    padding: 7px 0; text-align: left;
    border-bottom: 1px dashed var(--border);
  }
  .portal-table:not(.portal-table-kv) td:last-child { border-bottom: none; }
  .portal-table:not(.portal-table-kv) td::before {
    content: attr(data-label);
    display: block; margin-bottom: 3px;
    font-weight: 600; font-size: 11px; text-transform: uppercase;
    letter-spacing: .3px; color: var(--text-muted);
  }
}

/* ── Progress / Strength ──────────────────────────────────── */
.strength-bar {
  height: 4px; border-radius: 4px; background: var(--border); overflow: hidden;
}
.strength-fill { height: 100%; border-radius: 4px; transition: width .4s, background .4s; }
.strength-weak   .strength-fill { width: 25%; background: var(--esv-danger); }
.strength-fair   .strength-fill { width: 50%; background: var(--esv-warning); }
.strength-good   .strength-fill { width: 75%; background: var(--esv-accent); }
.strength-strong .strength-fill { width: 100%; background: var(--esv-success); }

/* ── Directory search ────────────────────────────────────── */
.member-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px;
  display: flex; gap: 14px; align-items: flex-start;
  transition: box-shadow var(--tx);
}
.member-card:hover { box-shadow: var(--shadow-md); }
.member-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--esv-primary-soft);
  color: var(--esv-primary); font-weight: 700; font-size: 17px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.member-name { font-size: 14px; font-weight: 600; }
.member-fn   { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.member-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.member-tag {
  font-size: 10.5px; padding: 2px 8px; border-radius: 20px;
  background: var(--esv-primary-soft); color: var(--esv-primary);
  font-weight: 600;
}

/* ── Empty states ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; opacity: .3; margin-bottom: 12px; display: block; }
.empty-state h4 { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; }
.portal-toast {
  background: var(--text-primary); color: #fff;
  border-radius: var(--radius-md); padding: 14px 18px;
  min-width: 260px; max-width: 360px;
  display: flex; align-items: flex-start; gap: 10px;
  box-shadow: var(--shadow-lg); margin-top: 8px;
  animation: slideInToast .3s ease;
}
.portal-toast.toast-success { background: #15803d; }
.portal-toast.toast-danger  { background: var(--esv-danger); }
.portal-toast.toast-warning { background: #92400e; }
.portal-toast i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-msg { font-size: 13px; line-height: 1.4; }

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── Spinner ─────────────────────────────────────────────── */
.portal-spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login / Auth pages ──────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex;
  background: linear-gradient(135deg, var(--esv-primary) 0%, #0f2742 60%, #1a3c5e 100%);
}
.auth-left {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 40px; position: relative; overflow: hidden;
}
.auth-left-content { position: relative; z-index: 1; color: #fff; max-width: 420px; }
.auth-left-bg {
  position: absolute; inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200"><circle cx="0" cy="0" r="120" fill="rgba(255,255,255,.04)"/><circle cx="200" cy="200" r="80" fill="rgba(245,166,35,.06)"/><circle cx="150" cy="50" r="60" fill="rgba(255,255,255,.03)"/></svg>');
  background-size: cover;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; }
.auth-brand-icon {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: var(--esv-accent);
}
.auth-brand-name { font-size: 20px; font-weight: 800; }
.auth-brand-sub  { font-size: 11px; opacity: .6; text-transform: uppercase; letter-spacing: 1px; }
.auth-tagline { font-size: 32px; font-weight: 700; line-height: 1.2; margin-bottom: 16px; }
.auth-tagline span { color: var(--esv-accent); }
.auth-tagline-sub { font-size: 14px; opacity: .7; line-height: 1.6; }
.auth-features { margin-top: 32px; display: flex; flex-direction: column; gap: 14px; }
.auth-feature { display: flex; align-items: center; gap: 12px; }
.auth-feature-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(245,166,35,.2); color: var(--esv-accent);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  flex-shrink: 0;
}
.auth-feature-text { font-size: 13px; opacity: .85; }

.auth-right {
  width: 480px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 40px; min-height: 100vh;
}
.auth-form-wrap { width: 100%; max-width: 380px; }
.auth-form-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.auth-form-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .portal-sidebar { transform: translateX(-100%); }
  .portal-sidebar.open { transform: none; }
  .portal-main { margin-left: 0; }
  .auth-left { display: none; }
  .auth-right { width: 100%; }
}
@media (max-width: 575.98px) {
  .portal-content { padding: 18px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-hero { padding: 22px 18px; }
  .profile-hero-stats { margin: 0; width: 100%; justify-content: space-around; }
  .licence-card { padding: 20px; }
}

/* ── Utilities ───────────────────────────────────────────── */
.gap-row { display: flex; flex-direction: column; gap: 16px; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.text-accent { color: var(--esv-accent); }
.text-primary-brand { color: var(--esv-primary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.rounded-portal { border-radius: var(--radius-md); }
.cursor-pointer { cursor: pointer; }
