/* Токени взяті з Fasunok Profit Studio (fps/resources/css/app.css) — та сама
   палітра, геометрія і тіні, щоб панелі виглядали як один продукт. */
:root {
  --bg: #fbfbfc;
  --surface: #ffffff;
  --ink: #202331;
  --muted: #737786;
  --subtle: #a6aab5;
  --line: #e7e8ed;
  --line-strong: #dcdee5;
  --brand: #526eee;
  --brand-soft: #eef1ff;
  --brand-ink: #ffffff;
  --ok: #10956b;
  --ok-bg: #e8f6f0;
  --warn-bg: #fff4e9;
  --warn-ink: #d97828;
  --err: #d84b55;
  --err-bg: #fdeced;
  --shadow: 0 2px 8px rgba(31,35,49,.045), 0 14px 30px rgba(31,35,49,.025);
  --shadow-lg: 0 18px 44px rgba(31,35,49,.14);
  --r: 14px;
  --r-sm: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font: 14px/1.45 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
code { background: #f2f3f7; padding: 1px 6px; border-radius: 6px; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-family: inherit; font-size: 14px; color: var(--ink); background: #fff; resize: vertical; }
textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(82,110,238,.16); }
h1 { font-size: 28px; font-weight: 580; letter-spacing: -.045em; margin: 0 0 22px; }
h3 { margin: 0 0 12px; font-size: 16px; font-weight: 580; letter-spacing: -.02em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 11px 22px; background: rgba(255,255,255,.86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.topbar strong { font-size: 17px; letter-spacing: -.02em; }
.topbar nav { display: flex; gap: 2px; margin-left: 10px; flex-wrap: wrap; }
.topbar nav a { padding: 7px 13px; border-radius: 10px; color: #4a5670; font-weight: 550; transition: .12s; }
.topbar nav a:hover { background: var(--brand-soft); text-decoration: none; }
.topbar nav a.active { background: var(--brand); color: #fff; }
.topbar .logout { margin-left: auto; color: var(--muted); font-size: 13px; }

main { max-width: 1180px; margin: 26px auto; padding: 0 22px; }

/* ---- flashes / banners ---- */
.flash { padding: 12px 16px; border-radius: var(--r-sm); margin: 10px 0; font-weight: 500; border: 1px solid transparent; }
.flash.info { background: var(--brand-soft); border-color: #dfe4ff; }
.flash.success { background: var(--ok-bg); color: #0f7a43; border-color: #c4ecd4; }
.flash.error { background: var(--err-bg); color: #a32020; border-color: #f4c9c9; }
.banner { padding: 14px 18px; border-radius: var(--r); margin-bottom: 18px; box-shadow: var(--shadow); background: var(--surface); }
.banner.on { background: var(--ok-bg); }
.banner.off { background: var(--warn-bg); }

/* ---- cards ---- */
.cards { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; flex: 1 1 320px; box-shadow: var(--shadow); }
.card label { display: block; margin: 10px 0; font-weight: 500; }
.card input, .card select { width: 100%; margin-top: 5px; }

/* ---- inputs ---- */
input, select, .search-input {
  padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: 14px; background: #fff; color: var(--ink); transition: .12s; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(82,110,238,.16); }
::placeholder { color: var(--subtle); }

/* ---- buttons ---- */
button, .btn-file, .btn-link {
  display: inline-block; background: var(--brand); color: var(--brand-ink);
  border: 0; padding: 9px 16px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px;
  font-weight: 550; font-family: inherit; transition: .12s; box-shadow: none;
}
button:hover, .btn-file:hover, .btn-link:hover { background: #4460e6; text-decoration: none; color: #fff; }
button.ghost { background: #f1f2f6; color: #4a4e5e; }
button.ghost:hover { background: #e7e9ef; }
button.danger { background: var(--err); }
button.danger:hover { background: #c74049; }
form.inline { display: inline-flex; align-items: center; gap: 8px; }

/* ---- toolbar ---- */
.toolbar { display: flex; gap: 12px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.file-form input[type=file] { display: none; }
.btn-file { display: inline-block; background: #eef0f6; color: #46506a; box-shadow: none; }
.search-form { position: relative; flex: 1 1 280px; }
.search-input { width: 100%; }
.clear-q { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; line-height: 1; }

/* ---- stat row ---- */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; box-shadow: var(--shadow); color: var(--muted); font-size: 13px; }
.stat-n { display: block; font-size: 22px; font-weight: 580; color: var(--ink); letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.stat.ok .stat-n { color: var(--ok); }
.stat.warn .stat-n { color: var(--warn-ink); }

/* ---- segmented control ---- */
.segmented { display: inline-flex; background: #f1f2f6; border-radius: 11px; padding: 3px; margin-bottom: 16px; }
.segmented a { padding: 7px 16px; border-radius: 9px; color: #4a4e5e; font-weight: 550; }
.segmented a:hover { text-decoration: none; }
.segmented a.active { background: #fff; color: var(--brand); box-shadow: var(--shadow); }

/* ---- table ---- */
.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.grid th, .grid td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid thead th { background: #fbfbfc; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.grid td.pick, .grid th.pick { width: 38px; text-align: center; padding-left: 14px; padding-right: 6px; }
.grid tbody tr { transition: background .1s; }
.grid tbody tr:hover { background: #fafafc; }
.grid tbody tr.chosen { background: var(--brand-soft); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td.center { text-align: center; }
.map td { width: 50%; }

/* ---- product cell ---- */
.prod { display: flex; gap: 12px; align-items: center; }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); background: #f2f4f9; flex: none; }
.pk-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pk-name { font-weight: 550; line-height: 1.3; }
.pk-sub, .uuid { color: var(--muted); font-size: 12px; }
.uuid { font-family: ui-monospace, SFMono-Regular, monospace; }
.pk-sku { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; color: #46506a; }

/* ---- combobox picker ---- */
.combo { position: relative; }
.pk-chip { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fafbff; }
.pk-chip .pk-meta { flex: 1; }
.pk-x { background: #fdecec; color: var(--err); box-shadow: none; padding: 3px 9px; border-radius: 7px; font-size: 15px; line-height: 1; font-weight: 700; }
.pk-x:hover { background: #f8d5d5; transform: none; }
.pk-search { position: relative; }
.pk-input { width: 100%; }
.pk-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); max-height: 340px; overflow: auto; padding: 5px; }
.pk-item { display: flex; align-items: center; gap: 11px; padding: 7px 9px; border-radius: 8px; cursor: pointer; }
.pk-item:hover, .pk-item.active { background: #eef0fb; }
.pk-empty { padding: 12px; color: var(--muted); text-align: center; }

/* ---- badges ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.created { background: var(--ok-bg); color: var(--ok); }
.badge.failed { background: var(--err-bg); color: var(--err); }
.badge.blocked { background: var(--warn-bg); color: var(--warn-ink); }

/* ---- order readiness ---- */
.checklist { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.chk { padding: 6px 13px; border-radius: 20px; font-size: 13px; font-weight: 600; background: #eef1f7; color: #59637c; }
.chk.ok { background: var(--ok-bg); color: var(--ok); }
.chk.no { background: var(--err-bg); color: var(--err); }
.chk-verdict { margin-left: auto; padding: 7px 16px; border-radius: 11px; font-weight: 700; }
.chk-verdict.ok { background: var(--ok-bg); color: var(--ok); }
.chk-verdict.no { background: var(--warn-bg); color: var(--warn-ink); }
.zebra-form { display: flex; gap: 10px; align-items: center; }
/* ---- custom dropdown (all selects) ---- */
.statussel { position: relative; min-width: 200px; max-width: 100%; display: inline-block; vertical-align: middle; }
.card .statussel, .card label .statussel { width: 100%; }
.statussel-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statussel-btn { width: 100%; background: #fff; border: 1px solid var(--line-strong); color: var(--ink);
  box-shadow: none; display: flex; align-items: center; gap: 9px; padding: 8px 12px; font-weight: 500; text-align: left; }
.statussel-btn:hover { filter: none; transform: none; border-color: var(--brand); }
.statussel-btn .caret { margin-left: auto; color: var(--muted); }
.statussel-menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); max-height: 340px; overflow: auto; padding: 5px; }
.statussel-item { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 8px; cursor: pointer; }
.statussel-item:hover { background: #eef0fb; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.12); display: inline-block; }

.vmap { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; border-left: 2px solid var(--line); padding-left: 12px; }
.vmap-row { display: flex; align-items: center; gap: 8px; }
.vmap-src { min-width: 130px; font-size: 13px; font-weight: 500; }
.cf-source > select, .cf-static > select, .cf-static > input { min-width: 240px; }
.btn-row { display: flex; gap: 10px; margin-top: 10px; }

/* ---- save bar / pager ---- */
.save-bar { margin: 16px 0; }
.kv td { padding: 5px 8px; }
.kv td:first-child { color: var(--muted); white-space: nowrap; }
.pager { display: flex; gap: 18px; align-items: center; justify-content: center; margin: 20px 0; }
.pager a { padding: 8px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); box-shadow: var(--shadow); }
.pager a:hover { text-decoration: none; border-color: var(--brand); }
.pager .off { padding: 8px 14px; color: #c2c9d8; }

pre { background: #0f172a; color: #cbd5e1; padding: 12px; border-radius: var(--r-sm); overflow: auto; font-size: 12px; }
pre.err { background: var(--err-bg); color: #a32020; }
pre.copyable, pre.raw { background: #eef1f7; color: var(--ink); }
.raw { max-height: 240px; }
details summary { cursor: pointer; color: var(--brand); }

/* ---- settings: grouped fieldsets ---- */
.card fieldset { border: 1px solid var(--line-strong); border-radius: var(--r); padding: 6px 18px 18px; margin: 22px 0; background: #fbfcff; }
.card fieldset.reqs { background: #fff; margin: 14px 0 4px; }
.card fieldset > legend { padding: 3px 13px; font-weight: 650; font-size: 12.5px; color: var(--brand); background: #eef0fb; border: 1px solid #dfe3fb; border-radius: 20px; }
.card input[type=checkbox] { width: auto; margin-top: 0; }
.req-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 9px; margin-top: 8px; }
.req-grid label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 13px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; cursor: pointer; font-weight: 500; transition: .12s; }
.req-grid label:hover { border-color: var(--brand); background: #fafbff; }
.req-grid label:has(input:checked) { border-color: var(--brand); background: #eef0fb; }
.req-grid input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); flex: none; cursor: pointer; }
.card fieldset .muted { margin: 10px 0 0; font-size: 13px; }

/* ---- suppliers ---- */
.sup-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.chk-inline { display: flex !important; align-items: center; gap: 9px; }
.chk-inline input { width: 17px; height: 17px; accent-color: var(--brand); }
.bulk { display: inline-flex; align-items: center; gap: 8px; margin-left: 16px; }
.supplier-form .card { flex: 1 1 420px; }

/* ---- login ---- */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: var(--surface); padding: 32px; border-radius: 18px; width: 320px; box-shadow: var(--shadow-lg); }
.login-box h1 { text-align: center; color: var(--brand); }
.login-box input { width: 100%; margin: 8px 0; }
.login-box button { width: 100%; margin-top: 10px; }
