/* IBI Product Listings Master — app styles (light-first, phone type floor 16px) */
:root {
  --ts: 1;
  --bg: #f4f5f8; --panel: #ffffff; --panel-2: #f8f9fc; --line: #e3e6ee; --line-2: #cfd4e0;
  --text: #16192b; --muted: #5b6478; --faint: #8a93a8;
  --accent: #6d28d9; --accent-2: #7f00ff; --accent-soft: #efe7ff; --accent-text: #4c1d95;
  --ok: #15803d; --ok-soft: #dcfce7; --warn: #b45309; --warn-soft: #fef3c7; --err: #b91c1c; --err-soft: #fee2e2; --info: #1d4ed8; --info-soft: #dbeafe;
  --radius: 14px; --radius-s: 9px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 6px 20px rgba(16,24,40,.06);
  --side: 248px; --head: 56px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1118; --panel: #171a24; --panel-2: #1d2130; --line: #2a2f40; --line-2: #3a4058;
  --text: #eef0f6; --muted: #a3abbf; --faint: #6f788f;
  --accent: #a78bfa; --accent-2: #b48cff; --accent-soft: #2b2145; --accent-text: #d6c8ff;
  --ok: #4ade80; --ok-soft: #14301f; --warn: #fbbf24; --warn-soft: #3a2a09; --err: #f87171; --err-soft: #3b1414; --info: #93c5fd; --info-soft: #14243f;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: calc(15px * var(--ts)); line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: calc(24px * var(--ts)); font-weight: 700; } h2 { font-size: calc(19px * var(--ts)); font-weight: 650; } h3 { font-size: calc(16px * var(--ts)); font-weight: 650; } h4 { font-size: calc(14px * var(--ts)); font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: calc(13px * var(--ts)); } .mono { font-family: var(--mono); }
.hidden, [hidden] { display: none !important; }

/* ── shell ── */
.shell { display: grid; grid-template-columns: var(--side) 1fr; grid-template-rows: var(--head) 1fr; min-height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.badge-ver { font: 600 12px/1 var(--mono); padding: 5px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); border: 1px solid transparent; cursor: pointer; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand .mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent-2), #3b0aa0); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; }
.brand small { color: var(--muted); font-weight: 500; }
.topbar .grow { flex: 1; }
.topbar .search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.topbar .search input { flex: 1; border: 0; background: transparent; outline: 0; min-width: 0; }
.iconbtn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.iconbtn:hover { border-color: var(--line-2); color: var(--text); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 13px; cursor: pointer; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: var(--head); height: calc(100dvh - var(--head)); overflow: auto; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav .sec { margin: 14px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.sidebar .plancard { margin: 16px 6px 0; padding: 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.sidebar .plancard b { display: block; }
main { padding: 22px 26px 90px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── panels, cards ── */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel > .ph { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel > .pb { padding: 16px; }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 14px 16px; }
.stat .v { font-size: calc(26px * var(--ts)); font-weight: 700; letter-spacing: -.02em; } .stat .l { color: var(--muted); font-size: calc(13px * var(--ts)); }
.stat .d { font-size: calc(12px * var(--ts)); color: var(--ok); }

/* ── buttons, chips ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { border-color: var(--accent); } .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; } .btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); } .btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--err); border-color: var(--err); } .btn.danger:hover { background: var(--err-soft); }
.btn.sm { padding: 6px 10px; font-size: calc(13px * var(--ts)); border-radius: 8px; }
.btn.busy::before { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font-size: calc(13px * var(--ts)); font-weight: 600; cursor: pointer; user-select: none; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--accent)); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip.static { cursor: default; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: calc(12px * var(--ts)); font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; } .tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; } .tag.err { background: var(--err-soft); color: var(--err); border-color: transparent; } .tag.info { background: var(--info-soft); color: var(--info); border-color: transparent; } .tag.acc { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

/* ── forms ── */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: calc(13px * var(--ts)); font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.field label .cnt { font-weight: 500; color: var(--faint); font-family: var(--mono); font-size: calc(12px * var(--ts)); }
.field .hint { font-size: calc(12px * var(--ts)); color: var(--faint); }
.input, textarea.input, select.input { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); outline: 0; min-width: 0; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 44px; overflow: hidden; }
.input.err { border-color: var(--err); }
.frow { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.frow.tight { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
fieldset.sec { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0 0 14px; background: var(--panel); }
fieldset.sec legend { padding: 0 8px; font-weight: 700; font-size: calc(14px * var(--ts)); color: var(--accent-text); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); transition: .2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
input:checked + .switch { background: var(--accent); } input:checked + .switch::after { left: 21px; }
.check input { position: absolute; opacity: 0; }

/* ── tables ── */
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: calc(12px * var(--ts)); text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; background: var(--panel-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; } tr.rowlink { cursor: pointer; } tr.rowlink:hover td { background: var(--panel-2); }
td .thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--panel-2); border: 1px solid var(--line); }

/* ── listing studio ── */
.studio { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.studio .side { position: sticky; top: calc(var(--head) + 14px); }
.chcard { margin-bottom: 14px; }
.chcard .ph { border-left: 5px solid var(--c, var(--accent)); border-top-left-radius: var(--radius); }
.chcard .ph h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.score { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font-weight: 800; font-size: 15px; background: conic-gradient(var(--sc) calc(var(--pct) * 1%), var(--line) 0); position: relative; }
.score::after { content: attr(data-v); position: absolute; inset: 4px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; }
.meter { height: 6px; border-radius: 999px; background: var(--line); position: relative; overflow: hidden; margin-top: 4px; }
.meter i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ok); border-radius: 999px; }
.meter i.warn { background: var(--warn); } .meter i.err { background: var(--err); } .meter i.low { background: var(--info); }
.meter b { position: absolute; top: -2px; width: 2px; height: 10px; background: var(--faint); opacity: .7; }
.lfield { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lfield:last-child { border-bottom: 0; }
.lfield .lh { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.lfield .lh b { font-size: calc(13px * var(--ts)); color: var(--muted); }
.lfield .lh .cnt { font-family: var(--mono); font-size: calc(12px * var(--ts)); color: var(--faint); }
.lfield .cnt.over { color: var(--err); font-weight: 700; } .lfield .cnt.low { color: var(--info); } .lfield .cnt.band { color: var(--ok); }
.lfield textarea { width: 100%; border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 8px; resize: none; overflow: hidden; line-height: 1.45; }
.lfield textarea:hover { border-color: var(--line); } .lfield textarea:focus { border-color: var(--accent); background: var(--panel); outline: 0; }
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.issues li { display: flex; gap: 8px; align-items: flex-start; font-size: calc(13px * var(--ts)); }
.issues li::before { content: ''; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--info); }
.issues li.warn::before { background: var(--warn); } .issues li.error::before { background: var(--err); } .issues li.ok::before { background: var(--ok); }
.kwlist { display: flex; flex-wrap: wrap; gap: 6px; }
.kwlist .kw { padding: 4px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: calc(12px * var(--ts)); display: inline-flex; gap: 6px; align-items: center; }
.kwlist .kw .w { font-family: var(--mono); color: var(--faint); }
.kwlist .kw.live { border-color: var(--ok); } .kwlist .kw.perf { border-color: var(--accent); }
.imgrow { display: flex; gap: 8px; flex-wrap: wrap; }
.imgrow .im { width: 84px; height: 84px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); position: relative; overflow: hidden; display: grid; place-items: center; color: var(--faint); font-size: 12px; }
.imgrow .im img { width: 100%; height: 100%; object-fit: cover; }
.imgrow .im .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }
.imgrow .im .n { position: absolute; left: 4px; bottom: 3px; font-size: 11px; background: rgba(0,0,0,.55); color: #fff; padding: 1px 5px; border-radius: 4px; }
.varrow { display: grid; grid-template-columns: 1.2fr 1fr 1fr .8fr .8fr .7fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.progress { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; } .progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.pricing { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.plan { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); position: relative; }
.plan.cur { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan .price { font-size: calc(28px * var(--ts)); font-weight: 800; letter-spacing: -.02em; } .plan .price small { font-size: calc(13px * var(--ts)); color: var(--muted); font-weight: 500; }
.plan ul { padding-left: 18px; margin: 10px 0 14px; color: var(--muted); font-size: calc(13.5px * var(--ts)); } .plan li { margin: 3px 0; }
.plan .rib { position: absolute; top: -10px; right: 14px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.callout { padding: 12px 14px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--panel-2); display: flex; gap: 10px; align-items: flex-start; }
.callout.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); } .callout.err { background: var(--err-soft); border-color: transparent; color: var(--err); } .callout.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); } .callout.info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.split { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: calc(14px * var(--ts)); } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.stepper { display: flex; gap: 6px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.stepper .st { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: calc(13px * var(--ts)); color: var(--muted); }
.stepper .st.on { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); } .stepper .st.done { color: var(--ok); }
.stepper .st i { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-style: normal; font-size: 11px; font-weight: 700; }
.stepper .st.on i { background: var(--accent); color: #fff; } .stepper .st.done i { background: var(--ok); color: #fff; }

/* ── modal ── */
.modal { position: fixed; inset: 0; background: rgba(9,12,24,.55); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal .box { width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal .box.wide { width: min(880px, 100%); }
.modal .mh { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; }
.modal .mh h3 { margin: 0; } .modal .mb { padding: 16px 18px; overflow: auto; min-height: 0; flex: 1; } .modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex: none; flex-wrap: wrap; }
.toast-wrap { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 10px; background: #1b1f2e; color: #fff; font-weight: 600; box-shadow: var(--shadow); animation: up .2s ease-out; max-width: min(92vw, 520px); }
.toast.ok { background: #14532d; } .toast.err { background: #7f1d1d; } .toast.warn { background: #78350f; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.tabbar { display: none; }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.help h3 { margin-top: 18px; }
.help ol, .help ul { padding-left: 20px; }
code { font-family: var(--mono); font-size: .92em; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }
.perfrow input { width: 100%; }
.about { font-size: calc(12.5px * var(--ts)); color: var(--faint); margin-top: 16px; }

/* ── responsive ── */
@media (max-width: 1080px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .studio { grid-template-columns: 1fr; } .studio .side { position: static; } }
@media (max-width: 820px) {
  :root { --ts: 1.06; --side: 0px; }
  body { font-size: calc(16px * var(--ts)); }
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  main { padding: 16px 14px 96px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .topbar .search { display: none; } .brand small { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); z-index: 40; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); padding: 4px 2px; border-radius: 10px; }
  .tabbar a svg { width: 22px; height: 22px; } .tabbar a.active { color: var(--accent-text); background: var(--accent-soft); }
  .btn { padding: 11px 14px; } .input, textarea.input, select.input { padding: 11px 12px; font-size: calc(16px * var(--ts)); }
  .field label { font-size: calc(14px * var(--ts)); } .small, .field .hint, .tag { font-size: calc(13px * var(--ts)); }
  .modal { padding: 0; align-items: end; } .modal .box { width: 100%; max-height: 100dvh; border-radius: 16px 16px 0 0; }
  .modal .mf .btn.primary { width: 100%; order: -1; }
  .varrow { grid-template-columns: 1fr 1fr; }
  .lfield textarea { font-size: calc(16px * var(--ts)); }
  th, td { padding: 10px 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .topbar, .sidebar, .tabbar, .page-head .actions, .btn { display: none !important; } main { padding: 0; } .panel { box-shadow: none; break-inside: avoid; } }
