/* ==========================================================================
   Складской учёт — стили интерфейса
   ========================================================================== */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --green: #16a34a; --green-50: #f0fdf4; --green-100: #dcfce7;
  --red: #dc2626; --red-50: #fef2f2; --red-100: #fee2e2;
  --rose: #e11d48; --rose-50: #fff1f2;
  --orange: #ea580c; --orange-50: #fff7ed;
  --amber: #d97706; --amber-50: #fffbeb;
  --blue: #2563eb; --blue-50: #eff6ff;
  --teal: #0d9488; --teal-50: #f0fdfa;
  --purple: #7c3aed; --purple-50: #f5f3ff;
  --slate: #475569; --slate-50: #f1f5f9;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .07);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .22);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111a2e;
  --surface-2: #0f172a;
  --surface-3: #1a2540;
  --border: #22304d;
  --border-2: #31426a;
  --text: #e5e9f2;
  --text-2: #a7b3c9;
  --muted: #6b7a96;
  --primary: #3b82f6;
  --primary-2: #60a5fa;
  --primary-50: #13213f;
  --primary-100: #1a2c55;
  --green: #22c55e; --green-50: #0f2a1c; --green-100: #123b25;
  --red: #f87171; --red-50: #2d1517; --red-100: #3d1a1d;
  --rose: #fb7185; --rose-50: #2e1520;
  --orange: #fb923c; --orange-50: #2c1a10;
  --amber: #fbbf24; --amber-50: #2b220d;
  --blue: #60a5fa; --blue-50: #13213f;
  --teal: #2dd4bf; --teal-50: #0f2826;
  --purple: #a78bfa; --purple-50: #1f1838;
  --slate: #94a3b8; --slate-50: #1a2540;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
:root[data-font="large"] { font-size: 18px; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  overflow-x: hidden;
  font-family: var(--font); font-size: 1rem; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.ic { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: middle; }
[v-cloak] { display: none !important; }

/* ---------- boot loader ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.boot-inner { text-align: center; color: var(--text-2); }
.boot-logo { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 16px; background: linear-gradient(135deg, #2563eb, #7c3aed); display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-md); }
.boot-logo svg { width: 40px; height: 40px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.layout { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); min-height: var(--topbar-h); }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; display: grid; place-items: center; flex: none; overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; padding: 10px; }
.nav-group { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; cursor: pointer;
  position: relative; user-select: none;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.nav-item .ic { width: 20px; height: 20px; }
.nav-item .badge { margin-left: auto; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }

.main { margin-left: var(--sidebar-w); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--topbar-h) + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 8px; padding-left: 20px; padding-right: 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 19px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.page { padding: 20px; width: 100%; max-width: 1280px; margin: 0 auto; flex: 1; }
.page.narrow { max-width: 860px; }
.page.full { max-width: none; padding: 0; }
.tabbar { display: none; }
.call-bar {
  position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); z-index: 29; display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer;
  background: var(--green); color: #fff; font-weight: 600;
}
.offline-bar { background: var(--amber); color: #fff; text-align: center; padding: 6px 12px; font-size: 14px; font-weight: 600; }

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); width: 290px; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
  .topbar { padding-left: 8px; }
  .page { padding: 14px 12px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 20px rgba(15, 23, 42, .06);
  }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; user-select: none; }
  .tab .ic { width: 24px; height: 24px; }
  .tab.active { color: var(--primary); }
  .tab .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
  .tab-plus { flex: 1; display: flex; align-items: center; justify-content: center; }
  .tab-plus button {
    width: 56px; height: 56px; border-radius: 18px; border: 0; background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; margin-top: -22px;
    box-shadow: 0 8px 22px rgba(37, 99, 235, .45); display: grid; place-items: center; cursor: pointer;
  }
  .tab-plus .ic { width: 30px; height: 30px; }
}
.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 39; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid transparent; background: var(--surface-3); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, filter .15s, transform .05s; user-select: none; text-decoration: none; font-size: 15px;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn .ic { width: 20px; height: 20px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); filter: none; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border-2); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-soft { background: var(--primary-50); color: var(--primary); }
.btn-soft-danger { background: var(--red-50); color: var(--red); }
.btn-lg { min-height: 54px; font-size: 17px; padding: 0 24px; border-radius: 14px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent; color: var(--text-2); display: inline-grid; place-items: center;
  cursor: pointer; position: relative; flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .ic { width: 22px; height: 22px; }
.icon-btn .badge { position: absolute; top: 4px; right: 2px; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }

/* ---------- badges, chips ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
}
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag .ic { width: 14px; height: 14px; }
.tag-green { background: var(--green-50); color: var(--green); }
.tag-red { background: var(--red-50); color: var(--red); }
.tag-amber { background: var(--amber-50); color: var(--amber); }
.tag-blue { background: var(--blue-50); color: var(--blue); }
.tag-purple { background: var(--purple-50); color: var(--purple); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; user-select: none;
}
.chip .ic { width: 16px; height: 16px; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .cnt { opacity: .7; font-weight: 500; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 16px; flex: 1; }
.card-body { padding: 16px 18px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 22px 4px 10px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 4px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1023px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2.sm-1, .grid-3.sm-1 { grid-template-columns: minmax(0, 1fr); } }
.grid > * { min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.semibold { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.pos { color: var(--green); } .neg { color: var(--red); }
@media (min-width: 1024px) { .show-mobile { display: none !important; } }
@media (max-width: 1023px) { .hide-mobile { display: none !important; } }
.wrap-narrow { max-width: 860px; margin: 0 auto; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--text-2); }
.field .hint, .hint { font-size: 13px; color: var(--muted); }
.req::after { content: " *"; color: var(--red); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--surface);
  font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.input.invalid { border-color: var(--red); }
.input-sm { min-height: 38px; padding: 6px 10px; font-size: 15px; border-radius: 9px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 42px; }
.input-group > .ic { position: absolute; left: 13px; color: var(--muted); pointer-events: none; width: 20px; height: 20px; }
.input-group .clear { position: absolute; right: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; padding: 6px 0; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.check .t { font-weight: 600; }
.check .d { font-size: 13px; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-2); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }
.picker-btn {
  width: 100%; min-height: 48px; padding: 8px 40px 8px 14px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--surface); text-align: left;
  cursor: pointer; display: flex; align-items: center; gap: 10px; position: relative;
}
.picker-btn::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); }
.picker-btn .ph { color: var(--muted); }
.picker-btn.invalid { border-color: var(--red); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* qty stepper */
.qty { display: inline-flex; align-items: stretch; border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; background: var(--surface); height: 44px; }
.qty button { width: 42px; border: 0; background: var(--surface-3); cursor: pointer; display: grid; place-items: center; color: var(--text-2); }
.qty button:active { background: var(--border); }
.qty input { width: 74px; border: 0; text-align: center; font-weight: 700; font-size: 17px; background: transparent; outline: none; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- tables & lists ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; min-height: 64px; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .main-t { font-weight: 600; }
.list-item .sub-t { font-size: 13.5px; color: var(--text-2); }
.list-item .end { text-align: right; flex: none; }
.load-more { display: flex; justify-content: center; padding: 14px; }
.num { font-variant-numeric: tabular-nums; }

/* product thumb */
.thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--muted); font-weight: 700; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.lg { width: 96px; height: 96px; border-radius: 16px; font-size: 28px; }
.thumb .ic { width: 22px; height: 22px; }

/* avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; flex: none; position: relative; background: var(--slate); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.xl { width: 120px; height: 120px; font-size: 42px; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
.avatar.lg .dot { width: 16px; height: 16px; }
.avatar.group { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.avatar.general { background: linear-gradient(135deg, #f59e0b, #ef4444); }

/* ---------- empty / loading ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty .ic-wrap { width: 72px; height: 72px; border-radius: 22px; background: var(--surface-3); display: grid; place-items: center; margin: 0 auto 14px; color: var(--muted); }
.empty .ic-wrap .ic { width: 34px; height: 34px; }
.empty h3 { font-size: 18px; color: var(--text); margin-bottom: 6px; }
.empty p { margin: 0 auto 16px; max-width: 420px; }
.loading { display: flex; justify-content: center; padding: 40px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); animation: fade .15s; }
.modal {
  position: relative; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px); display: flex; flex-direction: column; animation: pop .18s ease-out;
}
.modal.lg { max-width: 820px; }
.modal.xl { max-width: 1100px; }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 18px; flex: 1; min-width: 0; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.modal-body.flush { padding: 0; }
.modal-foot { padding: 14px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes up { from { transform: translateY(100%); } }
@media (max-width: 640px) {
  .modal-root { padding: 0; align-items: flex-end; }
  .modal, .modal.lg, .modal.xl, .modal.sm { max-width: none; border-radius: 22px 22px 0 0; max-height: 94vh; max-height: 94dvh; animation: up .22s ease-out; }
  .modal.full { height: 100vh; height: 100dvh; max-height: none; border-radius: 0; }
  .modal-foot .btn { flex: 1; }
}

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 300; left: 50%; transform: translateX(-50%); top: calc(12px + var(--safe-t)); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 14px; background: #0f172a; color: #fff; box-shadow: var(--shadow-lg);
  animation: pop .2s ease-out; font-weight: 500; white-space: pre-line; cursor: pointer;
}
.toast .ic { width: 22px; height: 22px; margin-top: 1px; }
.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }
.toast.warn { background: #b45309; }

/* ---------- dashboard ---------- */
.hello { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.hello h1 { font-size: 24px; }
.actions-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1023px) { .actions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.action-tile {
  display: flex; gap: 12px; align-items: center; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; box-shadow: var(--shadow); transition: transform .1s, box-shadow .15s; user-select: none; text-align: left; width: 100%;
}
.action-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.action-tile .ai { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; }
.action-tile .ai .ic { width: 26px; height: 26px; }
.action-tile .at { font-weight: 700; font-size: 16px; }
.action-tile .ad { font-size: 12.5px; color: var(--text-2); line-height: 1.3; }
.action-tile > div:last-child { min-width: 0; }
.action-tile .at { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .actions-grid { gap: 10px; }
  .actions-grid .action-tile { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .actions-grid .action-tile .ai { width: 44px; height: 44px; border-radius: 13px; }
  .actions-grid .action-tile .at { font-size: 15.5px; }
  .actions-grid .action-tile .ad { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hello h1 { font-size: 21px; }
}
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; cursor: default; }
.kpi.click { cursor: pointer; }
.kpi .kl { font-size: 13px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .kl .ic { width: 16px; height: 16px; }
.kpi .kv { font-size: 24px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .ks { font-size: 13px; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 8px 4px 0; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart .bars { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart .bar { width: 42%; max-width: 14px; border-radius: 4px 4px 0 0; min-height: 2px; }
.chart .lbl { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) { .chart { gap: 3px; } .chart .bar-wrap:nth-child(even) .lbl { visibility: hidden; } .legend { gap: 8px; font-size: 12px; } }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.setup-step { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); cursor: pointer; }
.setup-step:last-child { border-bottom: 0; }
.setup-step .n { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--border-2); display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--muted); flex: none; }
.setup-step.done .n { background: var(--green); border-color: var(--green); color: #fff; }
.setup-step.done .t { text-decoration: line-through; color: var(--muted); }

/* ---------- operations sheet ---------- */
.ops-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .ops-list { grid-template-columns: 1fr; } }

/* ---------- document editor ---------- */
.doc-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); color: #fff; margin-bottom: 14px; position: relative; overflow: hidden; }
.doc-head .ai { width: 52px; height: 52px; border-radius: 16px; background: rgba(255, 255, 255, .2); display: grid; place-items: center; flex: none; }
.doc-head .ai .ic { width: 28px; height: 28px; }
.doc-head h2 { font-size: 20px; }
.doc-head p { margin: 2px 0 0; opacity: .9; font-size: 14px; }
.doc-head .st { margin-left: auto; text-align: right; flex: none; }
.doc-head .st .tag { background: rgba(255, 255, 255, .22); color: #fff; }
.doc-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1023px) { .doc-layout { grid-template-columns: 1fr; } }
.line {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "th info rm" ". lc lc" ". err err";
  gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); align-items: center;
}
.line > .thumb { grid-area: th; }
.line > .info { grid-area: info; min-width: 0; }
.line > .rm { grid-area: rm; align-self: start; }
.line:last-child { border-bottom: 0; }
.line.bad { background: var(--red-50); }
.line .ln { font-weight: 600; line-height: 1.3; }
.line .ls { font-size: 13px; color: var(--text-2); }
.line .lc { grid-area: lc; display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.line .lc .price { width: 120px; }
.line .lsum { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.line .err { grid-area: err; color: var(--red); font-size: 13px; font-weight: 600; }
@media (min-width: 1024px) {
  .line { grid-template-columns: 44px minmax(0, 1fr) auto auto; grid-template-areas: "th info lc rm" ". err err err"; }
  .line .lc { flex-wrap: nowrap; }
  .line > .rm { align-self: center; }
}
.sticky-foot {
  position: sticky; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 16px; margin: 14px -20px -20px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; box-shadow: 0 -6px 18px rgba(15, 23, 42, .06);
}
@media (max-width: 1023px) { .sticky-foot { bottom: calc(var(--tabbar-h) + var(--safe-b)); margin: 14px -12px -14px; } }
.totals { font-size: 14px; color: var(--text-2); }
.totals > span { display: block; }
@media (max-width: 640px) {
  .sticky-foot { gap: 8px; padding: 10px 12px; }
  .sticky-foot .totals { flex-basis: 100%; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  .sticky-foot .btn { flex: 1; }
  .sticky-foot .btn-lg { flex: 1.4; min-height: 50px; }
}
.totals b { color: var(--text); font-size: 18px; }
.quick-add { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.quick-add .input-group { flex: 1; min-width: 200px; }
@media (max-width: 640px) { .quick-add .btn { flex: 1; padding: 0 10px; font-size: 14.5px; } }
.diff-pos { color: var(--green); font-weight: 700; }
.diff-neg { color: var(--red); font-weight: 700; }
.reason-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* doc type colors */
.c-receipt { background: #16a34a; } .t-receipt { color: var(--green); } .bg-receipt { background: var(--green-50); color: var(--green); }
.c-issue { background: #e11d48; } .t-issue { color: var(--rose); } .bg-issue { background: var(--rose-50); color: var(--rose); }
.c-transfer { background: #2563eb; } .t-transfer { color: var(--blue); } .bg-transfer { background: var(--blue-50); color: var(--blue); }
.c-writeoff { background: #ea580c; } .t-writeoff { color: var(--orange); } .bg-writeoff { background: var(--orange-50); color: var(--orange); }
.c-return_in { background: #0d9488; } .t-return_in { color: var(--teal); } .bg-return_in { background: var(--teal-50); color: var(--teal); }
.c-return_out { background: #d97706; } .t-return_out { color: var(--amber); } .bg-return_out { background: var(--amber-50); color: var(--amber); }
.c-inventory { background: #7c3aed; } .t-inventory { color: var(--purple); } .bg-inventory { background: var(--purple-50); color: var(--purple); }
.doc-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.doc-ic .ic { width: 22px; height: 22px; }

/* ---------- detail view ---------- */
.kv-list { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 14px; font-size: 15px; }
.kv-list dt { color: var(--text-2); }
.kv-list dd { margin: 0; font-weight: 600; word-break: break-word; }
@media (max-width: 640px) { .kv-list { grid-template-columns: 120px minmax(0, 1fr); } }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-row .card { flex: 1; min-width: 140px; }

/* ---------- chat ---------- */
.chat-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - var(--safe-t)); height: calc(100dvh - var(--topbar-h) - var(--safe-t)); background: var(--surface); }
.chat-side { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head { padding: 12px; display: flex; gap: 8px; border-bottom: 1px solid var(--border); }
.chat-list { flex: 1; overflow-y: auto; }
.chat-row { display: flex; gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.chat-row:hover { background: var(--surface-2); }
.chat-row.active { background: var(--primary-50); }
.chat-row .cr-top { display: flex; gap: 6px; align-items: baseline; }
.chat-row .cr-name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row .cr-time { font-size: 12px; color: var(--muted); flex: none; }
.chat-row .cr-last { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.chat-row .badge { background: var(--primary); }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); min-height: 60px; }
.chat-head .who { flex: 1; min-width: 0; cursor: pointer; }
.chat-head .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who small { color: var(--text-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .chat-head { gap: 4px; padding: 8px 6px; } .chat-head .icon-btn { width: 38px; } }
.chat-head .who small.on { color: var(--green); }
.msgs { flex: 1; overflow-y: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 4px; -webkit-overflow-scrolling: touch; }
.day-sep { align-self: center; font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); padding: 3px 12px; border-radius: 999px; margin: 10px 0; }
.unread-sep { align-self: stretch; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--primary); margin: 8px 0; border-top: 1px solid var(--primary-100); padding-top: 6px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: min(78%, 620px); }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 18px 18px 18px 6px; padding: 8px 12px 6px; position: relative; min-width: 0; box-shadow: var(--shadow); }
.msg.mine .bubble { background: var(--primary); color: #fff; border-color: var(--primary); border-radius: 18px 18px 6px 18px; }
.msg .author { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.msg .text { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: 15.5px; }
.msg .text a { color: inherit; text-decoration: underline; }
.msg .meta { font-size: 11.5px; opacity: .7; text-align: right; margin-top: 2px; display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.msg .meta .ic { width: 15px; height: 15px; }
.msg .meta .read { color: #a5f3fc; opacity: 1; }
.msg.cont .author { display: none; }
.msg .av-space { width: 32px; flex: none; }
.msg.deleted .text { font-style: italic; opacity: .7; }
.msg .img { display: block; border-radius: 12px; max-width: 280px; max-height: 320px; cursor: zoom-in; margin: 2px 0 4px; background: var(--surface-3); }
.msg .file { display: flex; gap: 10px; align-items: center; padding: 6px 2px; min-width: 200px; color: inherit; }
.msg .file .fi { width: 40px; height: 40px; border-radius: 10px; background: rgba(127, 127, 127, .15); display: grid; place-items: center; flex: none; }
.msg .card-msg { display: flex; gap: 10px; align-items: center; padding: 6px 2px; cursor: pointer; min-width: 220px; }
.msg.mine .card-msg .doc-ic { background: rgba(255, 255, 255, .22) !important; color: #fff !important; }
.msg .voice { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 4px 0; }
.msg .voice button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.msg.mine .voice button { background: #fff; color: var(--primary); }
.msg .voice .track { flex: 1; height: 4px; border-radius: 2px; background: rgba(127, 127, 127, .3); position: relative; cursor: pointer; }
.msg .voice .track i { position: absolute; left: 0; top: 0; bottom: 0; background: currentColor; border-radius: 2px; }
.msg-system { align-self: center; font-size: 13px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); padding: 5px 12px; border-radius: 12px; margin: 6px 0; text-align: center; max-width: 90%; }
.msg-call { display: flex; align-items: center; gap: 10px; }
.msg-call .ci { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(127, 127, 127, .15); }
.msg-actions { opacity: 0; transition: opacity .15s; display: flex; align-self: center; }
.msg:hover .msg-actions { opacity: 1; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--border); }
.composer textarea { flex: 1; min-height: 46px; max-height: 160px; resize: none; border-radius: 23px; border: 1px solid var(--border-2); padding: 11px 16px; outline: none; background: var(--surface-2); font-size: 16px; line-height: 1.4; }
.composer textarea:focus { border-color: var(--primary); }
.composer .send { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--primary); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.composer .send .ic { width: 22px; height: 22px; }
.composer .send.rec { background: var(--red); animation: pulse 1.2s infinite; }
.recording { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--red); font-weight: 700; padding: 0 8px; min-height: 46px; }
.recording .dotrec { width: 12px; height: 12px; background: var(--red); border-radius: 50%; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.uploading { padding: 8px 14px; font-size: 14px; color: var(--text-2); background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; flex: 1; }
.progress i { display: block; height: 100%; background: var(--primary); transition: width .2s; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--text-2); }
@media (max-width: 1023px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - var(--safe-t) - var(--safe-b)); height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - var(--safe-t) - var(--safe-b)); }
  .chat-layout.in-chat .chat-side { display: none; }
  .chat-layout:not(.in-chat) .chat-main { display: none; }
  .msg { max-width: 88%; }
  .msg-actions { opacity: 1; }
  .chat-layout.in-chat { height: calc(100vh - var(--topbar-h) - var(--safe-t)); height: calc(100dvh - var(--topbar-h) - var(--safe-t)); }
}

/* ---------- calls ---------- */
.call-overlay { position: fixed; inset: 0; z-index: 200; background: #0b1220; color: #fff; display: flex; flex-direction: column; }
.call-top { padding: calc(16px + var(--safe-t)) 18px 10px; display: flex; align-items: center; gap: 10px; }
.call-top .ct { flex: 1; min-width: 0; }
.call-top .ct b { display: block; font-size: 17px; }
.call-top .ct small { opacity: .75; }
.call-top .icon-btn { color: #fff; }
.call-top .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.call-stage { flex: 1; position: relative; display: grid; gap: 6px; padding: 6px; min-height: 0; }
.call-stage.n1 { grid-template-columns: 1fr; }
.call-stage.n2 { grid-template-columns: repeat(2, 1fr); }
.call-stage.n3, .call-stage.n4 { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; }
.call-stage.n5, .call-stage.n6, .call-stage.n7 { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; }
@media (max-width: 640px) { .call-stage.n2 { grid-template-columns: 1fr; } }
.tile { position: relative; background: #111a2e; border-radius: 16px; overflow: hidden; display: grid; place-items: center; min-height: 0; }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile .who { position: absolute; left: 12px; bottom: 12px; background: rgba(0, 0, 0, .5); padding: 4px 10px; border-radius: 10px; font-size: 14px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.tile .state { position: absolute; top: 12px; left: 12px; background: rgba(0, 0, 0, .5); padding: 4px 10px; border-radius: 10px; font-size: 13px; }
.tile .avatar { width: 120px; height: 120px; font-size: 44px; }
.self-view { position: absolute; right: 14px; bottom: calc(110px + var(--safe-b)); width: 120px; height: 170px; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); background: #000; z-index: 5; border: 2px solid rgba(255, 255, 255, .25); }
.self-view video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.self-view.rear video { transform: none; }
@media (min-width: 1024px) { .self-view { width: 220px; height: 150px; } }
.call-controls { display: flex; justify-content: center; gap: 14px; padding: 16px 12px calc(24px + var(--safe-b)); flex-wrap: wrap; }
.cbtn { width: 60px; height: 60px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; cursor: pointer; }
.cbtn:hover { background: rgba(255, 255, 255, .22); }
.cbtn.off { background: #fff; color: #0f172a; }
.cbtn.red { background: #ef4444; }
.cbtn.green { background: #22c55e; }
.cbtn .ic { width: 26px; height: 26px; }
.cbtn-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; opacity: .9; }
.ringing { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 20px; }
.ringing .avatar { width: 128px; height: 128px; font-size: 46px; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: ring 1.6s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .35); } 100% { box-shadow: 0 0 0 40px rgba(255, 255, 255, 0); } }
.ringing h2 { font-size: 26px; }
.ringing p { opacity: .8; margin: 0; }
.incoming-actions { display: flex; gap: 40px; padding-bottom: calc(40px + var(--safe-b)); justify-content: center; }
.incoming-actions .cbtn { width: 72px; height: 72px; }

/* ---------- misc ---------- */
.img-viewer { position: fixed; inset: 0; z-index: 250; background: rgba(0, 0, 0, .92); display: flex; align-items: center; justify-content: center; }
.img-viewer img { max-width: 96vw; max-height: 90vh; object-fit: contain; }
.img-viewer .icon-btn { position: absolute; top: calc(10px + var(--safe-t)); color: #fff; }
.scanner-box { position: relative; background: #000; border-radius: 16px; overflow: hidden; min-height: 260px; }
.scanner-box video { width: 100% !important; display: block; }
.scan-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #ef4444; box-shadow: 0 0 12px #ef4444; animation: scan 2s ease-in-out infinite; pointer-events: none; z-index: 3; }
@keyframes scan { 0%, 100% { transform: translateY(-60px); } 50% { transform: translateY(60px); } }
.help-item { border-bottom: 1px solid var(--border); }
.help-item summary { padding: 14px 18px; font-weight: 600; cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: center; }
.help-item summary::-webkit-details-marker { display: none; }
.help-item[open] summary { color: var(--primary); }
.help-item .help-body { padding: 0 18px 16px 50px; color: var(--text-2); }
.help-item .help-body p { margin: 6px 0; }
.perm-group { margin-bottom: 18px; }
.perm-group h4 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, #dbeafe, transparent), radial-gradient(900px 500px at 110% 110%, #ede9fe, transparent), var(--bg); }
:root[data-theme="dark"] .login-wrap { background: var(--bg); }
.login-card { width: 100%; max-width: 420px; padding: 30px 26px; }
.login-card .brand-logo { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 14px; }
.login-card h1 { text-align: center; font-size: 24px; }
.login-card .sub { text-align: center; color: var(--text-2); margin: 6px 0 22px; }
.err-box { background: var(--red-50); color: var(--red); border: 1px solid var(--red-100); border-radius: 12px; padding: 12px 14px; font-weight: 600; white-space: pre-line; }
.info-box { background: var(--primary-50); color: var(--text); border: 1px solid var(--primary-100); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; }
.info-box .ic { color: var(--primary); margin-top: 2px; }
.warn-box { background: var(--amber-50); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; }
.warn-box .ic { color: var(--amber); margin-top: 2px; }
.success-big { text-align: center; padding: 10px 0; }
.success-big .ok-ic { width: 84px; height: 84px; border-radius: 50%; background: var(--green-50); color: var(--green); display: grid; place-items: center; margin: 0 auto 14px; }
.success-big .ok-ic .ic { width: 46px; height: 46px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 60; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger { color: var(--red); }
.rel { position: relative; }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .more-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.more-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; text-align: center; font-weight: 600; font-size: 13.5px; position: relative; }
.more-tile .mi { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; }
.more-tile .mi .ic { width: 24px; height: 24px; }
.more-tile .badge { position: absolute; top: 8px; right: 8px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input-group { flex: 1; min-width: 220px; }
.filters .input-group .input { width: 100%; min-width: 0; }
.filters .select, .filters .input { width: auto; min-width: 150px; }
@media (max-width: 640px) { .filters .input-group { flex-basis: 100%; } .filters .select, .filters .input:not(.search) { flex: 1; min-width: 0; } }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.page-actions h2 { font-size: 22px; flex: 1; }
.notif { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif.unread { background: var(--primary-50); }
.notif .ni { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.photo-up { display: flex; gap: 14px; align-items: center; }
.kbd { font-family: ui-monospace, Consolas, monospace; background: var(--surface-3); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; font-size: 13px; }

/* ---------- print ---------- */
#print-area { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; color: #000 !important; }
  #app, .toasts, .modal-root, .call-overlay { display: none !important; }
  #print-area { display: block !important; font: 12px/1.35 Arial, sans-serif; color: #000; }
  .pr h1 { font-size: 18px; margin: 0 0 4px; }
  .pr .co { font-size: 12px; margin-bottom: 14px; }
  .pr table { width: 100%; border-collapse: collapse; margin: 10px 0; }
  .pr th, .pr td { border: 1px solid #000; padding: 4px 6px; text-align: left; vertical-align: top; }
  .pr th { background: #eee; font-weight: 700; }
  .pr .num { text-align: right; white-space: nowrap; }
  .pr .info td { border: 0; padding: 2px 8px 2px 0; }
  .pr table.info { width: auto; margin: 4px 0 8px; }
  .pr thead th:first-child { width: 28px; }
  .pr .num { width: 1%; }
  .pr .sign { display: flex; justify-content: space-between; gap: 40px; margin-top: 40px; }
  .pr .sign div { flex: 1; border-top: 1px solid #000; padding-top: 4px; font-size: 11px; }
  .pr .tot { text-align: right; font-size: 14px; font-weight: 700; margin-top: 6px; }
  .pr .lbl { display: inline-block; border: 1px dashed #999; padding: 6px; margin: 4px; width: 58mm; text-align: center; vertical-align: top; page-break-inside: avoid; }
  .pr .lbl .nm { font-weight: 700; font-size: 11px; height: 28px; overflow: hidden; }
  .pr .lbl .pr-price { font-size: 18px; font-weight: 800; }
}

/* phone: an open conversation takes the whole screen like in messengers */
@media (max-width: 1023px) {
  .layout.chat-open .topbar, .layout.chat-open .tabbar { display: none; }
  .layout.chat-open .main { padding-bottom: 0; }
  .layout.chat-open .chat-layout.in-chat { height: 100vh; height: 100dvh; padding-top: var(--safe-t); }
}
