/* Айдентика GARNE: помаранчевий PANTONE 172 C (#FF4713), чорний, білий; шрифт TT Norms без курсиву */
@font-face { font-family: "TT Norms"; src: url("fonts/TTNormsPro-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "TT Norms"; src: url("fonts/TTNormsPro-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "TT Norms"; src: url("fonts/TTNormsPro-Bold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }

:root {
  --bg: #f4f4f4; --surface: #fff; --ink: #000; --muted: #6b6b6b; --line: #e4e4e4;
  --brand: #ff4713; --brand-hover: #e83a08;
  /* --accent — для тексту й обведень: темніший відтінок фірмового, щоб читалось на білому */
  --accent: #d63a0c; --accent-soft: #ffece5; --warn: #b45309; --warn-soft: #fef3c7;
  --danger: #b91c1c; --danger-soft: #fee2e2; --ok: #15803d; --ok-soft: #dcfce7;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 8px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 "TT Norms", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
em, i { font-style: normal; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.1; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

header.top { position: sticky; top: 0; z-index: 10; background: #000; color: #fff;
  display: flex; align-items: center; gap: 28px; padding: 0 20px; height: 56px; border-bottom: 3px solid var(--brand); }
header.top .brand { display: flex; align-items: center; gap: 10px; color: #fff; flex-shrink: 0; }
header.top .brand:hover { text-decoration: none; }
header.top .brand img { height: 22px; display: block; }
header.top .brand span { background: var(--brand); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .08em; padding: 3px 7px 2px; }
header.top nav { display: flex; gap: 4px; flex: 1; }
header.top nav a { color: #cfcfcf; padding: 6px 12px; border-radius: 8px; font-weight: 500; }
header.top nav a:hover { background: #222; color: #fff; text-decoration: none; }
header.top nav a.on { background: var(--brand); color: #fff; text-decoration: none; }
header.top .me { color: #a6a6a6; font-size: 13px; white-space: nowrap; }
header.top .me a { color: #a6a6a6; margin-left: 8px; }
header.top .me a:hover { color: #fff; }

main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.stack > * + * { margin-top: 16px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger); }

.btn, button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); padding: 7px 12px; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 500; }
.btn:hover, button:hover { border-color: #bdbdbd; text-decoration: none; }
.btn.primary, button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.btn.primary:hover, button.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger, button.danger { color: var(--danger); }
.btn.small, button.small { padding: 3px 8px; font-size: 12px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }

input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
  background: #fff; color: var(--ink); min-width: 0; }
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.field { margin-bottom: 10px; }
.field input, .field select, .field textarea { width: 100%; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 140px; }
form.inline { display: inline; }

table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
table.tbl td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }

.badge { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 99px; background: #eee; color: #444; white-space: nowrap; }
.badge.own { background: #000; color: #fff; }
.badge.partner { background: #e0e7ff; color: #3730a3; }
.badge.stock { background: var(--ok-soft); color: var(--ok); }
.badge.sew { background: var(--warn-soft); color: var(--warn); }
.badge.none { background: #f1f1f4; color: var(--muted); }
.badge.base { background: var(--accent-soft); color: var(--accent); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.manual { background: var(--warn-soft); color: var(--warn); }
.badge.site { background: var(--brand); color: #fff; }
.lead-card { display: flex; gap: 16px; align-items: flex-start; border-left: 4px solid var(--brand); }
.lead-card img { width: 180px; max-width: 40vw; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.lead-card h3 { margin: 0 0 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); vertical-align: -1px; }

/* Воронка */
.board { display: grid; grid-template-columns: repeat(8, minmax(210px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eaeaea; border-radius: var(--radius); padding: 8px; min-height: 200px; }
.col h3 { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 4px 8px; }
.deal-card { display: block; background: #fff; border-radius: 8px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); color: var(--ink); }
.deal-card:hover { text-decoration: none; outline: 2px solid var(--accent-soft); }
.deal-card .t { font-weight: 600; }
.deal-card .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.deal-card .overdue { color: var(--danger); font-weight: 500; }

/* Етапи угоди */
.stepper { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 12px 0 4px; }
.step { padding: 8px; border-radius: 8px; background: #eaeaea; font-size: 12px; min-height: 58px; position: relative; }
.step .n { font-weight: 600; font-size: 11px; color: var(--muted); }
.step .name { font-weight: 600; }
.step.done { background: var(--accent-soft); }
.step.current { background: var(--brand); color: #fff; }
.step.current .n { color: #ffe0d5; }
.step.skipped { background: repeating-linear-gradient(45deg, #f2f2f5, #f2f2f5 6px, #e8e8ec 6px, #e8e8ec 12px); color: #9a9aa0; }
.step .skip { position: absolute; right: 6px; top: 6px; }
.step .skip button { font-size: 10px; padding: 0 5px; background: transparent; border-color: rgba(0,0,0,.12); color: inherit; }
.gate { font-size: 10px; display: block; margin-top: 2px; }

/* Каталог */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; align-items: end; }
.filters > div:first-of-type { grid-column: span 2; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.product { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.product .ph { aspect-ratio: 4/5; background: #f1f1f4 center/cover no-repeat; display: block; }
.product .ph.empty { display: flex; align-items: center; justify-content: center; color: #b0b0b5; font-size: 12px; }
.product .body { padding: 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product .name { font-weight: 600; line-height: 1.3; color: var(--ink); }
.product .price { font-weight: 700; font-size: 15px; }
.product .name:hover { color: var(--accent); }
.product .sizes { font-size: 11px; color: var(--muted); }
.product form { margin-top: auto; display: flex; gap: 6px; }
.product form select { flex: 1; font-size: 12px; padding: 5px; }
.product form input { width: 60px; font-size: 12px; padding: 5px; }
.pager { display: flex; gap: 6px; margin-top: 16px; justify-content: center; }

.items-table input.qty { width: 64px; }
.items-table input.price { width: 84px; }
.items-table .sizes-in { width: 100%; min-width: 150px; }
.items-table details summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.print-opts { columns: 2; font-size: 12px; margin: 6px 0; }
.print-opts label { display: flex; gap: 4px; color: var(--ink); font-size: 12px; margin: 0; }
.totals { font-size: 18px; font-weight: 700; text-align: right; padding-top: 10px; }

.doclist { list-style: none; padding: 0; margin: 0; }
.doclist li { display: flex; gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.doclist li:last-child { border-bottom: 0; }
.doclist .annulled { text-decoration: line-through; color: var(--muted); }
.checks { margin: 0 0 10px; padding-left: 18px; font-size: 13px; }
.checks .e { color: var(--danger); }
.checks .w { color: var(--warn); }

.history { font-size: 12px; list-style: none; padding: 0; margin: 0; max-height: 360px; overflow: auto; }
.history li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.locked-banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.locked-banner.success { background: var(--ok-soft); color: var(--ok); }
.locked-banner.refused { background: var(--danger-soft); color: var(--danger); }

.logos { display: flex; gap: 10px; flex-wrap: wrap; }
.logo-tile { width: 120px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; text-align: center; font-size: 11px; }
.logo-tile img { max-width: 100%; height: 70px; object-fit: contain; display: block; margin: 0 auto 4px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; white-space: pre-line; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--bg); border-radius: 8px; padding: 10px; }
.stat b { display: block; font-size: 18px; }

.login { max-width: 380px; margin: 10vh auto; padding: 0; overflow: hidden; }
.login-head { background: #000; padding: 28px 24px 22px; border-bottom: 4px solid var(--brand); }
.login-head img { height: 34px; display: block; }
.login-head div { color: #fff; margin-top: 12px; font-weight: 500; letter-spacing: .02em; }
.login-head div b { background: var(--brand); padding: 2px 6px 1px; margin-right: 6px; font-weight: 700; }
.login-body { padding: 20px 24px 24px; }
.login .users { display: grid; gap: 8px; }
.login .users button { justify-content: space-between; width: 100%; padding: 12px 14px; }

@media (max-width: 1100px) {
  .grid2 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .stepper { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  main { padding: 12px 16px; }
  header.top { gap: 10px; padding: 0 12px; overflow-x: auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 1fr; }
}

/* макет лого */
.mk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.mk-stage { position: relative; aspect-ratio: 1000 / 900; background: #fff; user-select: none; touch-action: none; overflow: hidden; border-radius: 8px; max-width: 760px; margin: 0 auto; }
.mk-stage #mkBase { width: 100%; height: 100%; display: block; }
.mk-stage #mkLogo { position: absolute; cursor: move; outline: 1px dashed rgba(255, 71, 19, .8); outline-offset: 2px; }
.mk-logos { display: flex; gap: 8px; flex-wrap: wrap; }
.mk-logo { position: relative; margin: 0; cursor: pointer; }
.mk-logo input { position: absolute; opacity: 0; }
.mk-logo img { width: 72px; height: 54px; object-fit: contain; border: 2px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; display: block; }
.mk-logo input:checked + img { border-color: var(--accent); }
.mk-swatches { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mk-sw { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 1px solid #c7c7cc; }
.mk-swatches input[type=color] { width: 34px; height: 28px; padding: 1px; }
.mk-saved { display: flex; gap: 14px; flex-wrap: wrap; }
.mk-saved-item { width: 190px; }
.mk-saved-item img { width: 100%; border: 1px solid var(--line); border-radius: 8px; display: block; margin-bottom: 4px; }
.mk-saved-item.on img { border-color: var(--accent); border-width: 2px; }
.mk-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.mk-thumbs img { width: 54px; height: 49px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; display: block; }
@media (max-width: 900px) { .mk-grid { grid-template-columns: 1fr; } }
.print-opts input.print-n { width: 44px; padding: 1px 4px; font-size: 12px; }

/* № замовлення з сайту Garne — головний ідентифікатор угоди */
.order-no { display: inline-block; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums;
  background: var(--ink, #111); color: #fff; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.deal-card .order-no { font-size: 12px; margin-bottom: 4px; }
h1 .order-no { font-size: .8em; vertical-align: middle; padding: 3px 10px; }
.no-order { font-size: 11px; color: #999; }
.site-id { font-weight: 600; font-variant-numeric: tabular-nums; }
