/* ============================================================
   styles.css — DenwcoreHub Design System + UAT Test Suite
   ============================================================ */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --sidebar-bg: #0b1329;
  --sidebar-hover: #1e293b;
  --sidebar-text: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  --court-internal: #6366f1;
  --court-internal-bg: #e0e7ff;
  --court-partner: #d97706;
  --court-partner-bg: #fef3c7;
  --stage-dev: #64748b;
  --stage-uat: #f59e0b;
  --stage-pilot: #3b82f6;
  --stage-prod: #10b981;
  --ai-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #06b6d4 100%);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Login Screen ─────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #1e1b4b 0%, #0b1329 55%, #020617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #fff;
}

.login-container {
  max-width: 1040px;
  width: 100%;
  text-align: center;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.login-logo-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--ai-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}

.login-logo-text {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.8px;
  background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  color: #94a3b8;
  font-size: 15px;
  margin-bottom: 38px;
}

.login-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
}

.role-card {
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 26px 20px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.role-card:hover {
  transform: translateY(-4px);
  border-color: #818cf8;
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.3);
}

.role-card-icon {
  font-size: 30px;
  display: inline-block;
  margin-bottom: 14px;
}

.role-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 6px;
}

.role-card-desc {
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.45;
}

/* ── App Shell ────────────────────────────────────────────── */
#app-shell {
  display: none;
  min-height: 100vh;
}

#app-shell.active {
  display: flex;
}

.sidebar {
  width: 255px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid #1e293b;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid #1e293b;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ai-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.sidebar-role-pill {
  margin: 14px 16px 6px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.16);
  border: 1px solid rgba(99, 102, 241, 0.35);
  font-size: 12px;
  color: #e0e7ff;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid #1e293b;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ai-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
}

.user-sub {
  font-size: 11px;
  color: #94a3b8;
}

/* ── Main Content & Topbar ────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-content {
  padding: 26px 28px;
  max-width: 1440px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.page-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

/* ── 4-Stage Environment Promotion Stepper ─────────────────── */
.stage-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.stage-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  background: transparent;
  white-space: nowrap;
  transition: all 0.2s;
}

.stage-step.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.stage-step.active.dev { border-left: 3px solid #64748b; }
.stage-step.active.uat { border-left: 3px solid #f59e0b; color: #92400e; background: #fffbeb; }
.stage-step.active.pilot { border-left: 3px solid #3b82f6; color: #1e40af; background: #eff6ff; }
.stage-step.active.prod { border-left: 3px solid #10b981; color: #065f46; background: #ecfdf5; }

.stage-step.complete {
  color: #10b981;
}

.stage-step.locked {
  color: #94a3b8;
  opacity: 0.65;
}

.stage-divider {
  color: #cbd5e1;
  font-size: 12px;
}

.badge-stage-dev { background: #f1f5f9; color: #475569; font-weight: 700; }
.badge-stage-uat { background: #fef3c7; color: #92400e; font-weight: 700; border: 1px solid #fde68a; }
.badge-stage-pilot { background: #dbeafe; color: #1e40af; font-weight: 700; border: 1px solid #bfdbfe; }
.badge-stage-prod { background: #d1fae5; color: #065f46; font-weight: 700; border: 1px solid #a7f3d0; }

/* ── UAT Test Suite Styles ────────────────────────────────── */
.uat-suite-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}

.uat-suite-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.uat-test-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  transition: all 0.15s;
}

.uat-test-card.passed {
  border-left: 4px solid #10b981;
  background: #f0fdf4;
}

.uat-test-card.failed {
  border-left: 4px solid #ef4444;
  background: #fef2f2;
}

.uat-test-card.pending {
  border-left: 4px solid #f59e0b;
}

.uat-test-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.uat-test-title {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}

.uat-test-steps {
  font-family: inherit;
  font-size: 12px;
  color: #334155;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
  margin: 6px 0;
  white-space: pre-line;
}

.uat-test-expected {
  font-size: 12px;
  color: #475569;
  margin-bottom: 6px;
}

.uat-test-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.uat-signoff-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
}

.uat-signoff-box.approved {
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.promotion-lock-warning {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── War Room Active Banner ───────────────────────────────── */
.war-room-banner {
  background: linear-gradient(90deg, #7f1d1d 0%, #991b1b 100%);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #ef4444;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
  animation: pulse-glow 2.5s infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.6); }
}

.war-room-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f87171;
  display: inline-block;
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  from { opacity: 0.3; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.3); }
}

/* ── Cards & Grids ────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--kpi-bg, #eef2ff);
  color: var(--kpi-color, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.kpi-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── View Switcher Buttons ────────────────────────────────── */
.view-toggle {
  display: inline-flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
}

.view-toggle-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.view-toggle-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── Kanban Board Layout ──────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-col {
  background: #f1f5f9;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 480px;
  border: 2px dashed transparent;
  transition: background 0.15s, border-color 0.15s;
}

.kanban-col.drag-over {
  background: #e2e8f0;
  border-color: #6366f1;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 700;
  font-size: 13px;
}

.kanban-col-count {
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px;
  box-shadow: var(--shadow);
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.kanban-card.dragging {
  opacity: 0.4;
}

.kanban-card-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--text);
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* ── "Ball-in-Court" Badges ───────────────────────────────── */
.badge-court-internal {
  background: var(--court-internal-bg);
  color: #3730a3;
  border: 1px solid #c7d2fe;
  font-weight: 700;
}

.badge-court-partner {
  background: var(--court-partner-bg);
  color: #92400e;
  border: 1px solid #fde68a;
  font-weight: 700;
}

/* ── Subtasks & Progress Bars ─────────────────────────────── */
.subtask-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
}

.subtask-item.done {
  text-decoration: line-through;
  color: var(--text-muted);
  background: #f1f5f9;
}

.subtask-item.internal-only {
  border-left: 3px solid #6366f1;
}

.progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  transition: width 0.3s ease;
}

/* ── Approval Gate Sign-Off Cards ─────────────────────────── */
.approval-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 14px;
  margin: 12px 0;
}

.approval-card.pending {
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
}

.approval-card.approved {
  border-left: 4px solid #10b981;
  background: #f0fdf4;
}

.approval-card.rejected {
  border-left: 4px solid #ef4444;
  background: #fef2f2;
}

.approval-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.approval-title {
  font-weight: 700;
  font-size: 13.5px;
}

/* ── Dual SLA Timer Meter ─────────────────────────────────── */
.sla-dual-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}

.sla-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
}

/* ── Denwcore AI Summary Styles ───────────────────────────── */
.btn-ai {
  background: var(--ai-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-ai:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.45);
}

.ai-summary-header {
  margin-bottom: 16px;
}

.ai-badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #6b21a8;
  margin-bottom: 12px;
}

.ai-sparkle-icon {
  font-size: 14px;
  color: #a855f7;
}

.ai-mode-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  overflow-x: auto;
}

.ai-mode-btn {
  border: none;
  background: transparent;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.ai-mode-btn:hover {
  background: #f1f5f9;
  color: var(--text);
}

.ai-mode-btn.active {
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 700;
}

.ai-summary-box {
  background: linear-gradient(180deg, #faf5ff 0%, #ffffff 100%);
  border: 1px solid #e9d5ff;
  border-radius: 12px;
  padding: 16px;
  font-size: 13px;
  line-height: 1.55;
  color: #1e293b;
}

.ai-section-title {
  font-weight: 800;
  font-size: 13.5px;
  color: #581c87;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-key-points {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.ai-point {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
}

.ai-point-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a855f7;
  margin-top: 6px;
  flex-shrink: 0;
}

.ai-loading-placeholder {
  padding: 36px 20px;
  text-align: center;
}

.ai-shimmer-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ai-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.4);
  animation: pulse-shimmer 1.5s infinite ease-in-out;
}

@keyframes pulse-shimmer {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover {
  background: #f8fafc;
}

/* ── Badges & Tags ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: #065f46; }
.badge-warning { background: var(--warning-bg); color: #92400e; }
.badge-danger  { background: var(--danger-bg);  color: #991b1b; }
.badge-info    { background: var(--info-bg);    color: #1e40af; }
.badge-accent  { background: var(--accent-soft); color: #3730a3; }
.badge-neutral { background: #f1f5f9; color: #475569; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  font-size: 11.5px;
  margin: 2px;
}

/* ── Buttons & Inputs ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: #f1f5f9;
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
}
.btn-danger:hover:not(:disabled) {
  background: #fecaca;
}

.btn-success {
  background: #d1fae5;
  color: #065f46;
}
.btn-success:hover:not(:disabled) {
  background: #a7f3d0;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.btn-icon:hover {
  background: #f1f5f9;
}

.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.form-group {
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #334155;
}

.form-label span {
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.search-input {
  max-width: 280px;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13.5px;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* ── Comment Thread ───────────────────────────────────────── */
.comment-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.comment {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.comment-avatar.external { background: #10b981; }
.comment-avatar.internal { background: #4f46e5; }

.comment-bubble {
  flex: 1;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

.comment-bubble.internal {
  background: #fffbeb;
  border-color: #fde68a;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}

.comment-author {
  font-weight: 700;
}

.comment-time {
  color: var(--text-muted);
}

/* ── Permissions & Charts ─────────────────────────────────── */
.perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.perm-row:last-child {
  border-bottom: none;
}

.perm-module {
  font-weight: 600;
  min-width: 140px;
}

.chart-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 0;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}

.bar-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

.donut-chart {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(
    var(--d1, #3b82f6) 0deg var(--p1, 90deg),
    var(--d2, #6366f1) var(--p1, 90deg) var(--p2, 180deg),
    var(--d3, #10b981) var(--p2, 180deg) var(--p3, 270deg),
    #e2e8f0 var(--p3, 270deg) 360deg
  );
  position: relative;
  flex-shrink: 0;
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 24px;
  background: #fff;
  border-radius: 50%;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.donut-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.donut-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ── Modal & Toasts ───────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: 14px;
  max-width: 680px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f8fafc;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slide-in 0.2s ease-out;
}

@keyframes slide-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.fw-600 { font-weight: 600; }
.text-muted { color: var(--text-muted); font-size: 12.5px; }

/* ── File Upload & Dropzone UI ── */
.file-upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  background: #fcfcfd;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}
.file-upload-zone:hover, .file-upload-zone.dragover {
  border-color: var(--accent);
  background: #f5f3ff;
}
.file-upload-icon {
  font-size: 30px;
  margin-bottom: 6px;
}
.file-upload-prompt {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.file-upload-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}
.file-preview-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 10px;
}
.file-preview-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-preview-ext {
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 10.5px;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.file-preview-info {
  display: flex;
  flex-direction: column;
}
.file-preview-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.file-preview-size {
  font-size: 11.5px;
  color: var(--text-muted);
}
.doc-section-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
}
.doc-section-header {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Audit Management & Certificate CLM UI ── */
.audit-engagement-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 4px solid #cbd5e1;
}
.audit-engagement-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-left-color: var(--accent);
}
.audit-engagement-card.selected {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: #fdfcff;
  box-shadow: 0 0 0 1px var(--accent);
}

/* ── Modular Internal Role Badges & Assignment Styles ── */
.badge-role-clm {
  background: #ecfeff;
  color: #0e7490;
  border: 1px solid #a5f3fc;
  font-weight: 600;
}
.badge-role-audit {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
  font-weight: 600;
}
.badge-role-delivery {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 600;
}
.badge-role-issue {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  font-weight: 600;
}
.badge-role-doc {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-weight: 600;
}
.badge-role-admin {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
  font-weight: 600;
}
.badge-role-compliance {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-weight: 600;
}

.role-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.modular-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.role-option-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.role-option-card:hover {
  border-color: var(--accent);
  background: #fbfbfe;
}
.role-option-card.checked {
  border-color: var(--accent);
  background: #f5f3ff;
  box-shadow: 0 0 0 1px var(--accent);
}
.role-option-checkbox {
  margin-top: 3px;
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  cursor: pointer;
}
.role-option-content {
  flex: 1;
}
.role-option-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.role-option-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.role-presets-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  align-items: center;
}
.role-preset-btn {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}
.role-preset-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── External Vendor SSL & Expiry Alert Styling ── */
.badge-vendor-ext {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  font-weight: 600;
  font-size: 10px;
}
.badge-vendor-int {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-weight: 600;
  font-size: 10px;
}
.badge-alert-sent {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-size: 10px;
  font-weight: 600;
}
.badge-alert-due {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 10px;
  font-weight: 700;
  animation: pulse-border 2s infinite;
}
@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.expiry-calc-box {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.expiry-calc-box.danger {
  background: #fef2f2;
  border-color: #f87171;
  border-style: solid;
}
.expiry-calc-box.warning {
  background: #fffbeb;
  border-color: #fcd34d;
  border-style: solid;
}
.expiry-calc-box.success {
  background: #f0fdf4;
  border-color: #86efac;
  border-style: solid;
}

.cert-alert-preview {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 14px;
  font-family: monospace;
  font-size: 11.5px;
  line-height: 1.6;
  margin-bottom: 12px;
  border-left: 4px solid #f59e0b;
}
.cert-alert-preview.critical {
  border-left-color: #ef4444;
}

/* ── Department & Vendor Audit Verification Styles ── */
.badge-dept {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-verified {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-size: 10px;
  font-weight: 600;
}
.badge-pending {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 10px;
  font-weight: 600;
}
.audit-comment-thread {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-top: 8px;
}
.audit-comment-bubble {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 11.5px;
}
.audit-comment-bubble.issue {
  border-left: 3px solid #ef4444;
  background: #fffafa;
}
.audit-comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3px;
  font-size: 10.5px;
  color: var(--text-muted);
}




