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

:root {
  --primary: #5b4fcf;
  --primary-h: #6d63d9;
  --primary-l: #7c73e0;
  --primary-bg: #eeeeff;
  --primary-bd: #c4c0f0;
  --bg: #f3f3fb;
  --surface: #ffffff;
  --s2: #f7f7fb;
  --s3: #ededf7;
  --border: #e4e4ef;
  --bd2: #d0d0e2;
  --text: #1a1a2e;
  --t2: #5a5a7a;
  --t3: #9090a8;
  --error: #e53935;
  --err-bg: #fff0f0;
  --ok: #16a34a;
  --ok-bg: #f0fdf4;
  --radius: 12px;
  --rsm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06),0 4px 16px rgba(91,79,207,0.07);
  --shadow-md: 0 4px 20px rgba(91,79,207,0.12);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.18);
  --tr: 0.2s ease;
}

html[data-theme="dark"] {
  --primary: #8075e5;
  --primary-h: #9088ec;
  --primary-l: #a09ae8;
  --primary-bg: #1e1a3a;
  --primary-bd: #3a3560;
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --s2: #20203a;
  --s3: #252540;
  --border: #2a2a45;
  --bd2: #363660;
  --text: #e8e8f5;
  --t2: #9898b8;
  --t3: #5a5a80;
  --error: #f87171;
  --err-bg: #2a1515;
  --ok: #4ade80;
  --ok-bg: #0f2a1a;
  --shadow: 0 1px 3px rgba(0,0,0,0.4),0 4px 16px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.5);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  transition: background var(--tr), color var(--tr);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bd2); border-radius: 3px; }

/* ── Header ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
  transition: background var(--tr), border-color var(--tr);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-l));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(91,79,207,0.4); flex-shrink: 0;
}
.logo-text { display: flex; flex-direction: column; }
.logo-title { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2; }
.logo-sub { font-size: 11px; color: var(--t3); line-height: 1.2; }
.header-actions { display: flex; align-items: center; gap: 6px; }

/* ── Main ── */
.main { padding: 28px 0 100px; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 50%, #0891b2 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -50%; right: -5%; width: 300px; height: 300px;
  background: rgba(255,255,255,0.06); border-radius: 50%; pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute; bottom: -60%; right: 15%; width: 200px; height: 200px;
  background: rgba(255,255,255,0.04); border-radius: 50%; pointer-events: none;
}
.hero-content { position: relative; }
.hero-title { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.hero-sub { font-size: 13.5px; color: rgba(255,255,255,0.8); max-width: 380px; line-height: 1.5; }
.hero-stats { display: flex; align-items: center; gap: 20px; position: relative; flex-shrink: 0; }
.stat { text-align: center; }
.stat-val { display: block; font-size: 28px; font-weight: 800; color: #fff; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 11px; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.stat-div { width: 1px; height: 40px; background: rgba(255,255,255,0.2); }

/* ── Tabs ── */
.tabs {
  display: flex; gap: 2px;
  background: var(--s2); border: 1px solid var(--border);
  border-radius: 10px; padding: 4px; width: fit-content; margin-bottom: 20px;
}
.tab {
  background: transparent; border: none; border-radius: 7px;
  padding: 8px 20px; font-size: 13.5px; font-weight: 500; font-family: inherit;
  color: var(--t2); cursor: pointer; transition: all 0.15s;
}
.tab.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }
.tab:hover:not(.active) { color: var(--text); background: var(--s3); }

/* ── Layout ── */
.layout { display: grid; grid-template-columns: 1fr 400px; gap: 20px; align-items: start; }

/* ── Form Panel ── */
.form-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
  transition: background var(--tr), border-color var(--tr);
}

/* Progress */
.progress-wrap { margin-bottom: 24px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--t3); margin-bottom: 6px; font-weight: 500; }
.progress-track { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-l)); border-radius: 2px; transition: width 0.4s cubic-bezier(.4,0,.2,1); }

/* Fields */
.field-group { margin-bottom: 20px; }
.field-group label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px;
}
.req { color: var(--error); font-size: 13px; }

/* Input wrap */
.input-wrap { position: relative; }
.input-wrap input {
  width: 100%; height: 42px; border: 1.5px solid var(--bd2); border-radius: var(--rsm);
  font-size: 13.5px; font-family: inherit; color: var(--text); background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, background var(--tr); outline: none;
  padding: 0 14px;
}
.input-wrap.with-icon input { padding-left: 38px; }
.input-wrap.with-badge input { padding-left: 104px; }
.input-wrap input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,79,207,0.12); }
.input-wrap input.error { border-color: var(--error); box-shadow: 0 0 0 3px rgba(229,57,53,0.08); }
.input-wrap input.valid { border-color: var(--ok); }
.input-wrap input::placeholder { color: var(--t3); }

.inp-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--t3); display: flex; align-items: center; pointer-events: none;
}
.badge {
  position: absolute; left: 0; top: 0; height: 42px;
  display: flex; align-items: center; padding: 0 10px;
  font-size: 10.5px; font-weight: 700; font-family: 'Courier New', monospace;
  color: var(--primary); background: var(--primary-bg);
  border-right: 1.5px solid var(--primary-bd);
  border-radius: var(--rsm) 0 0 var(--rsm); pointer-events: none; white-space: nowrap;
}
.badge.opt { color: var(--t3); background: var(--s2); border-right-color: var(--border); }

.err { display: block; font-size: 12px; color: var(--error); margin-top: 5px; min-height: 16px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip {
  background: var(--s2); border: 1px solid var(--border); border-radius: 20px;
  padding: 3px 10px; font-size: 11.5px; font-family: inherit; color: var(--t2);
  cursor: pointer; transition: all 0.15s;
}
.chip:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }

/* Section dividers */
.sec-divider { display: flex; align-items: center; gap: 10px; margin: 4px 0 20px; }
.sec-divider::before, .sec-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.sec-divider span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--primary); white-space: nowrap; }
.sec-divider.opt span { color: var(--t3); }

/* Tooltip */
.tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; background: var(--s2); border: 1px solid var(--bd2);
  border-radius: 50%; font-size: 9.5px; font-weight: 700; color: var(--t3);
  cursor: help; position: relative; flex-shrink: 0;
}
.tip:hover::after {
  content: attr(data-tip);
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(100% + 8px); background: #1a1a2e; color: #e8e8f5;
  font-size: 12px; font-weight: 400; padding: 8px 12px; border-radius: 7px;
  white-space: normal; width: 220px; z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25); line-height: 1.5; pointer-events: none;
}
.tip:hover::before {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(100% + 2px); border: 5px solid transparent; border-top-color: #1a1a2e; z-index: 200;
}

/* Toggles */
.options-row {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 20px; padding: 14px 16px;
  background: var(--s2); border-radius: var(--rsm); border: 1px solid var(--border);
}
.toggle-label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--t2); cursor: pointer; user-select: none; }
.toggle-label input[type="checkbox"] { display: none; }
.toggle { width: 34px; height: 19px; background: var(--bd2); border-radius: 20px; position: relative; transition: background 0.2s; flex-shrink: 0; }
.toggle::after { content: ''; position: absolute; left: 2px; top: 2px; width: 15px; height: 15px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle-label input:checked + .toggle { background: var(--primary); }
.toggle-label input:checked + .toggle::after { transform: translateX(15px); }
.toggle-label code { background: var(--border); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; font-family: monospace; color: var(--primary); }

/* Live Preview */
.live-preview {
  background: var(--s2); border: 1.5px dashed var(--bd2);
  border-radius: var(--rsm); padding: 12px 14px; margin-bottom: 16px;
}
.live-label { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--t3); margin-bottom: 6px; }
.live-url { font-size: 11.5px; font-family: 'Courier New', monospace; color: var(--primary); word-break: break-all; line-height: 1.6; }

.form-footer { display: flex; justify-content: center; margin-top: 12px; }

/* ── Buttons ── */
.btn-primary {
  width: 100%; height: 46px;
  background: linear-gradient(135deg, var(--primary), var(--primary-l));
  color: #fff; border: none; border-radius: var(--rsm);
  font-size: 14.5px; font-weight: 600; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 14px rgba(91,79,207,0.4);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 22px rgba(91,79,207,0.5); }
.btn-primary:active { transform: translateY(1px); box-shadow: none; }
.btn-primary.sm { width: auto; height: 36px; padding: 0 16px; font-size: 13px; }

.btn-ghost {
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--rsm); padding: 7px 13px; font-size: 13px; font-family: inherit;
  color: var(--t2); cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all 0.15s; white-space: nowrap;
}
.btn-ghost:hover { background: var(--s2); border-color: var(--bd2); color: var(--text); }
.btn-ghost.sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost.icon-btn { padding: 8px; }

.btn-copy {
  background: var(--primary); color: #fff; border: none; border-radius: 7px;
  padding: 9px 16px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: background 0.15s, transform 0.1s;
}
.btn-copy:hover { background: var(--primary-h); }
.btn-copy:active { transform: translateY(1px); }
.btn-copy.copied { background: var(--ok); }

.btn-sec {
  background: var(--surface); color: var(--t2); border: 1.5px solid var(--bd2);
  border-radius: 7px; padding: 8px 13px; font-size: 13px; font-family: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s;
}
.btn-sec:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

.btn-danger { background: var(--error); color: #fff; border: none; border-radius: 7px; padding: 9px 18px; font-size: 13.5px; font-family: inherit; cursor: pointer; transition: opacity 0.15s; }
.btn-danger:hover { opacity: 0.85; }

/* ── Output Panel ── */
.output-panel { display: flex; flex-direction: column; gap: 16px; }

.output-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  transition: background var(--tr), border-color var(--tr);
}
.output-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px 24px; text-align: center; }
.empty-icon { width: 64px; height: 64px; background: var(--s2); border: 1.5px dashed var(--bd2); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--t3); margin-bottom: 4px; }
.output-empty p { font-size: 14px; color: var(--t2); }
.output-empty strong { color: var(--text); }
.empty-hint { font-size: 12.5px; color: var(--t3); }

.output-result { padding: 20px; }
.output-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.output-title { font-size: 14px; font-weight: 700; color: var(--text); }
.output-badges { display: flex; align-items: center; gap: 6px; }
.badge-pill { font-size: 11px; color: var(--t3); background: var(--s2); border: 1px solid var(--border); border-radius: 20px; padding: 2px 9px; white-space: nowrap; }
.badge-pill.accent { color: var(--primary); background: var(--primary-bg); border-color: var(--primary-bd); }

.url-box {
  background: var(--s2); border: 1.5px solid var(--border); border-radius: var(--rsm);
  padding: 14px; font-size: 12px; font-family: 'Courier New', monospace;
  word-break: break-all; color: var(--text); line-height: 1.7;
  margin-bottom: 12px; max-height: 120px; overflow-y: auto;
}

/* Copy formats */
.copy-formats { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.fmt-label { font-size: 12px; color: var(--t3); white-space: nowrap; }
.fmt-btn { background: var(--s2); border: 1px solid var(--border); border-radius: 5px; padding: 3px 9px; font-size: 11.5px; font-family: inherit; color: var(--t2); cursor: pointer; transition: all 0.15s; }
.fmt-btn.active { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); font-weight: 600; }

.output-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }

/* Breakdown */
.breakdown { border-top: 1px solid var(--border); padding-top: 16px; }
.breakdown-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--t3); margin-bottom: 10px; }
.breakdown-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; margin-bottom: 7px; animation: fadeIn 0.2s ease; }
.bd-key { font-family: monospace; font-size: 11px; padding: 2px 7px; border-radius: 4px; white-space: nowrap; font-weight: 600; flex-shrink: 0; }
.bd-key[data-k="utm_source"]   { color: #5b4fcf; background: #eeeeff; }
.bd-key[data-k="utm_medium"]   { color: #0284c7; background: #e0f2fe; }
.bd-key[data-k="utm_campaign"] { color: #16a34a; background: #f0fdf4; }
.bd-key[data-k="utm_id"]       { color: #d97706; background: #fffbeb; }
.bd-key[data-k="utm_term"]     { color: #dc2626; background: #fef2f2; }
.bd-key[data-k="utm_content"]  { color: #7c3aed; background: #f5f3ff; }
html[data-theme="dark"] .bd-key[data-k="utm_source"]   { color: #a09ae8; background: #1e1a3a; }
html[data-theme="dark"] .bd-key[data-k="utm_medium"]   { color: #38bdf8; background: #0c1e30; }
html[data-theme="dark"] .bd-key[data-k="utm_campaign"] { color: #4ade80; background: #0f2a1a; }
html[data-theme="dark"] .bd-key[data-k="utm_id"]       { color: #fbbf24; background: #251c08; }
html[data-theme="dark"] .bd-key[data-k="utm_term"]     { color: #f87171; background: #2a1010; }
html[data-theme="dark"] .bd-key[data-k="utm_content"]  { color: #c084fc; background: #1a0e2a; }
.bd-val { color: var(--t2); word-break: break-all; line-height: 1.5; font-size: 13px; }

@keyframes fadeIn { from { opacity: 0; transform: translateX(-5px); } to { opacity: 1; transform: none; } }

/* QR */
.qr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); transition: background var(--tr), border-color var(--tr); }
.qr-hdr { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.qr-sub { display: block; font-size: 11.5px; color: var(--t3); margin-top: 2px; }
.qr-wrap { display: flex; justify-content: center; }
#qrCanvas { border-radius: 10px; border: 4px solid var(--s2); }

/* Tips */
.tips-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: background var(--tr), border-color var(--tr); }
.tips-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.tips-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tips-list li { font-size: 12.5px; color: var(--t2); padding-left: 14px; position: relative; line-height: 1.5; }
.tips-list li::before { content: '•'; position: absolute; left: 0; color: var(--primary); font-weight: bold; }
.tips-list code { background: var(--primary-bg); border: 1px solid var(--primary-bd); border-radius: 3px; padding: 1px 5px; font-size: 11px; font-family: monospace; color: var(--primary); }

/* ── Bulk Generator ── */
.bulk-layout { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.bulk-form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.bulk-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.bulk-desc { font-size: 13px; color: var(--t3); margin-bottom: 20px; line-height: 1.5; }
.bulk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bulk-results { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.bulk-results-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.bulk-item { border: 1px solid var(--border); border-radius: var(--rsm); padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; transition: all 0.15s; }
.bulk-item:hover { border-color: var(--primary); background: var(--primary-bg); }
.bulk-item-info { flex: 1; min-width: 0; }
.bulk-source { font-size: 11.5px; font-weight: 700; color: var(--primary); background: var(--primary-bg); display: inline-block; padding: 2px 8px; border-radius: 4px; margin-bottom: 5px; border: 1px solid var(--primary-bd); }
.bulk-url { font-size: 11.5px; font-family: monospace; color: var(--t2); word-break: break-all; line-height: 1.5; }
.bulk-copy { background: var(--s2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 12px; color: var(--t2); cursor: pointer; display: flex; align-items: center; gap: 5px; transition: all 0.15s; white-space: nowrap; flex-shrink: 0; font-family: inherit; }
.bulk-copy:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

/* Plain inputs for bulk + modals */
.plain-input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1.5px solid var(--bd2); border-radius: var(--rsm);
  font-size: 13.5px; font-family: inherit; color: var(--text); background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, background var(--tr); outline: none;
}
.plain-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,79,207,0.12); }
.plain-input::placeholder { color: var(--t3); }
.plain-textarea {
  width: 100%; padding: 10px 12px; resize: vertical; min-height: 100px;
  border: 1.5px solid var(--bd2); border-radius: var(--rsm);
  font-size: 13px; font-family: 'Courier New', monospace; color: var(--text); background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s; outline: none;
}
.plain-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,79,207,0.12); }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 500; padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 14px; border: 1px solid var(--border);
  width: 100%; max-width: 620px; max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: slideUp 0.22s cubic-bezier(.34,1.56,.64,1);
}
.modal.modal-sm { max-width: 420px; }
.modal.modal-lg { max-width: 780px; }

@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: none; } }

.modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px;
}
.modal-sub { font-size: 12px; font-weight: 400; color: var(--t3); margin-left: 8px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--t2); padding: 6px; border-radius: 6px; display: flex; transition: background 0.15s; }
.modal-close:hover { background: var(--s2); color: var(--text); }
.modal-body { overflow-y: auto; flex: 1; min-height: 0; padding: 18px 22px; }
.modal-ftr { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* History */
.history-empty { text-align: center; padding: 40px 20px; color: var(--t3); font-size: 14px; }
.history-item { border: 1px solid var(--border); border-radius: var(--rsm); padding: 12px 14px; margin-bottom: 8px; cursor: pointer; transition: all 0.15s; }
.history-item:hover { border-color: var(--primary); background: var(--primary-bg); }
.history-url { font-size: 11.5px; font-family: monospace; color: var(--primary); word-break: break-all; margin-bottom: 7px; line-height: 1.5; }
.history-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11.5px; color: var(--t3); align-items: center; }
.htag { background: var(--s2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 7px; font-size: 11px; }

/* Templates */
.tpl-section { margin-bottom: 24px; }
.tpl-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--t3); margin-bottom: 12px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tpl-card { border: 1.5px solid var(--border); border-radius: var(--rsm); padding: 14px; background: var(--surface); transition: all 0.15s; }
.tpl-card:hover { border-color: var(--primary); background: var(--primary-bg); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tpl-icon { width: 32px; height: 32px; background: var(--primary-bg); border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 16px; }
.tpl-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.tpl-desc { font-size: 11.5px; color: var(--t3); line-height: 1.4; }
.tpl-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tpl-tag { font-size: 10.5px; font-family: monospace; color: var(--primary); background: var(--primary-bg); border: 1px solid var(--primary-bd); border-radius: 3px; padding: 1px 5px; }
.tpl-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.tpl-load { font-size: 11.5px; color: var(--primary); font-weight: 600; cursor: pointer; background: none; border: none; font-family: inherit; padding: 0; }
.tpl-del { font-size: 11px; color: var(--t3); cursor: pointer; background: none; border: none; font-family: inherit; padding: 0; transition: color 0.15s; }
.tpl-del:hover { color: var(--error); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a2e; color: #fff;
  padding: 11px 20px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3); z-index: 999;
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1); pointer-events: none;
  max-width: 400px; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--ok); }
.toast.error { background: var(--error); }

/* Animations */
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes drawerIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }

/* ── Hamburger ── */
.hamburger {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 4.5px; padding: 8px; border-radius: 8px;
  transition: background 0.15s; flex-shrink: 0;
}
.hamburger:hover { background: var(--s2); }
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--text); border-radius: 2px; transition: all 0.2s;
}

/* ── Left Drawer ── */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(3px);
  z-index: 200; display: none; opacity: 0; transition: opacity 0.25s;
}
.drawer-backdrop.open { display: block; opacity: 1; }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px;
  background: var(--surface); border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 300;
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}
.drawer.open { transform: translateX(0); }

.drawer-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
}
.drawer-brand { display: flex; align-items: center; gap: 10px; }
.drawer-brand-icon {
  width: 36px; height: 36px; background: rgba(255,255,255,0.2); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.drawer-brand-name { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.2; }
.drawer-brand-sub { font-size: 11px; color: rgba(255,255,255,0.7); }
.drawer-close {
  background: rgba(255,255,255,0.15); border: none; cursor: pointer;
  color: #fff; padding: 7px; border-radius: 8px; display: flex; transition: background 0.15s;
}
.drawer-close:hover { background: rgba(255,255,255,0.25); }

.drawer-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.drawer-section-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--t3); padding: 6px 8px 4px; margin-bottom: 2px;
}
.drawer-divider { height: 1px; background: var(--border); margin: 8px 0; }

.drawer-item {
  width: 100%; background: none; border: none; border-radius: 9px;
  padding: 10px 12px; font-size: 13.5px; font-family: inherit; color: var(--t2);
  cursor: pointer; display: flex; align-items: center; gap: 10px; text-align: left;
  transition: all 0.15s; margin-bottom: 2px;
}
.drawer-item:hover { background: var(--s2); color: var(--text); }
.drawer-item.active { background: var(--primary-bg); color: var(--primary); font-weight: 600; }
.drawer-item.new { color: var(--text); }
.drawer-item.danger:hover { background: var(--err-bg); color: var(--error); }

.drawer-item-icon {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  background: var(--s2); border-radius: 7px; flex-shrink: 0; transition: background 0.15s;
}
.drawer-item.active .drawer-item-icon { background: var(--primary-bg); color: var(--primary); }
.drawer-item.danger:hover .drawer-item-icon { background: var(--err-bg); color: var(--error); }

.drawer-item-badge {
  margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 2px 7px;
  border-radius: 10px; background: var(--s3); color: var(--t3); white-space: nowrap;
}
.drawer-item-badge.new-badge { background: #fef3c7; color: #d97706; }
html[data-theme="dark"] .drawer-item-badge.new-badge { background: #292108; color: #fbbf24; }

.drawer-item-count {
  margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: 10px; background: var(--primary-bg); color: var(--primary); min-width: 20px; text-align: center;
}

.drawer-footer {
  padding: 14px 18px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.drawer-copy { font-size: 12px; color: var(--t2); }
.drawer-copy strong { color: var(--primary); }
.drawer-version { font-size: 11px; color: var(--t3); margin-top: 2px; cursor: default; user-select: none; }

/* ── Site Footer ── */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 14px 0;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  transition: background var(--tr), border-color var(--tr);
  box-shadow: 0 -1px 12px rgba(0,0,0,0.06);
}
.footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--text); }
.footer-logo-icon {
  width: 24px; height: 24px; background: linear-gradient(135deg, var(--primary), var(--primary-l));
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
}
.footer-copy { font-size: 12.5px; color: var(--t3); }
.footer-copy strong { color: var(--primary); font-weight: 600; }
.footer-powered { font-size: 11.5px; color: var(--t3); opacity: 0.8; }
.footer-links { display: flex; align-items: center; gap: 8px; }
.footer-link { background: none; border: none; font-size: 12.5px; color: var(--t2); cursor: pointer; font-family: inherit; padding: 0; transition: color 0.15s; }
.footer-link:hover { color: var(--primary); }
.footer-dot { color: var(--border); font-size: 12px; }

/* ── About Modal ── */
.modal-about { max-width: 560px; }
.about-hero {
  text-align: center; 
  border-bottom: 1px solid var(--border); 
}
.about-logo {
  width: 45px; height: 45px; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(91,79,207,0.35);
}
.about-name { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.about-ver { font-size: 12.5px; color: var(--t3); }
.about-desc { font-size: 14px; color: var(--t2); line-height: 1.7; margin-bottom: 20px; }
.about-features { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.about-feat { display: flex; align-items: flex-start; gap: 10px; padding: 12px; background: var(--s2); border-radius: 10px; border: 1px solid var(--border); }
.about-feat-icon { font-size: 20px; flex-shrink: 0; line-height: 1; }
.about-feat-title { font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.about-feat-desc { font-size: 11.5px; color: var(--t3); line-height: 1.5; }
.about-divider { height: 1px; background: var(--border); margin: 20px 0; }
.about-team { text-align: center; }
.about-team-label { font-size: 12px; color: var(--t3); margin-bottom: 4px; }
.about-team-name { font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.about-team-desc { font-size: 13px; color: var(--t2); line-height: 1.6; }
.about-contact { margin-top: 12px; }
.about-contact-link { font-size: 13px; color: var(--primary); text-decoration: none; font-weight: 600; border: 1px solid var(--primary); border-radius: 20px; padding: 6px 16px; display: inline-block; transition: background 0.2s, color 0.2s; }
.about-contact-link:hover { background: var(--primary); color: #fff; }
.about-ftr { justify-content: space-between; align-items: center; }
.about-copy { font-size: 12px; color: var(--t3); }

/* ── What's New ── */
.wn-release-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.wn-version { font-size: 18px; font-weight: 800; color: var(--primary); }
.wn-date { font-size: 13px; color: var(--t3); }
.wn-badge { font-size: 11px; font-weight: 700; background: var(--primary); color: #fff; padding: 2px 8px; border-radius: 10px; }
.wn-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.wn-item { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--t2); line-height: 1.5; }
.wn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex-shrink: 0; margin-top: 7px; }
.wn-item.new-item .wn-dot { background: var(--primary); }
.wn-item strong { color: var(--text); }

/* ── UTM Guide ── */
.guide-intro { font-size: 13.5px; color: var(--t2); line-height: 1.7; margin-bottom: 20px; }
.guide-params { display: flex; flex-direction: column; gap: 10px; }
.guide-param { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--s2); }
.guide-key { font-family: 'Courier New', monospace; font-size: 11.5px; font-weight: 700; color: var(--c); background: var(--bg); padding: 4px 8px; border-radius: 5px; white-space: nowrap; flex-shrink: 0; align-self: flex-start; margin-top: 2px; }
.guide-param-body { flex: 1; min-width: 0; }
.guide-param-title { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guide-req { font-size: 10.5px; font-weight: 600; background: #fef2f2; color: #dc2626; padding: 1px 6px; border-radius: 4px; }
.guide-opt { font-size: 10.5px; font-weight: 600; background: var(--s3); color: var(--t3); padding: 1px 6px; border-radius: 4px; }
.guide-param-desc { font-size: 12.5px; color: var(--t2); line-height: 1.5; margin-bottom: 8px; }
.guide-examples { display: flex; flex-wrap: wrap; gap: 5px; }
.guide-examples span { font-size: 11px; font-family: monospace; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 2px 7px; color: var(--t2); }

/* ── Desktop: Drawer always open as sidebar ── */
@media (min-width: 901px) {
  /* Drawer is always visible, no animation needed */
  .drawer {
    transform: translateX(0);
    box-shadow: none;
    border-right: 1px solid var(--border);
  }
  /* Hide close button — drawer can't be closed on desktop */
  .drawer-close { display: none; }
  /* Hide the mobile backdrop */
  .drawer-backdrop { display: none !important; }
  /* Hide hamburger — drawer is always open */
  .hamburger { display: none; }
  /* Push all app content to the right of the sidebar */
  .app { margin-left: 280px; }
  /* Fixed footer must also start after the sidebar */
  .site-footer { left: 280px; }
}

/* ── Tablet / Mobile: Drawer is a slide-in overlay ── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .bulk-layout { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .app { margin-left: 0; }
}

@media (max-width: 480px) {
  .header-inner { padding: 0 16px; }
  .container { padding: 0 16px; }
  .hero { padding: 20px; }
  .hero-title { font-size: 18px; }
  .form-panel { padding: 20px; }
  .hero-stats { flex-direction: row; }
  .header-actions .btn-ghost span { display: none; }
  .drawer { width: 260px; }
}
.about-ftr {
  text-align: center;
}

.about-copy {
  display: inline-block;
  line-height: 1.6;
}

.about-powered {
  display: block;
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

/* ── Analytics Modal ── */
.modal-analytics { max-width: 540px; }
.an-section-label { font-size: 11px; font-weight: 700; color: var(--t3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 10px; }
.an-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.an-grid-2 { grid-template-columns: 1fr; gap: 0; }
.an-card { background: var(--s2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 12px; text-align: center; }
.an-card.an-accent { background: var(--primary-bg); border-color: var(--primary-bd); }
.an-card-icon { font-size: 20px; margin-bottom: 6px; }
.an-card-val { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1; margin-bottom: 4px; }
.an-card-label { font-size: 11px; color: var(--t3); font-weight: 500; }
.an-stat-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.an-stat-row:last-child { border-bottom: none; }
.an-stat-icon { font-size: 16px; flex-shrink: 0; width: 24px; text-align: center; }
.an-stat-label { flex: 1; font-size: 13px; color: var(--t2); }
.an-stat-val { font-size: 16px; font-weight: 700; color: var(--primary); min-width: 32px; text-align: right; }
.an-tracking-info { display: flex; flex-direction: column; gap: 10px; }
.an-track-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px; background: var(--s2); border: 1px solid var(--border); border-radius: 10px; }
.an-track-logo { width: 36px; height: 36px; border-radius: 8px; background: #e8710a; color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.an-track-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.an-track-desc { font-size: 12px; color: var(--t3); line-height: 1.5; }
.an-track-desc code { background: var(--s3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 11px; color: var(--primary); }
