:root {
  color-scheme: dark;
  --bg: #0e1720;
  --panel: #16232e;
  --panel-2: #1d2a34;
  --line: #30414e;
  --text: #f7fbff;
  --muted: #a9bac7;
  --green: #10e52d;
  --green-dark: #164c24;
  --green-soft: #17371f;
  --danger: #ff5b64;
  --warning: #ffcc66;
  --radius: 14px;
  --shadow: 0 18px 55px rgba(0,0,0,.25);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; }
.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; color: var(--muted); }
.loader { width: 42px; height: 42px; border: 3px solid #2c3c48; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand { position: relative; display: inline-flex; align-items: baseline; line-height: .8; letter-spacing: -2px; font-weight: 900; white-space: nowrap; }
.brand-big { color: var(--green); font-size: 31px; }
.brand-line { color: #fff; font-size: 31px; }
.brand small { position: absolute; top: 30px; left: 37px; font-size: 8px; letter-spacing: 5px; color: #fff; }
.brand--boot { margin-bottom: 14px; transform: scale(1.4); }
.topbar { position: sticky; top: 0; z-index: 30; min-height: 76px; display: grid; grid-template-columns: auto minmax(240px,1fr) auto; align-items: center; gap: 24px; padding: 10px 24px; border-top: 4px solid var(--green); border-bottom: 1px solid var(--line); background: rgba(19,31,42,.97); backdrop-filter: blur(12px); }
.topbar-copy strong { display: block; font-size: 15px; }
.topbar-copy small { color: #bbcfdf; }
.price-pill, .status-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 10px; color: #a8ffb4; background: var(--green-soft); font-size: 13px; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.cart-summary { display: flex; align-items: center; gap: 9px; border: 0; color: #fff; background: transparent; padding: 7px; border-radius: 10px; }
.cart-summary:hover, .cart-summary:focus-visible { background: #243541; outline: none; }
.cart-count { display: grid; place-items: center; min-width: 27px; height: 27px; padding: 0 7px; color: #051108; background: var(--green); border-radius: 50%; font-weight: 800; }
.go-cart { padding: 9px 13px; border: 1px solid #2c6d39; border-radius: 999px; background: #193c21; color: #b8ffbf; }
.page-grid { display: grid; grid-template-columns: 220px minmax(0,1fr); min-height: calc(100vh - 76px); }
.sidebar { position: sticky; top: 76px; align-self: start; height: calc(100vh - 76px); padding: 24px 16px; border-right: 1px solid var(--line); background: var(--panel-2); overflow-y: auto; }
.company-card { padding: 0 10px 18px; margin-bottom: 14px; border-bottom: 1px solid #3a4852; }
.company-card strong { display: block; font-size: 15px; }
.company-card small { display: block; margin-top: 6px; color: #b4d4ec; }
.nav { display: grid; gap: 5px; }
.nav-button { position: relative; display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; color: #fff; background: transparent; text-align: left; }
.nav-button:hover, .nav-button:focus-visible { background: #263742; outline: none; }
.nav-button.is-active { color: #07150a; background: var(--green); }
.nav-icon { flex: 0 0 20px; width: 20px; height: 20px; display: grid; place-items: center; }
.nav-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; color: #07150a; background: var(--green); font-size: 12px; }
.nav-button.is-active .nav-badge { color: #fff; background: #21313b; }
.content { width: 100%; max-width: 1460px; margin: 0 auto; padding: 28px 32px 90px; overflow: hidden; }
.view-title { margin: 0 0 18px; font-size: clamp(23px,3vw,34px); }
.subtle { color: var(--muted); }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.panel-body { padding: 22px; }
.notice { margin: 14px 0; padding: 13px 15px; border-left: 3px solid var(--green); color: #baffc1; background: #16351e; }
.notice--warning { border-color: var(--warning); color: #ffe2a4; background: #3b311c; }
.notice--danger { border-color: var(--danger); color: #ffccd0; background: #3d2024; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 9px; color: #fff; background: #293843; transition: .15s ease; }
.btn:hover, .btn:focus-visible { transform: translateY(-1px); border-color: #5d7485; outline: none; }
.btn-primary { border-color: var(--green); color: #061208; background: var(--green); }
.btn-danger { border-color: #6e3036; color: #ffd7da; background: #4a2529; }
.btn-muted { color: #8494a0; background: #26343e; }
.btn-block { width: 100%; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 650; color: #d7e5ef; }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #46545e; border-radius: 9px; color: #fff; background: #373737; outline: none; }
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(16,229,45,.13); }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1/-1; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(320px,460px) minmax(0,1fr); background: radial-gradient(circle at 85% 10%,#173f29 0,transparent 34%), var(--bg); }
.auth-card { align-self: center; margin: 32px; padding: 30px; }
.auth-hero { display: grid; align-content: center; padding: clamp(30px,7vw,100px); }
.auth-hero h1 { max-width: 780px; margin: 0; font-size: clamp(37px,6vw,78px); line-height: .98; }
.auth-hero p { max-width: 700px; color: #bdd1df; font-size: clamp(17px,2vw,23px); }
.tabs { display: flex; gap: 8px; margin: 24px 0 18px; }
.tab { flex: 1; padding: 10px; border: 0; border-bottom: 2px solid #394a56; color: var(--muted); background: transparent; }
.tab.is-active { border-color: var(--green); color: #fff; }
.error-box { min-height: 22px; margin: 10px 0; color: #ff9ba1; }
.banner-wrap { position: relative; min-height: 210px; margin-bottom: 28px; overflow: hidden; border-radius: var(--radius); background: linear-gradient(120deg,#1c3344,#176437); }
.banner { min-height: 210px; display: grid; align-content: center; padding: 32px 68px; background-position: center; background-size: cover; }
.banner::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg,rgba(10,21,30,.93),rgba(10,21,30,.3)); pointer-events: none; }
.banner-content { position: relative; max-width: 700px; z-index: 1; }
.banner h2 { margin: 0 0 10px; font-size: clamp(26px,4vw,46px); }
.banner p { max-width: 650px; color: #d4e5ef; font-size: 17px; }
.banner-nav { position: absolute; inset: 50% 14px auto; z-index: 2; display: flex; justify-content: space-between; transform: translateY(-50%); pointer-events: none; }
.banner-nav button { width: 38px; height: 38px; border: 0; border-radius: 50%; color: #fff; background: rgba(8,18,24,.75); pointer-events: auto; }
.banner-dots { position: absolute; z-index: 2; bottom: 12px; left: 50%; display: flex; gap: 6px; transform: translateX(-50%); }
.banner-dots button { width: 9px; height: 9px; padding: 0; border: 0; border-radius: 50%; background: #8ba6b7; }
.banner-dots button.is-active { background: var(--green); }
.toolbar { display: grid; grid-template-columns: minmax(220px,2fr) minmax(160px,1fr) minmax(160px,1fr); gap: 12px; margin: 14px 0 20px; }
.catalog-status { min-height: 22px; color: #b6c9d6; font-size: 13px; }
.catalog-more { display: flex; justify-content: center; padding: 22px 0 6px; }
.catalog-more .btn { min-width: 220px; }
.product-grid { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
.product-card { display: grid; grid-template-columns: 96px minmax(0,1fr); min-width: 0; min-height: 102px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #111c25; transition: border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.product-card:has(.add-button.is-added) { border-color: var(--green); background: #102119; box-shadow: 0 0 0 1px rgba(0,230,39,.18); }
.product-image { display: grid; place-items: center; min-height: 100%; padding: 8px; background: #fff; overflow: hidden; }
.product-image img { display: block; width: 100%; height: 86px; object-fit: contain; object-position: center; }
.product-placeholder { color: #4c5d67; font-size: 40px; }
.product-body { display: grid; grid-template-columns: minmax(260px,1fr) 120px 120px 180px 130px; grid-template-areas: "meta stock price quantity action" "name stock price quantity action"; align-items: center; gap: 3px 14px; min-width: 0; padding: 11px 14px; }
.product-meta { color: #a9bed0; font-size: 12px; }
.product-body > .product-meta { grid-area: meta; }
.product-name { grid-area: name; min-width: 0; margin: 0; font-size: 14px; line-height: 1.3; }
.product-row { display: grid; align-content: center; gap: 5px; min-height: 64px; padding-left: 14px; border-left: 1px solid #293945; }
.product-row:nth-of-type(1) { grid-area: stock; }
.product-row:nth-of-type(2) { grid-area: price; }
.product-body > .field { grid-area: quantity; margin: 0; }
.product-body > .add-button { grid-area: action; align-self: center; }
.stock { color: #55ef9e; }
.price { font-size: 16px; font-weight: 800; }
.qty { display: grid; grid-template-columns: 40px minmax(54px,1fr) 40px; overflow: hidden; border: 1px solid #435563; border-radius: 9px; }
.qty button { min-height: 42px; border: 0; color: #fff; background: #1b2b36; font-size: 21px; }
.qty input { min-width: 0; border: 0; color: #fff; background: #353535; text-align: center; }
.add-button.is-added { border-color: var(--green); color: #061208; background: var(--green); }
.cart-layout { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(300px,.8fr); gap: 20px; }
.cart-line { display: grid; grid-template-columns: minmax(160px,1fr) 110px 150px 120px 38px; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .qty { grid-template-columns: 36px 1fr 36px; }
.cart-check { display: flex; align-items: flex-start; gap: 10px; }
.round-check { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--green); }
.delete-selected { border: 0; color: #6f7f89; background: transparent; padding: 10px 0; }
.delete-selected.is-active { color: var(--green); }
.summary { position: sticky; top: 100px; align-self: start; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.summary-row:last-of-type { border: 0; }
.success { min-height: 420px; display: grid; place-content: center; justify-items: center; text-align: center; }
.success-mark { display: grid; place-items: center; width: 82px; height: 82px; border-radius: 50%; color: #042509; background: var(--green); font-size: 38px; }
.back-link { justify-self: start; margin-bottom: 35px; border: 0; color: #c1d0da; background: transparent; }
.orders { display: grid; gap: 12px; }
.order-card { padding: 18px; }
.order-head { display: flex; justify-content: space-between; gap: 12px; }
.order-items { margin: 12px 0 0; padding: 10px 0 0 20px; border-top: 1px solid var(--line); color: #d8e5ed; }
.order-company { display: block; font-size: 21px; line-height: 1.25; }
.order-identity { margin: 5px 0; color: #dce8ef; font-weight: 700; }
.order-actions { display: flex; align-items: center; gap: 9px; }
.order-status { width: 145px; min-height: 36px; }
.icon-button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 9px; color: #fff; background: #263642; }
.icon-button.danger { color: #ffb8bd; border-color: #6e3036; background: #46262a; }
.order-filters { display: grid; grid-template-columns: minmax(260px,1fr) 210px; gap: 14px; margin-bottom: 16px; }
.order-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.order-table th, .order-table td { padding: 10px 12px; border-top: 1px solid var(--line); text-align: left; }
.order-table th { color: #b9cbd7; background: #132d19; }
.order-table td small { display: block; margin-top: 3px; color: var(--muted); }
.order-table tfoot { font-weight: 800; }
.repeat-row { display: flex; justify-content: flex-end; margin-top: 14px; }
.repeat-order { color: #07150a; border-color: var(--green); background: var(--green); }
.order-toast { position: sticky; top: 12px; z-index: 5; }
.order-comment { margin-top: 12px; padding: 10px 12px; border-left: 3px solid var(--green); background: rgba(31, 227, 50, .08); color: var(--muted); }
.order-comment strong { color: var(--text); }
.admin-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(320px,.7fr); gap: 20px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th, .data-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.data-table th { color: #b9cbd7; background: #132d19; }
.drop-zone { display: grid; place-items: center; min-height: 96px; border: 1px dashed #5b7180; border-radius: 10px; color: #adc0cd; background: #111c24; text-align: center; padding: 12px; }
.drop-zone input { max-width: 100%; }
.mobile-nav { display: none; }
.empty { padding: 45px 20px; color: var(--muted); text-align: center; }
.skeleton { min-height: 220px; background: linear-gradient(90deg,#15232d,#1e303d,#15232d); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1100px) {
  .product-card { grid-template-columns: 80px minmax(0,1fr); }
  .product-image { padding: 6px; }
  .product-image img { height: 72px; }
  .product-body { grid-template-columns: minmax(180px,1fr) 92px 104px 145px 108px; gap: 3px 9px; padding: 9px 10px; }
  .product-row { padding-left: 9px; }
  .admin-grid { grid-template-columns: 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
}

@media (max-width: 700px) {
  .order-card { min-width: 0; max-width: 100%; padding: 14px; overflow: hidden; }
  .order-head { display: grid; align-items: start; }
  .order-filters { grid-template-columns: 1fr; }
  .order-company { font-size: 18px; }
  .order-identity, .order-head .product-meta { overflow-wrap: anywhere; }
  .order-actions { width: 100%; flex-direction: row; align-items: center; justify-content: flex-start; }
  .order-status { width: min(100%, 180px); }
  .order-card .table-wrap { overflow: visible; }
  .order-table { min-width: 0; display: block; }
  .order-table thead { display: none; }
  .order-table tbody, .order-table tfoot { display: grid; }
  .order-table tr { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; padding: 12px 0; border-top: 1px solid var(--line); }
  .order-table th, .order-table td { min-width: 0; padding: 0; border: 0; overflow-wrap: anywhere; }
  .order-table tbody td:first-child { grid-column: 1/-1; font-weight: 700; }
  .order-table tbody td:nth-child(n+2)::before { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
  .order-table tbody td:nth-child(2)::before { content: "Количество"; }
  .order-table tbody td:nth-child(3)::before { content: "Цена"; }
  .order-table tbody td:nth-child(4)::before { content: "Итого"; }
  .order-table tfoot tr { grid-template-columns: 1fr auto; align-items: end; }
  .order-table tfoot td:first-child { grid-column: 1; }
  .order-table tfoot td:last-child { grid-column: 2; text-align: right; white-space: nowrap; }
  .repeat-row { justify-content: stretch; }
  .repeat-order { width: 100%; }
}
@media (max-width: 760px) {
  .topbar { position: sticky; top: 0; z-index: 60; grid-template-columns: auto 1fr; gap: 14px; padding: 10px 14px; }
  .topbar-copy { font-size: 12px; }
  .topbar-copy small { display: none; }
  .top-actions { grid-column: 1/-1; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 9px; }
  .page-grid { display: block; min-height: auto; }
  .sidebar { display: none; }
  .content { padding: 18px 12px 92px; }
  .mobile-nav { position: fixed; z-index: 70; right: 0; bottom: 0; left: 0; display: flex; padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid #3b4d59; background: rgba(22,34,43,.98); box-shadow: 0 -8px 24px rgba(0,0,0,.25); }
  .mobile-nav .nav-button { flex: 1 1 0; min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px; font-size: 10px; line-height: 1.1; text-align: center; }
  .mobile-nav .nav-icon, .mobile-nav .nav-icon svg { width: 19px; height: 19px; }
  .mobile-nav .nav-label { white-space: nowrap; }
  .mobile-nav .nav-badge { position: absolute; top: 3px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; font-size: 9px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { order: -1; padding: 32px 24px 5px; }
  .auth-hero h1 { font-size: 36px; }
  .auth-hero p { font-size: 16px; }
  .auth-card { margin: 18px 12px 32px; padding: 22px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; gap: 8px; }
  .product-grid { grid-template-columns: 1fr; gap: 12px; }
  .product-card { grid-template-columns: 120px minmax(0,1fr); grid-template-rows: auto; min-height: 0; }
  .product-card:has(.add-button.is-added) { box-shadow: 0 0 0 1px rgba(0,230,39,.18); }
  .product-image { min-height: 100%; padding: 8px; }
  .product-image img { height: 118px; }
  .product-body { grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-areas: "meta meta" "name name" "stock price" "quantity quantity" "action action"; gap: 10px 12px; padding: 12px; }
  .product-row { min-height: 0; padding: 9px 0 0; border-top: 1px solid #293945; border-left: 0; }
  .product-body > .field { margin: 0; }
  .banner-wrap, .banner { min-height: 235px; }
  .banner { padding: 30px 50px; }
  .banner h2 { font-size: 27px; }
  .cart-line { grid-template-columns: minmax(120px,1fr) 110px; gap: 8px; }
  .cart-line > :nth-child(3), .cart-line > :nth-child(4) { text-align: right; }
  .cart-line > :last-child { grid-column: 2; justify-self: end; }
}
@media (max-width: 430px) {
  .brand-big, .brand-line { font-size: 25px; }
  .brand small { top: 24px; left: 30px; font-size: 6px; letter-spacing: 4px; }
  .go-cart { font-size: 12px; }
  .product-card { grid-template-columns: 96px minmax(0,1fr); }
  .product-image img { height: 96px; }
  .product-body { padding: 12px; }
  .product-body { grid-template-columns: 1fr; grid-template-areas: "meta" "name" "stock" "price" "quantity" "action"; }
}
