:root {
  --bg: #0b0d0c;
  --panel: #121513;
  --panel-2: #181c19;
  --line: #2a2f2b;
  --text: #f4f7f4;
  --muted: #949b95;
  --accent: #b8f23d;
  --accent-dark: #18230a;
  --danger: #ff6b6b;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(184, 242, 61, .055), transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, summary { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.topbar {
  height: 72px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 12, .82);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 750; letter-spacing: -.03em; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #0a0d08; background: var(--accent); font-weight: 900; }
.brand-large { font-size: 22px; }
.brand-large .brand-mark { width: 38px; height: 38px; }
.top-actions, .system-status { display: flex; align-items: center; gap: 18px; }
.system-status { gap: 8px; color: var(--muted); font-size: 13px; }
.system-status i, .badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(184, 242, 61, .09); }
.icon-button { border: 1px solid var(--line); background: var(--panel); color: var(--muted); width: 36px; height: 36px; border-radius: 10px; }
.icon-button:hover { color: var(--text); border-color: #484e49; }

.container { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 68px 0 80px; }
.hero { display: flex; align-items: end; justify-content: space-between; margin-bottom: 34px; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: .18em; font-weight: 800; margin: 0 0 12px; }
h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1; letter-spacing: -.055em; margin: 0 0 15px; }
.muted { color: var(--muted); margin: 0; line-height: 1.6; }
.stat { display: flex; align-items: baseline; gap: 8px; color: var(--muted); }
.stat strong { font-size: 30px; color: var(--text); letter-spacing: -.04em; }

.flash { display: flex; align-items: center; justify-content: space-between; margin: 0 0 18px; padding: 13px 16px; border: 1px solid rgba(184,242,61,.25); border-radius: 12px; background: var(--accent-dark); color: #dff99d; font-size: 14px; }
.flash.error { border-color: rgba(255,107,107,.3); background: rgba(255,107,107,.08); color: #ffadad; }
.flash button { color: inherit; border: 0; background: transparent; font-size: 20px; }

.add-panel { padding: 22px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 22px 70px rgba(0,0,0,.16); }
.add-form { display: grid; grid-template-columns: minmax(280px, 1fr) 110px 190px auto; gap: 12px; align-items: end; }
label { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
label > span, .settings-form label > span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
label em { color: #616861; font-style: normal; letter-spacing: 0; font-weight: 500; }
input, select {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #0e110f;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #555c56; }
input:focus, select:focus { border-color: rgba(184, 242, 61, .58); box-shadow: 0 0 0 3px rgba(184, 242, 61, .07); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%); background-position: calc(100% - 16px) 19px, calc(100% - 11px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.input-with-icon { position: relative; }
.input-with-icon b { position: absolute; left: 14px; top: 12px; color: var(--muted); z-index: 1; }
.input-with-icon input { padding-left: 39px; }
.button { height: 46px; border: 0; border-radius: 11px; padding: 0 19px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; font-weight: 750; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; transform: none; cursor: wait; }
.button.primary { color: #10140a; background: var(--accent); }
.button.primary:hover { background: #c5ff47; }
.button.secondary { color: var(--text); background: #242a25; border: 1px solid #333a34; }
.full { width: 100%; }
.form-hint { margin: 13px 0 0; font-size: 12px; color: #687068; }

.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 44px 0 18px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.section-heading span { color: var(--muted); font-size: 12px; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.product-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); transition: transform .18s, border-color .18s; }
.product-card:hover { transform: translateY(-3px); border-color: #414842; }
.product-card.has-error { border-color: rgba(255, 107, 107, .25); }
.product-image { height: 220px; display: grid; place-items: center; overflow: hidden; position: relative; background: #f1f2ef; }
.product-image img { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; mix-blend-mode: multiply; }
.image-placeholder { color: #abb0aa; font-size: 42px; }
.external { position: absolute; top: 12px; right: 12px; width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: #333; background: rgba(255,255,255,.8); opacity: 0; transition: opacity .15s; z-index: 2; }
.product-image:hover .external { opacity: 1; }
.product-content { padding: 20px; }
.product-meta { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.badge { display: inline-flex; align-items: center; gap: 7px; color: #c8e98b; background: rgba(184, 242, 61, .08); border: 1px solid rgba(184, 242, 61, .13); border-radius: 20px; padding: 5px 9px; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.badge.danger { color: #ffadad; background: rgba(255,107,107,.08); border-color: rgba(255,107,107,.15); }
.product-content h3 { height: 44px; margin: 16px 0 12px; font-size: 16px; line-height: 1.4; letter-spacing: -.02em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price-line { display: flex; align-items: baseline; gap: 7px; }
.price-line strong { font-size: 31px; letter-spacing: -.05em; }
.price-line > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.price-line small { margin-left: auto; padding: 4px 6px; border-radius: 6px; font-weight: 700; }
.price-line small.down { color: var(--accent); background: rgba(184,242,61,.08); }
.price-line small.up { color: #ff9292; background: rgba(255,107,107,.08); }
.checked { color: #6f766f; font-size: 11px; margin: 8px 0 16px; }
.scrape-error { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #ff9292; font-size: 11px; }
details { border-top: 1px solid var(--line); }
summary { list-style: none; padding: 13px 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
summary::-webkit-details-marker { display: none; }
details[open] summary span { transform: rotate(180deg); }
.settings-form { display: grid; gap: 12px; padding: 5px 0 16px; }
.settings-row { display: grid; grid-template-columns: .7fr 1.3fr; gap: 10px; }
.settings-form input, .settings-form select { height: 39px; font-size: 12px; }
.toggle { flex-direction: row; align-items: center; color: var(--muted); font-size: 11px; cursor: pointer; }
.toggle input { display: none; }
.toggle span { width: 30px; height: 18px; border-radius: 12px; background: #333933; position: relative; }
.toggle span::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #777f78; left: 3px; top: 3px; transition: .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(12px); background: #172006; }
.card-actions { min-height: 35px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 5px 12px; flex-wrap: wrap; }
.text-button { padding: 4px 0; border: 0; color: var(--muted); background: transparent; font-size: 11px; }
.text-button:hover { color: var(--text); }
.text-button.delete:hover { color: var(--danger); }
.empty-state { padding: 80px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty-state > span { font-size: 35px; color: var(--accent); }
.empty-state h2 { color: var(--text); font-size: 18px; margin: 15px 0 8px; }
.empty-state p { margin: 0; font-size: 13px; }
footer { padding: 24px; border-top: 1px solid var(--line); text-align: center; color: #5c635d; font-size: 11px; }
footer span { color: var(--accent); padding: 0 5px; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, .78fr) 1.22fr; }
.login-card { width: min(430px, calc(100% - 60px)); margin: auto; display: grid; gap: 48px; }
.login-card h1 { font-size: 43px; margin-bottom: 12px; }
.stack { display: grid; gap: 17px; }
.login-visual { margin: 14px; border-radius: 24px; overflow: hidden; position: relative; background: #171c15; border: 1px solid #283024; }
.login-visual::before { content: ""; position: absolute; inset: 0; opacity: .28; background-image: linear-gradient(rgba(184,242,61,.15) 1px, transparent 1px), linear-gradient(90deg, rgba(184,242,61,.15) 1px, transparent 1px); background-size: 55px 55px; mask-image: linear-gradient(to top right, black, transparent 72%); }
.orb { position: absolute; width: 430px; height: 430px; border: 1px solid rgba(184,242,61,.4); border-radius: 50%; left: 20%; top: 20%; box-shadow: 0 0 130px rgba(184,242,61,.12), inset 0 0 90px rgba(184,242,61,.07); }
.orb::before, .orb::after { content: ""; position: absolute; border-radius: 50%; inset: 45px; border: 1px solid rgba(184,242,61,.18); }
.orb::after { inset: 105px; background: radial-gradient(circle at 35% 30%, #d8ff80, #9ad025 45%, #28400c); border: 0; box-shadow: 0 0 80px rgba(184,242,61,.3); }
.visual-copy { position: absolute; left: 48px; bottom: 42px; color: #dbe6d2; font-size: 22px; line-height: 1.4; font-weight: 560; }
.pulse-dot { display: block; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 7px rgba(184,242,61,.09); }

@media (max-width: 960px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .add-form { grid-template-columns: minmax(250px, 1fr) 100px; }
  .add-button { align-self: end; }
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 18px; }
  .system-status { display: none; }
  .container { width: min(100% - 28px, 1180px); padding-top: 45px; }
  .hero { align-items: start; }
  .hero .stat { display: none; }
  h1 { font-size: 38px; }
  .add-form { grid-template-columns: 1fr 1fr; }
  .url-field { grid-column: 1 / -1; }
  .add-form label:nth-of-type(3) { grid-column: 1 / -1; }
  .add-button { grid-column: 1 / -1; }
  .product-grid { grid-template-columns: 1fr; }
  .product-image { height: 240px; }
  .login-card { width: min(100% - 36px, 430px); gap: 42px; }
}
