/* ═══════════════════════════════════════════════════
   ToolkitsApp — iOS-Inspired Design System
   ═══════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #e8e8ed;
  --bg-tool: #ffffff;
  --bg-input: #f5f5f7;
  --bg-glass: rgba(255, 255, 255, 0.72);
  --bg-card: #ffffff;

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #aeaeb2;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #e0e7ff;
  --accent-bg: #eef2ff;

  --success: #34c759;
  --error: #ff3b30;
  --warning: #ff9500;
  --info: #007aff;

  --border: #d2d2d7;
  --border-light: #e5e5ea;
  --border-hover: #c7c7cc;

  --shadow-xs: 0 0.5px 1px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --bg-primary: #000000;
  --bg-secondary: #1c1c1e;
  --bg-tertiary: #2c2c2e;
  --bg-tool: #1c1c1e;
  --bg-input: #1c1c1e;
  --bg-glass: rgba(28, 28, 30, 0.78);
  --bg-card: #1c1c1e;

  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #636366;

  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: #312e81;
  --accent-bg: #1e1b4b;

  --success: #30d158;
  --error: #ff453a;
  --warning: #ff9f0a;
  --info: #0a84ff;

  --border: #38383a;
  --border-light: #2c2c2e;
  --border-hover: #48484a;

  --shadow-xs: 0 0.5px 1px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.5);
}


/* ── Base ── */
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }


/* ── Navigation (Frosted Glass) ── */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--border-light);
}


/* ── Search ── */
.search-input-wrap {
  position: relative;
}

.search-input {
  background: var(--bg-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 14px;
  color: var(--text-primary);
  transition: all 0.25s ease;
  outline: none;
}

.search-input:focus {
  background: var(--bg-primary);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-input::placeholder { color: var(--text-tertiary); }

.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 200;
}

.search-results.active { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s;
  border-bottom: 0.5px solid var(--border-light);
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-secondary); }

.search-result-item .result-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-result-item .result-icon i { color: var(--accent); width: 16px; height: 16px; }
.search-result-item .result-name { font-weight: 500; font-size: 14px; }
.search-result-item .result-cat { font-size: 12px; color: var(--text-tertiary); }


/* ── Icon Button ── */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.icon-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}


/* ── Logo ── */
.nav-logo {
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}


/* ── Dark mode icon visibility ── */
.dark-hidden { display: block; }
.dark-show { display: none; }
[data-theme="dark"] .dark-hidden { display: none; }
[data-theme="dark"] .dark-show { display: block; }


/* ── Language selector ── */
.lang-selector { position: relative; }

.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  display: none;
  z-index: 300;
  max-height: 80vh;
  overflow-y: auto;
}

.lang-dropdown.show { display: block; }

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.lang-option:hover { background: var(--bg-secondary); }
.lang-option.active { background: var(--accent-bg); color: var(--accent); font-weight: 500; }

.lang-flag { font-size: 18px; line-height: 1; }
.lang-name { flex: 1; }
.lang-check { margin-left: 6px; color: var(--accent); }

[dir="rtl"] .lang-dropdown { right: auto; left: 0; }


/* ── How to Use list ── */
.how-to-use p {
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
  margin: 6px 0;
}
[dir="rtl"] .how-to-use p { border-left: none; border-right: 3px solid var(--accent); }


/* ── Drop zone (file upload) ── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 36px 24px;
  text-align: center;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.drop-zone:hover { border-color: var(--accent); background: var(--accent-bg); }
.drop-zone.dragover { border-color: var(--accent); background: var(--accent-bg); }
.drop-zone-icon { width: 44px; height: 44px; margin: 0 auto 12px; color: var(--text-tertiary); }
.drop-zone:hover .drop-zone-icon, .drop-zone.dragover .drop-zone-icon { color: var(--accent); }
.drop-zone-title { font-weight: 600; font-size: 15px; color: var(--text-primary); margin-bottom: 4px; }
.drop-zone-hint { font-size: 13px; color: var(--text-tertiary); }
.drop-zone .browse-link { color: var(--accent); font-weight: 600; cursor: pointer; }


/* ── Image preview ── */
.img-preview {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  display: block;
  margin: 0 auto;
  background: repeating-conic-gradient(#f0f0f0 0% 25%, transparent 0% 50%) 50% / 16px 16px;
}


/* ── Color picker block ── */
.color-input-row { display: flex; align-items: center; gap: 8px; }
.color-picker-input {
  width: 44px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 2px;
}


/* ── Live result block ── */
.result-block {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}
.result-block .result-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; padding: 6px 0;
}
.result-block .result-row + .result-row { border-top: 1px dashed var(--border-light); }
.result-block .result-row .label { color: var(--text-secondary); font-weight: 500; }
.result-block .result-row .value {
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--text-primary); font-weight: 600;
}


/* ── Hero ── */
.hero-section {
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%);
  opacity: 0.4;
  pointer-events: none;
}

[data-theme="dark"] .hero-section::before { opacity: 0.15; }

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 16px;
  position: relative;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 36px;
  line-height: 1.6;
  position: relative;
}

.hero-search {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.hero-search input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 16px;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  outline: none;
}

.hero-search input:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent-light);
}

.hero-search input::placeholder { color: var(--text-tertiary); }

.hero-search .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}


/* ── Tool Cards ── */
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.tool-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.tool-card:hover .tool-card-icon {
  background: var(--accent);
}

.tool-card-icon i {
  width: 22px;
  height: 22px;
  color: var(--accent);
  transition: color 0.3s;
}

.tool-card:hover .tool-card-icon i { color: white; }

.tool-card-name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
}

.tool-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.section-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-icon i { width: 20px; height: 20px; color: var(--accent); }

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}


/* ── Popular Tools (horizontal scroll) ── */
.popular-scroll-wrap {
  position: relative;
}

.popular-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding-bottom: 8px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.popular-scroll::-webkit-scrollbar { display: none; }

.popular-scroll .tool-card {
  min-width: 220px;
  max-width: 260px;
  scroll-snap-align: start;
  flex-shrink: 0;
}
[dir="rtl"] .popular-scroll .tool-card {
  scroll-snap-align: end;
}

/* Desktop nav arrows for the popular-tools carousel.
   Hidden by default (mobile uses touch swipe); shown on >=768px when content overflows. */
.popular-scroll-arrow {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  z-index: 5;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, opacity 0.2s, transform 0.15s;
  padding: 0;
}

.popular-scroll-arrow i {
  width: 20px;
  height: 20px;
}

.popular-scroll-arrow.left  { left: -8px; }
.popular-scroll-arrow.right { right: -8px; }

.popular-scroll-arrow:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.popular-scroll-arrow.is-disabled {
  opacity: 0;
  pointer-events: none;
}

@media (min-width: 768px) {
  .popular-scroll-wrap.has-overflow .popular-scroll-arrow {
    display: flex;
  }
}


/* ── Tool Page ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--text-tertiary); }

.tool-container {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.tool-container-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Split layout for dual-panel tools */
.tool-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .tool-split { grid-template-columns: 1fr; }
}

.tool-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tool-panel-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Textarea */
.code-input {
  width: 100%;
  min-height: 240px;
  padding: 16px;
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  resize: vertical;
  outline: none;
  transition: all 0.25s ease;
  tab-size: 2;
}

.code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--bg-primary);
}

.code-input::placeholder { color: var(--text-tertiary); }

/* Code output */
.code-output {
  width: 100%;
  min-height: 240px;
  padding: 16px;
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}


/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--bg-tertiary); }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 6px;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* Segmented control (iOS-style toggle) */
.segmented-control {
  display: inline-flex;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.segmented-btn {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.segmented-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.segmented-sm .segmented-btn {
  padding: 3px 10px;
  font-size: 12px;
}

/* ── JSON Tree View ── */
.json-tree {
  font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.7;
}
.jt-line { white-space: nowrap; }
.jt-toggle { cursor: pointer; border-radius: 3px; }
.jt-toggle:hover { background: rgba(128,128,128,0.08); }
.jt-arrow {
  display: inline-block;
  width: 16px;
  text-align: center;
  font-size: 10px;
  color: var(--text-tertiary);
  user-select: none;
  vertical-align: middle;
  transition: color 0.15s;
}
.jt-toggle:hover .jt-arrow { color: var(--accent); }
.jt-sp   { display: inline-block; width: 16px; }
.jt-key  { color: var(--accent); font-weight: 600; }
.jt-str  { color: var(--success); }
.jt-num  { color: var(--info); }
.jt-bool { color: var(--warning); }
.jt-null { color: var(--error); font-style: italic; }
.jt-br   { color: var(--text-secondary); font-weight: 500; }
.jt-punc { color: var(--text-tertiary); }
.jt-comma { color: var(--text-tertiary); }
.jt-ell  { color: var(--text-tertiary); font-size: 12px; font-style: italic; }

/* Expanded: hide ellipsis + toggle comma */
.jt-node:not(.jt-collapsed) > .jt-toggle .jt-ell,
.jt-node:not(.jt-collapsed) > .jt-toggle .jt-ct { display: none; }
/* Collapsed: hide children + close line */
.jt-node.jt-collapsed > .jt-children,
.jt-node.jt-collapsed > .jt-close { display: none; }

/* Action toolbar */
.tool-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}


/* ── Slider ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}


/* ── Toggle / Switch (iOS style) ── */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}


/* ── Feature/FAQ sections ── */
.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.feature-item i { color: var(--success); width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.feature-item span { font-size: 14px; color: var(--text-primary); }

.faq-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 8px;
}

.faq-item summary {
  padding: 16px 20px;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}

.faq-item summary:hover { background: var(--bg-secondary); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 20px; color: var(--text-tertiary); transition: transform 0.2s; }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item .faq-answer { padding: 0 20px 16px; font-size: 14px; color: var(--text-secondary); line-height: 1.65; }


/* ── Ad Container ── */
.ad-container {
  text-align: center;
  margin: 40px auto;
  max-width: 728px;
}

.ad-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}


/* ── Toast ── */
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 1.7s forwards;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast-success i { color: var(--success); }
.toast-error i { color: var(--error); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(50%); }
}


/* ── Category Badge ── */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}


/* ── Checkbox / Radio (iOS style) ── */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
}

.checkbox-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  border-radius: 4px;
}


/* ── Number Input ── */
.num-input {
  width: 80px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.num-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}


/* ── Select ── */
.select-input {
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}


/* ── Password strength bar ── */
.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--bg-tertiary);
  overflow: hidden;
}

.strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
}


/* ── Stat cards ── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label { font-size: 13px; color: var(--text-tertiary); font-weight: 500; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }


/* ── Color swatch ── */
.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid var(--border-light);
}

.color-swatch:hover { transform: scale(1.05); }


/* ── Glass card (frosted panel, used on login & dashboard) ── */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
}


/* ── Dashboard ── */
.dash-shell { max-width: 1280px; margin: 0 auto; padding: 24px 24px 64px; }

.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.dash-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.dash-subtitle { font-size: 13px; color: var(--text-tertiary); margin-top: 2px; }

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.dash-card-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; }

.dash-stat-label { font-size: 13px; color: var(--text-tertiary); font-weight: 500; }
.dash-stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.dash-stat-delta { font-size: 12px; font-weight: 600; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.dash-stat-delta.up { color: var(--success); }
.dash-stat-delta.down { color: var(--error); }
.dash-stat-delta.flat { color: var(--text-tertiary); }

.dash-period {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 2px;
}
.dash-period button {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
  border: none;
  background: transparent;
  cursor: pointer;
}
.dash-period button.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.dash-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.dash-table th { text-align: left; font-weight: 600; color: var(--text-tertiary); padding: 8px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.dash-table td { padding: 10px; border-top: 1px solid var(--border-light); color: var(--text-primary); }
.dash-table tr:hover td { background: var(--bg-input); }

.dash-bar-track { background: var(--bg-input); border-radius: var(--radius-full); height: 6px; overflow: hidden; }
.dash-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #a78bfa); border-radius: var(--radius-full); }

.dash-chart-wrap { position: relative; height: 260px; }
.dash-chart-wrap.tall { height: 320px; }


/* ── Responsive ── */
@media (max-width: 640px) {
  .tool-container { padding: 16px; border-radius: var(--radius-md); }
  .hero-section { padding: 48px 0 40px; }
  .code-input, .code-output { min-height: 180px; font-size: 12px; }
  .dash-shell { padding: 16px 16px 48px; }
}
