/* ============ SecurelyX — Base design system ============ */
:root {
  --primary: #7C3AED;
  --primary-dark: #6D28D9;
  --primary-medium: #8B5CF6;
  --primary-light: #A78BFA;
  --purple-soft: #EDE9FE;
  --purple-ultra-soft: #F5F3FF;
  --bg-page: #F8F7FC;
  --bg-card: #FFFFFF;
  --text-primary: #111827;
  --text-secondary: #374151;
  --text-muted: #6B7280;
  --text-disabled: #9CA3AF;
  --border: #E5E7EB;
  --border-soft: #F3F4F6;
  --success: #10B981;
  --success-soft: #ECFDF5;
  --warning: #F59E0B;
  --warning-soft: #FFFBEB;
  --danger: #EF4444;
  --danger-soft: #FEF2F2;
  --info: #3B82F6;
  --info-soft: #EFF6FF;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 8px 24px rgba(124, 58, 237, 0.08);
  --shadow-lg: 0 16px 48px rgba(17, 24, 39, 0.12);
  --r-btn: 12px;
  --r-input: 12px;
  --r-card: 16px;
  --r-modal: 20px;
  --r-badge: 999px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'Poppins', 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }

h1 { font-size: 36px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 28px; font-weight: 700; line-height: 1.25; }
h3 { font-size: 22px; font-weight: 600; }
h4 { font-size: 18px; font-weight: 600; }
small, .small { font-size: 13px; }
.tiny { font-size: 12px; }
.muted { color: var(--text-muted); }
.mono { font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace; font-size: 13px; }
.b { font-weight: 600; }
.text-grad {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 820px; }
.section { padding: 64px 0; }
.section-tight { padding-top: 48px; }
.section-soft { background: var(--purple-ultra-soft); }
.section-gap { height: 24px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 40px; }
.section-head h2 { margin-bottom: 8px; }
.section-head p { color: var(--text-muted); }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r-btn); border: none;
  font-family: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer;
  transition: all .18s ease; text-decoration: none; line-height: 1.3;
  min-height: 40px;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #7C3AED, #8B5CF6);
  color: #FFFFFF;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.20);
}
.btn-primary:hover {
  color: #fff; transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(124, 58, 237, 0.30);
  filter: brightness(1.05);
}
.btn-secondary { background: #fff; color: var(--primary-dark); border: 1px solid #E9D5FF; }
.btn-secondary:hover { background: var(--purple-ultra-soft); }
.btn-ghost { background: transparent; color: var(--primary-dark); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--purple-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 32px; }
.btn-lg { padding: 13px 26px; font-size: 16px; min-height: 48px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: var(--r-input);
  background: #fff; color: var(--text-primary);
  font-family: inherit; font-size: 14.5px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12); }
textarea.form-input { resize: vertical; }
select.form-input { appearance: auto; cursor: pointer; }
.form-hint { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 5px; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; color: var(--text-secondary); }
.checkbox input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-card { display: flex; gap: 10px; padding: 12px; border: 1.5px solid var(--border); border-radius: var(--r-btn); cursor: pointer; transition: border-color .15s, background .15s; align-items: flex-start; }
.radio-card:hover { background: var(--purple-ultra-soft); }
.radio-card input { margin-top: 3px; accent-color: var(--primary); }
.radio-card span b { display: block; font-size: 14px; color: var(--text-primary); }
.radio-card span i { font-style: normal; font-size: 12px; color: var(--text-muted); }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--purple-ultra-soft); }
.code-area { font-family: 'JetBrains Mono', monospace; font-size: 13px; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: box-shadow .2s ease;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 17px; font-weight: 600; }
.form-card { padding: 24px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--r-badge);
  font-size: 12px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: #047857; }
.badge-warning { background: var(--warning-soft); color: #B45309; }
.badge-danger { background: var(--danger-soft); color: #B91C1C; }
.badge-muted { background: #F3F4F6; color: var(--text-muted); }
.badge-info { background: var(--info-soft); color: #1D4ED8; }
.badge-purple { background: var(--purple-soft); color: var(--primary-dark); }

/* ---------- Alerts ---------- */
.alert {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-radius: var(--r-btn);
  font-size: 14px; margin-bottom: 16px; border: 1px solid transparent;
  animation: slideDown .25s ease;
}
.alert b { font-weight: 700; }
.alert-success { background: var(--success-soft); color: #065F46; border-color: #A7F3D0; }
.alert-danger { background: var(--danger-soft); color: #991B1B; border-color: #FECACA; }
.alert-info { background: var(--info-soft); color: #1E40AF; border-color: #BFDBFE; }
.alert-warning { background: var(--warning-soft); color: #92400E; border-color: #FDE68A; }
.alert-close { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: .7; line-height: 1; }
.alert-close:hover { opacity: 1; }

/* ---------- Tables ---------- */
.table-card { overflow-x: auto; border-radius: var(--r-card); border: 1px solid var(--border-soft); background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th {
  text-align: left; padding: 12px 16px; font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border-soft); background: var(--purple-ultra-soft);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--purple-ultra-soft); }
.actions-cell { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.inline-form { display: inline-flex; }

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center; padding: 56px 24px;
  background: #fff; border: 1px dashed var(--border); border-radius: var(--r-card);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; margin-bottom: 6px; }
.empty-state p { color: var(--text-muted); font-size: 14px; margin-bottom: 18px; }

/* ---------- Links & misc ---------- */
.link { color: var(--primary); font-weight: 500; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-btn);
  color: var(--text-primary); transition: background .15s;
}
.list-item:hover { background: var(--purple-ultra-soft); color: var(--text-primary); }
.list-item > div { display: flex; flex-direction: column; }
.list-item span { font-size: 13px; }
.notif-item { padding: 10px 12px; border-radius: var(--r-btn); background: var(--purple-ultra-soft); margin-bottom: 8px; display: flex; flex-direction: column; gap: 2px; }
.notif-item b { font-size: 14px; }
.notif-item .muted { font-size: 13px; }
.scope-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Code blocks ---------- */
.code-block {
  background: #1E1B4B; border-radius: var(--r-card); overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .06);
}
.code-block-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: rgba(255, 255, 255, .05);
  color: #C4B5FD; font-size: 12.5px; font-weight: 600;
}
.code-block pre { padding: 16px; overflow-x: auto; }
.code-block code, pre code {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; color: #E9E4FF; line-height: 1.65;
}
pre { white-space: pre-wrap; word-break: break-word; }
.copy-btn {
  background: rgba(124, 58, 237, .35); color: #fff; border: none;
  padding: 4px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; font-family: inherit;
}
.copy-btn:hover { background: rgba(124, 58, 237, .6); }

/* ---------- Hamburger ---------- */
.hamburger {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 8px; font-size: 18px; padding: 6px 10px;
  cursor: pointer; color: var(--text-primary); line-height: 1;
}

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination-info { font-size: 13px; color: var(--text-muted); margin-right: auto; }
.pagination-btn {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  font-size: 13px; color: var(--text-secondary); background: #fff; min-width: 36px; text-align: center;
}
.pagination-btn:hover { border-color: var(--primary); color: var(--primary); }
.pagination-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar .form-input { max-width: 320px; }
.filter-bar-multi .form-input { max-width: 190px; }

/* ---------- Page head ---------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h1 { font-size: 24px; margin-bottom: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stats-grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stats-card {
  display: flex; gap: 14px; align-items: center;
  background: #fff; border: 1px solid var(--border-soft);
  border-radius: var(--r-card); padding: 16px 18px;
  box-shadow: var(--shadow-sm); color: var(--text-primary);
  transition: transform .15s ease, box-shadow .15s ease;
}
.stats-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text-primary); }
.stats-icon { font-size: 26px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--purple-ultra-soft); border-radius: 12px; flex-shrink: 0; }
.stats-body { display: flex; flex-direction: column; min-width: 0; }
.stats-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.stats-value { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.stats-hint { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Charts ---------- */
.chart-wrap { position: relative; height: 260px; }

/* ---------- Grids ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 20px; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-action {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 16px; border: 1px solid var(--border-soft); border-radius: var(--r-btn);
  font-weight: 600; font-size: 14px; color: var(--text-primary);
  transition: all .15s ease;
}
.quick-action:hover { background: var(--purple-ultra-soft); border-color: var(--purple-soft); color: var(--text-primary); transform: translateY(-1px); }
.quick-action span { font-size: 22px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .5);
  display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; animation: fadeIn .18s ease; }
.modal {
  background: #fff; border-radius: var(--r-modal); max-width: 460px; width: 100%;
  box-shadow: var(--shadow-lg); animation: popIn .2s ease;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-head h3 { font-size: 17px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 14px 22px; color: var(--text-secondary); font-size: 14.5px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 20px; }

/* ---------- Danger zone ---------- */
.danger-zone { border: 1px solid #FECACA; background: #FFFBFA; }

/* ---------- Animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseSoft { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 30px; } h2 { font-size: 24px; }
}
@media (max-width: 768px) {
  .section { padding: 44px 0; }
  h1 { font-size: 26px; } h2 { font-size: 21px; } h3 { font-size: 18px; }
  .form-row-2, .form-row-3, .radio-cards, .checkbox-grid { grid-template-columns: 1fr; }
  .btn { width: auto; }
  .stats-grid, .stats-grid-4 { grid-template-columns: 1fr 1fr; }
  .filter-bar .form-input, .filter-bar-multi .form-input { max-width: 100%; flex: 1 1 140px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
}
@media (max-width: 640px) {
  .stats-grid, .stats-grid-4 { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .actions-cell { flex-wrap: wrap; }
}
