/* ==========================================================================
   TomzDevTool — Design tokens
   Dark-first developer UI. Small radius, subtle borders, quiet shadows.
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg: #0a0b0e;
  --bg-elevated: #101216;
  --surface: #131519;
  --surface-2: #1b1e23;
  --surface-3: #23262c;
  --border: #24272d;
  --border-strong: #33373f;
  --text: #e7e9ee;
  --text-muted: #8b909b;
  --text-faint: #5b616c;

  --accent: #22d3b8;
  --accent-strong: #1ab49d;
  --accent-soft: rgba(34, 211, 184, 0.12);
  --accent-contrast: #06211d;

  --success: #3fcf8e;
  --warning: #f0b429;
  --danger: #f0554b;
  --info: #4c9ffe;

  --success-soft: rgba(63, 207, 142, 0.14);
  --warning-soft: rgba(240, 180, 41, 0.14);
  --danger-soft: rgba(240, 85, 75, 0.14);
  --info-soft: rgba(76, 159, 254, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --bg: #f7f8fa;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --surface-3: #e7e9ee;
  --border: #e2e4e9;
  --border-strong: #cfd3da;
  --text: #14161a;
  --text-muted: #5b6270;
  --text-faint: #888e99;

  --accent: #0f9e8c;
  --accent-strong: #0c8577;
  --accent-soft: rgba(15, 158, 140, 0.1);
  --accent-contrast: #ffffff;

  --success: #16a34a;
  --warning: #b45309;
  --danger: #dc2626;
  --info: #2563eb;

  --success-soft: rgba(22, 163, 74, 0.1);
  --warning-soft: rgba(180, 83, 9, 0.1);
  --danger-soft: rgba(220, 38, 38, 0.1);
  --info-soft: rgba(37, 99, 235, 0.1);

  --shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 22, 26, 0.08);
  --shadow-lg: 0 20px 48px rgba(20, 22, 26, 0.12);
}

:root {
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;

  --header-h: 60px;
  --sidebar-w: 260px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  transition: background-color .15s ease, color .15s ease;
}

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
input, textarea, select { font-family: inherit; color: inherit; }

::selection { background: var(--accent); color: var(--accent-contrast); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

.mono { font-family: var(--font-mono); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* ==========================================================================
   App shell / layout
   ========================================================================== */

.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: relative;
  z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: var(--space-3); flex: 0 0 auto; }
.topbar-search { flex: 1 1 auto; display: flex; justify-content: center; }
.topbar-right { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto; }

.logo { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; font-size: 15px; }
.logo-mark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--accent-contrast);
  background: var(--accent);
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  letter-spacing: -0.05em;
  flex: 0 0 auto;
}
.logo-text { white-space: nowrap; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.theme-toggle i { display: none; }
[data-theme-pref="dark"] .theme-toggle .icon-moon { display: inline; }
[data-theme-pref="light"] .theme-toggle .icon-sun { display: inline; }
[data-theme-pref="system"] .theme-toggle .icon-system { display: inline; }

.drawer-toggle { display: none; }

.search-trigger {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; max-width: 520px; height: 38px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-faint);
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color .12s ease, color .12s ease;
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-muted); }
.search-trigger-text { flex: 1; text-align: left; }
.search-kbd { display: flex; gap: 4px; }
kbd {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  border-radius: 4px; padding: 2px 6px; line-height: 1.3;
}

.mobile-search-btn { display: none; }

.app-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 0;
}

.sidebar {
  grid-column: 1;
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  overflow-y: auto;
  padding: var(--space-4) var(--space-3) var(--space-6);
  display: flex; flex-direction: column;
  min-height: 0;
}
.sidebar-mobile-header { display: none; }
.sidebar-nav { flex: 1; }

.nav-section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  color: var(--text-faint); text-transform: uppercase;
  margin: var(--space-5) var(--space-2) var(--space-2);
}
.nav-section-label:first-child { margin-top: var(--space-1); }

.nav-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 8px 10px; border-radius: var(--radius-md);
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  margin-bottom: 2px;
  transition: background-color .1s ease, color .1s ease;
}
.nav-link i { width: 16px; text-align: center; font-size: 14px; flex: 0 0 auto; color: var(--text-faint); }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover i { color: var(--text-muted); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-link.is-active i { color: var(--accent); }
.nav-badge {
  margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: .03em;
  color: var(--accent-contrast); background: var(--accent);
  padding: 2px 6px; border-radius: 999px; line-height: 1.4;
}

.sidebar-footer {
  font-size: 11.5px; color: var(--text-faint);
  padding: var(--space-3) 10px 0; border-top: 1px solid var(--border);
  margin-top: var(--space-3);
}

.drawer-overlay {
  position: fixed; inset: 0; background: rgba(5, 6, 8, .6);
  opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 45;
}
body.drawer-open .drawer-overlay { opacity: 1; pointer-events: auto; }

.content-col { grid-column: 2; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.main-content { flex: 1 0 auto; width: 100%; max-width: 1320px; margin: 0 auto; padding: var(--space-8) var(--space-10) var(--space-6); }

.site-footer { border-top: 1px solid var(--border); margin-top: auto; }
.site-footer-inner {
  max-width: 1320px; margin: 0 auto; padding: var(--space-6) var(--space-10) var(--space-8);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-5);
  flex-wrap: wrap; color: var(--text-faint); font-size: 13px;
}
.site-footer-brand p { margin: 6px 0 0; font-size: 12.5px; }
.site-footer-links { display: flex; gap: var(--space-5); }
.site-footer-links a { color: var(--text-muted); transition: color .12s ease; }
.site-footer-links a:hover { color: var(--accent); }
.site-footer-copy { white-space: nowrap; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: 38px; padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, transform .05s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); border-color: var(--border-strong); }

.btn-sm { height: 32px; padding: 0 var(--space-3); font-size: 12.5px; }
.btn-lg { height: 46px; padding: 0 var(--space-6); font-size: 14.5px; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: transparent; border-color: var(--border-strong); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-block { width: 100%; }
.btn-group { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ==========================================================================
   Form fields
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field-row { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.field-row > .field { flex: 1 1 160px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field-hint { font-size: 11.5px; color: var(--text-faint); }

.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13.5px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.select { appearance: none; -webkit-appearance: none; cursor: pointer; background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; padding-right: 32px; }
[data-theme="dark"] .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%238b909b' d='M6 8 0 0h12z'/%3E%3C/svg%3E"); }
[data-theme="light"] .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6270' d='M6 8 0 0h12z'/%3E%3C/svg%3E"); }

.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { font-family: var(--font-mono); resize: vertical; line-height: 1.6; }

.checkbox-row { display: flex; align-items: center; gap: var(--space-2); font-size: 13.5px; color: var(--text); cursor: pointer; user-select: none; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-5); margin-bottom: var(--space-4); }

.range-row { display: flex; align-items: center; gap: var(--space-4); }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-value {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 10px; min-width: 44px; text-align: center;
}

/* ==========================================================================
   Cards / badges / tabs / tooltip
   ========================================================================== */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-5); }
.card-hover { transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.card-hover:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }

.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); margin-bottom: var(--space-5); overflow-x: auto; }
.tab {
  padding: 9px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-muted);
  border: none; background: none; border-bottom: 2px solid transparent; cursor: pointer;
  margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-color: var(--accent); }

[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 7px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--surface-3); color: var(--text);
  font-size: 11.5px; padding: 5px 9px; border-radius: var(--radius-sm);
  white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  border: 1px solid var(--border-strong); z-index: 60;
}
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Command palette
   ========================================================================== */

.cmdk-backdrop { position: fixed; inset: 0; background: rgba(5, 6, 8, .6); z-index: 150; animation: fade-in .15s ease; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.cmdk {
  position: fixed; top: 14vh; left: 50%; transform: translateX(-50%);
  width: min(560px, 92vw); max-height: 64vh;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  z-index: 151; display: flex; flex-direction: column; overflow: hidden;
  animation: cmdk-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cmdk-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
.cmdk-inputwrap { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.cmdk-inputwrap > i { color: var(--text-faint); font-size: 14px; }
.cmdk-input { flex: 1; border: none; background: transparent; color: var(--text); font-size: 15px; outline: none; min-width: 0; }
.cmdk-input::placeholder { color: var(--text-faint); }
.cmdk-close { width: 28px; height: 28px; flex: 0 0 auto; cursor: pointer; background: transparent; border: none; padding: 0; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.cmdk-list { list-style: none; margin: 0; padding: var(--space-2); overflow-y: auto; flex: 1; min-height: 0; }
.cmdk-item { display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px; border-radius: var(--radius-md); cursor: pointer; color: var(--text); }
.cmdk-item-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--text-muted); flex: 0 0 auto; }
.cmdk-item-body { flex: 1; min-width: 0; }
.cmdk-item-name { display: block; font-size: 13.5px; font-weight: 500; }
.cmdk-item-desc { display: block; font-size: 12px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item-cat { font-size: 10.5px; color: var(--text-faint); background: var(--surface-2); padding: 3px 7px; border-radius: 4px; flex: 0 0 auto; white-space: nowrap; }
.cmdk-item.is-selected { background: var(--accent-soft); }
.cmdk-item.is-selected .cmdk-item-icon { background: var(--accent); color: var(--accent-contrast); }
.cmdk-empty { padding: var(--space-8) var(--space-4); text-align: center; color: var(--text-faint); font-size: 13px; }
.cmdk-footer { display: flex; gap: var(--space-4); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); font-size: 11px; color: var(--text-faint); flex: 0 0 auto; }
.cmdk-footer kbd { margin-right: 2px; }

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-region {
  position: fixed; z-index: 200; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  pointer-events: none; max-width: calc(100vw - 24px);
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 360px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  border-radius: var(--radius-md); padding: 12px 14px; box-shadow: var(--shadow-lg);
  color: var(--text); font-size: 13px; animation: toast-in .18s ease;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast > i { margin-top: 1px; flex: 0 0 auto; }
.toast.toast-success > i { color: var(--success); }
.toast.toast-error > i { color: var(--danger); }
.toast.toast-warning > i { color: var(--warning); }
.toast.is-leaving { animation: toast-out .15s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

/* ==========================================================================
   Dashboard
   ========================================================================== */

.hero { padding: var(--space-12) 0 var(--space-8); }
.hero h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; max-width: 760px; }
.hero h1 .accent-text { color: var(--accent); }
.hero .lead { margin-top: var(--space-4); color: var(--text-muted); font-size: 16px; max-width: 560px; line-height: 1.65; }
.hero-search { margin-top: var(--space-6); max-width: 480px; }
.hero-search .search-trigger { height: 46px; font-size: 14px; }

.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; margin: var(--space-8) 0;
}
.stat { background: var(--surface); padding: var(--space-5) var(--space-6); }
.stat-value { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin: var(--space-10) 0 var(--space-4); }
.section-heading h2 { font-size: 18px; }
.section-heading .section-sub { font-size: 12.5px; color: var(--text-faint); }
.section-heading .section-link { font-size: 12.5px; color: var(--accent); font-weight: 600; }

.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.category-card i.cat-icon {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: var(--space-3);
}
.category-card h3 { font-size: 14.5px; margin-bottom: 4px; }
.category-card p { font-size: 12.5px; color: var(--text-faint); line-height: 1.55; }

.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.tool-card { display: flex; flex-direction: column; gap: var(--space-3); position: relative; }
.tool-card i.tool-icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: var(--surface-2); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.tool-card h3 { font-size: 14.5px; padding-right: 24px; }
.tool-card p { font-size: 12.5px; color: var(--text-faint); line-height: 1.55; min-height: 36px; }
.tool-card .tool-open { font-size: 12.5px; color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; margin-top: auto; }
.tool-card .tool-open i { font-size: 11px; transition: transform .15s ease; }
.tool-card:hover .tool-open i { transform: translateX(3px); }

.fav-btn {
  position: absolute; top: var(--space-4); right: var(--space-4);
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  font-size: 15px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
}
.fav-btn:hover { color: var(--warning); background: var(--surface-2); }
.fav-btn.is-fav { color: var(--warning); }
.fav-btn.is-fav i { font-weight: 900; }

.tool-page-header-actions .btn[data-fav-toggle].is-fav { color: var(--warning); border-color: var(--warning); }

.recent-list, .fav-list { display: flex; flex-direction: column; gap: 2px; }
.recent-item {
  display: flex; align-items: center; gap: var(--space-4);
  padding: 10px 12px; border-radius: var(--radius-md); position: relative;
}
.recent-item:hover { background: var(--surface-2); }
.recent-item i.tool-icon { width: 32px; height: 32px; font-size: 13px; flex: 0 0 auto; }
.recent-item-name { font-size: 13.5px; font-weight: 500; flex: 1; min-width: 0; }
.recent-item-cat { font-size: 11.5px; color: var(--text-faint); }
.recent-item-time { font-size: 12px; color: var(--text-faint); white-space: nowrap; }

.empty-state { text-align: center; padding: var(--space-10) var(--space-4); color: var(--text-faint); }
.empty-state i { font-size: 26px; margin-bottom: var(--space-3); color: var(--text-faint); opacity: .6; }
.empty-state h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.empty-state p { font-size: 12.5px; max-width: 300px; margin: 0 auto; line-height: 1.6; }

/* ==========================================================================
   Tool page shell (shared by every tool under /tools)
   ========================================================================== */

.breadcrumb { font-size: 12.5px; color: var(--text-faint); margin-bottom: var(--space-3); display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

.tool-page-header {
  display: flex; align-items: flex-start; gap: var(--space-4);
  margin-bottom: var(--space-6); padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.tool-icon-lg {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex: 0 0 auto;
}
.tool-page-header-text { flex: 1 1 240px; min-width: 0; }
.tool-page-header h1 { font-size: 22px; }
.tool-page-header p { margin-top: 4px; color: var(--text-muted); font-size: 13.5px; }
.tool-page-header-actions { display: flex; gap: var(--space-2); flex: 0 0 auto; }

/* ==========================================================================
   Loading
   ========================================================================== */

.spinner { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
