:root {
  --sidebar-width: 260px;
  --accent: #6366f1;
  --accent-soft: #eef2ff;
  --accent-dark: #4f46e5;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --radius: 12px;
  --radius-sm: 8px;
}

[data-bs-theme=dark] {
  --accent: #818cf8;
  --accent-soft: #1e1b4b;
  --accent-dark: #6366f1;
  --surface: #111111;
  --surface-soft: #000000;
  --border: #222222;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.6);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.7);
  color-scheme: dark;
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--surface-soft); color: var(--text); }

a { transition: color .15s ease; }
a:hover { color: var(--accent); }

.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}
.sidebar .sidebar-header { flex-shrink: 0; text-align: center; padding: 2px 0 6px; }
.sidebar .sidebar-search-wrap { flex-shrink: 0; padding: 0 0 4px; }
.sidebar .sidebar-tools {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.sidebar .sidebar-footer {
  flex-shrink: 0;
  padding-top: 4px;
}
[data-bs-theme=dark] .sidebar { background: linear-gradient(180deg, #000000 0%, #0a0a0a 100%); }
[data-bs-theme=dark] body { background: #000; }
[data-bs-theme=dark] .bg-white,
[data-bs-theme=dark] .bg-light { background: var(--surface) !important; }
[data-bs-theme=dark] .bg-body { background: var(--surface-soft) !important; }
[data-bs-theme=dark] .card.border-0 { border: 1px solid var(--border) !important; }
[data-bs-theme=dark] pre, [data-bs-theme=dark] code { background: #0a0a0a; }
[data-bs-theme=dark] .table { --bs-table-bg: transparent; --bs-table-border-color: var(--border); }
.sidebar .nav-link {
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 2px;
  font-size: .875rem;
  transition: all .15s ease;
}
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.sidebar-cat-header { cursor: pointer; user-select: none; border-radius: var(--radius-sm); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: rgba(255,255,255,.7) !important; }
.sidebar-cat-header:hover { background: rgba(255,255,255,.06); color: #fff !important; }
.cat-chevron { font-size: .6rem; transition: transform .2s ease; }
.sidebar-cat-header[aria-expanded=false] .cat-chevron { transform: rotate(-90deg); }
.sidebar .nav-link.ps-3 { font-weight: 400; letter-spacing: 0; text-transform: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .2s ease;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card .btn { border-radius: var(--radius-sm); }

.tool-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.main-header { margin-bottom: 1.5rem; }
.main-header h1 { font-weight: 700; font-size: 1.5rem; letter-spacing: -.02em; }
.main-header p { color: var(--text-muted); font-size: .875rem; }

input.form-control, select.form-select, textarea.form-control {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
  font-size: .9rem;
}
input.form-control:focus, select.form-select:focus, textarea.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .875rem;
  padding: 8px 18px;
  transition: all .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-success { background: #10b981; border-color: #10b981; }
.btn-success:hover { background: #059669; border-color: #059669; }
.btn-warning { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; border-color: #d97706; color: #fff; }
.btn-info { background: #06b6d4; border-color: #06b6d4; color: #fff; }
.btn-info:hover { background: #0891b2; border-color: #0891b2; color: #fff; }

pre, code, .font-mono { font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace; }

.card-header-pattern {
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.tag-badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: .02em;
}

.navbar-tool {
  background: linear-gradient(135deg, #0f172a, #1e293b) !important;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

footer { border-top: 1px solid var(--border); }
footer a { transition: color .15s ease, opacity .15s ease; }
footer a:hover { text-decoration: underline; opacity: .85; }
footer .btn:hover { opacity: .9; }

.card {
  animation: fadeUp .35s ease both;
}
.card:nth-child(1) { animation-delay:0s }
.card:nth-child(2) { animation-delay:.02s }
.card:nth-child(3) { animation-delay:.04s }
.card:nth-child(4) { animation-delay:.06s }
.card:nth-child(5) { animation-delay:.08s }
.card:nth-child(6) { animation-delay:.1s }
.card:nth-child(7) { animation-delay:.12s }
.card:nth-child(8) { animation-delay:.14s }
.card:nth-child(9) { animation-delay:.16s }
.card:nth-child(10) { animation-delay:.18s }
.card:nth-child(11) { animation-delay:.2s }
.card:nth-child(12) { animation-delay:.22s }
.card:nth-child(13) { animation-delay:.24s }
.card:nth-child(14) { animation-delay:.26s }
.card:nth-child(15) { animation-delay:.28s }
.card:nth-child(16) { animation-delay:.3s }

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

.hero-section {
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 100%);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}
.hero-section h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; }
.hero-section p { max-width: 540px; color: var(--text-muted); }

@media (max-width: 767.98px) {
  .sidebar-desktop { display: none; }
  .main-content { padding: 1rem !important; }
  .hero-section { padding: 1.25rem; }
  .hero-section h1 { font-size: 1.35rem; }
}
