/* ============================================================
   WB Logistics — Кабинет. Премиальная тёмная дизайн-система.
   ============================================================ */
:root {
  --bg: #08090f;
  --bg-2: #0c0e17;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.055);
  --surface-solid: #12141f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eaecf5;
  --text-dim: #a6abc2;
  --muted: #6f7690;

  --brand-1: #7c5cff;
  --brand-2: #4dd0ff;
  --brand: linear-gradient(120deg, #7c5cff 0%, #5b8cff 45%, #4dd0ff 100%);
  --brand-soft: linear-gradient(120deg, rgba(124,92,255,.16), rgba(77,208,255,.16));
  --success: #37d99a;
  --warn: #ffc24b;
  --danger: #ff5c72;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, .7);
  --shadow-glow: 0 8px 40px -6px rgba(124, 92, 255, .45);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* мягкий цветной «мэш» на фоне */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(124, 92, 255, .18), transparent 60%),
    radial-gradient(50% 45% at 95% 10%, rgba(77, 208, 255, .12), transparent 55%),
    radial-gradient(60% 60% at 50% 110%, rgba(91, 140, 255, .10), transparent 60%),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
::selection { background: rgba(124, 92, 255, .35); }

/* --------- скролл --------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); background-clip: padding-box; }

/* ============================ BOOT / SPINNER ============================ */
.boot { position: fixed; inset: 0; display: grid; place-content: center; gap: 22px; justify-items: center; }
.boot__logo { width: 54px; height: 54px; border-radius: 15px; background: var(--brand); box-shadow: var(--shadow-glow); animation: pulse 1.6s ease-in-out infinite; }
.boot__spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--brand-1); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{ transform: scale(1); opacity:1;} 50%{ transform: scale(.9); opacity:.75;} }

/* ============================ LOGIN ============================ */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth__card {
  width: 100%; max-width: 410px; background: var(--surface); backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: 26px; padding: 38px 32px 32px;
  box-shadow: var(--shadow); animation: rise .5s cubic-bezier(.2,.7,.2,1) both;
}
.auth__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth__logo { width: 44px; height: 44px; border-radius: 13px; background: var(--brand); box-shadow: var(--shadow-glow); flex: none; display:grid; place-items:center; }
.auth__logo svg { width: 26px; height: 26px; }
.auth__brand b { font-size: 17px; letter-spacing: -.2px; }
.auth__brand span { display:block; font-size: 12px; color: var(--muted); font-weight: 500; }
.auth h1 { font-size: 25px; letter-spacing: -.5px; margin-bottom: 8px; }
.auth p.sub { color: var(--text-dim); font-size: 14px; line-height: 1.5; margin-bottom: 24px; }
.auth .field { margin-bottom: 14px; }

@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity:1; transform:none; } }

/* ============================ FORM CONTROLS ============================ */
.field label { display: block; font-size: 12.5px; color: var(--text-dim); margin: 0 0 7px 3px; font-weight: 600; }
.input {
  width: 100%; height: 52px; padding: 0 16px; font-size: 16px; color: var(--text);
  background: rgba(255,255,255,.04); border: 1.5px solid var(--border); border-radius: 14px;
  transition: border-color .18s, background .18s, box-shadow .18s; outline: none;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: rgba(124,92,255,.7); background: rgba(124,92,255,.06); box-shadow: 0 0 0 4px rgba(124,92,255,.12); }
.input.code { letter-spacing: 8px; text-align: center; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236f7690' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 42px; }

.btn {
  width: 100%; height: 52px; border: none; border-radius: 14px; font-size: 15.5px; font-weight: 650;
  color: #fff; background: var(--brand); box-shadow: var(--shadow-glow);
  transition: transform .12s, filter .18s, opacity .18s; display: inline-flex; align-items: center; justify-content: center; gap: 9px;
}
.btn svg { width: 19px; height: 19px; flex: none; }
.btn.sm svg { width: 16px; height: 16px; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .55; box-shadow: none; cursor: default; filter: grayscale(.3); }
.btn.ghost { background: var(--surface-2); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.btn.ghost:hover { background: rgba(255,255,255,.09); }
.btn.sm { height: 40px; font-size: 13.5px; border-radius: 11px; width: auto; padding: 0 16px; }
.btn.danger { background: linear-gradient(120deg,#ff5c72,#ff8a5c); }
.btn-link { background: none; border: none; color: var(--brand-2); font-weight: 600; font-size: 14px; padding: 6px; }
.btn-link:hover { text-decoration: underline; }

.form-msg { font-size: 13.5px; margin-top: 14px; padding: 11px 14px; border-radius: 12px; line-height: 1.45; display:none; }
.form-msg.show { display: block; animation: rise .25s both; }
.form-msg.err { background: rgba(255,92,114,.12); color: #ff9aa8; border: 1px solid rgba(255,92,114,.25); }
.form-msg.ok  { background: rgba(55,217,154,.12); color: #7ff0c4; border: 1px solid rgba(55,217,154,.25); }
.form-msg.info{ background: rgba(77,208,255,.10); color: #9fe3ff; border: 1px solid rgba(77,208,255,.22); }

/* ============================ APP SHELL ============================ */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; padding: 22px 16px; display: flex; flex-direction: column; gap: 6px;
  border-right: 1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 20px; }
.sidebar__brand .logo { width: 38px; height: 38px; border-radius: 11px; background: var(--brand); box-shadow: var(--shadow-glow); flex:none; display:grid; place-items:center; }
.sidebar__brand .logo svg { width: 22px; height: 22px; }
.sidebar__brand b { font-size: 15px; letter-spacing: -.2px; }
.sidebar__brand span { display: block; font-size: 11.5px; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 13px; color: var(--text-dim);
  font-size: 14.5px; font-weight: 550; transition: background .15s, color .15s; position: relative;
}
.nav-item svg { width: 20px; height: 20px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: #fff; }
.nav-item.active::before { content:""; position:absolute; left:-16px; top:50%; transform:translateY(-50%); width:4px; height:22px; border-radius:4px; background: var(--brand); box-shadow: var(--shadow-glow); }
.nav-badge { margin-left: auto; font-size: 11px; background: var(--brand); color:#fff; padding: 2px 8px; border-radius: 20px; font-weight: 700; }
.sidebar__foot { margin-top: auto; }
.user-chip { display:flex; align-items:center; gap:11px; padding: 10px 12px; border-radius: 13px; border:1px solid var(--border); background: var(--surface); }
.user-chip .av { width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); display:grid; place-items:center; font-weight:700; font-size: 14px; color:#fff; flex:none; }
.user-chip .nm { font-size: 13px; font-weight: 600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.user-chip .ph { font-size: 11px; color: var(--muted); }

.main { padding: 30px 34px 90px; max-width: 1180px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; letter-spacing: -.6px; }
.page-head p { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

/* topbar (mobile) */
.topbar { display: none; }

/* ============================ CARDS / GRID ============================ */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; backdrop-filter: blur(14px); transition: border-color .2s, transform .2s;
}
.card.pad-lg { padding: 24px; }
.card.hover:hover { border-color: var(--border-strong); }

.stat { position: relative; overflow: hidden; }
.stat .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); display:grid; place-items:center; margin-bottom: 14px; }
.stat .ic svg { width: 21px; height: 21px; color: var(--brand-2); }
.stat .label { font-size: 13px; color: var(--text-dim); font-weight: 550; }
.stat .value { font-size: 27px; font-weight: 750; letter-spacing: -.8px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 15px; color: var(--muted); font-weight: 600; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.stat.accent { background: var(--brand-soft); border-color: rgba(124,92,255,.28); }
.stat.accent .value { background: var(--brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; margin: 30px 4px 14px; }

/* ============================ WAREHOUSE LIST ============================ */
.wh-list { display: flex; flex-direction: column; gap: 10px; }
.wh {
  display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); transition: border-color .18s, background .18s;
}
.wh:hover { border-color: var(--border-strong); }
.wh__ic { width: 42px; height: 42px; border-radius: 11px; background: rgba(255,255,255,.05); display:grid; place-items:center; flex:none; }
.wh__ic svg { width: 21px; height: 21px; color: var(--text-dim); }
.wh__main { min-width: 0; flex: 1; }
.wh__name { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh__meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; display:flex; align-items:center; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); }
.chip.on { background: rgba(55,217,154,.14); color: #7ff0c4; border-color: rgba(55,217,154,.28); }
.fchip { transition: box-shadow .15s, background .15s, opacity .15s; }
.fchip.act { box-shadow: 0 0 0 2px currentColor inset, 0 2px 10px rgba(0,0,0,.25); background: rgba(255,255,255,.06); font-weight: 700; }
.chip.group { background: rgba(77,208,255,.12); color: #9fe3ff; border-color: rgba(77,208,255,.24); cursor: pointer; }
.chip.none { color: var(--muted); }

/* toggle switch */
.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 20px; background: rgba(255,255,255,.12); transition: background .2s; }
.switch .track::before { content:""; position:absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform .22s cubic-bezier(.3,.8,.3,1); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.switch input:checked + .track { background: var(--brand); box-shadow: var(--shadow-glow); }
.switch input:checked + .track::before { transform: translateX(19px); }

/* ============================ TABLE (admin) ============================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; padding: 14px 16px; background: rgba(255,255,255,.02); border-bottom: 1px solid var(--border); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,.02); }
.tbl .u-name { font-weight: 600; }
.tbl .u-sub { font-size: 12px; color: var(--muted); }
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 8px; }
.badge.ok { background: rgba(55,217,154,.15); color: #7ff0c4; }
.badge.no { background: rgba(255,92,114,.15); color: #ff9aa8; }

/* ============================ MODAL ============================ */
.modal-back { position: fixed; inset: 0; background: rgba(4,5,10,.6); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade .2s both; }
@keyframes fade { from{opacity:0} to{opacity:1} }
.modal { width: 100%; max-width: 440px; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 22px; padding: 26px; box-shadow: var(--shadow); animation: rise .28s cubic-bezier(.2,.7,.2,1) both; }
.modal h3 { font-size: 20px; letter-spacing: -.3px; margin-bottom: 6px; }
.modal p.mp { color: var(--text-dim); font-size: 13.5px; margin-bottom: 18px; line-height: 1.5; }
.modal .row { display: flex; gap: 10px; margin-top: 18px; }
.amount-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-bottom: 14px; }
.amount-grid .amt { height: 46px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-weight: 650; font-size: 14px; transition: .15s; }
.amount-grid .amt:hover { border-color: var(--border-strong); }
.amount-grid .amt.sel { background: var(--brand-soft); border-color: rgba(124,92,255,.6); color:#fff; }

/* ============================ MOBILE NAV ============================ */
.tabbar { display: none; }

/* misc */
.empty { text-align:center; padding: 46px 20px; color: var(--muted); }
.empty .ic { width: 56px; height:56px; border-radius: 16px; background: var(--surface); display:grid; place-items:center; margin: 0 auto 16px; }
.empty .ic svg { width: 28px; height:28px; opacity:.6; }
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display:flex; flex-direction:column; gap:8px; align-items:center; }
.toast { background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 13px; padding: 12px 18px; font-size: 13.5px; font-weight: 550; box-shadow: var(--shadow); animation: rise .25s both; max-width: 90vw; }
.toast.ok { border-color: rgba(55,217,154,.4); }
.toast.err { border-color: rgba(255,92,114,.4); }
.fade-in { animation: rise .4s cubic-bezier(.2,.7,.2,1) both; }
.spin-sm { width: 16px; height:16px; border-radius:50%; border:2px solid rgba(255,255,255,.3); border-top-color:#fff; animation: spin .7s linear infinite; display:inline-block; }
.hidden { display: none !important; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    /* верхний inset — чтобы шапка не уезжала под челку/часы iPhone в standalone (black-translucent) */
    padding: calc(14px + env(safe-area-inset-top)) 18px 14px; position: sticky; top: 0; z-index: 20;
    background: rgba(8,9,15,.8); backdrop-filter: blur(16px); border-bottom: 1px solid var(--border);
  }
  .topbar .tb-brand { display:flex; align-items:center; gap:10px; }
  .topbar .tb-brand .logo { width: 32px; height:32px; border-radius:9px; background: var(--brand); display:grid; place-items:center; }
  .topbar .tb-brand .logo svg { width:19px; height:19px; }
  .topbar .tb-brand b { font-size: 14px; }
  .topbar .tb-bal { font-size: 13px; font-weight: 700; padding: 7px 12px; border-radius: 11px; background: var(--brand-soft); border:1px solid rgba(124,92,255,.28); }
  .main { padding: 20px 16px 96px; }
  .page-head h1 { font-size: 22px; }
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-3 { grid-template-columns: 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: rgba(10,11,18,.9); backdrop-filter: blur(20px); border-top: 1px solid var(--border);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); justify-content: space-around;
  }
  .tabbar a { display:flex; flex-direction:column; align-items:center; gap:3px; padding: 6px 14px; border-radius: 12px; color: var(--muted); font-size: 10.5px; font-weight:600; transition:.15s; }
  .tabbar a svg { width: 22px; height:22px; }
  .tabbar a.active { color: #fff; }
  .tabbar a.active svg { color: var(--brand-2); }
}
@media (max-width: 420px) {
  .cols-4 { grid-template-columns: 1fr 1fr; }
  .amount-grid { grid-template-columns: repeat(3,1fr); }
}
