:root {
  --graphite: #23282E; --graphite-2: #2D333A; --steel: #5A646E;
  --zinc: #E2E6E9; --paper: #F4F5F6; --white: #fff;
  --amber: #D4A041; --amber-hi: #F3E99C; --amber-dark: #A9771A;
  --gold: linear-gradient(120deg, #B38A4D 0%, #F3E99C 42%, #D9B862 62%, #D4A041 100%);
  --ink: #1B1F23; --muted: #5E6770; --on-dark: #C5CCD2;
  --ok: #2E7D4F; --ok-bg: #E7F4EC; --err: #B3261E; --err-bg: #FBEAE9;
  --display: "Oswald", "Arial Narrow", sans-serif;
  --body: "Onest", "Segoe UI", Roboto, Arial, sans-serif;
  --r: 12px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); font-size: 15.5px; line-height: 1.5; color: var(--ink); background: var(--paper); }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: .005em; }
h1 { font-size: clamp(26px, 3.4vw, 36px); }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 20px; } .mb { margin-bottom: 20px; }

/* шапка */
.top { background: var(--graphite); color: var(--white); position: sticky; top: 0; z-index: 30; box-shadow: 0 4px 20px rgba(0,0,0,.15); }
.top .wrap { display: flex; align-items: center; gap: 22px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.brand img { height: 38px; width: auto; }
.brand span { font-size: 13px; color: var(--on-dark); line-height: 1.2; border-left: 1px solid rgba(255,255,255,.18); padding-left: 12px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--on-dark); padding: 8px 12px; border-radius: 8px; font-size: 15px; font-weight: 500; transition: background .2s, color .2s; }
.nav a:hover { color: var(--white); background: rgba(255,255,255,.06); }
.nav a.on { color: var(--ink); background: var(--gold); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { font-size: 13.5px; color: var(--on-dark); text-align: right; line-height: 1.25; }
.who b { color: var(--white); font-weight: 500; display: block; }
.cart-link { position: relative; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; background: rgba(255,255,255,.08); padding: 8px 14px; border-radius: 8px; font-weight: 500; }
.cart-link:hover { background: rgba(255,255,255,.14); }
.cart-link svg { width: 20px; height: 20px; }
.badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--amber); color: var(--ink); font-size: 12.5px; font-weight: 700; display: inline-grid; place-items: center; }
.badge.zero { background: rgba(255,255,255,.18); color: var(--on-dark); }
.linkbtn { background: none; border: 0; color: var(--on-dark); font: inherit; font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.linkbtn:hover { color: var(--white); background: rgba(255,255,255,.06); }
.cart-mini { display: none; position: relative; margin-left: auto; color: #fff; text-decoration: none; padding: 8px; }
.cart-mini svg { width: 26px; height: 26px; }
.cart-mini .badge { position: absolute; top: 0; right: -4px; }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 8px; width: 42px; height: 42px; font-size: 20px; cursor: pointer; }

main { padding: 28px 0 60px; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 8px; border: 1.5px solid transparent; font: inherit; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; transition: transform .15s, background .2s, border-color .2s, box-shadow .2s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn-gold { background: var(--gold); background-size: 200% 100%; color: var(--ink); }
.btn-gold:hover { background-position: 100% 0; box-shadow: 0 6px 18px rgba(212,160,65,.35); }
.btn-dark { background: var(--graphite); color: #fff; }
.btn-dark:hover { background: var(--graphite-2); }
.btn-line { background: #fff; border-color: var(--zinc); color: var(--ink); }
.btn-line:hover { border-color: var(--steel); }
.btn-danger { background: #fff; border-color: #F0C9C6; color: var(--err); }
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* уведомления */
.flashes { display: grid; gap: 10px; margin-bottom: 20px; }
.flash { padding: 12px 16px; border-radius: 10px; font-weight: 500; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #CBE7D5; }
.flash.error { background: var(--err-bg); color: var(--err); border-color: #F0C9C6; }
.flash.secret { background: #FFF8E1; color: #6B4E00; border-color: #F2DE9C; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; }

/* карточки и таблицы */
.card { background: #fff; border: 1px solid var(--zinc); border-radius: var(--r); padding: 22px; }
.card + .card { margin-top: 18px; }
.card h2 { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.stat { background: #fff; border: 1px solid var(--zinc); border-radius: var(--r); padding: 18px 20px; text-decoration: none; display: block; transition: box-shadow .2s, border-color .2s; }
a.stat:hover { box-shadow: 0 10px 26px rgba(35,40,46,.08); border-color: transparent; }
.stat b { display: block; font-family: var(--display); font-size: 32px; font-weight: 600; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 14px; }
.stat.hl { background: var(--graphite); color: #fff; border-color: var(--graphite); }
.stat.hl span { color: var(--on-dark); }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--zinc); border-radius: var(--r); }
table.t { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.t th, .t td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--zinc); vertical-align: middle; }
.t th { font-weight: 600; font-size: 13px; color: var(--muted); background: var(--paper); white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: #FAFBFB; }
.t td.num, .t th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.t tfoot td { font-weight: 700; background: var(--paper); border-top: 1px solid var(--zinc); }
.t a.row-link { text-decoration: none; font-weight: 600; }
.t a.row-link:hover { color: var(--amber-dark); }
.t .inactive td { color: #9AA2A9; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.st-new { background: #FFF4D6; color: #7A5A00; }
.st-work { background: #E3EEFB; color: #1F4E8C; }
.st-invoiced { background: #EDE7FB; color: #4B2E91; }
.st-paid { background: var(--ok-bg); color: var(--ok); }
.st-shipped { background: #E6F0EE; color: #245B52; }
.st-cancelled { background: #EEF0F2; color: #6B737A; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--paper); color: var(--steel); font-weight: 600; }
.tag.work { background: #E9EEF9; color: #2F4A86; }

/* формы */
.form { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
label { display: grid; gap: 5px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: #fff; border: 1.5px solid var(--zinc); border-radius: 8px; padding: 9px 12px; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(212,160,65,.18); }
textarea { min-height: 84px; resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink); font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--amber-dark); }
.hint { font-size: 13px; color: var(--muted); font-weight: 400; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline { display: inline; }

/* вход */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 600px at 50% 30%, #353C44, transparent 70%), var(--graphite); }
.login-box { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 34px 30px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login-box .logo { background: var(--graphite); border-radius: 12px; padding: 16px; display: grid; place-items: center; margin-bottom: 22px; }
.login-box .logo img { height: 46px; }
.login-box h1 { font-size: 26px; margin-bottom: 4px; }
.login-box p { margin: 0 0 20px; color: var(--muted); font-size: 14.5px; }
.login-box .btn { width: 100%; min-height: 48px; margin-top: 6px; }
.login-foot { margin-top: 18px; font-size: 13.5px; color: var(--muted); text-align: center; }

/* каталог */
.cat-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.cat-tools input[type=search] { max-width: 320px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1.5px solid var(--zinc); background: #fff; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.chip:hover { border-color: var(--steel); }
.chip.on { background: var(--graphite); color: #fff; border-color: var(--graphite); }
.cat-group { margin-top: 26px; }
.cat-group > h2 { margin-bottom: 12px; }
.plist { display: grid; gap: 10px; }
.pitem { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; background: #fff; border: 1px solid var(--zinc); border-radius: var(--r); padding: 10px 14px 10px 10px; transition: box-shadow .2s, border-color .2s; }
.pitem:hover { box-shadow: 0 8px 22px rgba(35,40,46,.07); border-color: transparent; }
.pitem .img { width: 76px; height: 60px; border-radius: 8px; background: #fff; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--paper); }
.pitem .img img { width: 100%; height: 100%; object-fit: contain; }
.pitem .img .ph { font-family: var(--display); font-size: 22px; color: var(--zinc); }
.pitem .name { font-weight: 600; line-height: 1.3; }
.pitem .meta { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pitem .pr { text-align: right; white-space: nowrap; }
.pitem .pr b { font-family: var(--display); font-weight: 600; font-size: 21px; }
.pitem .pr small { display: block; color: var(--muted); font-size: 12.5px; }
.pitem .own { color: var(--amber-dark); font-size: 12px; font-weight: 600; }
.addform { display: flex; gap: 6px; align-items: center; }
.stepper { display: inline-flex; align-items: stretch; border: 1.5px solid var(--zinc); border-radius: 8px; overflow: hidden; background: #fff; }
.stepper button { width: 34px; border: 0; background: var(--paper); font-size: 18px; cursor: pointer; color: var(--ink); }
.stepper button:hover { background: var(--zinc); }
.stepper input { width: 64px; border: 0; border-radius: 0; text-align: center; padding: 7px 4px; font-weight: 600; box-shadow: none !important; }
.in-cart { font-size: 12.5px; color: var(--ok); font-weight: 600; white-space: nowrap; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); margin-bottom: 8px; }

/* корзина */
.cart-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.summary { position: sticky; top: 84px; }
.summary .total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; border-top: 1px dashed var(--zinc); border-bottom: 1px dashed var(--zinc); margin: 14px 0; }
.summary .total b { font-family: var(--display); font-size: 28px; }
.summary .btn { width: 100%; min-height: 50px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: var(--graphite); color: #fff; padding: 12px 20px; border-radius: 10px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50; box-shadow: 0 12px 30px rgba(0,0,0,.25); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.log { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.log li { padding: 8px 0; border-bottom: 1px solid var(--paper); }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--muted); font-size: 12.5px; display: block; }

.img-preview { width: 160px; height: 120px; border: 1px solid var(--zinc); border-radius: 8px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.img-preview img { width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 960px) {
  .cart-grid { grid-template-columns: 1fr; }
  .summary { position: static; }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .menu-btn { display: block; }
  .cart-mini + .menu-btn { margin-left: 6px; }
  .cart-mini { display: block; }
  .top .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .nav, .top-right { display: none; width: 100%; }
  .top.open .nav { display: flex; flex-direction: column; }
  .top.open .top-right { display: flex; justify-content: space-between; margin: 0; padding: 10px 0 4px; border-top: 1px solid rgba(255,255,255,.1); }
  .brand span { display: none; }
  .grid2, .row, .row3 { grid-template-columns: 1fr; }
  .pitem { grid-template-columns: 64px minmax(0, 1fr); }
  .pitem .img { width: 64px; height: 52px; }
  .pitem .pr { text-align: left; }
  .pitem .pr, .pitem .buy { grid-column: 2; }
}
@media (max-width: 520px) {
  .grid3 { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; }
}
