/* ── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       font-size: 14px; color: #1a1a2e; background: #f0f2f8; min-height: 100vh; display: flex; }

/* ── Sidebar ─────────────────────────────────── */
.sidebar { width: 240px; min-height: 100vh; background: #1a1a2e; color: #c8c8e8;
           display: flex; flex-direction: column; flex-shrink: 0; position: fixed; top: 0; left: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px;
                 font-size: 18px; font-weight: 700; color: #fff;
                 border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-icon { font-size: 22px; }
.nav-links { list-style: none; padding: 12px 0; flex: 1; overflow-y: auto; }
.nav-links li a { display: flex; align-items: center; gap: 10px; padding: 10px 18px;
                  color: #a8a8c8; text-decoration: none; border-radius: 6px; margin: 2px 8px;
                  transition: background 0.15s, color 0.15s; font-size: 14px; }
.nav-links li a:hover, .nav-links li a.active { background: rgba(108,92,231,0.25); color: #fff; }
.nav-links li a.active { color: #a78bfa; }
.nav-section { padding: 12px 18px 4px; font-size: 11px; text-transform: uppercase;
               letter-spacing: 1px; color: #6666aa; }

/* ── Collapsible Nav Groups ────────────────── */
.nav-group { list-style: none; }
.nav-section-toggle { display: flex; align-items: center; justify-content: space-between;
                      padding: 10px 18px 4px; cursor: pointer; user-select: none; }
.nav-section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
                     color: #6666aa; font-weight: 600; }
.nav-section-toggle:hover .nav-section-label { color: #9999cc; }
.nav-chevron { font-size: 14px; color: #6666aa; transition: transform 0.2s ease;
               display: inline-block; transform: rotate(0deg); line-height: 1; }
.nav-group.open .nav-chevron { transform: rotate(90deg); }
.nav-section-items { list-style: none; padding: 0; margin: 0;
                     max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.nav-group.open .nav-section-items { max-height: 500px; }
.nav-section-items li a { display: flex; align-items: center; gap: 10px; padding: 8px 18px 8px 28px;
                          color: #a8a8c8; text-decoration: none; border-radius: 6px; margin: 1px 8px;
                          transition: background 0.15s, color 0.15s; font-size: 13px; }
.nav-section-items li a:hover, .nav-section-items li a.active { background: rgba(108,92,231,0.25); color: #fff; }
.nav-section-items li a.active { color: #a78bfa; }
.sidebar-footer { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #6c5ce7;
          color: #fff; display: flex; align-items: center; justify-content: center;
          font-weight: 700; font-size: 14px; flex-shrink: 0; }
.username { font-weight: 600; color: #fff; font-size: 13px; }
.user-role { font-size: 11px; color: #9999cc; }
.logout-btn { display: block; text-align: center; padding: 8px; border-radius: 6px;
              background: rgba(255,255,255,0.07); color: #c8c8e8; text-decoration: none;
              font-size: 13px; transition: background 0.15s; }
.logout-btn:hover { background: rgba(255,80,80,0.25); color: #ff6b6b; }

/* ── Main Content ────────────────────────────── */
.main-content { margin-left: 240px; flex: 1; min-height: 100vh; }
.content-wrapper { padding: 32px; width: 100%; max-width: 100%; box-sizing: border-box; }

/* ── Page Header ─────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between;
               margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 24px; font-weight: 700; color: #1a1a2e; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-block; font-size: 13px; color: #6c5ce7; text-decoration: none;
             margin-bottom: 6px; }
.back-link:hover { text-decoration: underline; }
.text-muted { color: #666; font-size: 13px; }

/* ── Stats Grid ──────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
              gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px;
             box-shadow: 0 1px 4px rgba(0,0,0,0.07); text-align: center; }
.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 700; color: #1a1a2e; }
.stat-label { font-size: 13px; color: #888; margin: 4px 0 10px; }
.stat-link { font-size: 12px; color: #6c5ce7; text-decoration: none; }
.stat-link:hover { text-decoration: underline; }

/* ── Dashboard Grid ──────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px; }

/* ── Card ────────────────────────────────────── */
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.07);
        overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between;
               padding: 16px 20px; border-bottom: 1px solid #eee; }
.card-header h2 { font-size: 16px; font-weight: 600; }
.card-toolbar { padding: 12px 16px; border-bottom: 1px solid #eee; }
.form-card { padding: 24px; }
.detail-card { }

/* ── Table ───────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 10px 16px; font-size: 12px; font-weight: 600;
            text-transform: uppercase; letter-spacing: 0.5px; color: #888;
            background: #fafafa; border-bottom: 1px solid #eee; }
.table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table a { color: #6c5ce7; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.empty { text-align: center; color: #aaa; padding: 24px !important; }
.actions { display: flex; gap: 6px; white-space: nowrap; align-items: center; }
.row-latest { background: #f9fffe; }

/* ── Detail Grid & List ──────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.detail-section { margin-bottom: 0; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

/* Used on publisher detail page */
.detail-list-simple { padding: 20px; }
.detail-list-simple dt { font-size: 11px; font-weight: 600; text-transform: uppercase;
                         letter-spacing: 0.5px; color: #888; margin-top: 14px; }
.detail-list-simple dt:first-child { margin-top: 0; }
.detail-list-simple dd { margin: 3px 0 0; color: #1a1a2e; }

/* Used on lead analysis detail page */
.detail-list { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; padding: 16px; }
.detail-list dt { font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase;
                  letter-spacing: 0.5px; align-self: start; padding-top: 2px; }
.detail-list dd { font-size: 14px; color: #1a1a2e; margin: 0; }

.description { padding: 16px 20px; border-top: 1px solid #eee; }
.description h3 { font-size: 13px; font-weight: 600; color: #888; margin-bottom: 8px; }
.description p { line-height: 1.6; color: #444; }

/* ── Forms ───────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 5px; }
.form-control,
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 14px; color: #1a1a2e; background: #fafafa; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s; }
input[type=checkbox], input[type=radio] { width: auto; }
.form-control:focus, input:focus, select:focus, textarea:focus {
  border-color: #6c5ce7; box-shadow: 0 0 0 3px rgba(108,92,231,0.12); background: #fff; }
.has-error .form-control { border-color: #e74c3c; }
.error-text { color: #e74c3c; font-size: 12px; margin-top: 4px; display: block; }
.field-error { color: #e74c3c; font-size: 12px; margin-top: 4px; display: block; }
.help-text { color: #999; font-size: 12px; margin-top: 3px; display: block; }
.form-actions { display: flex; gap: 10px; padding-top: 16px; margin-top: 8px;
                border-top: 1px solid #eee; flex-wrap: wrap; }
.search-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-input { max-width: 280px; }
.inline-form { display: inline; }
.required { color: #ef4444; }
.text-link { font-size: 12px; color: #6c5ce7; margin-left: 6px; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* Lead analysis form layout */
.lead-analysis-form { display: flex; flex-direction: column; gap: 20px; }
.form-section { margin-bottom: 0; }
.lead-analysis-form .form-grid-2 { padding: 16px; }
.form-full { grid-column: 1 / -1; }
@media (max-width: 768px) { .form-grid-2 { grid-template-columns: 1fr; } }

.radio-group { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 4px; }
.radio-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: #374151; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px 24px; padding-top: 4px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: #374151; }
.pain-list { list-style: disc; padding-left: 18px; margin: 0; }
.pain-list li { font-size: 13px; color: #374151; }

/* ── Buttons ─────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
       padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
       text-decoration: none; cursor: pointer; border: none; transition: all 0.15s;
       white-space: nowrap; }
.btn-primary   { background: #6c5ce7; color: #fff; }
.btn-primary:hover { background: #5a4bd1; }
.btn-secondary { background: #f0eeff; color: #6c5ce7; }
.btn-secondary:hover { background: #e2dcff; }
.btn-outline   { background: transparent; color: #555; border: 1px solid #ddd; }
.btn-outline:hover { border-color: #6c5ce7; color: #6c5ce7; }
.btn-danger    { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-success   { background: #d1fae5; color: #059669; }
.btn-success:hover { background: #a7f3d0; }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }

/* ── Badges ──────────────────────────────────── */
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success      { background: #d1fae5; color: #059669; }
.badge-muted        { background: #f3f4f6; color: #6b7280; }
.badge-danger       { background: #fee2e2; color: #dc2626; }
.badge-info         { background: #dbeafe; color: #1e40af; }
.badge-warning      { background: #fef3c7; color: #92400e; }
.badge-secondary    { background: #f3f4f6; color: #6b7280; }
.badge-role         { background: #ede9fe; color: #7c3aed; }
.badge-perm         { background: #e0f2fe; color: #0369a1; font-size: 10px; }
/* Opportunity level badges */
.badge-high         { background: #d1fae5; color: #065f46; }
.badge-medium       { background: #fef3c7; color: #92400e; }
.badge-low          { background: #fee2e2; color: #991b1b; }
.badge-not_suitable { background: #f3f4f6; color: #374151; }

/* ── Alerts ──────────────────────────────────── */
.messages { margin-bottom: 20px; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ── Pagination ──────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; padding: 14px 16px;
              border-top: 1px solid #eee; justify-content: center; flex-wrap: wrap; }
.page-btn { padding: 6px 12px; border-radius: 6px; background: #f0eeff; color: #6c5ce7;
            text-decoration: none; font-size: 13px; font-weight: 600; transition: all .15s; cursor: pointer;
            display: inline-flex; align-items: center; justify-content: center; min-width: 34px; text-align: center; }
.page-btn:hover { background: #6c5ce7; color: #fff; }
.page-btn.active { background: #6c5ce7; color: #fff; cursor: default; pointer-events: none; }
.page-btn.disabled { background: #f5f5f5; color: #ccc; cursor: default; pointer-events: none; }
.page-btn-nav { min-width: auto; }
.page-num { padding: 6px 10px; }
.page-ellipsis { color: #888; font-size: 14px; padding: 0 2px; user-select: none; }
.page-info { color: #888; font-size: 13px; }
.page-goto { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; }
.page-goto-input { width: 52px; padding: 5px 8px; border: 1px solid #ddd; border-radius: 6px;
                   font-size: 13px; text-align: center; color: #333; }
.page-goto-input:focus { outline: none; border-color: #6c5ce7; box-shadow: 0 0 0 2px rgba(108,92,231,.15); }

/* ── Login Page ──────────────────────────────── */
.login-page { min-height: 100vh; width: 100%; display: flex; align-items: center;
              justify-content: center; background: #1a1a2e; }
.login-card { background: #fff; border-radius: 16px; padding: 40px;
              width: 100%; max-width: 400px; box-shadow: 0 8px 32px rgba(0,0,0,0.2); }
.login-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 22px; font-weight: 700; color: #1a1a2e; }
.login-subtitle { text-align: center; color: #888; margin-bottom: 28px; font-size: 13px; }
.login-form .btn-block { margin-top: 8px; }
.login-footer {
  text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}
.forgot-password-link {
  color: #6c5ce7;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.forgot-password-link:hover {
  text-decoration: underline;
}
.back-to-login {
  color: #6c5ce7;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.back-to-login:hover {
  text-decoration: underline;
}
.password-rules {
  background: #f8f9fa;
  border: 1px solid #e8e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #666;
}
.password-rules p {
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}
.password-rules ul {
  list-style: disc;
  padding-left: 18px;
  margin: 0;
}
.password-rules li {
  padding: 2px 0;
}

/* ── Tabs ────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid #e8e8f0; }
.tab { padding: 10px 20px; font-size: 14px; font-weight: 500; color: #666;
       text-decoration: none; border-radius: 6px 6px 0 0;
       border: 1px solid transparent; border-bottom: none;
       margin-bottom: -2px; transition: color 0.15s, background 0.15s;
       display: flex; align-items: center; gap: 6px; }
.tab:hover { color: #6c5ce7; background: #f5f3ff; }
.tab-active { color: #6c5ce7; background: #fff; border-color: #e8e8f0;
              border-bottom-color: #fff; font-weight: 600; }
.tab-badge { background: #6c5ce7; color: #fff; font-size: 11px; font-weight: 700;
             padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center; }

/* ── Activity Timeline ───────────────────────── */
.activity-timeline { padding: 8px 0; }
.activity-item { display: flex; gap: 14px; padding: 14px 20px;
                 border-bottom: 1px solid #f0f0f8; transition: background 0.1s; }
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #faf9ff; }
.activity-icon { font-size: 20px; flex-shrink: 0; padding-top: 2px; }
.activity-body { flex: 1; min-width: 0; }
.activity-header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.activity-badge-created  { background: #d1fae5; color: #065f46; }
.activity-badge-updated  { background: #dbeafe; color: #1e40af; }
.activity-badge-deleted  { background: #fee2e2; color: #991b1b; }
.activity-badge-imported { background: #fef3c7; color: #92400e; }
.activity-action { font-size: 11px; font-weight: 700; text-transform: uppercase;
                   letter-spacing: 0.5px; padding: 2px 8px; border-radius: 4px; }
.activity-publisher { font-weight: 600; color: #1a1a2e; text-decoration: none; font-size: 14px; }
a.activity-publisher:hover { color: #6c5ce7; text-decoration: underline; }
.activity-user { font-size: 13px; color: #555; }
.activity-time { font-size: 12px; color: #999; margin-left: auto; white-space: nowrap; }
.activity-changes { margin-top: 8px; }
.activity-diff-table { width: 100%; border-collapse: collapse; font-size: 12px;
                        background: #fafafa; border-radius: 6px; overflow: hidden;
                        border: 1px solid #ebebf5; }
.activity-diff-table th { background: #f0f0f8; padding: 5px 10px; text-align: left;
                           font-weight: 600; color: #555; text-transform: uppercase; font-size: 11px; }
.activity-diff-table td { padding: 5px 10px; border-top: 1px solid #ebebf5; }
.activity-diff-table td code { background: #eee; padding: 1px 4px; border-radius: 3px; font-size: 11px; }
.diff-old { color: #991b1b; background: #fff5f5; }
.diff-new { color: #065f46; background: #f0fdf4; }

/* ── Role Cards ──────────────────────────────── */
.role-card { margin-bottom: 20px; }
.role-card-header { display: flex; align-items: center; justify-content: space-between;
                    padding: 16px 20px; border-bottom: 1px solid #eee; flex-wrap: wrap; gap: 10px; }
.role-title-group { display: flex; align-items: center; gap: 10px; }
.role-name { font-size: 17px; font-weight: 700; color: #1a1a2e; }
.role-perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
                  gap: 16px; padding: 16px 20px; }
.perm-module { }
.perm-module-title { font-size: 11px; font-weight: 700; text-transform: uppercase;
                     letter-spacing: 0.8px; color: #6c5ce7; margin-bottom: 8px;
                     padding-bottom: 4px; border-bottom: 1px solid #ede9fe; }
.perm-item { font-size: 12px; padding: 4px 0; display: flex; align-items: center; gap: 6px; color: #555; }
.perm-granted { color: #1a1a2e; }
.perm-denied  { color: #bbb; }

/* ── Permission Picker ───────────────────────── */
.perm-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
                    gap: 20px; padding: 20px; }
.perm-picker-module { background: #faf9ff; border: 1px solid #ede9fe; border-radius: 10px; overflow: hidden; }
.perm-picker-module-header { background: #ede9fe; padding: 10px 14px; border-bottom: 1px solid #ddd8f8; }
.perm-module-check-all { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.perm-module-check-all input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: #6c5ce7; }
.perm-picker-items { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.perm-checkbox-label { display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
                        padding: 5px 6px; border-radius: 6px; transition: background 0.1s; }
.perm-checkbox-label:hover { background: #ede9fe; }
.perm-checkbox-label input[type=checkbox] { width: 14px; height: 14px; margin-top: 2px;
                                             flex-shrink: 0; accent-color: #6c5ce7; }
.perm-label-text { font-size: 13px; color: #1a1a2e; line-height: 1.4; }
.perm-codename { font-size: 10px; color: #aaa; font-family: monospace; margin-left: auto; white-space: nowrap; }

/* ── Import Page ─────────────────────────────── */
.import-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.import-upload-card { }
.import-sidebar { }
.drop-zone { border: 2px dashed #d0c8ff; border-radius: 12px; padding: 40px 24px;
             text-align: center; background: #faf9ff;
             transition: border-color 0.2s, background 0.2s; cursor: pointer; }
.drop-zone--hover, .drop-zone:hover { border-color: #6c5ce7; background: #f0eeff; }
.drop-zone--active { border-color: #6c5ce7; background: #f0eeff; }
.drop-zone-icon { font-size: 40px; margin-bottom: 10px; }
.drop-zone-text { font-size: 15px; font-weight: 600; color: #1a1a2e; margin-bottom: 4px; }
.drop-zone-sub  { font-size: 13px; color: #aaa; margin-bottom: 12px; }
.drop-zone-filename { margin-top: 14px; font-size: 13px; color: #6c5ce7; font-weight: 600; min-height: 20px; }
.import-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.import-stat { border-radius: 10px; padding: 14px; text-align: center;
               display: flex; flex-direction: column; gap: 4px; }
.import-stat-ok   { background: #d1fae5; }
.import-stat-skip { background: #fef3c7; }
.import-stat-value { font-size: 28px; font-weight: 700; color: #1a1a2e; line-height: 1; }
.import-stat-label { font-size: 12px; color: #666; }
.import-errors { background: #fff8f0; border: 1px solid #ffd6a5; border-radius: 8px;
                 padding: 12px 16px; max-height: 220px; overflow-y: auto; }
.import-errors-title { font-weight: 600; color: #92400e; margin-bottom: 8px; font-size: 13px; }
.import-errors ul { list-style: none; padding: 0; }
.import-errors li { font-size: 12px; color: #7c3a00; padding: 3px 0; border-bottom: 1px solid #ffe4c4; }
.import-errors li:last-child { border-bottom: none; }

/* ── Lead Analysis — Opportunity Banner ──────── */
.opportunity-banner { display: flex; align-items: center; gap: 12px;
                      padding: 14px 20px; border-radius: 10px; margin-bottom: 24px;
                      font-size: 16px; font-weight: 600; }
.opportunity-high        { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.opportunity-medium      { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }
.opportunity-low         { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }
.opportunity-not_suitable{ background: #f3f4f6; color: #374151; border-left: 4px solid #9ca3af; }
.opp-label { font-size: 13px; font-weight: 500; opacity: 0.75; }
.opp-value { font-size: 18px; font-weight: 700; }

/* ── Stage Indicator ─────────────────────────── */
.stage-indicator { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.stage-step { display: flex; align-items: center; gap: 8px; padding: 8px 16px;
              border-radius: 20px; font-size: 13px; font-weight: 600;
              border: 2px solid #e0e0f0; color: #aaa; background: #fafafa; }
.stage-active  { border-color: #6c5ce7; color: #6c5ce7; background: #f0eeff; }
.stage-done    { border-color: #10b981; color: #059669; background: #f0fdf4; }
.stage-pending { border-color: #e0e0f0; color: #bbb;    background: #fafafa; }
.stage-divider { color: #ccc; font-size: 18px; }
.stage-num { width: 22px; height: 22px; border-radius: 50%;
             display: flex; align-items: center; justify-content: center;
             font-size: 12px; font-weight: 700; }
.stage-active  .stage-num { background: #6c5ce7; color: #fff; }
.stage-done    .stage-num { background: #10b981; color: #fff; }
.stage-pending .stage-num { background: #ddd;    color: #888; }

/* ── Publisher Search Dropdown ───────────────── */
.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
                   background: #fff; border: 1px solid #ddd; border-top: none;
                   border-radius: 0 0 8px 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.1);
                   max-height: 240px; overflow-y: auto; }
.dropdown-item { padding: 10px 14px; cursor: pointer; font-size: 14px; color: #1a1a2e;
                 border-bottom: 1px solid #f0f0f0; transition: background 0.1s; }
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: #f0eeff; color: #6c5ce7; }

/* ── Selected Publisher Badge ────────────────── */
.selected-badge { display: flex; align-items: center; gap: 8px; padding: 9px 12px;
                  background: #f0eeff; border: 1px solid #c4b5fd; border-radius: 8px;
                  font-size: 14px; color: #5b21b6; font-weight: 500; }
.badge-clear { border: none; background: none; cursor: pointer;
               color: #7c3aed; font-size: 14px; padding: 0 2px; line-height: 1; }
.badge-clear:hover { color: #ef4444; }

/* ── Stage 2 Selection Summary ───────────────── */
.selection-summary { display: flex; align-items: center; padding: 0; margin-bottom: 20px; overflow: hidden; }
.summary-item { display: flex; flex-direction: column; gap: 2px; padding: 14px 20px; flex: 1; }
.summary-label { font-size: 11px; font-weight: 600; text-transform: uppercase;
                 letter-spacing: 0.5px; color: #888; }
.summary-value { font-size: 15px; font-weight: 700; color: #1a1a2e; }
.summary-meta  { font-size: 11px; color: #aaa; }
.summary-divider { width: 1px; background: #eee; align-self: stretch; }
.summary-change { margin: 12px 16px 12px auto; white-space: nowrap; flex-shrink: 0; }

/* ── Version Badges ──────────────────────────── */
.version-badge { display: inline-flex; align-items: center; padding: 3px 10px;
                 border-radius: 12px; font-size: 12px; font-weight: 700;
                 vertical-align: middle; margin-left: 8px; }
.version-badge-sm { display: inline-block; padding: 2px 7px; border-radius: 10px;
                    font-size: 11px; font-weight: 700; }
.version-latest { background: #d1fae5; color: #065f46; }
.version-old    { background: #fef3c7; color: #92400e; }

/* ── Version Timeline ────────────────────────── */
.version-timeline { display: flex; flex-direction: column; }
.version-item { display: flex; gap: 14px; padding: 14px 16px;
                border-bottom: 1px solid #f0f0f8; transition: background 0.1s; }
.version-item:last-child { border-bottom: none; }
.version-item:hover { background: #faf9ff; }
.version-item-current { background: #f0eeff !important; }
.version-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.dot-latest { background: #10b981; }
.dot-old    { background: #d1d5db; }
.dot-green  { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
              background: #10b981; margin-right: 4px; vertical-align: middle; }
.dot-grey   { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
              background: #d1d5db; margin-right: 4px; vertical-align: middle; }
.version-body { flex: 1; min-width: 0; }
.version-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.version-analyst { font-size: 13px; color: #374151; font-weight: 500; }
.version-date { font-size: 12px; color: #9ca3af; margin-left: auto; }
.version-actions { margin-top: 6px; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 100%; min-height: auto; position: relative; height: auto; }
  .main-content { margin-left: 0; }
  body { flex-direction: column; }
  .detail-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .import-layout { grid-template-columns: 1fr; }
  .selection-summary { flex-direction: column; align-items: stretch; }
  .summary-divider { width: auto; height: 1px; }
}

/* ── Analysis Module Cards ───────────────────── */
.analysis-modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
.analysis-module-card { display: flex; align-items: center; gap: 1rem; padding: 1.5rem;
  background: #fff; border-radius: 10px; border: 1px solid #e8e8f0;
  text-decoration: none; color: inherit; transition: box-shadow 0.2s, border-color 0.2s; }
a.analysis-module-card:hover { box-shadow: 0 4px 16px rgba(108,92,231,0.12); border-color: #a78bfa; }
.analysis-module-card .module-icon { font-size: 2.5rem; flex-shrink: 0; }
.analysis-module-card .module-body h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.35rem; color: #1a1a2e; }
.analysis-module-card .module-body p { font-size: 0.82rem; color: #666; line-height: 1.45; margin: 0; }
.analysis-module-card .module-body .module-meta { margin-top: 0.6rem; }
.analysis-module-card .module-arrow { font-size: 1.4rem; color: #a78bfa; margin-left: auto; flex-shrink: 0; }
.analysis-module-coming-soon { border-style: dashed; cursor: default; }

/* ── Lead Status Badges ──────────────────────── */
.badge-status-new { background: #ebf5ff; color: #2980b9; }
.badge-status-contacted { background: #f0ebff; color: #7c3aed; }
.badge-status-qualified { background: #fff8eb; color: #d97706; }
.badge-status-proposal { background: #e8faf5; color: #0d9488; }
.badge-status-negotiation { background: #eef0ff; color: #4f46e5; }
.badge-status-won { background: #ecfdf5; color: #059669; }
.badge-status-lost { background: #fef2f2; color: #dc2626; }

/* ── Task Status Badges ──────────────────────── */
.badge-status-todo { background: #f3f4f6; color: #6b7280; }
.badge-status-in_progress { background: #ebf5ff; color: #2563eb; }
.badge-status-in_review { background: #fff8eb; color: #d97706; }
.badge-status-done { background: #ecfdf5; color: #059669; }
.badge-status-cancelled { background: #fef2f2; color: #dc2626; }

/* ── Social Calendar Status Badges ───────────── */
.badge-social-draft { background: #f3f4f6; color: #6b7280; }
.badge-social-level1_approved { background: #fff8eb; color: #d97706; }
.badge-social-level2_approved { background: #ebf5ff; color: #2563eb; }
.badge-social-scheduled { background: #f0ebff; color: #7c3aed; }
.badge-social-posted { background: #ecfdf5; color: #059669; }
.badge-social-rejected { background: #fef2f2; color: #dc2626; }
.badge-outline { background: transparent; border: 1px solid #d1d5db; color: #374151; }

/* ── Knowledge Base Badges ───────────────────── */
.badge-kb-public { background: #ecfdf5; color: #059669; }
.badge-kb-internal { background: #fff8eb; color: #d97706; }
.badge-kb-status-draft { background: #f3f4f6; color: #6b7280; }
.badge-kb-status-published { background: #ecfdf5; color: #059669; }

/* ── View Toggle ─────────────────────────────── */
.view-toggle { display: inline-flex; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; }
.view-toggle-btn { display: flex; align-items: center; gap: 5px; padding: 7px 14px;
                   font-size: 13px; font-weight: 600; color: #666; text-decoration: none;
                   background: #fff; border-right: 1px solid #ddd; transition: all 0.15s; }
.view-toggle-btn:last-child { border-right: none; }
.view-toggle-btn:hover { background: #f5f3ff; color: #6c5ce7; }
.view-toggle-btn.active { background: #6c5ce7; color: #fff; }

/* ── Task Calendar ───────────────────────────── */
.task-calendar { padding: 0; min-height: 500px; }
.cal-grid { display: flex; flex-direction: column; }
.cal-header-row { display: grid; grid-template-columns: repeat(7, 1fr);
                  border-bottom: 1px solid #eee; background: #fafafa; }
.cal-header-cell { padding: 10px 8px; text-align: center; font-size: 12px;
                   font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #888; }
.cal-body-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day-cell { min-height: 110px; padding: 6px 8px; border-bottom: 1px solid #f0f0f0;
                border-right: 1px solid #f0f0f0; position: relative;
                transition: background 0.1s; cursor: default; }
.cal-day-cell:nth-child(7n) { border-right: none; }
.cal-body-row:last-child .cal-day-cell { border-bottom: none; }
.cal-day-empty { background: #f9f9fc; }
.cal-day-today { background: #f5f3ff; }
.cal-day-has-events { cursor: pointer; }
.cal-day-has-events:hover { background: #f0eeff; }
.cal-day-num { font-size: 13px; font-weight: 600; color: #999; margin-bottom: 4px; }
.cal-today-num { color: #fff; background: #6c5ce7; width: 24px; height: 24px;
                 border-radius: 50%; display: flex; align-items: center; justify-content: center;
                 font-size: 12px; }
.cal-day-events { display: flex; flex-direction: column; gap: 2px; }
.cal-event-chip { display: flex; align-items: center; gap: 4px; padding: 2px 5px;
                  background: #f8f7ff; border-radius: 3px; font-size: 11px;
                  overflow: hidden; white-space: nowrap; }
.cal-event-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cal-dot-estimated { background: #6c5ce7; }
.cal-dot-actual { background: #10b981; }
.cal-event-label { overflow: hidden; text-overflow: ellipsis; color: #374151; font-weight: 500; }
.cal-event-more { font-size: 10px; color: #6c5ce7; font-weight: 600; padding: 1px 5px; }

/* Calendar legend */
.cal-legend { display: flex; gap: 16px; align-items: center; }
.cal-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px;
                   font-weight: 600; color: #666; }
.cal-legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Calendar navigation */
.cal-nav { display: flex; align-items: center; gap: 6px; }

/* Calendar tooltip */
.cal-tooltip { position: absolute; z-index: 999; background: #fff; border: 1px solid #ddd;
               border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,0.15);
               max-height: 320px; overflow-y: auto; }
.cal-tooltip-inner { padding: 6px; }
.cal-tooltip-event { display: block; padding: 10px 12px; border-radius: 8px;
                     text-decoration: none; color: inherit; transition: background 0.1s;
                     border-left: 4px solid transparent; margin-bottom: 4px; }
.cal-tooltip-event:last-child { margin-bottom: 0; }
.cal-tooltip-event:hover { background: #f5f3ff; }
.cal-evt-estimated { border-left-color: #6c5ce7; background: #faf9ff; }
.cal-evt-actual { border-left-color: #10b981; background: #f0fdf4; }
.cal-tooltip-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.cal-tooltip-type { font-size: 10px; font-weight: 700; text-transform: uppercase;
                    letter-spacing: 0.5px; padding: 2px 6px; border-radius: 3px; }
.cal-evt-estimated .cal-tooltip-type { background: #ede9fe; color: #6c5ce7; }
.cal-evt-actual .cal-tooltip-type { background: #d1fae5; color: #059669; }
.cal-tooltip-title { font-size: 13px; font-weight: 700; color: #1a1a2e; margin-bottom: 2px; }
.cal-tooltip-meta { font-size: 11px; color: #888; }

@media (max-width: 768px) {
  .cal-day-cell { min-height: 70px; padding: 4px; }
  .cal-event-chip { display: none; }
  .cal-day-has-events .cal-day-num::after { content: ''; display: inline-block;
    width: 6px; height: 6px; border-radius: 50%; background: #6c5ce7; margin-left: 4px; vertical-align: middle; }
  .view-toggle-btn span:first-child { display: none; }
}

/* ── Lead Priority Badges ────────────────────── */
.badge-priority-low { background: #f3f4f6; color: #6b7280; }
.badge-priority-medium { background: #fff8eb; color: #d97706; }
.badge-priority-high { background: #fef2f2; color: #dc2626; }
.badge-priority-critical { background: #450a0a; color: #fca5a5; }

/* ── Pipeline Bars ───────────────────────────── */
.pipeline-bar { height: 8px; background: #f0f2f8; border-radius: 4px; overflow: hidden; }
.pipeline-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.pipeline-fill-new { background: #2980b9; }
.pipeline-fill-contacted { background: #7c3aed; }
.pipeline-fill-qualified { background: #d97706; }
.pipeline-fill-proposal { background: #0d9488; }
.pipeline-fill-negotiation { background: #4f46e5; }
.pipeline-fill-won { background: #059669; }
.pipeline-fill-lost { background: #dc2626; }

/* ── Form Fieldsets ──────────────────────────── */
.lead-form { padding: 1.5rem; }
.form-fieldset { border: 1px solid #e8e8f0; border-radius: 8px; padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; }
.form-fieldset legend { font-weight: 700; font-size: 0.95rem; color: #1a1a2e; padding: 0 0.5rem; }
.form-fieldset .form-grid-2 { padding: 0; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1.25rem; }
.lead-form > .form-actions { padding: 1.25rem 0 0; margin-top: 0.5rem; border-top: 1px solid #e8e8f0; }
.form-fieldset .form-group { margin-bottom: 0.5rem; }
.form-fieldset .form-group:last-child { margin-bottom: 0; }
.form-fieldset > .form-grid-2 + .form-group { margin-top: 0.75rem; }

/* ── Interaction Timeline ────────────────────── */
.interaction-timeline { padding: 0; }

/* ── Lead Detail Layout ──────────────────────── */
.lead-detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.lead-detail-info { grid-column: 1 / -1; }
.lead-detail-info .detail-meta { margin: 0; padding: 1rem 16px; border-top: 1px solid #eee; font-size: 0.82rem; color: #888; }
@media (max-width: 900px) { .lead-detail-layout { grid-template-columns: 1fr; } }

/* ── Company Detail Layout ───────────────────── */
.company-detail-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.company-detail-info { grid-column: 1 / -1; }
.company-detail-info .detail-meta { margin: 0; padding: 1rem 16px; border-top: 1px solid #eee; font-size: 0.82rem; color: #888; }
@media (max-width: 900px) { .company-detail-layout { grid-template-columns: 1fr; } }
.interaction-item { padding: 1rem 1.5rem; border-bottom: 1px solid #f0f2f8; }
.interaction-item:last-child { border-bottom: none; }
.interaction-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem; }
.interaction-type-badge { font-size: 0.82rem; font-weight: 600; }
.interaction-meta { font-size: 0.78rem; color: #888; }
.interaction-subject { font-size: 0.92rem; margin-bottom: 0.25rem; }
.interaction-body { font-size: 0.85rem; color: #555; line-height: 1.5; }

@media (max-width: 768px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

/* ── Import Column Mapping Grid ──────────────── */
.import-mapping-grid {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  gap: 0.75rem 1rem;
  align-items: center;
}
.import-mapping-header {
  font-weight: 600; font-size: 0.82rem; color: #888; text-transform: uppercase;
}
.import-mapping-arrow {
  text-align: center; color: #aaa; font-size: 1.1rem;
}
.import-mapping-label {
  padding: 0.5rem 0.75rem; background: #f8f9fa; border-radius: 6px;
  font-weight: 500; word-break: break-word; min-width: 0;
}
.import-mapping-select {
  min-width: 0;
}
.import-mapping-select select {
  width: 100%;
}
.import-footer {
  padding: 1.5rem; display: flex; justify-content: space-between;
  align-items: center; gap: 1rem; flex-wrap: wrap;
}
.import-footer-hint {
  font-size: 0.9rem; color: #666; flex: 1; min-width: 200px;
}
.import-footer-actions {
  display: flex; gap: 0.5rem; flex-shrink: 0;
}

/* Small laptops: stack label above select */
@media (max-width: 1100px) {
  .import-mapping-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .import-mapping-header:nth-child(2),
  .import-mapping-header:nth-child(3) { display: none; }
  .import-mapping-header:first-child {
    margin-bottom: 0.5rem;
  }
  .import-mapping-arrow { display: none; }
  .import-mapping-label {
    margin-top: 0.75rem;
    border-radius: 6px 6px 0 0;
    font-size: 0.82rem;
    color: #555;
    padding: 0.4rem 0.75rem;
  }
  .import-mapping-select {
    margin-bottom: 0;
  }
  .import-mapping-select select {
    border-radius: 0 0 6px 6px;
    border-top: none;
  }
}

/* ── Searchable Select ───────────────────────────── */
.ss-wrapper { position: relative; }
.ss-display {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 9px 12px; border: 1px solid #ddd; border-radius: 8px;
  font-size: 14px; color: #1a1a2e; background: #fafafa; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ss-display:focus, .ss-open .ss-display {
  border-color: #6c5ce7; box-shadow: 0 0 0 3px rgba(108,92,231,0.12); background: #fff; outline: none;
}
.ss-display-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-placeholder { color: #999; }
.ss-arrow { font-size: 10px; color: #999; margin-left: 8px; transition: transform 0.15s; }
.ss-open .ss-arrow { transform: rotate(180deg); }

.ss-dropdown {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  margin-top: 4px; background: #fff; border: 1px solid #ddd; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12); overflow: hidden;
}
.ss-open .ss-dropdown { display: block; }

.ss-search {
  width: 100%; padding: 9px 12px; border: none; border-bottom: 1px solid #eee;
  font-size: 13px; outline: none; background: #fafafa;
}
.ss-search:focus { background: #fff; }

.ss-list {
  list-style: none; max-height: 220px; overflow-y: auto; padding: 4px 0; margin: 0;
}
.ss-option {
  padding: 8px 12px; font-size: 13px; cursor: pointer; transition: background 0.1s;
}
.ss-option:hover { background: #f0eeff; }
.ss-option.ss-selected { background: #ede9fe; color: #6c5ce7; font-weight: 600; }

/* AJAX select extras */
.ajax-ss-clear {
  font-size: 16px; color: #999; cursor: pointer; margin-left: 4px; margin-right: 2px;
  line-height: 1; padding: 0 4px; border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}
.ajax-ss-clear:hover { color: #dc2626; background: #fef2f2; }
.ss-loading, .ss-no-results {
  padding: 10px 14px; font-size: 13px; color: #888; text-align: center;
  list-style: none;
}
.ss-loading { font-style: italic; }

/* ── Galley File Card ────────────────────────────── */
.file-card {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem;
  background: #f8f9fa; border: 1px solid #e5e7eb; border-radius: 8px; margin-top: 0.5rem;
}
.file-card-icon { font-size: 1.5rem; flex-shrink: 0; }
.file-card-info { flex: 1; min-width: 0; }
.file-card-name {
  font-size: 0.85rem; font-weight: 500; color: #1a1a2e;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-card-meta { font-size: 0.75rem; color: #888; margin-top: 2px; }
.file-card-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* ── Impersonation Banner ────────────────────── */
.impersonation-banner {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
  color: #78350f;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 14px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.impersonation-banner strong {
  color: #92400e;
}
.btn-impersonate-stop {
  background: #78350f;
  color: #fef3c7;
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-impersonate-stop:hover {
  background: #451a03;
  color: #fff;
}
.btn-impersonate {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
}
.btn-impersonate:hover {
  background: #fbbf24;
  color: #78350f;
}
.btn-impersonate-lg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid #f59e0b;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #78350f;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
  transition: all 0.15s;
}
.btn-impersonate-lg:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #451a03;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

/* ── Active Role Banner ──────────────────────── */
.active-role-banner {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
  color: #1e3a5f;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 13px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.active-role-banner strong { color: #1e3a8a; }
.btn-role-clear {
  background: #1e3a5f;
  color: #dbeafe;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.btn-role-clear:hover { background: #1e3a8a; color: #fff; }

/* ── Role Switcher (Sidebar) ─────────────────── */
.role-switcher { position: relative; margin-bottom: 8px; }
.btn-role-switch {
  display: block;
  width: 100%;
  text-align: center;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(108,92,231,0.2);
  color: #c8c8e8;
  border: 1px solid rgba(108,92,231,0.3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-role-switch:hover { background: rgba(108,92,231,0.4); color: #fff; }
.role-switcher-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: #1e1e3a;
  border: 1px solid rgba(108,92,231,0.3);
  border-radius: 8px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
  margin-bottom: 6px;
  overflow: hidden;
  z-index: 100;
}
.role-switcher-dropdown.open { display: block; }
.role-switcher-header {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #9999cc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.role-switcher-item { margin: 0; }
.role-switcher-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: none;
  border: none;
  color: #c8c8e8;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}
.role-switcher-btn:hover { background: rgba(108,92,231,0.25); color: #fff; }
.role-switcher-btn.active { color: #a78bfa; font-weight: 700; }
.role-switcher-all {
  border-top: 1px solid rgba(255,255,255,0.06);
  color: #60a5fa;
  font-size: 12px;
}
.role-switcher-all:hover { background: rgba(96,165,250,0.15); }

/* ── HR Module — Form Grid & Card Fixes ──────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1.25rem;
  padding: 1.25rem 1.5rem;
}
@media (max-width: 768px) { .form-grid { grid-template-columns: 1fr; } }

/* Cards that directly contain forms (no .form-card class) */
.card:not(.form-card) > form {
  padding: 1.25rem 1.5rem;
}
.card:not(.form-card) > form > .form-grid {
  padding: 0;
}
.card:not(.form-card) > form > .form-actions {
  margin-top: 1rem;
}

/* Headings inside cards (Components, Payslips, Line Items, etc.) */
.card > h3,
.card > form > h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  padding: 1rem 1.5rem 0.5rem;
  margin: 0;
}
.card:not(.form-card) > form > h3 {
  padding: 1rem 0 0.5rem;
}

/* Tables inside cards need no extra padding (table cells have their own) */
.card:not(.form-card) > form > .table {
  margin: 0 -1.5rem;
  width: calc(100% + 3rem);
}

/* Detail info blocks inside .form-grid (payslip, leave, expense, onboarding details) */
.card > .form-grid div {
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
}
.card > .form-grid div strong {
  color: #555;
  font-weight: 600;
}

/* Paragraphs directly inside cards (description, remarks) */
.card > p {
  padding: 1rem 1.5rem;
  margin: 0;
  font-size: 14px;
  color: #374151;
  line-height: 1.6;
}
.card > p + p {
  padding-top: 0;
}

/* Card body: generic padded container inside a card (for action groups, info blocks, etc.) */
.card-body {
  padding: 1rem 1.5rem;
}

/* Tables inside formsets: full bleed within the card form */
.card:not(.form-card) > form > .table th:first-child,
.card:not(.form-card) > form > .table td:first-child {
  padding-left: 1.5rem;
}
.card:not(.form-card) > form > .table th:last-child,
.card:not(.form-card) > form > .table td:last-child {
  padding-right: 1.5rem;
}

/* Table total row */
.table-total td {
  border-top: 2px solid #e5e7eb;
  background: #fafafa;
  font-weight: 700;
}

/* Net pay highlight */
.net-pay-row td {
  background: #f0fdf4;
  font-size: 1.05rem;
}

/* Status badge next to page header title */
.page-header > .badge,
.page-header > span.badge {
  align-self: center;
  margin-left: 12px;
}

/* ── Sortable Table Headers ──────────────────── */
.sort-link {
  color: #666; text-decoration: none; display: inline-flex; align-items: center;
  gap: 6px; white-space: nowrap; transition: color 0.15s; user-select: none;
  cursor: pointer;
}
.sort-link:hover { color: #6c5ce7; text-decoration: none; }
.sort-link:hover .sort-arrows { opacity: 1; }
th.sort-active .sort-link { color: #6c5ce7; font-weight: 700; }
th.sort-active { background: #f5f3ff; }

/* Arrow container — stacks ▲ above ▼ */
.sort-arrows {
  display: inline-flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; width: 10px;
  flex-shrink: 0; margin-left: 2px; transition: opacity 0.15s;
}

/* Individual arrow triangles (CSS borders) */
.arrow-up, .arrow-down {
  display: block; width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  transition: opacity 0.15s, border-color 0.15s;
}
.arrow-up   { border-bottom: 5px solid currentColor; }   /* ▲ */
.arrow-down { border-top:    5px solid currentColor; }   /* ▼ */

/* ── Unsorted: both arrows visible but faded ── */
.sort-arrows.sort-unsorted { opacity: 0.3; }

/* ── Sorted ascending: up arrow highlighted, down arrow hidden ── */
.sort-arrows.sort-asc { opacity: 1; }
.sort-arrows.sort-asc .arrow-up   { border-bottom-color: #6c5ce7; }
.sort-arrows.sort-asc .arrow-down { display: none; }

/* ── Sorted descending: down arrow highlighted, up arrow hidden ── */
.sort-arrows.sort-desc { opacity: 1; }
.sort-arrows.sort-desc .arrow-down { border-top-color: #6c5ce7; }
.sort-arrows.sort-desc .arrow-up   { display: none; }

/* ══════════════════════════════════════════════════════════════════════
   AWESOME BAR — Universal Search & Navigation
   ═════════════════════════════════════════════════════════════════════ */

/* Trigger button in sidebar */
.ab-trigger { display: flex; align-items: center; gap: 8px; padding: 8px 14px;
              margin: 8px 10px; border-radius: 8px; background: rgba(255,255,255,0.06);
              cursor: pointer; transition: background 0.2s; border: 1px solid rgba(255,255,255,0.08); }
.ab-trigger:hover { background: rgba(108,92,231,0.25); }
.ab-trigger-icon { font-size: 14px; }
.ab-trigger-text { flex: 1; font-size: 13px; color: #a8a8c8; }
.ab-trigger-shortcut { font-size: 10px; color: #6666aa; background: rgba(255,255,255,0.08);
                        padding: 2px 6px; border-radius: 4px; font-family: monospace; }

/* Overlay */
.ab-overlay { display: none; position: fixed; inset: 0; z-index: 9999;
              background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
              justify-content: center; align-items: flex-start; padding-top: 12vh; }

/* Dialog */
.ab-dialog { width: 580px; max-width: 90vw; background: #fff; border-radius: 14px;
             box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(0,0,0,0.06);
             overflow: hidden; animation: ab-slide-in 0.15s ease-out; }

@keyframes ab-slide-in {
  from { opacity: 0; transform: translateY(-20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Input area */
.ab-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 18px;
                 border-bottom: 1px solid #e8e8ee; }
.ab-search-icon { font-size: 18px; flex-shrink: 0; }
.ab-input { flex: 1; border: none; outline: none; font-size: 16px; color: #1a1a2e;
            background: transparent; font-family: inherit; }
.ab-input::placeholder { color: #999; }
.ab-shortcut-hint { font-size: 10px; color: #999; background: #f0f0f4; padding: 3px 8px;
                    border-radius: 4px; font-family: monospace; flex-shrink: 0; }

/* Results area */
.ab-results { max-height: 400px; overflow-y: auto; padding: 6px 0; }
.ab-results-heading { padding: 8px 18px 4px; font-size: 11px; text-transform: uppercase;
                      letter-spacing: 0.5px; color: #888; font-weight: 600; }
.ab-section-label { padding: 10px 18px 4px; font-size: 10px; text-transform: uppercase;
                    letter-spacing: 0.8px; color: #aaa; font-weight: 600;
                    border-top: 1px solid #f0f0f4; margin-top: 4px; }
.ab-section-label:first-child { border-top: none; margin-top: 0; }

/* Result item */
.ab-result-item { display: flex; align-items: center; gap: 10px; padding: 10px 18px;
                  text-decoration: none; color: #333; cursor: pointer;
                  transition: background 0.1s; }
.ab-result-item:hover, .ab-result-item.ab-selected { background: #f0f0ff; }
.ab-result-item.ab-selected { background: #ebe8ff; }
.ab-item-icon { font-size: 16px; width: 24px; text-align: center; flex-shrink: 0; }
.ab-item-label { flex: 1; font-size: 14px; font-weight: 500; }
.ab-item-section { font-size: 11px; color: #aaa; flex-shrink: 0; }

/* Empty state */
.ab-empty { padding: 30px 18px; text-align: center; color: #999; font-size: 13px; }

/* ── Payroll Happy-Flow Navigation Bar ──────────────────────────────── */
.payroll-flow-nav {
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
  border: 1px solid #d8daf0;
  border-radius: 10px;
  margin-bottom: 18px;
  padding: 0;
  position: relative;
  z-index: 10;
}
.payroll-flow-nav .flow-toggle {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  color: #4a4a6a; width: 100%;
}
.payroll-flow-nav .flow-toggle:hover { color: #6c5ce7; }
.payroll-flow-nav .flow-toggle-chevron {
  margin-left: auto; transition: transform 0.2s; font-size: 14px;
}
.payroll-flow-nav.expanded .flow-toggle-chevron { transform: rotate(90deg); }
.payroll-flow-nav .flow-steps-wrapper {
  display: none; padding: 0 16px 14px;
}
.payroll-flow-nav.expanded .flow-steps-wrapper { display: block; }

/* Step strip */
.flow-steps {
  display: flex; align-items: center; gap: 4px;
  overflow-x: auto; padding: 4px 0 8px;
  scrollbar-width: thin;
}
.flow-steps::-webkit-scrollbar { height: 4px; }
.flow-steps::-webkit-scrollbar-thumb { background: #c0c0d8; border-radius: 4px; }

.flow-step {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 16px;
  font-size: 11.5px; font-weight: 500;
  text-decoration: none; white-space: nowrap;
  background: #e8e8f0; color: #666;
  border: 1.5px solid transparent;
  transition: all 0.15s;
}
.flow-step:hover { background: #ddd8f8; color: #5b4cc4; border-color: #b8b0e8; }
.flow-step .flow-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 10px; font-weight: 700;
  background: #ccc; color: #fff;
}
.flow-step.active {
  background: #6c5ce7; color: #fff; border-color: #5b4cc4;
  box-shadow: 0 2px 8px rgba(108,92,231,0.3);
}
.flow-step.active .flow-num { background: rgba(255,255,255,0.3); color: #fff; }
.flow-step.active:hover { background: #5b4cc4; }
.flow-step.done { background: #d4edda; color: #155724; border-color: #b8dfc2; }
.flow-step.done .flow-num { background: #28a745; color: #fff; }
.flow-step.done:hover { background: #c3e6cb; }

.flow-arrow { color: #aaa; font-size: 12px; flex-shrink: 0; }
.flow-divider { color: #c0b8e8; font-size: 16px; margin: 0 4px; flex-shrink: 0; }
.flow-group-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.8px;
  color: #8888aa; font-weight: 700; margin-right: 2px; white-space: nowrap;
}

/* Prev / Next row */
.flow-prev-next {
  display: flex; align-items: center; gap: 8px;
  padding-top: 8px; border-top: 1px solid #e0e0f0;
  margin-top: 4px;
}
.flow-step-indicator {
  font-size: 11px; color: #8888aa; font-weight: 600; margin: 0 auto;
}
.flow-prev-next .btn { font-size: 12px; padding: 4px 12px; }

/* Responsive: show toggle label only on wider screens */
@media (max-width: 640px) {
  .flow-toggle-label { display: none; }
  .flow-step .flow-label { display: none; }
  .flow-step { padding: 4px 6px; }
  .flow-group-label { display: none; }
}

/* ── Project Tabs ─────────────────────────────── */
.project-tab {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  color: #666; text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s;
  white-space: nowrap;
}
.project-tab:hover { color: #2563eb; background: #f0f7ff; }
.project-tab.active { color: #2563eb; border-bottom-color: #2563eb; }

/* ── Kanban / Board ───────────────────────────── */
.kanban-card:active { cursor: grabbing; opacity: 0.7; }
