/* ============================================================
   CISO Collection Manager — Global tokens & layout
   Hybrid theme: light app body + dark navy sidebar
   ============================================================ */

:root {
  /* Brand palette */
  --c-bg:           #f6f8fb;
  --c-surface:      #ffffff;
  --c-surface-2:    #f1f4f9;
  --c-border:       #e3e8f0;
  --c-border-strong:#cfd6e2;
  --c-text:         #0f172a;
  --c-text-muted:   #5b6779;
  --c-text-dim:     #8893a5;

  --c-primary:      #2f5bea;
  --c-primary-700:  #1f47c9;
  --c-primary-50:   #eaf0ff;

  --c-accent:       #00c2a8;
  --c-accent-50:    #e6faf6;

  --c-warn:         #d97706;
  --c-warn-50:      #fff5e5;
  --c-danger:       #dc2626;
  --c-danger-50:    #fde9e9;
  --c-success:      #16a34a;
  --c-success-50:   #e8f8ee;

  --c-info:         #0ea5e9;
  --c-info-50:      #e3f5fe;

  /* Severity */
  --c-sev-low:      #64748b;
  --c-sev-med:      #d97706;
  --c-sev-high:     #dc2626;
  --c-sev-crit:     #7c1d6f;

  /* Sidebar (dark) */
  --c-sb-bg:        #0b1320;
  --c-sb-bg-2:      #0f1a2e;
  --c-sb-border:    #1f2a44;
  --c-sb-text:      #cbd5e1;
  --c-sb-text-dim:  #7d8aa3;
  --c-sb-active:    #2f5bea;
  --c-sb-hover:     #16213a;

  /* Sizing */
  --sb-width: 248px;
  --topbar-h: 60px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.05);
  --shadow:    0 4px 14px rgba(15,23,42,.07);
  --shadow-lg: 0 16px 40px rgba(15,23,42,.15);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-700); text-decoration: underline; }

h1,h2,h3,h4,h5 { color: var(--c-text); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 4px; }
h3 { font-size: 15px; margin: 0 0 4px; }

.text-muted-2 { color: var(--c-text-muted); }
.text-dim     { color: var(--c-text-dim); }

/* ===== Boot loader ===== */
.boot-loader {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--c-bg);
  z-index: 9999;
  gap: 14px;
}
.boot-logo {
  width: 64px; height: 64px; border-radius: 16px;
  background: linear-gradient(135deg, var(--c-primary) 0%, #6b8aff 100%);
  display: grid; place-items: center;
  color: white; font-size: 28px;
  box-shadow: var(--shadow);
  animation: pulse 1.6s ease-in-out infinite;
}
.boot-text { color: var(--c-text-muted); font-size: 13px; }
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.05); }
}

/* ===== App shell ===== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sb-width) 1fr;
  grid-template-rows: 100vh;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--c-sb-bg);
  color: var(--c-sb-text);
  border-right: 1px solid var(--c-sb-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}
.sb-brand {
  padding: 18px 18px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--c-sb-border);
}
.sb-brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--c-primary) 0%, #6b8aff 100%);
  display: grid; place-items: center;
  color: white; font-size: 16px;
}
.sb-brand-text { line-height: 1.2; }
.sb-brand-name { font-weight: 600; color: white; font-size: 14px; }
.sb-brand-sub  { font-size: 11px; color: var(--c-sb-text-dim); }

.sb-org {
  padding: 14px 18px;
  border-bottom: 1px solid var(--c-sb-border);
}
.sb-org-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-sb-text-dim); margin-bottom: 4px; }
.sb-org-name  { font-weight: 600; color: white; font-size: 13px; }
.sb-org-role  {
  display: inline-block; margin-top: 6px;
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  background: rgba(47,91,234,0.15); color: #93b1ff;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}

.sb-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.sb-nav-group { margin-top: 14px; }
.sb-nav-group:first-child { margin-top: 0; }
.sb-nav-heading {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--c-sb-text-dim);
  padding: 6px 12px 6px;
  font-weight: 600;
}
.sb-link {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; margin: 1px 2px;
  border-radius: 8px;
  color: var(--c-sb-text);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sb-link i { width: 18px; text-align: center; font-size: 14px; color: var(--c-sb-text-dim); }
.sb-link:hover { background: var(--c-sb-hover); color: white; text-decoration: none; }
.sb-link:hover i { color: white; }
.sb-link.active {
  background: rgba(47,91,234,0.18);
  color: white;
  font-weight: 600;
}
.sb-link.active i { color: #93b1ff; }

.sb-user {
  border-top: 1px solid var(--c-sb-border);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.sb-user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #2f5bea, #00c2a8);
  display: grid; place-items: center;
  color: white; font-weight: 600; font-size: 12px;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { color: white; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-email { color: var(--c-sb-text-dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-logout {
  background: transparent; border: 0; color: var(--c-sb-text-dim);
  cursor: pointer; padding: 6px; border-radius: 6px;
}
.sb-user-logout:hover { background: var(--c-sb-hover); color: white; }

/* ===== Main pane ===== */
.app-main {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex; flex-direction: column;
}
.topbar {
  height: var(--topbar-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.view-container { padding: 28px; max-width: 1500px; width: 100%; min-width: 0; overflow-x: auto; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px; flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; font-weight: 600; }
.page-header .page-sub { color: var(--c-text-muted); font-size: 13px; margin-top: 2px; }
.page-header .page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ===== Login page ===== */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--c-bg);
}
.login-art {
  background: linear-gradient(135deg, #0b1320 0%, #1f2a44 60%, #2f5bea 140%);
  color: white;
  padding: 56px 60px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-art::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(47,91,234,0.4), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0,194,168,0.25), transparent 40%);
  pointer-events: none;
}
.login-art > * { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,0.1);
  display: grid; place-items: center;
  font-size: 20px;
  backdrop-filter: blur(6px);
}
.login-brand-name { font-weight: 600; font-size: 16px; }
.login-art-headline {
  font-size: 34px; font-weight: 600; line-height: 1.2; margin-top: 80px;
  letter-spacing: -0.02em;
}
.login-art-headline span { color: #6b8aff; }
.login-art-sub { color: #cbd5e1; font-size: 15px; margin-top: 14px; max-width: 460px; line-height: 1.55; }
.login-art-features { margin-top: 32px; display: grid; gap: 14px; max-width: 460px; }
.login-art-feature { display: flex; gap: 12px; align-items: flex-start; }
.login-art-feature i { color: #00c2a8; margin-top: 3px; }
.login-art-feature-text { color: #e2e8f0; font-size: 13px; }
.login-art-footer { color: #94a3b8; font-size: 12px; }

.login-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.login-card {
  width: 100%; max-width: 380px;
}
.login-card h1 {
  font-size: 26px; margin-bottom: 6px;
}
.login-card .login-sub { color: var(--c-text-muted); margin-bottom: 28px; font-size: 14px; }
.login-card .form-label { font-weight: 500; font-size: 13px; color: var(--c-text); margin-bottom: 6px; }
.login-card .form-control {
  height: 42px; border-radius: 8px; border-color: var(--c-border-strong);
  font-size: 14px;
}
.login-card .form-control:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-50);
}
.login-card .btn-login {
  width: 100%; height: 44px; font-weight: 600;
}
.login-hint {
  margin-top: 18px; padding: 12px 14px;
  background: var(--c-info-50);
  border: 1px solid #b6e1f5;
  border-radius: 8px;
  font-size: 12px;
  color: #075985;
}
.login-hint code { background: white; padding: 1px 5px; border-radius: 4px; font-size: 11px; color: var(--c-text); }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
}

/* ===== Empty / loading states ===== */
.empty {
  padding: 48px 24px; text-align: center;
  color: var(--c-text-muted);
}
.empty-icon {
  font-size: 36px; color: var(--c-text-dim); margin-bottom: 12px;
}
.empty-title { font-weight: 600; color: var(--c-text); font-size: 15px; margin-bottom: 4px; }
.empty-sub { font-size: 13px; }
.empty .btn { margin-top: 16px; }

.spinner-wrap {
  padding: 48px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--c-text-muted); font-size: 13px;
}
.spinner-ring {
  width: 32px; height: 32px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Responsive ===== */
@media (max-width: 960px) {
  :root { --sb-width: 64px; }
  .sb-brand-text, .sb-org, .sb-link span, .sb-nav-heading, .sb-user-info { display: none; }
  .sb-brand { justify-content: center; padding: 18px 0; }
  .sb-link { justify-content: center; padding: 10px 0; }
  .sb-link i { width: auto; }
  .sb-user { justify-content: center; padding: 12px 0; }
  .sb-user-logout { margin-left: 0; }
}
