:root {
  --bg: #f7f8fb !important;
  --panel: #ffffff !important;
  --panel-soft: #f4f6fa !important;
  --line: #e7ebf2 !important;
  --text: #131722 !important;
  --muted: #667085 !important;
  --accent: #3677ff !important;
  --accent-soft: rgba(54, 119, 255, 0.1) !important;
}

html,
body {
  background:
    radial-gradient(circle at top left, rgba(54, 119, 255, 0.08), transparent 24%),
    linear-gradient(180deg, #fbfcfe 0%, #f7f8fb 100%) !important;
  color: var(--text) !important;
}

.shell {
  width: min(calc(100% - 24px), 1320px) !important;
  margin: 0 auto !important;
  padding: 0 0 28px !important;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  min-height: 56px;
  margin-bottom: 14px;
  padding: 0 4px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  border-radius: 0 !important;
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(12px) !important;
  box-shadow: none !important;
}

.brand {
  display: none !important;
}

.brand::before {
  display: none !important;
}

.nav-links,
.links {
  display: flex !important;
  align-items: center;
  gap: 14px !important;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  color: var(--muted) !important;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
}

.nav-links::-webkit-scrollbar,
.links::-webkit-scrollbar {
  display: none;
}

.nav-links a,
.links a {
  display: inline-flex !important;
  align-items: center;
  min-height: 56px;
  padding: 0 2px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted) !important;
  transition: 160ms ease;
  font-size: 14px;
}

.nav-links a:hover,
.links a:hover {
  color: var(--text) !important;
  background: transparent !important;
}

.nav-links a.active,
.links a.active {
  color: var(--accent) !important;
  background: transparent !important;
  border-bottom-color: var(--accent);
  box-shadow: none !important;
}

.nav .site-lang-switch,
.nav #site-lang-switch {
  align-self: center;
}

.hero,
.toolbar,
.controls,
.filters,
.section,
.panel,
.card,
.summary-card,
.stat,
.rewrite-card,
.line-card,
.chunk {
  background: rgba(255, 255, 255, 0.95) !important;
  background-image: none !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06) !important;
  backdrop-filter: none !important;
}

.toolbar,
.hero,
.controls,
.filters,
.section,
.panel {
  padding: 18px !important;
}

h1,
h2,
h3,
h4,
.toolbar-head h1,
.section-head h2,
.hero h1,
.hero h2,
.brand {
  color: var(--text) !important;
  letter-spacing: 0 !important;
}

h1,
.toolbar-head h1,
.hero h1 {
  font-size: 30px !important;
  line-height: 1.18 !important;
}

h2,
.section-head h2,
.hero h2 {
  font-size: 20px !important;
  line-height: 1.3 !important;
}

p,
.meta,
.summary,
.hint,
.toolbar-head p,
.hero-copy,
.section-head p,
.stat-label,
.filter-label,
.chip,
.badge,
.status-badge,
.empty,
.host,
.line-note,
.label,
.tile-meta {
  color: var(--muted) !important;
}

.eyebrow,
.count,
.line-index,
.chunk-index {
  color: var(--accent) !important;
}

.eyebrow::before {
  background: var(--accent-soft) !important;
  border-color: rgba(54, 119, 255, 0.2) !important;
}

input,
textarea,
select,
.search input,
input[type="search"] {
  background: #ffffff !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

.chip-btn,
.chip,
.badge,
.status-badge,
.pill,
.ghost,
.btn,
.link-btn {
  background: #ffffff !important;
  color: var(--muted) !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
}

.chip-btn.active,
.chip-btn:hover,
.chip.active,
.pill.primary,
.btn-primary {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border-color: rgba(54, 119, 255, 0.18) !important;
}

.visit,
.open,
.btn-primary,
.link-btn,
.btn-row .btn:first-child {
  background: var(--accent) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

.tool-card,
.quick-card,
.item-card,
.card,
.rewrite-card,
.line-card,
.chunk {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #fbfcff) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

.tool-card:hover,
.quick-card:hover,
.item-card:hover,
.card:hover,
.rewrite-card:hover,
.line-card:hover,
.chunk:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 14px 26px rgba(54, 119, 255, 0.08) !important;
}

.tool-card::before,
.quick-card::before,
.card::before,
.quote-card::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  left: 0 !important;
  top: 10px !important;
  bottom: 10px !important;
  width: 3px !important;
  border-radius: 0 4px 4px 0 !important;
  background: var(--tool-accent, var(--card-accent, var(--accent))) !important;
  opacity: 0.72 !important;
  pointer-events: none !important;
}

.stats,
.summary-grid {
  gap: 12px !important;
}

.stat {
  padding: 14px !important;
}

.count {
  background: var(--accent-soft) !important;
  border: 1px solid rgba(54, 119, 255, 0.16) !important;
}

.logo,
.mini-logo,
.card-icon,
.icon {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #f7f9ff) !important;
  color: var(--accent) !important;
  border: 1px solid var(--line) !important;
}

.mini-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.mini-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 4px;
  object-fit: contain;
  display: block;
  opacity: 0;
  background: #ffffff;
  pointer-events: none;
}

.mini-logo.has-image img {
  opacity: 1;
}

.mini-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.mini-logo.has-image .mini-logo-fallback {
  display: none;
}

.compact-head {
  display: grid;
  grid-template-columns: 32px 1fr;
  column-gap: 10px;
  align-items: start;
}

.compact-copy {
  min-width: 0;
}

code {
  background: #f4f6fa;
  border-radius: 6px;
  padding: 2px 6px;
}

@media (max-width: 980px) {
  .nav {
    top: 0;
  }
}

@media (max-width: 720px) {
  h1,
  .toolbar-head h1,
  .hero h1 {
    font-size: 26px !important;
  }

  .toolbar,
  .hero,
  .controls,
  .filters,
  .section,
  .panel {
    padding: 14px !important;
  }

  .filter-row {
    display: grid !important;
    gap: 8px !important;
    align-items: start !important;
  }

  .filter-label {
    padding-top: 0 !important;
  }

  .chips,
  .filter-group {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    padding-bottom: 4px !important;
    scrollbar-width: none;
  }

  .chips::-webkit-scrollbar,
  .filter-group::-webkit-scrollbar {
    display: none;
  }

  .chip-btn,
  .filter-chip {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
  }
}
