:root {
  --bg: #080b14;
  --bg2: #0d1220;
  --card: rgba(255, 255, 255, 0.05);
  --card2: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.1);
  --border2: rgba(255, 255, 255, 0.16);
  --text: #eef1f8;
  --muted: #9aa4bd;
  --accent1: #8b5cf6;
  --accent2: #22d3ee;
  --green: #34d399;
  --red: #f87171;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #22d3ee 100%);
  --grad-soft: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.12));
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: 'Unbounded', 'Inter', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(600px 400px at 12% -5%, rgba(139, 92, 246, 0.22), transparent 65%),
    radial-gradient(700px 500px at 95% 15%, rgba(34, 211, 238, 0.14), transparent 65%),
    radial-gradient(900px 700px at 50% 115%, rgba(99, 102, 241, 0.16), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 26px 26px;
}

.display-font { font-family: var(--font-display); }

.navbar { background: rgba(10, 14, 24, 0.75) !important; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.navbar .nav-link { font-family: var(--font-display); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text) !important; }
.brand-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .04em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-decoration: none;
}
.brand-logo i { -webkit-text-fill-color: var(--accent2); }

.glass {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.glass-soft {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.btn { border-radius: 14px; font-weight: 600; }
.btn-grad {
  background: var(--grad);
  border: none;
  color: #fff;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-grad:hover:not(:disabled), .btn-grad:focus { color: #fff; transform: translateY(-2px); box-shadow: 0 14px 36px rgba(99, 102, 241, 0.55); }
.btn-grad:disabled { opacity: .4; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border2);
  color: var(--text);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.form-control, .form-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border2);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 14px;
  font-size: .95rem;
}
.form-control:focus, .form-select:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent1);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18);
  color: var(--text);
}
.form-select option { background: #141a2c; color: var(--text); }
.form-control::placeholder { color: rgba(154, 164, 189, 0.6); }
.form-label { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.text-muted-2 { color: var(--muted) !important; }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  letter-spacing: .01em;
  background: linear-gradient(135deg, #fff 20%, #c7d2fe 60%, var(--accent2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .sub { color: var(--muted); font-size: .98rem; }

.step-card { transition: border-color .2s, transform .2s; }
.step-card:has(select:focus), .step-card:has(select:valid:focus) { border-color: var(--accent1); }
.step-num {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  font-family: var(--font-display);
  font-size: .8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}
.step-title { font-family: var(--font-display); font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.badge-kind {
  font-size: .68rem; font-weight: 700; letter-spacing: .05em;
  padding: .35em .7em; border-radius: 999px;
}
.badge-new { background: rgba(52, 211, 153, 0.16); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.35); }
.badge-old { background: rgba(248, 113, 113, 0.12); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.3); }
.badge-off { background: rgba(255, 255, 255, 0.07); color: var(--muted); }

.stat-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .45rem .9rem; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  font-size: .82rem; color: var(--muted);
}
.stat-chip b { color: var(--text); font-family: var(--font-display); font-size: .78rem; }

.nav-pills-custom .nav-link {
  font-size: .8rem; font-weight: 600; color: var(--muted);
  border-radius: 999px; padding: .5rem 1rem;
  border: 1px solid transparent;
}
.nav-pills-custom .nav-link.active {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}
.nav-pills-custom .nav-link:not(.active):hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.table-glass { --bs-table-bg: transparent; --bs-table-color: var(--text); }
.table-glass thead th {
  font-family: var(--font-display);
  font-size: .64rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-glass tbody td { border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; font-size: .9rem; }
.table-glass tbody tr:hover { background: rgba(255, 255, 255, 0.035); }

.pill-radio { display: none; }
.pill-radio + label {
  display: inline-block; padding: .55rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--border2); background: rgba(255, 255, 255, 0.04);
  color: var(--muted); font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: all .15s; user-select: none;
}
.pill-radio:checked + label { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4); }
.pill-radio:hover + label { border-color: var(--accent1); }

.login-wrap { min-height: calc(100vh - 100px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 430px; padding: 2.2rem; position: relative; overflow: hidden; }
.login-card::before {
  content: ''; position: absolute; top: -60px; left: 50%; transform: translateX(-50%);
  width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35), transparent 70%);
  pointer-events: none;
}

.upload-zone { border: 2px dashed var(--border2); border-radius: var(--radius-sm); padding: 1.4rem; text-align: center; transition: border-color .2s, background .2s; cursor: pointer; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent1); background: var(--grad-soft); }

.toast { border-radius: 14px; }
#ol-toast { z-index: 2000; }

@media (max-width: 767px) {
  .hero h1 { font-size: 1.35rem; }
  .login-card { padding: 1.6rem; }
  .step-card { padding: .9rem !important; }
  .table-glass { font-size: .82rem; }
  .nav-pills-custom { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav-pills-custom::-webkit-scrollbar { display: none; }
  .nav-pills-custom .nav-link { white-space: nowrap; }
}

/* ===== print ===== */
.print-toolbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10, 14, 24, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  color: #fff;
}
.print-toolbar .info { font-size: .8rem; color: var(--muted); min-width: 160px; }
.print-toolbar .info b { color: var(--text); }
.print-toolbar .btn { border-radius: 12px; font-weight: 600; font-size: .88rem; padding: 9px 18px; }

@media print {
  .print-toolbar { display: none !important; }
  body { background: #fff; }
  body::before, body::after { display: none; }
}

/* ===== workspace: tabs ===== */
.ol-tabs { gap: 8px; }
.ol-tabs .nav-link {
  border-radius: 999px;
  padding: .55rem 1.15rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
  transition: all .15s;
}
.ol-tabs .nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.09); }
.ol-tabs .nav-link.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}
.ol-badge {
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  font-size: .72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .25em .6em;
  margin-left: 2px;
}
.ol-tabs .nav-link.active .ol-badge { background: rgba(0, 0, 0, 0.22); }
.ol-badge.ok { background: rgba(52, 211, 153, 0.18); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.35); }

/* ===== search ===== */
.search-results { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; scrollbar-width: thin; }
.sr-item {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  transition: border-color .15s, background .15s;
}
.sr-item:hover { border-color: var(--accent1); background: rgba(139, 92, 246, 0.08); }
.sr-item.is-added { opacity: .55; }
.sr-name { font-weight: 600; font-size: .88rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sr-meta { display: flex; gap: 8px; align-items: center; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.sr-bc { font-family: monospace; }
.sr-price { font-weight: 800; font-size: .92rem; white-space: nowrap; }
.sr-old { font-size: .74rem; color: var(--red); text-decoration: line-through; }
.sr-add {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 10px; padding: 0;
  background: var(--grad); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.sr-add:hover { color: #fff; transform: scale(1.06); }
.sr-added {
  font-size: .62rem; font-weight: 700; letter-spacing: .05em;
  color: var(--green); text-transform: uppercase; white-space: nowrap;
}
.sr-none { text-align: center; color: var(--muted); font-size: .85rem; padding: 18px 0; }

.minw-0 { min-width: 0; }
.nowrap { white-space: nowrap; }

/* ===== added list ===== */
.added-list { display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow-y: auto; scrollbar-width: thin; }
.added-empty { color: var(--muted); font-size: .85rem; text-align: center; padding: 18px 0; }
.added-item {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 10px;
}
.a-name { font-weight: 600; font-size: .86rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.a-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .72rem; color: var(--muted); margin-top: 2px; }
.a-cat { opacity: .8; }
.a-old { color: var(--red); }
.a-price { max-width: 118px; flex: 0 0 auto; }
.a-price .form-control { text-align: right; font-weight: 700; padding: 4px 8px; font-size: .86rem; }
.a-price .input-group-text { background: rgba(255, 255, 255, 0.05); border-color: var(--border2); color: var(--muted); font-size: .78rem; padding: 0 8px; }
.a-del { width: 32px; height: 32px; flex: 0 0 32px; padding: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center; }

/* ===== preview area ===== */
.pv-area { position: relative; overflow: hidden; min-height: 220px; border-radius: 14px; }
.pv-area .pv-page { margin: 0 auto; }

/* ===== db tab ===== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: .4rem .85rem; border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border2);
  color: var(--muted); font-size: .8rem; font-weight: 600;
  transition: all .15s;
}
.chip:hover { border-color: var(--accent1); color: var(--text); }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35); }
.chip .ol-badge { background: rgba(255, 255, 255, 0.16); }

.table-glass.db-table { --bs-table-bg: transparent; --bs-table-color: var(--text); }
.db-table thead th {
  font-family: var(--font-display);
  font-size: .62rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap; padding: .55rem .75rem;
}
.db-table tbody td { border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; font-size: .88rem; padding: .45rem .75rem; }
.db-table tbody tr { transition: background .15s; }
.db-table tbody tr:hover { background: rgba(139, 92, 246, 0.06); }
.db-table tbody tr.is-added { opacity: .55; }
.db-name { font-weight: 600; max-width: 380px; }
.db-name .ol-badge { font-size: .6rem; vertical-align: middle; }

@media (max-width: 991px) {
  .pv-area { overflow-x: auto; }
}
