/* ==========================================================================
   ZeroVault Design System — Phase 4 Polish
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens / Variables
   -------------------------------------------------------------------------- */
:root {
  /* Colors */
  --bg:          #0d1117;
  --bg-elevated: #161b22;
  --bg-card:     rgba(22, 27, 34, 0.85);
  --border:      rgba(255,255,255,0.08);
  --border-focus:rgba(99,179,237,0.6);

  --text:        #e6edf3;
  --text-muted:  #8b949e;
  --text-dim:    #484f58;

  --accent:      #58a6ff;
  --accent-hover:#79c0ff;
  --accent-dim:  rgba(88,166,255,0.12);

  --success:     #3fb950;
  --success-dim: rgba(63,185,80,0.12);
  --warning:     #d29922;
  --warning-dim: rgba(210,153,34,0.12);
  --danger:      #f85149;
  --danger-dim:  rgba(248,81,73,0.12);

  /* Severity */
  --sev-critical: #ff4444;
  --sev-high:     #ff8c00;
  --sev-medium:   #ffd700;
  --sev-low:      #4caf50;

  /* Spacing */
  --sp-xs:  4px;
  --sp-sm:  8px;
  --sp-md:  16px;
  --sp-lg:  24px;
  --sp-xl:  32px;
  --sp-2xl: 48px;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 150ms;
  --dur-med:  250ms;

  /* Sidebar */
  --sidebar-w: 220px;
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--sp-md) 0;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: var(--sp-xl);
  max-width: 1100px;
}

/* --------------------------------------------------------------------------
   4. Sidebar
   -------------------------------------------------------------------------- */
.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 0 var(--sp-md);
  margin-bottom: var(--sp-lg);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.logo svg { width: 22px; height: 22px; color: var(--accent); }

.nav-links {
  list-style: none;
  flex: 1;
  overflow-y: auto;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 10px var(--sp-md);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  border-radius: 0;
  position: relative;
}
.nav-links a svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-links a.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}
.nav-links a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-footer {
  padding: var(--sp-md);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.vault-status-pill {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: var(--sp-xs) 0;
  margin-bottom: var(--sp-sm);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
  transition: background var(--dur-med) var(--ease);
}
.status-dot[data-state="unlocked"] { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot[data-state="locked"] { background: var(--danger); }

.btn-lock {
  display: flex; align-items: center; gap: var(--sp-xs);
  width: 100%; padding: 8px var(--sp-sm);
  background: var(--danger-dim);
  border: 1px solid rgba(248,81,73,0.3);
  border-radius: var(--r-sm);
  color: var(--danger);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.btn-lock svg { width: 14px; height: 14px; }
.btn-lock:hover { background: rgba(248,81,73,0.2); }

/* --------------------------------------------------------------------------
   5. Views
   -------------------------------------------------------------------------- */
.view { display: none; }
.view.active { display: block; animation: fadeUp var(--dur-med) var(--ease); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   6. Page Header
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-xl);
  gap: var(--sp-md);
}

h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}

h2 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; font-weight: 600; }

.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 2px; }

.card-title { font-size: 1rem; font-weight: 700; margin-bottom: var(--sp-md); color: var(--text); }

/* --------------------------------------------------------------------------
   7. Glass Cards
   -------------------------------------------------------------------------- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
button, .btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--r-md);
  transition: all var(--dur-fast) var(--ease);
  display: inline-flex; align-items: center; gap: var(--sp-xs);
  padding: 10px 18px;
  line-height: 1;
  white-space: nowrap;
}
button svg { width: 15px; height: 15px; }

.btn-primary {
  background: var(--accent);
  color: #0d1117;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(88,166,255,0.3); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.10); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.05); color: var(--text); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(248,81,73,0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(248,81,73,0.2); }

button:disabled { opacity: 0.5; cursor: not-allowed; }

.full-width { width: 100%; justify-content: center; }
.mt-4 { margin-top: var(--sp-md); }

.form-actions { display: flex; gap: var(--sp-sm); align-items: center; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   9. Forms
   -------------------------------------------------------------------------- */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-md); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }

label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-xs);
}

input, textarea, select {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  padding: 10px 12px;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,179,237,0.12);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }

input[type="range"] {
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  accent-color: var(--accent);
}

input[type="checkbox"], input[type="radio"] {
  width: auto;
  accent-color: var(--accent);
  cursor: pointer;
}

.required-mark { color: var(--danger); font-size: 0.75rem; }

.form-hint { font-size: 0.775rem; color: var(--text-dim); line-height: 1.4; }

.form-error {
  background: var(--danger-dim);
  border: 1px solid rgba(248,81,73,0.3);
  border-radius: var(--r-sm);
  color: var(--danger);
  font-size: 0.825rem;
  padding: var(--sp-sm) var(--sp-md);
}

.input-with-toggle, .input-with-action {
  display: flex;
  align-items: center;
  position: relative;
}
.input-with-toggle input, .input-with-action input {
  flex: 1;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
}

.btn-toggle-pw {
  padding: 0 12px;
  height: 40px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-muted);
  flex-shrink: 0;
}
.btn-toggle-pw:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.btn-toggle-pw svg { width: 16px; height: 16px; }

.btn-icon-pill {
  padding: 8px 14px;
  background: rgba(88,166,255,0.1);
  border: 1px solid rgba(88,166,255,0.3);
  border-left: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--accent);
  font-size: 0.8rem;
  flex-shrink: 0;
  gap: 4px;
}
.btn-icon-pill:hover { background: rgba(88,166,255,0.2); }
.btn-icon-pill svg { width: 13px; height: 13px; }

.char-counter { font-size: 0.75rem; color: var(--text-dim); font-weight: 400; }

.checkbox-label, .radio-label {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 0.825rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
}
.checkbox-label:hover, .radio-label:hover { color: var(--text); }

/* --------------------------------------------------------------------------
   10. Unlock Screen
   -------------------------------------------------------------------------- */
.unlock-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.unlock-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: var(--sp-2xl);
}

.unlock-logo {
  width: 72px; height: 72px;
  background: var(--accent-dim);
  border-radius: var(--r-xl);
  border: 1px solid rgba(88,166,255,0.2);
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: var(--sp-lg);
  color: var(--accent);
}
.unlock-logo svg { width: 36px; height: 36px; }

.unlock-card h1 {
  font-size: 2rem;
  margin-bottom: var(--sp-xs);
}

.unlock-badges {
  display: flex;
  justify-content: center;
  gap: var(--sp-xs);
  flex-wrap: wrap;
  margin: var(--sp-md) 0 var(--sp-lg);
}
.badge-pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 10px;
  font-size: 0.725rem;
  color: var(--text-dim);
  font-weight: 500;
}

.unlock-card .form-group { text-align: left; }
.unlock-card .actions { display: flex; flex-direction: column; gap: var(--sp-sm); margin-top: var(--sp-lg); }

/* --------------------------------------------------------------------------
   11. Dashboard
   -------------------------------------------------------------------------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
}

.stat-card {
  text-align: center;
  padding: var(--sp-lg) var(--sp-md);
}

.stat-icon {
  width: 40px; height: 40px;
  background: var(--accent-dim);
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: var(--sp-sm);
  color: var(--accent);
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.text-success { background: var(--success-dim); color: var(--success); }

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.04em;
}
.stat-label { font-size: 0.775rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-sm);
}

.quick-action-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 0.825rem;
  font-weight: 600;
  padding: var(--sp-md);
  flex-direction: column;
  gap: 6px;
  height: 72px;
  align-items: flex-start;
  transition: all var(--dur-fast) var(--ease);
}
.quick-action-btn svg { width: 18px; height: 18px; color: var(--accent); }
.quick-action-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: rgba(255,255,255,0.15); transform: translateY(-1px); }

.audit-summary-inline { min-height: 80px; }
.empty-hint { font-size: 0.825rem; padding: var(--sp-md) 0; }

/* --------------------------------------------------------------------------
   12. Vault / Credential List
   -------------------------------------------------------------------------- */
.state-container {
  text-align: center;
  padding: var(--sp-2xl) var(--sp-lg);
  color: var(--text-muted);
}
.empty-icon { margin-bottom: var(--sp-md); opacity: 0.3; }
.empty-icon svg { width: 56px; height: 56px; }
.state-container h3 { margin-bottom: var(--sp-xs); }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto var(--sp-md);
}
@keyframes spin { to { transform: rotate(360deg); } }

.items-list { display: flex; flex-direction: column; gap: 1px; }

.credential-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md);
  border-radius: var(--r-md);
  transition: background var(--dur-fast) var(--ease);
  gap: var(--sp-md);
}
.credential-item:hover { background: rgba(255,255,255,0.04); }

.credential-info { flex: 1; min-width: 0; }
.credential-service {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.credential-username {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.credential-updated { font-size: 0.75rem; color: var(--text-dim); white-space: nowrap; }

.credential-actions { display: flex; gap: var(--sp-xs); flex-shrink: 0; }

.btn-icon {
  padding: 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  transition: all var(--dur-fast) var(--ease);
}
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon:hover { background: rgba(255,255,255,0.06); border-color: var(--border); color: var(--text); }
.btn-icon.danger:hover { background: var(--danger-dim); border-color: rgba(248,81,73,0.3); color: var(--danger); }

.mb-4 { margin-bottom: var(--sp-lg); }

/* --------------------------------------------------------------------------
   13. TOTP Authenticator
   -------------------------------------------------------------------------- */
.security-notice {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: rgba(63,185,80,0.08);
  border: 1px solid rgba(63,185,80,0.2);
  border-radius: var(--r-sm);
  padding: var(--sp-sm) var(--sp-md);
  font-size: 0.825rem;
  color: var(--text-muted);
}
.security-notice svg { width: 14px; height: 14px; color: var(--success); flex-shrink: 0; }

.totp-display { margin-top: var(--sp-xl); }

.totp-code-wrapper {
  text-align: center;
  padding: var(--sp-xl) 0 var(--sp-md);
}
.totp-label { font-size: 0.75rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: var(--sp-xs); }
.totp-code {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text);
  line-height: 1;
}
.totp-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  margin-top: var(--sp-md);
}
.totp-timer { font-size: 0.825rem; color: var(--text-muted); }
.btn-copy-code {
  background: var(--accent-dim);
  border: 1px solid rgba(88,166,255,0.2);
  border-radius: var(--r-sm);
  color: var(--accent);
  font-size: 0.8rem;
  padding: 6px 12px;
  gap: 5px;
}
.btn-copy-code svg { width: 13px; height: 13px; }
.btn-copy-code:hover { background: rgba(88,166,255,0.2); }

.totp-progress {
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-top: var(--sp-sm);
}
.totp-progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 1s linear, background-color 0.5s ease;
  background: var(--success);
}
.totp-warn { font-size: 0.8rem; margin-top: var(--sp-sm); text-align: center; }

/* --------------------------------------------------------------------------
   14. Scanner
   -------------------------------------------------------------------------- */
.scanner-results { margin-top: var(--sp-lg); }

.scan-result-clean {
  background: var(--success-dim);
  border: 1px solid rgba(63,185,80,0.3);
  border-radius: var(--r-md);
  padding: var(--sp-xl);
  text-align: center;
  color: var(--success);
  font-weight: 600;
}

.scan-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.scan-summary-count { font-size: 0.875rem; color: var(--text-muted); }
.scan-summary-count strong { color: var(--text); }

.findings-list { display: flex; flex-direction: column; gap: var(--sp-sm); }

.finding-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--dur-fast);
}
.finding-card:hover { border-color: rgba(255,255,255,0.15); }

.finding-card.severity-critical { border-left: 3px solid var(--sev-critical); }
.finding-card.severity-high     { border-left: 3px solid var(--sev-high); }
.finding-card.severity-medium   { border-left: 3px solid var(--sev-medium); }
.finding-card.severity-low      { border-left: 3px solid var(--sev-low); }

.finding-header {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  background: rgba(0,0,0,0.15);
}
.finding-rule { font-weight: 600; font-size: 0.875rem; flex: 1; }
.finding-body { padding: var(--sp-sm) var(--sp-md); }
.finding-location { font-size: 0.775rem; color: var(--text-dim); margin-bottom: 4px; }
.finding-redacted {
  font-family: var(--font-mono);
  font-size: 0.825rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  border-radius: var(--r-sm);
  padding: 3px 8px;
  display: inline-block;
}

.sev-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 100px;
}
.sev-badge.critical { background: rgba(255,68,68,0.2);  color: var(--sev-critical); }
.sev-badge.high     { background: rgba(255,140,0,0.2);  color: var(--sev-high); }
.sev-badge.medium   { background: rgba(255,215,0,0.15); color: var(--sev-medium); }
.sev-badge.low      { background: rgba(76,175,80,0.15); color: var(--sev-low); }

/* --------------------------------------------------------------------------
   15. Generator
   -------------------------------------------------------------------------- */
.gen-tabs {
  display: flex;
  gap: 2px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--r-md);
  padding: 3px;
  margin-bottom: var(--sp-lg);
}
.tab-btn {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.825rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease);
}
.tab-btn.active { background: var(--bg-card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.tab-btn:hover:not(.active) { color: var(--text); }

.gen-options { margin-bottom: var(--sp-lg); }
.gen-option-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md); margin-bottom: var(--sp-md); }
.gen-option-row label { font-size: 0.875rem; color: var(--text-muted); flex-shrink: 0; }
.gen-option-row input[type="range"] { flex: 1; }
.gen-checkboxes { display: flex; flex-wrap: wrap; gap: var(--sp-xs) var(--sp-lg); }

.result-box {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-md) var(--sp-lg);
  min-height: 72px;
  display: flex;
  align-items: center;
  word-break: break-all;
  margin-bottom: var(--sp-md);
}
.gen-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text);
  letter-spacing: 0.02em;
}

.entropy-bar-wrapper { margin-bottom: var(--sp-md); }
.entropy-label { display: flex; justify-content: space-between; font-size: 0.775rem; color: var(--text-muted); margin-bottom: 4px; }
.entropy-value { font-weight: 700; color: var(--text); }
.entropy-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.entropy-fill { height: 100%; border-radius: 3px; transition: width 0.4s var(--ease), background-color 0.4s ease; }

/* --------------------------------------------------------------------------
   16. Audit
   -------------------------------------------------------------------------- */
.audit-layout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }

.audit-result-panel { margin-top: var(--sp-lg); }

.audit-score-block {
  text-align: center;
  padding: var(--sp-lg);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  margin-bottom: var(--sp-md);
}
.audit-score-block.success { background: var(--success-dim); border-color: rgba(63,185,80,0.3); }
.audit-score-block.warning { background: var(--warning-dim); border-color: rgba(210,153,34,0.3); }
.audit-score-block.danger  { background: var(--danger-dim);  border-color: rgba(248,81,73,0.3); }

.audit-score-num {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}
.audit-score-num span { font-size: 1.2rem; color: var(--text-muted); font-weight: 500; }
.audit-tier { font-size: 0.875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.audit-meta-info { font-size: 0.775rem; color: var(--text-muted); margin-top: var(--sp-xs); }

.audit-findings { margin-top: var(--sp-md); }
.audit-findings h3 { font-size: 0.825rem; font-weight: 700; margin-bottom: var(--sp-sm); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.finding-detail {
  background: rgba(0,0,0,0.2);
  border-radius: var(--r-sm);
  padding: var(--sp-sm) var(--sp-md);
  margin-bottom: 4px;
  border-left: 2px solid var(--border);
}
.finding-detail.critical { border-left-color: var(--sev-critical); }
.finding-detail.high { border-left-color: var(--sev-high); }
.finding-detail.medium { border-left-color: var(--sev-medium); }
.finding-detail.info { border-left-color: var(--success); }
.finding-detail-desc { font-size: 0.825rem; color: var(--text); }
.finding-detail-rec { font-size: 0.775rem; color: var(--text-muted); margin-top: 2px; }

.audit-recs { margin-top: var(--sp-md); }
.audit-recs h3 { font-size: 0.825rem; font-weight: 700; margin-bottom: var(--sp-sm); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.audit-recs li { font-size: 0.825rem; color: var(--text-muted); padding: 4px 0; padding-left: var(--sp-md); position: relative; }
.audit-recs li::before { content: '→'; position: absolute; left: 0; color: var(--accent); }

/* --------------------------------------------------------------------------
   17. Modals
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn var(--dur-fast) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  width: 100%;
  max-width: 440px;
  animation: slideIn var(--dur-med) var(--ease);
}
@keyframes slideIn {
  from { transform: scale(0.95) translateY(-10px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.reveal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-md); }
.btn-close { background: none; border: none; color: var(--text-muted); font-size: 1.4rem; padding: 4px 8px; cursor: pointer; border-radius: var(--r-sm); line-height: 1; }
.btn-close:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.reveal-content { display: flex; flex-direction: column; gap: var(--sp-sm); }
.reveal-field { background: rgba(0,0,0,0.2); border-radius: var(--r-sm); padding: var(--sp-sm) var(--sp-md); }
.reveal-field-label { font-size: 0.725rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 2px; }
.reveal-field-value { font-size: 0.875rem; color: var(--text); word-break: break-all; }
.reveal-field-value.password-value { font-family: var(--font-mono); }
.reveal-field-action { margin-top: 4px; }

/* --------------------------------------------------------------------------
   18. Toasts
   -------------------------------------------------------------------------- */
#toast-container {
  position: fixed;
  bottom: var(--sp-lg);
  right: var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  z-index: 9999;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--r-md);
  font-size: 0.825rem;
  font-weight: 600;
  max-width: 360px;
  animation: toastIn 0.25s var(--ease), toastOut 0.25s var(--ease) 3s forwards;
  border: 1px solid transparent;
  display: flex; align-items: center; gap: var(--sp-xs);
}
.toast.success { background: var(--success-dim); border-color: rgba(63,185,80,0.3); color: var(--success); }
.toast.error   { background: var(--danger-dim);  border-color: rgba(248,81,73,0.3);  color: var(--danger); }
.toast.info    { background: var(--accent-dim);  border-color: rgba(88,166,255,0.3); color: var(--accent); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

/* --------------------------------------------------------------------------
   19. Utilities
   -------------------------------------------------------------------------- */
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

code {
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
}

/* --------------------------------------------------------------------------
   20. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --sidebar-w: 56px; }
  .logo span, .nav-links a span, .btn-lock span { display: none; }
  .logo { justify-content: center; }
  .nav-links a { justify-content: center; padding: 12px; }
  .nav-links a svg { margin: 0; }
  .nav-footer { padding: var(--sp-xs); }
  .btn-lock { justify-content: center; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .audit-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .main-content { padding: var(--sp-md); }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: 1fr 1fr; }
}
