/* ─────────────────────────────────────────────────────────────────────────
   Sentry — Design System
   Dark security-product aesthetic: deep navy base, cyan accent, tight grid.
   Inspired by Modulus1 portfolio: clean, premium, purposeful.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* Palette */
  --bg-base:       #080c10;
  --bg-surface:    #0d1420;
  --bg-elevated:   #131b28;
  --bg-overlay:    #1a2436;
  --border:        #1e2d42;
  --border-subtle: #162030;

  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #4a6080;

  --accent:        #38d9f5;
  --accent-dim:    rgba(56, 217, 245, 0.12);
  --accent-hover:  #5ee8ff;

  --breach-red:    #ff4d6d;
  --breach-red-dim:rgba(255, 77, 109, 0.12);
  --warn-amber:    #f59e0b;
  --ok-green:      #10b981;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; }

/* ── Auth ────────────────────────────────────────────────────────────────── */
#screen-auth {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 800px 600px at 50% -100px, rgba(56,217,245,0.06) 0%, transparent 70%),
              var(--bg-base);
}
#screen-auth-callback {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.auth-wrap {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  text-align: center;
}
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2.5rem;
}
.brand-icon {
  font-size: 1.75rem;
  color: var(--accent);
  line-height: 1;
}
.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.auth-headline {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-primary);
}
.auth-sub {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 2.5rem;
  line-height: 1.6;
}
.auth-form { text-align: left; }
.auth-status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.875rem;
  text-align: center;
}
.auth-status.error {
  background: var(--breach-red-dim);
  color: var(--breach-red);
}
.auth-footer {
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ── App Shell ───────────────────────────────────────────────────────────── */
#screen-app {
  min-height: 100vh;
  flex-direction: row;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0.75rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.breach-badge {
  margin-left: auto;
  background: var(--breach-red);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
}
.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.plan-badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: inline-block;
  width: fit-content;
}

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
}

/* ── Views ───────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }
.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}
.view-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.view-sub {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* ── Targets Grid ────────────────────────────────────────────────────────── */
.targets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.target-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.15s;
}
.target-card:hover { border-color: var(--border-subtle); }
.target-card.has-breach { border-color: rgba(255,77,109,0.4); }
.target-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.target-label {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.target-url {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1rem;
}
.target-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tag {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.tag.breach { background: var(--breach-red-dim); color: var(--breach-red); border-color: rgba(255,77,109,0.3); }
.tag.ok     { background: rgba(16,185,129,0.1);  color: var(--ok-green);   border-color: rgba(16,185,129,0.3); }
.tag.freq   { color: var(--accent); background: var(--accent-dim); border-color: rgba(56,217,245,0.2); }
.target-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

/* ── Findings List ───────────────────────────────────────────────────────── */
.findings-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.finding-row {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.finding-row:hover { background: var(--bg-elevated); border-color: rgba(56,217,245,0.2); }
.finding-row.breach { border-left: 3px solid var(--breach-red); }
.finding-row.muted { opacity: 0.45; }
.severity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.severity-dot.critical { background: #e11d48; }
.severity-dot.high     { background: var(--breach-red); }
.severity-dot.medium   { background: var(--warn-amber); }
.severity-dot.low      { background: #60a5fa; }
.severity-dot.informational { background: var(--text-muted); }

.finding-info { flex: 1; min-width: 0; }
.finding-vuln { font-weight: 600; font-size: 0.9375rem; color: var(--text-primary); }
.finding-url  { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted);
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.finding-summary { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 4px; line-height: 1.5;
                   overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.finding-meta { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.finding-date { font-size: 0.75rem; color: var(--text-muted); }

/* ── Finding Detail Modal body ───────────────────────────────────────────── */
.finding-detail-section { margin-bottom: 1.5rem; }
.finding-detail-section h4 { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em;
                              text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.5rem; }
.finding-detail-section p  { color: var(--text-secondary); font-size: 0.875rem; line-height: 1.7; }
.evidence-block {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
}

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}
.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.settings-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.375rem; }
.settings-desc { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 1.25rem; }
.plan-details { margin-bottom: 1.25rem; }
.plan-limit-row { display: flex; justify-content: space-between; padding: 0.4rem 0;
                  border-bottom: 1px solid var(--border-subtle); font-size: 0.875rem; }
.plan-limit-row:last-child { border-bottom: none; }
.plan-limit-key { color: var(--text-secondary); }
.plan-limit-val { color: var(--text-primary); font-weight: 500; }
.plan-actions { display: flex; flex-direction: column; gap: 0.5rem; }

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}
.empty-icon { font-size: 3rem; color: var(--text-muted); margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.125rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.5rem; }
.empty-state p  { margin-bottom: 1.5rem; max-width: 360px; margin-left: auto; margin-right: auto; }

/* ── Forms / Fields ──────────────────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 0.375rem; margin-bottom: 1rem; }
.field-group label { font-size: 0.8125rem; font-weight: 500; color: var(--text-secondary); }
.field-group input,
.field-group select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  transition: border-color 0.15s;
  width: 100%;
  outline: none;
}
.field-group input:focus,
.field-group select:focus { border-color: var(--accent); }
.field-group input::placeholder { color: var(--text-muted); }
select option { background: var(--bg-elevated); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #080c10;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); }
.btn-full { width: 100%; }
.btn-signout {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  text-align: left;
  padding: 0;
}
.btn-signout:hover { color: var(--breach-red); }
.btn-danger { color: var(--breach-red) !important; border-color: rgba(255,77,109,0.4) !important; }
.btn-danger:hover { background: var(--breach-red-dim) !important; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

/* ── Toggle ──────────────────────────────────────────────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}
.toggle-wrap input { display: none; }
.toggle-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  position: relative;
  padding-left: 44px;
}
.toggle-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: background 0.2s;
}
.toggle-label::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: left 0.2s, background 0.2s;
}
.toggle-wrap input:checked + .toggle-label::before { background: var(--accent-dim); border-color: var(--accent); }
.toggle-wrap input:checked + .toggle-label::after  { left: 19px; background: var(--accent); }

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(8,12,16,0.85);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  padding: 1.75rem;
  animation: modal-in 0.18s ease;
}
.modal-wide { max-width: 640px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { margin-bottom: 1.5rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.75rem; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  z-index: 200;
  animation: toast-in 0.2s ease;
  max-width: 360px;
}
.toast.success { border-color: rgba(16,185,129,0.4); color: var(--ok-green); }
.toast.error   { border-color: rgba(255,77,109,0.4); color: var(--breach-red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Loader / Spinner ────────────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-secondary); text-align: center; }

/* ── Utils ───────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
