/* ============================================
   ToolBoxHub - Complete Stylesheet
   ============================================ */

/* --- CSS Variables / Theme --- */
:root {
  --primary: #38b2ac;
  --primary-dark: #2f9590;
  --primary-light: rgba(56,178,172,0.08);
  --secondary: #10B981;
  --secondary-dark: #059669;
  --accent: #f59e0b;
  --bg: #f5f7fa;
  --bg-secondary: #eef1f5;
  --bg-card: #ffffff;
  --bg-code: #f1f5f9;
  --text: #1a202c;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --nav-height: 64px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1200px;
  --transition: 0.2s ease;
  /* Icon color palette (tlbx-style) */
  --icon-1: #38b2ac;
  --icon-1-bg: rgba(56,178,172,0.1);
  --icon-2: #10b981;
  --icon-2-bg: rgba(16,185,129,0.1);
  --icon-3: #f59e0b;
  --icon-3-bg: rgba(245,158,11,0.1);
  --icon-4: #8b5cf6;
  --icon-4-bg: rgba(139,92,246,0.1);
  --icon-5: #f43f5e;
  --icon-5-bg: rgba(244,63,94,0.1);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-code: #0f172a;
  --primary-light: rgba(56,178,172,0.15);
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --border-light: #1e293b;
  --shadow: 0 1px 3px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.45);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
ul, ol { list-style: none; }

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  backdrop-filter: blur(8px);
  transition: background var(--transition), border var(--transition);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.nav-logo:hover { color: var(--primary); }

.nav-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--bg-secondary);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  transition: all var(--transition);
  margin-left: 8px;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

/* --- Hero Section --- */
.hero {
  padding: 56px 0 40px;
  text-align: center;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero h1 span { color: var(--primary); }

.hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 28px;
}

/* --- Search / Filter --- */
.search-bar {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 12px 44px 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56,178,172,0.12);
}

.search-bar .search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* --- Tab Section --- */
.tab-section { padding: 28px 0 48px; }

/* --- Tab Layout: sidebar + content --- */
.tab-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.tab-sidebar {
  flex-shrink: 0;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: calc(var(--nav-height) + 16px);
}

.tab-sidebar .tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  text-align: left;
  white-space: nowrap;
}

.tab-sidebar .tab-btn i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.tab-sidebar .tab-btn:hover {
  color: var(--text);
  background: var(--bg-secondary);
}

.tab-sidebar .tab-btn.active {
  color: var(--primary);
  background: rgba(56,178,172,0.15);
  font-weight: 700;
}

/* --- Tab Content --- */
.tab-content {
  flex: 1;
  min-width: 0;
}

.tab-panel {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.tab-panel.active {
  display: block;
  animation: tabFadeIn 0.3s ease;
}

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

.tab-desc {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* --- Tool Cards Grid --- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all var(--transition);
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  min-height: 82px;
}

.tool-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.tool-card-icon {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 6px;
  background: var(--icon-1-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-1);
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: background var(--transition);
}

.tool-card:nth-child(2) .tool-card-icon { background: var(--icon-2-bg); color: var(--icon-2); }
.tool-card:nth-child(3) .tool-card-icon { background: var(--icon-3-bg); color: var(--icon-3); }
.tool-card:nth-child(4) .tool-card-icon { background: var(--icon-4-bg); color: var(--icon-4); }
.tool-card:nth-child(5) .tool-card-icon { background: var(--icon-5-bg); color: var(--icon-5); }

.tool-card:hover .tool-card-icon {
  background: rgba(56,178,172,0.18);
}
.tool-card:nth-child(2):hover .tool-card-icon { background: rgba(16,185,129,0.18); }
.tool-card:nth-child(3):hover .tool-card-icon { background: rgba(245,158,11,0.18); }
.tool-card:nth-child(4):hover .tool-card-icon { background: rgba(139,92,246,0.18); }
.tool-card:nth-child(5):hover .tool-card-icon { background: rgba(244,63,94,0.18); }

.tool-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tool-card-body h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
  line-height: 1.3;
}

.tool-card-body p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* --- Footer --- */
.footer {
  margin-top: auto;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 36px 0 28px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 28px;
  margin-bottom: 24px;
}

.footer-col h4 {
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.footer-col a {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 3px 0;
}

.footer-col a:hover { color: var(--primary); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============================================
   PAGE LAYOUTS
   ============================================ */

/* --- Page Header (for tool/info pages) --- */
.page-header {
  padding: 36px 0 28px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.page-header .breadcrumb {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.page-header .breadcrumb a { color: var(--text-muted); }
.page-header .breadcrumb a:hover { color: var(--primary); }

.page-header p {
  color: var(--text-secondary);
  max-width: 680px;
  font-size: 0.95rem;
}

/* --- Tool Layout --- */
.tool-layout {
  max-width: 840px;
  margin: 0 auto;
  padding: 28px 0;
}

/* --- Tool Interface Card --- */
.tool-card-interface {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
}

.tool-card-interface h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 18px;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

input[type="text"],
input[type="url"],
input[type="number"],
input[type="email"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: var(--font);
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56,178,172,0.15);
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

select {
  cursor: pointer;
  appearance: auto;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

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

.btn-secondary:hover {
  border-color: var(--text-muted);
}

.btn-success {
  background: var(--secondary);
  color: #fff;
}

.btn-success:hover {
  background: var(--secondary-dark);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.85rem;
}

.btn-block { width: 100%; }

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

/* --- Result Box --- */
.result-box {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  min-height: 60px;
  max-height: 400px;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.result-box:empty::before {
  content: 'Results will appear here...';
  color: var(--text-muted);
  font-family: var(--font);
  font-style: italic;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* --- Tags / Badges --- */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 2px;
}

.tag-blue { background: rgba(56,178,172,0.1); color: var(--primary); }
.tag-green { background: rgba(16,185,129,0.1); color: var(--secondary); }
.tag-orange { background: rgba(245,158,11,0.1); color: var(--accent); }
.tag-red { background: rgba(239,68,68,0.1); color: #ef4444; }

/* --- Ad Placeholder --- */
.ad-placeholder {
  background: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  margin: 16px 0;
}

.ad-banner {
  width: 100%;
  min-height: 90px;
}

.ad-inline {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: 24px auto;
}

.ad-placeholder::after {
  content: 'Ad';
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* SEO Content Section */
.seo-content {
  padding: 32px 0 48px;
}

.seo-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.seo-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 24px;
}

.seo-content p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.7;
}

.seo-content ul {
  list-style: disc;
  padding-left: 24px;
  margin-bottom: 16px;
}

.seo-content ul li {
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* --- Info Pages (About, Privacy, Contact, Terms) --- */
.info-content {
  padding: 48px 0;
  max-width: 800px;
}

.info-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 32px 0 12px;
}

.info-content h2:first-child { margin-top: 0; }

.info-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 24px 0 8px;
}

.info-content p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.7;
}

.info-content ul {
  list-style: disc;
  padding-left: 24px;
  margin-bottom: 16px;
}

.info-content ul li {
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* --- Contact Form --- */
.contact-form {
  max-width: 600px;
}

.contact-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* --- Alert / Message --- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.alert-info { background: rgba(56,178,172,0.1); border-left: 3px solid var(--primary); color: var(--text); }
.alert-success { background: rgba(16,185,129,0.1); border-left: 3px solid var(--secondary); color: var(--text); }
.alert-warning { background: rgba(245,158,11,0.1); border-left: 3px solid var(--accent); color: var(--text); }
.alert-error { background: rgba(239,68,68,0.1); border-left: 3px solid #ef4444; color: var(--text); }

/* --- Status Badge --- */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}

.status-high { background: rgba(16,185,129,0.15); color: var(--secondary); }
.status-medium { background: rgba(245,158,11,0.15); color: var(--accent); }
.status-low { background: rgba(239,68,68,0.15); color: #ef4444; }

/* --- Table Styles --- */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table th, table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table th {
  font-weight: 600;
  background: var(--bg-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

table tr:hover td { background: var(--bg-secondary); }

/* --- Chart / Bar Visualization --- */
.bar-chart { margin: 16px 0; }
.bar-item { margin-bottom: 10px; }
.bar-label { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 0.88rem; }
.bar-track { height: 8px; background: var(--bg-secondary); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.bar-fill.positive { background: var(--secondary); }
.bar-fill.negative { background: #ef4444; }
.bar-fill.neutral { background: var(--accent); }
.bar-fill.primary { background: var(--primary); }

/* --- Color Preview (Gradient Generator) --- */
.color-preview {
  width: 100%;
  height: 150px;
  border-radius: var(--radius);
  margin: 16px 0;
  border: 1px solid var(--border);
}

/* --- Invoice Preview --- */
.invoice-preview {
  background: #fff;
  color: #0f172a;
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 16px;
  font-size: 0.88rem;
}

.invoice-preview h2 { font-size: 1.4rem; margin-bottom: 24px; color: #0f172a; }
.invoice-preview table { color: #0f172a; }
.invoice-preview table th { background: #f8fafc; color: #475569; }
.invoice-preview table td { color: #0f172a; }
.invoice-preview .total-row td { font-weight: 700; font-size: 1.05rem; }

/* --- Progress Bar --- */
.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--bg-secondary);
  border-radius: 5px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--primary);
  transition: width 0.5s ease;
}

/* --- Modal (for upgrade/paywall) --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 0.92rem;
}

.modal-actions { display: flex; gap: 10px; }

/* --- Two column layout for forms --- */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* --- Checkbox / Toggle --- */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* --- Tab Styles --- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab {
  padding: 10px 20px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  font-family: var(--font);
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* --- Gradient Presets --- */
.presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.preset-swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
}

.preset-swatch:hover, .preset-swatch.active {
  border-color: var(--primary);
  transform: scale(1.1);
}

/* --- Timezone Slider --- */
.timezone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.tz-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.tz-card .city { font-weight: 600; font-size: 0.95rem; }
.tz-card .time { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin: 4px 0; }
.tz-card .date { font-size: 0.8rem; color: var(--text-muted); }
.tz-card.overlap { background: rgba(16,185,129,0.1); border-color: var(--secondary); }

/* --- Invoice Items --- */
.invoice-item {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.invoice-item input { padding: 8px 10px; font-size: 0.88rem; }

.invoice-item .remove-item {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
}

/* --- History (unit converter) --- */
.history-list {
  margin-top: 16px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size: 0.88rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* --- Preview Image (thumbnail analyzer) --- */
.preview-image {
  max-width: 320px;
  max-height: 240px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 12px 0;
}

/* --- Barcode --- */
.barcode-output {
  background: #fff;
  padding: 24px;
  border-radius: var(--radius);
  display: inline-block;
  text-align: center;
}

/* --- Responsive --- */
@media (max-width: 900px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .hero h1 { font-size: 1.6rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .tool-card { padding: 14px; gap: 12px; }
  .tool-card-icon { width: 42px; height: 42px; min-width: 42px; font-size: 1rem; }
  .tool-card-body h3 { font-size: 0.9rem; }
  .tool-card-body p { font-size: 0.8rem; }
  .tab-section { padding: 16px 0 32px; }
}

@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  .form-row-2, .contact-form .form-row { grid-template-columns: 1fr; }
  .invoice-item { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .page-header h1 { font-size: 1.6rem; }
  .nav-links a { font-size: 0.82rem; padding: 6px 10px; }

  /* Sidebar becomes horizontal tabs on mobile */
  .tab-layout { flex-direction: column; gap: 0; }
  .tab-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    position: static;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 4px;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-sidebar::-webkit-scrollbar { display: none; }
  .tab-sidebar .tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 10px 16px;
    font-size: 0.85rem;
    width: auto;
  }
  .tab-sidebar .tab-btn i { width: auto; }
  .tab-content {
    border-top: none;
  }
  .tab-panel {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 20px;
  }
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: var(--bg);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 9999;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* --- Loading Spinner --- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Barcode canvas container --- */
.canvas-container {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: #fff;
  border-radius: var(--radius);
  margin: 16px 0;
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.items-center { align-items: center; }
.hidden { display: none !important; }

/* --- Print --- */
@media print {
  .nav, .footer, .ad-placeholder, .no-print { display: none !important; }
}
