:root {
  --bg-grad-start: #f8fafc;
  --bg-grad-end: #eef2f7;
  --bg-elev: rgba(255, 255, 255, 0.94);
  --text: #1f2937;
  --muted: #5f6b7a;
  --line: rgba(56, 92, 150, 0.2);
  --primary: #2563eb;
  --secondary: #4f46e5;
  --ok: #34d399;
  --err: #fb7185;
  --accent-rgb: 37, 99, 235;
  --secondary-rgb: 79, 70, 229;
  --input-bg: rgba(255, 255, 255, 0.95);
  --input-border: rgba(56, 92, 150, 0.35);
  --button-bg: rgba(255, 255, 255, 0.95);
  --status-bg: rgba(248, 250, 252, 0.92);
  --output-bg: rgba(255, 255, 255, 0.96);
  --card-bg: rgba(255, 255, 255, 0.94);
  --panel-shadow: 0 0 0 1px rgba(37, 99, 235, 0.06) inset, 0 10px 20px rgba(31, 41, 55, 0.12);
}

body[data-theme="dark"] {
  --bg-grad-start: #2b2f36;
  --bg-grad-end: #1f2329;
  --bg-elev: rgba(43, 47, 54, 0.92);
  --text: #e5e7eb;
  --muted: #b3bcc8;
  --line: rgba(148, 163, 184, 0.24);
  --primary: #60a5fa;
  --secondary: #818cf8;
  --accent-rgb: 96, 165, 250;
  --secondary-rgb: 129, 140, 248;
  --input-bg: rgba(55, 65, 81, 0.88);
  --input-border: rgba(148, 163, 184, 0.42);
  --button-bg: rgba(55, 65, 81, 0.92);
  --status-bg: rgba(51, 60, 74, 0.92);
  --output-bg: rgba(43, 47, 54, 0.95);
  --card-bg: rgba(51, 60, 74, 0.86);
  --panel-shadow: 0 0 0 1px rgba(96, 165, 250, 0.08) inset, 0 10px 20px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(var(--accent-rgb), 0.08), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(var(--secondary-rgb), 0.1), transparent 35%),
    linear-gradient(180deg, var(--bg-grad-start) 0%, var(--bg-grad-end) 100%);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.auth-page {
  max-width: 1100px;
}

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  background: color-mix(in srgb, var(--bg-elev) 92%, #000 8%);
  border-right: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.08) inset;
  display: grid;
  grid-template-rows: auto 1fr auto;
  z-index: 1100;
}

.sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sidebar-logo {
  width: 144px;
  height: auto;
  display: block;
  flex-shrink: 0;
  filter: var(--logo-filter, none);
}

.auth-logo {
  width: 300px;
  max-width: 88vw;
  height: auto;
  display: block;
  margin: 0 auto 4px;
  filter: var(--logo-filter, none);
}

.auth-hero {
  text-align: center;
  padding-bottom: 8px;
}

.sidebar-close {
  display: none;
  width: 30px;
  height: 30px;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.sidebar-nav {
  padding: 12px 10px;
  display: grid;
  gap: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  border-color: rgba(var(--accent-rgb), 0.3);
  background: rgba(var(--accent-rgb), 0.08);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.15) inset;
}

.sidebar-link.active {
  border-color: rgba(var(--accent-rgb), 0.45);
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.2), rgba(var(--secondary-rgb), 0.14));
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.25) inset;
}

.sidebar-footer {
  padding: 12px 10px 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.user-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
  padding: 10px;
  display: grid;
  gap: 4px;
}

.user-block p {
  margin: 0;
  font-weight: 600;
}

.user-block span {
  font-size: 0.82rem;
  color: var(--muted);
}

.footer-actions {
  display: grid;
  gap: 8px;
}

.footer-actions button:last-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.app-main {
  margin-left: 240px;
  padding: 24px 18px 36px;
  transition: margin-left 0.25s ease;
}

.mobile-menu-btn,
.mobile-overlay {
  display: none;
}

.mobile-menu-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1250;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
}

.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 1090;
}

.mobile-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.hero p {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-family: Orbitron, Inter, sans-serif;
}

.hero h1 {
  margin: 8px 0 6px;
  font-family: Orbitron, Inter, sans-serif;
  font-size: clamp(1.4rem, 2.1vw, 2rem);
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-header-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dashboard-header-item strong {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.dashboard-header-item span {
  color: var(--text);
  font-size: 0.88rem;
}

.dashboard-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-inline: 14px;
}

.hero .sub {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--panel-shadow);
  padding: 16px;
  margin-top: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.action-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.link-btn {
  text-decoration: none;
  border: 1px solid rgba(100, 139, 255, 0.45);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

input {
  border: 1px solid var(--input-border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(65, 182, 255, 0.2);
}

.btn-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tabs-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--input-border);
  color: var(--text);
  background: var(--button-bg);
  border-radius: 10px;
  font-weight: 600;
  padding: 10px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--primary);
}

button.primary {
  background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.2), rgba(var(--secondary-rgb), 0.2));
  border-color: rgba(var(--accent-rgb), 0.45);
}

button:disabled {
  opacity: 0.65;
  cursor: progress;
}

.status {
  border-radius: 9px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  background: var(--status-bg);
  padding: 9px 10px;
  font-size: 0.86rem;
}

.status.ok { border-color: rgba(52, 211, 153, 0.5); }
.status.err { border-color: rgba(251, 113, 133, 0.6); }

.output {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--output-bg);
  padding: 12px;
  min-height: 100px;
  white-space: pre-wrap;
}

.info-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
  padding: 10px;
  display: grid;
  gap: 6px;
}

.info-card strong {
  color: var(--muted);
  font-size: 0.84rem;
}

.dashboard-metric-grid {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1), rgba(var(--secondary-rgb), 0.07));
  padding: 12px;
}

.metric-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-value {
  margin: 8px 0 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.target-score-grid {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.target-score-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-bg);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.target-score-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.target-score-name {
  font-weight: 600;
  font-size: 0.9rem;
  word-break: break-all;
}

.score-pill {
  min-width: 56px;
  text-align: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.score-pill.low {
  color: rgba(52, 211, 153, 0.95);
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.12);
}

.score-pill.medium {
  color: rgba(251, 191, 36, 0.95);
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
}

.score-pill.high {
  color: rgba(251, 113, 133, 0.95);
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(251, 113, 133, 0.12);
}

.score-pill.unknown {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(148, 163, 184, 0.08);
}

.score-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 0.2s ease;
}

.score-fill.low {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.9), rgba(52, 211, 153, 0.95));
}

.score-fill.medium {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.9), rgba(251, 191, 36, 0.95));
}

.score-fill.high {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.9), rgba(251, 113, 133, 0.95));
}

.score-fill.unknown {
  background: transparent;
}

.target-score-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.muted-count {
  color: var(--muted);
  font-size: 0.84rem;
}

.scan-target-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.scan-target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
  padding: 10px 12px;
  flex-wrap: wrap;
}

.scan-target-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.target-badge {
  flex-shrink: 0;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.target-badge.domain {
  background: rgba(65, 182, 255, 0.15);
  color: rgba(65, 182, 255, 0.9);
  border: 1px solid rgba(65, 182, 255, 0.3);
}

.target-badge.ip {
  background: rgba(167, 139, 250, 0.15);
  color: rgba(167, 139, 250, 0.9);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.target-value {
  font-size: 0.9rem;
  word-break: break-all;
}

.scan-target-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.scan-btn {
  padding: 7px 12px;
  font-size: 0.84rem;
}

.target-state {
  font-size: 0.8rem;
  border-radius: 6px;
  padding: 3px 8px;
}

.target-state.scanning {
  color: rgba(251, 191, 36, 0.9);
  border: 1px solid rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
}

.target-state.done {
  color: rgba(52, 211, 153, 0.9);
  border: 1px solid rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.08);
  font-family: monospace;
  font-size: 0.76rem;
}

.target-state.error {
  color: rgba(251, 113, 133, 0.9);
  border: 1px solid rgba(251, 113, 133, 0.3);
  background: rgba(251, 113, 133, 0.08);
}

.profile-editor {
  margin-top: 14px;
  display: grid;
  gap: 14px;
}

.profile-target-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.inline-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--bg-elev);
  font-size: 0.86rem;
}

.tag-remove {
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 1;
  font-size: 1rem;
}

.empty-hint {
  color: var(--muted);
  font-size: 0.86rem;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-message {
  color: var(--muted);
  font-size: 0.86rem;
}

.report-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.report-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.report-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.report-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.report-ai-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(148, 163, 184, 0.08);
}

.report-ai-pill.completed {
  color: rgba(52, 211, 153, 0.95);
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(52, 211, 153, 0.12);
}

.report-ai-pill.failed {
  color: rgba(251, 113, 133, 0.95);
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(251, 113, 133, 0.12);
}

.report-ai-pill.running,
.report-ai-pill.queued {
  color: rgba(251, 191, 36, 0.95);
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
}

.report-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1200;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 280px;
  max-width: min(420px, calc(100vw - 24px));
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  padding: 10px 12px;
  box-shadow: var(--panel-shadow);
}

.toast.ok { border-color: rgba(52, 211, 153, 0.75); }
.toast.err { border-color: rgba(251, 113, 133, 0.75); }

@media (max-width: 920px) {
  .mobile-menu-btn,
  .mobile-overlay {
    display: block;
  }

  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-flex;
  }

  .app-main {
    margin-left: 0;
    padding-top: 58px;
  }

  .grid.two,
  .btn-row {
    grid-template-columns: 1fr;
  }

  .dashboard-metric-grid,
  .target-score-grid {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-links {
    width: 100%;
  }

  .action-links .link-btn,
  .action-links button {
    width: 100%;
    text-align: center;
  }

  .toast-wrap {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .toast {
    min-width: 0;
    max-width: 100%;
  }

  .hero-top {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-header {
    justify-content: flex-end;
  }
}
