/* ── COMPLI UI — Clean Light Theme ── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

:root {
  --bg:          #f8f9fb;
  --surface:     #ffffff;
  --surface-2:   #f1f3f7;
  --border:      #e2e6ed;
  --border-2:    #cbd2db;
  --text:        #111827;
  --text-2:      #4b5563;
  --text-3:      #9ca3af;
  --accent:      #059669;
  --accent-light:#d1fae5;
  --accent-dark: #047857;
  --blue:        #2563eb;
  --blue-light:  #dbeafe;
  --warn:        #d97706;
  --warn-light:  #fef3c7;
  --danger:      #dc2626;
  --danger-light:#fee2e2;
  --purple:      #7c3aed;
  --purple-light:#ede9fe;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:   0 10px 15px rgba(0,0,0,.07), 0 4px 6px rgba(0,0,0,.05);
  --font:        'Inter', system-ui, sans-serif;
  --mono:        'DM Mono', monospace;
  --sidebar-w:   240px;
  --topbar-h:    60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--text);
       line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── LAYOUT ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  overflow-y: auto;
}

.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-content { padding: 28px; flex: 1; }

/* ── SIDEBAR BRAND ── */
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.03em;
}
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.brand-sub  { font-size: 10px; color: var(--text-3); font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }

/* ── SIDEBAR NAV ── */
.sidebar-nav { padding: 12px 10px; flex: 1; }
.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 10px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-2);
  transition: all .15s;
  margin-bottom: 1px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-light); color: var(--accent-dark); font-weight: 500; }
.nav-item .icon { width: 18px; height: 18px; opacity: .7; flex-shrink: 0; }
.nav-item.active .icon { opacity: 1; }

/* ── SIDEBAR FOOTER ── */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
}
.sidebar-footer .org-name { font-weight: 500; color: var(--text-2); font-size: 13px; }
.sidebar-footer .user-role { font-size: 11px; font-family: var(--mono); color: var(--text-3); }

/* ── TOPBAR ── */
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-weight: 600; font-size: 14px; }
.card-body  { padding: 20px 22px; }

/* ── STAT CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.stat-sub   { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stat-card.green  .stat-value { color: var(--accent); }
.stat-card.blue   .stat-value { color: var(--blue); }
.stat-card.warn   .stat-value { color: var(--warn); }
.stat-card.danger .stat-value { color: var(--danger); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600;
           letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
           border-bottom: 1px solid var(--border); background: var(--surface-2); }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
}
.badge.green   { background: var(--accent-light);  color: var(--accent-dark); }
.badge.blue    { background: var(--blue-light);    color: var(--blue); }
.badge.warn    { background: var(--warn-light);    color: var(--warn); }
.badge.danger  { background: var(--danger-light);  color: var(--danger); }
.badge.purple  { background: var(--purple-light);  color: var(--purple); }
.badge.neutral { background: var(--surface-2);     color: var(--text-2); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-2); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger-light); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: var(--radius); }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(5,150,105,.1);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ── PROGRESS BAR ── */
.progress-bar-wrap { background: var(--surface-2); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 20px; background: var(--accent); transition: width .4s ease; }
.progress-bar-fill.warn   { background: var(--warn); }
.progress-bar-fill.danger { background: var(--danger); }

/* ── ALERTS / FLASH ── */
.flash { padding: 12px 16px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.flash.success { background: var(--accent-light); color: var(--accent-dark); border-color: #a7f3d0; }
.flash.error   { background: var(--danger-light); color: var(--danger);      border-color: #fecaca; }
.flash.warn    { background: var(--warn-light);   color: var(--warn);        border-color: #fcd34d; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-3); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state p  { font-size: 13.5px; }

/* ── AUTH PAGES ── */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.auth-card  { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 40px; }
.auth-logo  { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.auth-title { font-size: 22px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.02em; }
.auth-sub   { font-size: 13.5px; color: var(--text-3); margin-bottom: 28px; }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.page-title  { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.page-sub    { font-size: 13.5px; color: var(--text-3); margin-top: 2px; }

/* ── TABS ── */
.tab-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-item { padding: 10px 16px; font-size: 13.5px; font-weight: 500; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .15s; cursor: pointer; }
.tab-item:hover { color: var(--text-2); }
.tab-item.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-box { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-weight: 600; font-size: 15px; }
.modal-body   { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── SEVERITY COLORS ── */
.sev-critical { color: var(--danger); }
.sev-high     { color: #ea580c; }
.sev-medium   { color: var(--warn); }
.sev-low      { color: var(--blue); }
.sev-informational { color: var(--text-3); }

/* ── NOTIFICATION BELL ── */
.notif-bell-wrap { position: relative; }
.notif-bell-btn { position: relative; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 600;
  min-width: 16px; height: 16px;
  border-radius: 10px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.notif-dropdown {
  position: absolute; top: 42px; right: 0;
  width: 360px; max-height: 480px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 100; display: flex; flex-direction: column;
}
.notif-dropdown-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13.5px;
}
.notif-dropdown-body { flex: 1; overflow-y: auto; max-height: 340px; }
.notif-dropdown-footer {
  padding: 10px 16px; border-top: 1px solid var(--border);
  text-align: center; font-size: 12.5px;
}
.notif-dropdown-footer a { color: var(--accent); font-weight: 500; }
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px; cursor: pointer; transition: background .1s;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { border-left: 3px solid var(--accent); }
.notif-item .notif-title { font-weight: 500; color: var(--text); margin-bottom: 2px; }
.notif-item .notif-time { font-size: 11px; color: var(--text-3); }

/* ── RISK HEATMAP ── */
.heatmap-grid {
  display: grid; grid-template-columns: auto repeat(5, 1fr);
  gap: 3px; max-width: 360px;
}
.heatmap-label {
  font-size: 10px; font-weight: 500; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  padding: 2px 6px; text-transform: uppercase; letter-spacing: .04em;
}
.heatmap-cell {
  aspect-ratio: 1; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  min-width: 36px; min-height: 36px;
}
.heatmap-cell.level-0 { background: var(--surface-2); }
.heatmap-cell.level-1 { background: #d1fae5; color: #047857; }
.heatmap-cell.level-2 { background: #fef3c7; color: #92400e; }
.heatmap-cell.level-3 { background: #fed7aa; color: #c2410c; }
.heatmap-cell.level-4 { background: #fee2e2; color: #dc2626; }
.risk-score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 24px; border-radius: 4px;
  font-size: 12px; font-weight: 600; font-family: var(--mono);
}
.risk-score-badge.low    { background: #d1fae5; color: #047857; }
.risk-score-badge.medium { background: #fef3c7; color: #92400e; }
.risk-score-badge.high   { background: #fed7aa; color: #c2410c; }
.risk-score-badge.critical { background: #fee2e2; color: #dc2626; }

/* ── POLICY ATTESTATION BAR ── */
.attest-bar-wrap {
  display: flex; align-items: center; gap: 10px;
}
.attest-bar-track {
  flex: 1; background: var(--surface-2); border-radius: 20px; height: 6px; overflow: hidden;
}
.attest-bar-fill { height: 100%; border-radius: 20px; background: var(--accent); transition: width .4s ease; }
.attest-bar-label { font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; }

/* ── MARKDOWN RENDERED CONTENT ── */
.md-content { font-size: 14px; line-height: 1.7; color: var(--text); }
.md-content h1 { font-size: 20px; font-weight: 600; margin: 24px 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.md-content h2 { font-size: 17px; font-weight: 600; margin: 20px 0 6px; }
.md-content h3 { font-size: 15px; font-weight: 600; margin: 16px 0 4px; }
.md-content p  { margin: 8px 0; }
.md-content ul, .md-content ol { margin: 8px 0; padding-left: 24px; }
.md-content li { margin-bottom: 4px; }
.md-content code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 3px; font-size: 13px; }
.md-content pre { background: var(--surface-2); padding: 14px; border-radius: var(--radius); overflow-x: auto; margin: 12px 0; }
.md-content pre code { background: none; padding: 0; }
.md-content blockquote { border-left: 3px solid var(--accent); margin: 12px 0; padding: 8px 16px; background: var(--accent-light); border-radius: 0 var(--radius) var(--radius) 0; }

/* ── QUICK GUIDE ── */
.quick-guide {
  background: var(--blue-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}
.quick-guide-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: -0.01em;
}
.quick-guide-toggle:hover { background: rgba(37,99,235,.06); }
.quick-guide-chevron {
  width: 16px;
  height: 16px;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.quick-guide.open .quick-guide-chevron { transform: rotate(180deg); }
.quick-guide-body {
  display: none;
  padding: 0 18px 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
}
.quick-guide.open .quick-guide-body { display: block; }
.quick-guide-body ul {
  margin: 6px 0 0 0;
  padding-left: 18px;
}
.quick-guide-body ul li {
  margin-bottom: 4px;
}
.quick-guide-body strong { color: var(--text); }

/* ── MISC ── */
.mono { font-family: var(--mono); }
.text-muted { color: var(--text-3); }
.text-sm { font-size: 12.5px; }
.fw-500 { font-weight: 500; }
.gap-8  { gap: 8px; }
.flex   { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }

/* ── MOBILE MENU TOGGLE ── */
.mobile-menu-btn { display: none; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .mobile-menu-btn { display: flex; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 49; }
  .sidebar-overlay.open { display: block; }
}
