/* ==========================================================================
   Threat Intel Platform — Unified Theme
   Inspired by OpenCTI / Microsoft Defender design language
   ========================================================================== */

/* ── Variables ── */
:root {
  --bg-app:      #06091a;
  --bg-surface:  #0b1220;
  --bg-card:     #0f1830;
  --bg-hover:    #14203d;
  --bg-input:    #0b1525;
  --bg-stripe:   #0d1628;

  --border:        rgba(59, 130, 246, 0.14);
  --border-bright: rgba(59, 130, 246, 0.32);
  --border-input:  rgba(59, 130, 246, 0.22);

  --text-primary:   #d4e2f7;
  --text-secondary: #7a97be;
  --text-muted:     #3d5578;

  --blue:        #4080ff;
  --blue-dim:    #1d4ed8;
  --blue-glow:   rgba(64, 128, 255, 0.18);
  --cyan:        #22d3ee;
  --green:       #34d399;
  --green-dim:   #059669;
  --red:         #f87171;
  --red-dim:     #dc2626;
  --yellow:      #fbbf24;
  --purple:      #a78bfa;
  --orange:      #fb923c;

  --sidebar-w:   240px;
  --topbar-h:    56px;

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

  --shadow-card:     0 1px 4px rgba(0,0,0,0.5), 0 0 0 1px var(--border);
  --shadow-elevated: 0 4px 24px rgba(0,0,0,0.6), 0 0 0 1px var(--border-bright);
  --shadow-glow-blue: 0 0 16px rgba(64, 128, 255, 0.25);

  --transition: 0.18s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--cyan); }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }

/* ── App Shell ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow-blue);
}

.sidebar-brand-icon svg { width: 17px; height: 17px; color: #fff; }

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sidebar-brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-section {
  padding: 14px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  position: relative;
}

.sidebar-nav a svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.sidebar-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-left-color: var(--border-bright);
}

.sidebar-nav a:hover svg { opacity: 1; }

.sidebar-nav a.active {
  color: var(--blue);
  background: var(--blue-glow);
  border-left-color: var(--blue);
}

.sidebar-nav a.active svg { opacity: 1; color: var(--blue); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.user-pill:hover { border-color: var(--border-bright); }

.user-avatar {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--blue-dim), var(--blue));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-pill svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.user-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
  display: none;
  z-index: 300;
}

.user-dropdown.open { display: block; }

.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.user-dropdown a:hover { background: var(--bg-hover); color: var(--red); }
.user-dropdown a svg { width: 14px; height: 14px; }

/* ── Main Wrapper ── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.topbar-hamburger:hover { color: var(--text-primary); }
.topbar-hamburger svg { width: 20px; height: 20px; }

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-breadcrumb span { color: var(--text-secondary); }
.topbar-breadcrumb .sep { color: var(--text-muted); }

.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
}

/* ── Content Area ── */
.content {
  flex: 1;
  padding: 28px;
  max-width: 1280px;
}

/* ── Page Header ── */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-header p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h2, .card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-header .card-icon {
  width: 28px; height: 28px;
  background: var(--blue-glow);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.card-header .card-icon svg { width: 14px; height: 14px; color: var(--blue); }

.card-body { padding: 20px; }

.card + .card { margin-top: 20px; }

/* ── Stat Cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--border-bright); }

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue  { background: rgba(64,128,255,0.12); color: var(--blue); }
.stat-icon.cyan  { background: rgba(34,211,238,0.10); color: var(--cyan); }
.stat-icon.green { background: rgba(52,211,153,0.10); color: var(--green); }
.stat-icon.red   { background: rgba(248,113,113,0.10); color: var(--red); }
.stat-icon.yellow{ background: rgba(251,191,36,0.10); color: var(--yellow); }
.stat-icon.purple{ background: rgba(167,139,250,0.10); color: var(--purple); }

.stat-info { min-width: 0; }
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
}

/* ── Alerts ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 13px;
  margin-bottom: 16px;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-success {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--green);
}

.alert-error {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--red);
}

.alert-info {
  background: rgba(64, 128, 255, 0.08);
  border-color: rgba(64, 128, 255, 0.3);
  color: var(--blue);
}

.alert-warning {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--yellow);
}

/* ── Forms ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.form-grid-full { grid-column: 1 / -1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="search"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  padding: 8px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

input::placeholder { color: var(--text-muted); }

select option { background: var(--bg-card); }

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-bar:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}

.search-bar svg {
  width: 15px; height: 15px;
  color: var(--text-muted);
  margin-left: 10px;
  flex-shrink: 0;
}

.search-bar input {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 8px 12px;
  flex: 1;
}

/* Checkboxes */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label:hover { color: var(--text-primary); }

.checkbox-label input[type="checkbox"] {
  width: 15px; height: 15px;
  cursor: pointer;
  accent-color: var(--blue);
  flex-shrink: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  outline: none;
  text-decoration: none;
  line-height: 1;
}

.btn svg { width: 14px; height: 14px; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover {
  background: #5090ff;
  box-shadow: 0 0 12px rgba(64,128,255,0.35);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-bright);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: rgba(248,113,113,0.1);
  color: var(--red);
  border-color: rgba(248,113,113,0.3);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* Form actions bar */
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead tr {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:nth-child(even) { background: var(--bg-stripe); }
tbody tr:nth-child(even):hover { background: var(--bg-hover); }

tbody td {
  padding: 11px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tbody td.wrap { white-space: normal; }

td .id-cell {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

td .monospace {
  font-family: 'Consolas', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--cyan);
  background: rgba(34,211,238,0.07);
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

td .mono-hash {
  font-family: 'Consolas', 'Cascadia Code', monospace;
  font-size: 11.5px;
  color: var(--purple);
  background: rgba(167,139,250,0.07);
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background var(--transition);
}

td .mono-hash:hover { background: rgba(167,139,250,0.15); }

/* Empty state */
.table-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}

.table-empty svg {
  width: 36px; height: 36px;
  margin: 0 auto 10px;
  display: block;
  opacity: 0.4;
}

.table-empty p { font-size: 13px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-green  { background: rgba(52,211,153,0.12); color: var(--green); }
.badge-red    { background: rgba(248,113,113,0.12); color: var(--red); }
.badge-blue   { background: rgba(64,128,255,0.12); color: var(--blue); }
.badge-yellow { background: rgba(251,191,36,0.12); color: var(--yellow); }
.badge-purple { background: rgba(167,139,250,0.12); color: var(--purple); }
.badge-gray   { background: rgba(255,255,255,0.06); color: var(--text-muted); }
.badge-cyan   { background: rgba(34,211,238,0.10); color: var(--cyan); }
.badge-orange { background: rgba(251,146,60,0.12); color: var(--orange); }

/* ── Expired rows ── */
tr.row-expired td {
  opacity: 0.55;
}

/* ── Empty cell placeholder ── */
.cell-empty {
  color: var(--text-muted);
  font-size: 13px;
}

/* ── URL cell truncation ── */
.url-cell {
  max-width: 200px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* ── Copy-to-clipboard active flash ── */
.mono-hash.copy-active,
.copyable.copy-active {
  background: rgba(52,211,153,0.18) !important;
  color: var(--green) !important;
  transition: background 0.15s ease, color 0.15s ease;
}

/* ── Action buttons cell ── */
.action-btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── Section Divider ── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-divider span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Auth Layout ── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-app);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.auth-shell::before {
  content: '';
  position: absolute;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(64,128,255,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  overflow: hidden;
}

.auth-card-header {
  padding: 28px 32px 24px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.auth-logo {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-glow-blue);
}

.auth-logo svg { width: 26px; height: 26px; color: #fff; }

.auth-card-header h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-card-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-card-body { padding: 28px 32px; }

.auth-card-body .form-group { margin-bottom: 16px; }

.auth-card-body .btn { width: 100%; margin-top: 6px; padding: 10px; }

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Inline Table Form (remove buttons inside table rows) ── */
.inline-form { display: inline; }
.inline-form .btn { display: inline-flex; }

/* ── Permissions Grid ── */
.perm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Tags */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.tag-chip {
  --tag-color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--tag-color) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag-color) 45%, transparent);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.tag-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tag-color);
  box-shadow: 0 0 6px color-mix(in srgb, var(--tag-color) 60%, transparent);
}

.tag-remove {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 0 0 2px;
}

.tag-remove:hover { color: var(--red); }

.tag-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-form select { min-width: 140px; }

input[type="color"] {
  width: 42px;
  height: 34px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background: var(--bg-input);
  padding: 3px;
  cursor: pointer;
}

/* Shodan map */
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.map-canvas {
  height: 460px;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
}

.leaflet-container {
  background: var(--bg-surface);
  color: #111827;
}

.asset-row {
  cursor: pointer;
}

.asset-row:hover td {
  color: var(--text-primary);
}

.details-json {
  margin-top: 8px;
  max-height: 260px;
  overflow: auto;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: pre-wrap;
}

.ioc-detail-row td {
  background: rgba(255,255,255,0.025);
  padding: 0;
}

.ioc-detail-panel {
  border-top: 1px solid var(--border);
  padding: 16px 18px 18px;
}

.ioc-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
}

.ioc-detail-grid section {
  min-width: 0;
}

.ioc-detail-grid h4 {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-primary);
}

.ioc-detail-list {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
  font-size: 12px;
}

.ioc-detail-list dt {
  color: var(--text-muted);
}

.ioc-detail-list dd {
  margin: 0;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.ioc-source-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ioc-source-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,0.025);
}

.ioc-source-item strong {
  font-size: 12px;
  color: var(--text-primary);
}

.ioc-source-item span,
.ioc-source-item small {
  font-size: 11px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.ioc-copy-template {
  min-height: 130px;
  margin-bottom: 8px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  resize: vertical;
}

/* ── Responsive Sidebar Toggle ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
}

/* ── Dashboard Grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* ── Toolbar (search + actions) ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar .search-bar { min-width: 240px; }

/* ── Utility ── */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); font-size: 12px; }
.text-sm    { font-size: 12px; }
.monofont   { font-family: 'Consolas', monospace; }
.w-full     { width: 100%; }
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.gap-8      { gap: 8px; }
.gap-12     { gap: 12px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay.open { display: block; }

  .main-wrapper { margin-left: 0; }

  .topbar-hamburger { display: flex; }

  .content { padding: 16px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  .form-grid { grid-template-columns: 1fr; }

  .dashboard-grid { grid-template-columns: 1fr; }

  .ioc-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .stat-grid { grid-template-columns: 1fr; }
  .auth-card-header, .auth-card-body { padding-left: 20px; padding-right: 20px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search-bar { min-width: 0; }
}
