/* ================= Евросталь CRM ================= */
:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1b2333;
  --muted: #7a8599;
  --border: #e7eaf1;
  --primary: #e31e24;
  --primary-2: #0055a4;
  --primary-soft: #fff1e8;
  --sidebar: #11161f;
  --sidebar-2: #1a212d;
  --green: #16a34a;
  --red: #dc2626;
  --blue: #2563eb;
  --orange: #ea580c;
  --purple: #7c3aed;
  --yellow: #ca8a04;
  --gray: #64748b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .16);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
.icon { flex-shrink: 0; vertical-align: middle; }
[hidden] { display: none !important; }

/* ---------- keyframes ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(110%); } to { opacity: 1; transform: none; } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(234, 88, 12, .45); } 70% { box-shadow: 0 0 0 10px rgba(234, 88, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(30px, -40px) scale(1.1); } }
@keyframes tileWave { 0%, 100% { opacity: .05; transform: translateY(0); } 50% { opacity: .16; transform: translateY(-6px); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes stripes { to { background-position: 40px 0; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

.page-enter { animation: fadeUp .45s var(--ease) both; }
.card, .stat-card, .user-card, .role-card, .dir-card, .coil-card, .machine-card, .op-card {
  animation: fadeUp .5s var(--ease) both;
  animation-delay: calc(var(--d, 0) * 60ms);
}

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: linear-gradient(180deg, var(--sidebar), #0c1017);
  color: #c9d1de; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; z-index: 40; transition: transform .3s var(--ease);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 16px 14px; color: #fff; }
.brand-img { display: block; padding: 16px 18px 12px; }
.brand-img img {
  display: block; width: auto; height: 44px; max-width: 100%;
  object-fit: contain; filter: brightness(1.08);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 18px rgba(232, 89, 12, .45);
}
.brand-text { font-size: 17px; letter-spacing: .3px; line-height: 1.1; }
.brand-text b { color: #e31e24; }
.brand-text > span { color: #0055a4; font-weight: 800; }
.brand-text small { display: block; font-size: 11px; color: #7f8aa0; letter-spacing: 0; margin-top: 2px; }
.nav { padding: 6px 12px; flex: 1; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #5d687d; padding: 16px 10px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; margin-bottom: 2px;
  color: #aab4c5; position: relative; transition: background .2s, color .2s, transform .2s;
}
.nav-link:hover { background: var(--sidebar-2); color: #fff; transform: translateX(3px); }
.nav-link.active { background: linear-gradient(90deg, rgba(232, 89, 12, .22), rgba(232, 89, 12, .04)); color: #fff; }
.nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--primary-2); box-shadow: 0 0 12px var(--primary-2);
}
.nav-link.active .icon { color: var(--primary-2); }
.sidebar-foot { padding: 16px 22px; font-size: 11px; color: #4d576a; }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 28px; background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; overflow: hidden; white-space: nowrap; }
.crumbs a:hover { color: var(--primary); }
.crumbs b { color: var(--text); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; padding: 6px 8px; border-radius: 12px; transition: background .2s; }
.user-chip:hover { background: var(--bg); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--muted); font-size: 12px; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all .2s var(--ease);
}
.user-chip.open .dropdown { opacity: 1; visibility: visible; transform: none; }
.dropdown a, .dropdown button {
  display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; border: 0;
  background: none; cursor: pointer; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--bg); color: var(--primary); }
.content { padding: 16px 18px 20px; max-width: 1600px; width: 100%; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 750; letter-spacing: -.3px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- avatar ---------- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #ffd8bf, #ffb38a); color: #9a3412; font-weight: 700; font-size: 13px;
}
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; box-shadow: 0 8px 24px rgba(232, 89, 12, .25); }
.avatar.gold, .role-icon.gold { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #78350f; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid transparent; font-weight: 600; cursor: pointer; white-space: nowrap; position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 4px 14px rgba(232, 89, 12, .3); }
.btn-primary:hover { box-shadow: 0 6px 22px rgba(232, 89, 12, .45); transform: translateY(-1px); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-success { background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; box-shadow: 0 4px 14px rgba(22, 163, 74, .28); }
.btn-success:hover { filter: brightness(1.05); }
.btn-info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.btn-info:hover { background: #dbeafe; color: #1d4ed8; }
.btn-warning { background: linear-gradient(135deg, #d97706, #f59e0b); color: #fff; box-shadow: 0 4px 14px rgba(217, 119, 6, .28); }
.btn-warning:hover { filter: brightness(1.05); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-ghost { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-danger-ghost:hover { background: #fef2f2; color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-xl { padding: 16px 26px; font-size: 17px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .5); width: 40px; height: 40px; margin: -20px 0 0 -20px; transform: scale(0); animation: ripple .6s ease-out; pointer-events: none; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent; background: transparent; display: inline-grid;
  place-items: center; cursor: pointer; color: var(--muted); transition: all .2s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.danger:hover { background: #fef2f2; color: var(--red); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.inline { display: inline-flex; margin: 0; }
.mr-auto { margin-right: auto; }
.link { color: var(--primary); font-weight: 600; background: none; border: 0; cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border);
  background: #fff; font-size: 12.5px; cursor: pointer; transition: all .2s; font-weight: 500;
}
.chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.chip-red:hover { border-color: var(--red); color: var(--red); }
.chip-green:hover { border-color: var(--green); color: var(--green); }
.chip-blue:hover { border-color: var(--blue); color: var(--blue); }
.chip-purple:hover { border-color: var(--purple); color: var(--purple); }

/* ---------- cards & grids ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; border: 1px solid rgba(231, 234, 241, .6); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head h3 { font-size: 16px; font-weight: 700; }
.mt { margin-top: 22px; }
.grid { display: grid; gap: 12px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-2-1 { grid-template-columns: 2fr 1fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
.grid-1-1 { grid-template-columns: 1fr 1fr; }
.form-card { max-width: 820px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px; display: flex; gap: 10px;
  align-items: center; position: relative; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s;
}
.stat-card:hover { box-shadow: var(--shadow-lg); }
.stat-card::after { content: none; }
.stat-card > div { position: relative; z-index: 1; }
.stat-card small { color: var(--muted); display: block; }
.stat-card b { font-size: 18px; font-weight: 800; letter-spacing: -.4px; display: block; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-card.small { padding: 16px; }
.stat-card.small b { font-size: 20px; }
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.trend { font-size: 12px; color: var(--muted); }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }

.bg-orange { background: linear-gradient(135deg, #f97316, #fb923c); }
.bg-blue { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.bg-red { background: linear-gradient(135deg, #dc2626, #f87171); }
.bg-green { background: linear-gradient(135deg, #16a34a, #4ade80); }
.bg-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.bg-gray { background: #94a3b8; }
.bg-yellow { background: #eab308; }
.bg-dark { background: #334155; }

/* ---------- badges & dots ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-green { background: #f0fdf4; color: #15803d; }
.badge-purple { background: #f5f3ff; color: #6d28d9; }
.badge-red { background: #fef2f2; color: #b91c1c; }
.badge-yellow { background: #fefce8; color: #a16207; }
.badge-dark { background: #1e293b; color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-gray { background: #94a3b8; } .dot-blue { background: var(--blue); } .dot-orange { background: var(--orange); }
.dot-green { background: var(--green); } .dot-purple { background: var(--purple); } .dot-red { background: var(--red); } .dot-dark { background: #334155; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: -2px; margin-right: 6px; border: 1px solid rgba(0, 0, 0, .12); }
.swatch.lg { width: 22px; height: 22px; border-radius: 6px; }

/* ---------- progress ---------- */
.progress { height: 7px; background: #eef1f6; border-radius: 99px; overflow: hidden; flex: 1; }
.progress i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width 1.1s var(--ease); }
.progress.full { grid-column: 1 / -1; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; }
.th-sort:hover, .th-sort.on { color: var(--primary); }
.th-sort i { font-style: normal; font-size: 11px; }
.table td { padding: 8px 10px; border-bottom: 1px solid #f1f3f7; vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: #fafbfd; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.table tfoot td { border: 0; padding: 8px 12px; }
.table tfoot .grand td, .table .grand td { font-size: 16px; font-weight: 800; color: var(--primary); }
.table.compact td { padding: 8px 10px; }
.table-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.card:has(> table.table),
.card:has(> .table-scroll) {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.card-flush { padding: 0; overflow: hidden; }
.card-flush .table-scroll { border-radius: inherit; }
.card-flush .table { margin: 0; }
.card-flush .empty { padding: 28px; }
.table-compact th, .table-compact td { padding: 10px 12px; vertical-align: middle; }
.table-compact th { white-space: nowrap; font-size: 11px; letter-spacing: .04em; }
.table td .cell-clip {
  display: inline-block; max-width: min(280px, 36vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.table-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; background: #f1f5f9; flex-shrink: 0; }
.content { min-width: 0; }
.row-warn td { background: #fffbeb; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.text-red { color: var(--red) !important; }
.text-green { color: var(--green) !important; }
.right { text-align: right; margin-left: auto; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.w-70 { width: 70px !important; } .w-90 { width: 96px !important; } .w-120 { width: 120px !important; } .w-150 { width: 160px !important; }
input::placeholder { color: #b3bac7; }
input[readonly] { background: #f6f7fa !important; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty-big { text-align: center; padding: 60px 20px; color: var(--green); }
.empty-big h3 { color: var(--text); margin: 12px 0 6px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: #4b5568; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff;
  transition: border-color .2s, box-shadow .2s; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 4px rgba(232, 89, 12, .12); }
textarea { resize: vertical; }
input[type=color] { width: 60px; height: 40px; border: 1px solid var(--border); border-radius: 10px; padding: 3px; background: #fff; cursor: pointer; }
input[type=range] { accent-color: var(--primary); width: 100%; }
.input-xl { font-size: 24px !important; font-weight: 700; padding: 14px !important; text-align: center; }
.input-group { display: flex; gap: 8px; }
.inline-field { flex-direction: row; align-items: center; gap: 8px; }
.inline-field input, .inline-field select { width: auto; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; align-items: center; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 16px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); padding: 12px; border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 5; }
.segmented { display: inline-flex; background: #f1f3f8; padding: 4px; border-radius: 12px; margin-bottom: 16px; gap: 2px; flex-wrap: wrap; }
.segmented input { display: none; }
.segmented span { display: block; padding: 8px 16px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); transition: all .25s var(--ease); }
.segmented input:checked + span { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.switch i { width: 42px; height: 24px; border-radius: 99px; background: #d5dae3; position: relative; transition: background .25s; flex-shrink: 0; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(18px); }
.check { display: inline-block; cursor: pointer; }
.check input { display: none; }
.check i { width: 22px; height: 22px; border-radius: 7px; border: 2px solid #cfd5df; display: inline-grid; place-items: center; transition: all .2s var(--ease); }
.check input:checked + i { background: var(--primary); border-color: var(--primary); transform: scale(1.08); }
.check input:checked + i::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:disabled + i { opacity: .55; }

/* ---------- toolbar / tabs / search ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.card.toolbar { margin-bottom: 20px; }
.search { position: relative; flex: 1; max-width: 420px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px !important; }
.quick-ranges { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; transition: all .2s; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.tabs a span { background: #eef1f6; border-radius: 99px; padding: 1px 8px; font-size: 11px; margin-left: 4px; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pagination a { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- dashboard ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 18px; height: 240px; padding-top: 20px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; }
.bar {
  width: 100%; max-width: 54px; height: 0; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, var(--primary-2), var(--primary));
  transition: height 1s var(--ease); transition-delay: calc(var(--d) * 90ms); position: relative; box-shadow: 0 6px 16px rgba(232, 89, 12, .25);
}
.bar:hover { filter: brightness(1.1); }
.bar-col:last-child .bar { background: repeating-linear-gradient(45deg, var(--primary), var(--primary) 10px, var(--primary-2) 10px, var(--primary-2) 20px); background-size: 40px 100%; animation: stripes 1.2s linear infinite; }
.bar-value { font-size: 12px; font-weight: 700; color: var(--muted); }
.bar-label { font-size: 12px; color: var(--muted); }
.status-list { display: flex; flex-direction: column; gap: 12px; }
.status-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 4px 10px; align-items: center; }
.status-row .progress { grid-column: 2 / -1; }
.task-mini-list { display: flex; flex-direction: column; gap: 10px; }
.task-mini { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; transition: all .2s; }
a.task-mini:hover { border-color: var(--primary); transform: translateX(3px); }
.low-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--border); color: #b45309; }
.low-row b { margin-left: auto; }

/* ---------- profile / client ---------- */
.profile-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 14px 0 0; text-align: left; width: 100%; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; text-align: right; }
.note { background: #fffbeb; border: 1px solid #fde68a; padding: 12px; border-radius: 10px; margin-top: 14px; width: 100%; text-align: left; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user.big { padding: 4px 0 6px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; z-index: 100; opacity: 0; visibility: hidden; transition: all .25s; }
.modal.open { opacity: 1; visibility: visible; }
.modal-box { background: #fff; border-radius: 16px; padding: 16px 18px; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); transform: scale(.94) translateY(16px); transition: transform .3s var(--ease); }
.modal-box.modal-wide { max-width: 920px; }
.variant-block { margin-top: 14px; }
.variant-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.variant-row { display: grid; grid-template-columns: 1.3fr 1.1fr .7fr .9fr auto; gap: 8px; align-items: end; margin-top: 8px; }
.variant-row .field { margin: 0; }
.form-more { margin-top: 14px; }
.form-more summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.form-more .form-grid { margin-top: 10px; }
@media (max-width: 720px) {
  .variant-row { grid-template-columns: 1fr 1fr; }
}
.modal.open .modal-box { transform: none; }
.modal-box.sm { max-width: 440px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { font-size: 18px; }
.nom-dialog { max-width: 760px; }
.nom-dialog .modal-head { align-items: flex-start; margin-bottom: 14px; }
.nom-dialog .modal-head p { margin: 4px 0 0; }
.nom-meta, .nom-extra-row {
  display: grid; grid-template-columns: 1.15fr .85fr auto; gap: 14px; align-items: end; margin-top: 14px;
}
.nom-switch { display: flex; align-items: center; min-height: 42px; }
.nom-switch .field { margin: 0; }
.nom-coil, .nom-extra {
  margin-top: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 14px;
  background: #f8fafc; display: flex; flex-direction: column; gap: 12px;
}
.nom-coil[hidden], .nom-extra[hidden], [data-kind-show][hidden], [data-kind-hide][hidden] { display: none !important; }
.nom-yield { display: flex; flex-direction: column; gap: 10px; }
.nom-yield-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.nom-yield-head h4 { margin: 0; font-size: 14px; }
.nom-yield-head span, .nom-yield-note { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.nom-size-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lead-size-grid { display: flex; gap: 8px; margin-top: 8px; }
.lead-size-grid > .field { flex: 1; min-width: 0; }
.lead-size-grid > .field[hidden] { display: none !important; }
.lead-party { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.lead-party .lead-calc-note { grid-column: 1 / -1; margin: 0; }
.lead-lines { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.lead-line { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: #f8fafc; }
.lead-line-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.lead-line-head[hidden] { display: none !important; }
.lead-line-head b { font-size: 13px; font-weight: 800; color: var(--muted); }
.lead-line-sum {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border);
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.lead-line-sum[hidden] { display: none !important; }
.lead-line-sum > span:last-child { margin-left: auto; white-space: nowrap; }
.lead-line-sum b { color: var(--text); font-variant-numeric: tabular-nums; }
.lead-line-add { width: auto; margin-top: 8px; }
.lead-modal-box .field { gap: 4px; }
.lead-modal-box input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
.lead-modal-box select,
.lead-modal-box textarea { padding: 8px 10px; }
.icon-btn[hidden] { display: none !important; }
.lead-calc-note { margin: 10px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.lead-size { margin-top: 6px; font-size: 13.5px; font-weight: 700; }
.nom-yield-note { margin: 0; }
.nom-output-list { display: flex; flex-direction: column; gap: 10px; }
.nom-output-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 132px 36px; gap: 8px 10px; align-items: end;
}
.nom-output-row .nom-yield-note { grid-column: 1 / -1; }
.nom-output-row .icon-btn { margin-bottom: 2px; }
[data-lead-output-wrap][hidden] { display: none !important; }
.nom-extra { background: #fafbfd; }
.nom-extra-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.nom-extra-head h4 { margin: 0; font-size: 14px; }
.nom-extra-head span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.nom-extra .form-grid, .nom-extra-row { margin-top: 0; }
.nom-photo { display: flex; align-items: center; gap: 14px; }
.nom-photo img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; background: #eef1f6; flex-shrink: 0; }
.nom-photo-file { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nom-photo-file small { line-height: 1.35; }
.nom-dialog .form-actions { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px; background: #111827; color: #fff; padding: 14px 18px; border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: slideIn .45s var(--ease) both; min-width: 260px; max-width: 420px; position: relative; overflow: hidden;
}
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; width: 100%; animation: toastBar 4.5s linear forwards; opacity: .6; }
@keyframes toastBar { to { width: 0; } }
.toast-success .icon { color: #4ade80; }
.toast-error { background: #7f1d1d; }
.toast.hide { transition: all .4s; opacity: 0; transform: translateX(110%); }

/* ---------- order ---------- */
.items-table select, .items-table input { padding: 7px 8px !important; font-size: 13px; }
.item-row { animation: fadeUp .3s var(--ease) both; }
.item-row.removing { transition: all .25s; opacity: 0; transform: translateX(30px); }
.order-summary { display: grid; grid-template-columns: 1fr 360px; gap: 24px; margin-top: 20px; align-items: start; }
.totals { background: #fafbfd; border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.totals .grand { border-top: 1px dashed var(--border); padding-top: 12px; font-size: 20px; }
.totals .grand b { color: var(--primary); font-size: 24px; }
.stepper { display: flex; justify-content: space-between; position: relative; margin: 6px 10px 18px; }
.stepper::before { content: ""; position: absolute; left: 20px; right: 20px; top: 17px; height: 3px; background: #eef1f6; }
.step { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; flex: 1; }
.step span { width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 3px solid #e2e6ee; display: grid; place-items: center; font-weight: 700; color: var(--muted); transition: all .4s var(--ease); transition-delay: calc(var(--d) * 100ms); }
.step small { color: var(--muted); font-weight: 600; text-align: center; }
.step.done span { background: var(--green); border-color: var(--green); color: #fff; }
.step.current span { background: var(--primary); border-color: var(--primary); color: #fff; animation: pulse 1.8s infinite; }
.step.current small { color: var(--primary); }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid var(--border); padding-top: 14px; }
.pay-ring, .ring {
  --p: 0; width: 140px; height: 140px; border-radius: 50%; margin: 6px auto; display: grid; place-items: center;
  background: conic-gradient(var(--green) calc(var(--pp, 0) * 1%), #eef1f6 0); transition: --pp 1.2s;
}
.ring { background: conic-gradient(var(--primary) calc(var(--pp, 0) * 1%), #eef1f6 0); width: 170px; height: 170px; }
.pay-ring > div, .ring > div { width: 76%; height: 76%; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pay-ring b, .ring b { font-size: 26px; }
.pay-ring small, .ring small { color: var(--muted); font-size: 12px; text-align: center; }
@property --pp { syntax: "<number>"; inherits: false; initial-value: 0; }
.pay-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid #f1f3f7; gap: 10px; }
.quick-amounts { display: flex; gap: 8px; }
.timeline { display: flex; flex-direction: column; gap: 14px; position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: #eef1f6; }
.tl-item { position: relative; display: flex; gap: 10px; animation: fadeUp .4s both; }
.tl-item > span { position: absolute; left: -18px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); }

/* ---------- calculator ---------- */
.roof-preview { height: 150px; display: grid; place-items: center; margin-bottom: 16px; background: linear-gradient(180deg, #eaf4ff, #fff); border-radius: 14px; overflow: hidden; }
.roof-preview svg { width: 260px; height: 140px; }
.roof-preview .roof-shape { transition: all .5s var(--ease); }
.roof-preview .r-line { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1s var(--ease) forwards; }
.calc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.calc-stats > div { background: var(--primary-soft); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; }
.calc-stats small { color: #9a3412; font-weight: 600; font-size: 12px; }
.calc-stats b { font-size: 26px; color: var(--primary); font-variant-numeric: tabular-nums; }
.calc-stats span { color: var(--muted); font-size: 12px; }
.result-card { position: sticky; top: 84px; align-self: start; }
.result-card .table { margin-bottom: 16px; }
.result-card tbody tr { animation: fadeUp .35s both; }
.field b[data-angle-label] { font-size: 13px; color: var(--primary); }

/* ---------- sales POS ---------- */
.sale-pos { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(420px, 1.25fr); gap: 20px; align-items: start; }
.sale-catalog { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 110px); }
.sale-catalog .search { max-width: none; }
.segmented.small { margin-bottom: 0; }
.segmented.small span { padding: 6px 12px; font-size: 13px; }
.stock-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; margin: 0 -4px 0 0; }
.stock-item { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; cursor: pointer; transition: all .2s var(--ease); animation: fadeUp .3s both; animation-delay: calc(var(--d) * 25ms); font: inherit; color: inherit; }
.stock-item:hover { border-color: var(--primary); transform: translateX(4px); box-shadow: 0 4px 14px rgba(232, 89, 12, .12); }
.stock-item.added { border-color: var(--primary); background: var(--primary-soft); }
.stock-item.empty { opacity: .45; cursor: not-allowed; transform: none; }
.stock-item .swatch { margin: 0; display: grid; place-items: center; font-size: 12px; color: var(--muted); }
.si-name { min-width: 0; }
.si-name b, .si-name small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-name small { color: var(--muted); font-size: 12px; }
.si-stock { text-align: right; }
.si-stock b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; color: var(--green); }
.si-stock small { color: var(--muted); font-size: 11px; }
.sale-cart { display: flex; flex-direction: column; gap: 0; }
.sale-cart select { width: 100%; }
.cart-empty { text-align: center; color: var(--muted); padding: 30px 10px; border: 2px dashed var(--border); border-radius: 14px; margin-bottom: 16px; }
.cart-empty p { margin-top: 8px; }
.cart-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.cart-row { display: grid; grid-template-columns: 26px 1fr 34px; gap: 8px 12px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 12px; animation: fadeUp .3s var(--ease) both; }
.cart-row.removing { transition: all .25s; opacity: 0; transform: translateX(30px); }
.cart-row .swatch { margin: 0; }
.cart-name { min-width: 0; display: flex; flex-direction: column; }
.cart-name small { font-size: 11px; }
.cart-field { display: flex; flex-direction: column; gap: 2px; }
.cart-field small { color: var(--muted); font-size: 11px; }
.cart-field span { display: flex; align-items: center; gap: 4px; }
.cart-field i { font-style: normal; color: var(--muted); font-size: 12px; }
.cart-sum { text-align: right; display: flex; flex-direction: column; }
.cart-sum b { font-variant-numeric: tabular-nums; }
.cart-sum small { font-size: 11px; }
input.invalid { border-color: var(--red) !important; background: #fef2f2; }
.row-muted { opacity: .5; }
.btn-block.mt { margin-top: 14px; }
.quick-amounts { align-items: center; flex-wrap: wrap; }

/* ---------- leads list (заявки) ---------- */
.lead-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px;
}
.lead-stat {
  background: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; border-left: 3px solid var(--border);
}
.lead-stat small { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.lead-stat b { font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1; }
.lead-stat-wait { border-left-color: var(--orange); }
.lead-stat-wait b { color: var(--orange); }
.lead-stat-prep { border-left-color: var(--blue); }
.lead-stat-prep b { color: var(--blue); }
.lead-stat-done { border-left-color: var(--green); }
.lead-stat-done b { color: var(--green); }

.lead-list { display: flex; flex-direction: column; gap: 6px; }
.lead-item {
  background: #fff; border-radius: 10px;
  padding: 7px 10px 7px 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  border: 1px solid var(--border); cursor: pointer;
}
.lead-item:hover { background: #f8fafc; }
.lead-item-waiting { border-left: 3px solid var(--orange); }
.lead-item-preparing { border-left: 3px solid var(--blue); }
.lead-mill { position: relative; flex: 0 0 58px; width: 58px; height: 48px; overflow: hidden; display: grid; place-items: center; }
.lead-stage { position: relative; width: 40px; height: 32px; transform: scale(1.38); }
.lm-svg { position: absolute; inset: 0; width: 40px; height: 32px; display: block; }
.rc-peel { fill: none; stroke: #2563eb; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 18 24; animation: rcPeel .7s linear infinite; }
@keyframes rcPeel { to { stroke-dashoffset: -42; } }
.lead-item-done { border-left: 3px solid var(--green); }
.lead-item-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.lead-item-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; justify-content: flex-start; }
.lead-item-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.lead-item-name b { font-size: 14px; font-weight: 600; }
.lead-id { font-size: 12px; color: var(--muted); font-weight: 600; }
.lead-item-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lead-type {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 700;
}
.lead-item-body, .lead-item-foot {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; font-size: 12.5px; line-height: 1.35;
}
.lead-spec { font-weight: 600; }
.lead-sep { color: #c5ccd8; }
.lead-phone {
  display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--primary-2);
}
.lead-phone:hover { text-decoration: underline; }
.lead-item-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.lead-item-actions form { margin: 0; }
.lead-item-actions .btn { width: auto; justify-content: center; white-space: nowrap; border-radius: 500px; padding-left: 14px; padding-right: 14px; }
.op-leads-block .lead-list {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; gap: 0; overflow: hidden;
}
.op-leads-block .lead-item { border: 0; border-radius: 0; border-bottom: 1px solid var(--border); }
.op-leads-block .lead-item:last-child { border-bottom: 0; }
.lead-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.lead-done-block { margin-top: 4px; }
.lead-done-list { display: flex; flex-direction: column; }
.lead-done-row {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 4px; border-bottom: 1px solid var(--border); transition: background .15s;
}
.lead-done-row:last-child { border-bottom: 0; }
.lead-done-row:hover { background: #f8fafc; border-radius: 10px; }
.lead-done-check {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: #dcfce7; color: var(--green);
}
.lead-done-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lead-done-main small { color: var(--muted); }
.lead-done-meta { text-align: right; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; color: var(--muted); font-size: 12px; }
.lead-done-main, .lead-done-check { color: inherit; text-decoration: none; }
.lead-done-list .lead-item {
  border: 0; border-radius: 0; background: transparent;
  border-bottom: 1px solid var(--border); padding: 8px 2px;
}
.lead-done-list .lead-item:last-child { border-bottom: 0; }
.lead-done-list .lead-item:hover { background: #f8fafc; }
.lead-done-mark {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #dcfce7; color: var(--green);
}
.lead-done-sell { border-radius: 500px; padding-left: 14px; padding-right: 14px; }

.lead-panel {
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow); padding: 18px 18px 12px; margin-bottom: 16px;
}
.lead-panel h2 { margin: 0 0 4px; font-size: 18px; }
.lead-panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.lead-panel-head p { margin: 0; font-size: 13.5px; max-width: 560px; }
.lead-panel-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.lead-panel-counts span { background: #f8fafc; border-radius: 999px; padding: 6px 10px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.lead-panel-counts b { color: var(--text); }
.lead-kicker { margin: 14px 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.lead-panel .lead-item { box-shadow: none; background: #f8fafc; }
.lead-panel .lead-item:hover { background: #fff; box-shadow: var(--shadow); }
.lead-panel .empty { padding: 6px 0 12px; }
.lead-msg {
  margin: 2px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lead-decide { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lead-decide form { margin: 0; }
.lead-decide-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 12px;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.lead-decide-btn.is-wait.is-on { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.lead-decide-btn.is-ok.is-on { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.lead-decide-btn.is-no.is-on { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.lead-item-accepted { border-left: 4px solid var(--green); }
.lead-item-rejected { border-left: 4px solid var(--red); }
#site .lead-list { gap: 6px; }
#site .lead-site-row { padding: 8px 12px; border-radius: 12px; align-items: center; gap: 12px; }
#site .lead-site-row .lead-item-main { gap: 2px; }
#site .lead-site-row .lead-item-name b { font-size: 14px; }
#site .lead-site-row .lead-item-body { font-size: 12.5px; gap: 4px; }
#site .lead-site-row .lead-msg { display: inline; margin: 0; font-size: inherit; color: var(--muted); -webkit-line-clamp: unset; }
#site .lead-decide { margin-top: 0; flex-shrink: 0; }
#site .lead-decide-btn { padding: 4px 10px; font-size: 12px; }

.lead-modal {
  border: 0; padding: 0; border-radius: 20px; max-width: 720px; width: calc(100% - 24px);
  box-shadow: var(--shadow-lg); background: transparent;
}
.lead-modal::backdrop { background: rgba(11, 18, 32, .55); backdrop-filter: blur(3px); }
.lead-modal-box {
  display: flex; flex-direction: column; background: #fff; border-radius: 20px; padding: 0;
  max-height: min(780px, calc(100vh - 32px)); overflow: hidden;
}
.lead-modal-head, .lead-modal-foot { flex: 0 0 auto; }
.lead-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px 0; margin: 0; }
.lead-modal-head h3 { margin: 0; font-size: 18px; }
.lead-modal-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.lead-modal-body { flex: 1 1 auto; min-height: 0; padding: 12px 16px; overflow: auto; }
.lead-modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 10px 16px 12px; border-top: 1px solid var(--border); background: #fff;
}
.lead-modal-foot .form-actions { margin: 0; flex-shrink: 0; }
.lead-form-hint { margin: 0 auto 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.lead-form-hint:empty { display: none; }
.lead-modal .btn:disabled,
.lead-modal .btn:disabled:hover,
.lead-modal .btn:disabled:active {
  opacity: .4; cursor: not-allowed; box-shadow: none; transform: none; filter: none;
}
.op-done-orders { margin-top: 16px; }
.op-leads-block { margin-bottom: 8px; }
.lead-mini-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.text-red { color: var(--red) !important; }

@media (max-width: 900px) {
  .lead-stats { grid-template-columns: 1fr; }
  .lead-item { flex-wrap: wrap; }
  .lead-item-main { flex: 1 1 200px; }
  .lead-item-actions { flex-direction: row; }
  .lead-done-row { grid-template-columns: 36px 1fr; }
  .lead-done-meta { grid-column: 2; text-align: left; flex-direction: row; gap: 10px; }
}

/* ---------- operator ---------- */
.step-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 14px; margin-right: 8px; }
.op-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.op-choices.profiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.op-choice input { position: absolute; opacity: 0; pointer-events: none; }
.op-choice > span:last-child, .op-choice.coil-choice { cursor: pointer; }
.coil-choice { display: flex; gap: 12px; align-items: center; padding: 12px; border: 2px solid var(--border); border-radius: 14px; transition: all .2s var(--ease); position: relative; animation: fadeUp .35s both; animation-delay: calc(var(--d) * 50ms); }
.coil-choice:hover { border-color: #fdba74; }
.coil-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 6px 18px rgba(232, 89, 12, .15); }
.coil-choice:has(input:checked) .coil-visual { animation: spin 3s linear infinite; }
.coil-visual.sm { width: 54px; height: 54px; }
.oc-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.oc-body small { font-size: 12px; }
.oc-kg { margin-top: 4px; color: var(--muted); font-size: 13px; }
.oc-kg b { color: var(--text); font-size: 18px; }
.profile-choice > span { display: flex; flex-direction: column; gap: 2px; padding: 14px; border: 2px solid var(--border); border-radius: 14px; transition: all .2s var(--ease); height: 100%; }
.profile-choice > span:hover { border-color: #fdba74; }
.profile-choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.02); }
.profile-choice small { font-size: 12px; }
.big-input { font-size: 20px !important; font-weight: 700; padding: 12px 14px !important; width: 100%; }
.op-lengths td { vertical-align: middle; }
.op-lengths [data-l-area] { font-weight: 700; font-variant-numeric: tabular-nums; }
.op-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.op-summary > div { background: var(--primary-soft); border-radius: 12px; padding: 12px; }
.op-summary small { display: block; color: #9a3412; font-size: 12px; font-weight: 600; }
.op-summary b { font-size: 24px; color: var(--primary); font-variant-numeric: tabular-nums; }
.op-summary span { color: var(--muted); font-size: 12px; margin-left: 4px; }
.op-hint { background: #f8fafc; border-radius: 12px; padding: 12px 14px; margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.op-hint .chip { padding: 3px 10px; font-size: 12px; margin-left: 6px; }
.bar-chart.small { height: 200px; gap: 10px; }
.bar.bar-green { background: linear-gradient(180deg, #4ade80, var(--green)); }
.bar-col:last-child .bar.bar-green { background: repeating-linear-gradient(45deg, var(--green), var(--green) 10px, #4ade80 10px, #4ade80 20px); background-size: 40px 100%; }
body.fullscreen-mode .sidebar, body.fullscreen-mode .topbar { display: none; }
@media (max-width: 1100px) {
  .sale-pos { grid-template-columns: 1fr; }
  .sale-catalog { position: static; max-height: 420px; }
}

/* ---------- warehouse ---------- */
.color-stock { display: flex; flex-direction: column; gap: 10px; }
.cs-row { display: grid; grid-template-columns: 30px 170px 1fr 90px; gap: 12px; align-items: center; animation: fadeUp .4s both; animation-delay: calc(var(--d) * 60ms); }
.cs-row b { text-align: right; }
.coil-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.coil-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; gap: 16px; position: relative; transition: transform .25s var(--ease), box-shadow .25s; }
.coil-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.coil-card.finished { opacity: .55; }
.coil-visual { width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle, #fff 0 18%, #ddd 18% 20%, var(--hex) 20%); flex-shrink: 0; position: relative; box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .25), 0 6px 16px rgba(0, 0, 0, .15); }
.coil-visual span { position: absolute; inset: calc(50% - var(--left) / 2); border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .5); }
.coil-card:hover .coil-visual { animation: spin 4s linear infinite; }
.coil-body { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.coil-top { display: flex; justify-content: space-between; align-items: center; }
.coil-body > small { color: var(--muted); }
.coil-nums { display: flex; justify-content: space-between; font-size: 13px; }
.coil-del { position: absolute; bottom: 8px; right: 8px; opacity: 0; transition: opacity .2s; }
.coil-card:hover .coil-del { opacity: 1; }

.markup-box { display: flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 10px; background: var(--primary-soft); padding: 5px 10px; border-radius: 12px; }
.markup-box span { font-size: 13px; color: var(--muted); margin-right: 4px; }
.markup-box input { text-align: center; font-weight: 700; }
.markup-box .icon-btn { width: 28px; height: 28px; font-weight: 700; font-size: 16px; }
.items-table [data-profit] { display: block; font-size: 11px; color: var(--green, #2f9e44); margin-top: 2px; }
.items-table [data-profit].text-red { color: var(--red, #e03131); }
.totals .profit-line b { color: var(--green, #2f9e44); }
.totals .profit-line b.text-red { color: var(--red, #e03131); }
.move-total { background: var(--primary-soft); border-radius: 10px; padding: 10px 14px; }
.move-total b { color: var(--primary); font-size: 16px; }
.wh-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.wh-toolbar .search { flex: 1; min-width: 220px; max-width: 420px; }
.wh-filters { display: flex; gap: 4px; flex-wrap: wrap; background: #f1f5f9; padding: 4px; border-radius: 12px; }
.wh-filters button, .wh-filters a { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; text-decoration: none; }
.wh-filters button.active, .wh-filters a.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(16, 24, 40, .12); }
.wh-scroll { max-height: min(640px, calc(100vh - 280px)); overflow: auto; }
.wh-scroll-short { max-height: 420px; }
.wh-scroll thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.card-head .wh-filters { margin-left: auto; }
#journal .card-head { flex-wrap: wrap; }

/* ---------- reports ---------- */
.hbar { display: grid; grid-template-columns: 200px 1fr 130px; gap: 12px; align-items: center; padding: 8px 0; }
.hbar b { text-align: right; }
.donut-wrap { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.donut { width: 180px; height: 180px; border-radius: 50%; background: var(--g); display: grid; place-items: center; animation: donutIn 1s var(--ease) both; flex-shrink: 0; }
@keyframes donutIn { from { transform: rotate(-120deg) scale(.6); opacity: 0; } }
.donut > div { width: 62%; height: 62%; background: #fff; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut b { font-size: 22px; }
.legend { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.legend b { float: right; }

/* ---------- admin ---------- */
.user-grid, .role-grid, .dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.user-card { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; transition: transform .25s var(--ease), box-shadow .25s; }
.user-card:hover, .role-card:hover, .dir-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.user-card.inactive { opacity: .55; filter: grayscale(1); }
.user-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.role-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; transition: transform .25s var(--ease), box-shadow .25s; }
.role-top { display: flex; gap: 12px; align-items: center; }
.role-top small { display: block; }
.role-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: #eff6ff; color: var(--blue); flex-shrink: 0; }
.role-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.role-card .user-actions { justify-content: space-between; }
.perm-table td, .perm-table th { padding: 10px 8px; }
.perm-table tbody tr:hover { background: var(--primary-soft); }
.perm-list { display: flex; flex-direction: column; gap: 8px; }
.perm-list div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #f1f3f7; padding-bottom: 8px; }
.dir-card {
  background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; transition: transform .25s var(--ease), box-shadow .25s;
  min-width: 0; overflow: hidden;
}
.dir-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.dir-grid { min-width: 0; }
.settings-form { max-width: 900px; }
.error-page { text-align: center; padding: 80px 20px; }
.error-code { font-size: 120px; font-weight: 900; line-height: 1; background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; animation: scaleIn .6s var(--ease); }
.error-page h2 { margin: 10px 0; }
.error-page p { color: var(--muted); margin-bottom: 24px; }

/* ================= LOGIN ================= */
.login-body { background: #0b0f16; color: #fff; min-height: 100vh; overflow: hidden; }
.login-bg { position: fixed; inset: 0; overflow: hidden; }
.tiles { position: absolute; inset: -40px; display: grid; grid-template-columns: repeat(10, 1fr); gap: 0; transform: rotate(-8deg) scale(1.2); }
.tiles span {
  aspect-ratio: 1.6; border-radius: 0 0 50% 50%; border: 2px solid var(--primary-2); border-top: 0; margin: -10px 4px 0;
  animation: tileWave 4s ease-in-out infinite; animation-delay: calc(var(--i) * 90ms); opacity: .06;
}
.glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; animation: float 12s ease-in-out infinite; }
.glow-1 { width: 480px; height: 480px; background: #e8590c; top: -120px; left: -100px; }
.glow-2 { width: 420px; height: 420px; background: #7c2d12; bottom: -140px; right: -80px; animation-delay: -6s; }
.login-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; gap: 40px; max-width: 1180px; margin: 0 auto; padding: 40px; }
.login-hero { animation: fadeUp .8s var(--ease) both; }
.login-hero h1 { font-size: 64px; letter-spacing: 2px; font-weight: 300; }
.login-hero h1 b { font-weight: 900; color: var(--primary-2); }
.login-hero p { color: #a7b0c0; font-size: 18px; margin: 10px 0 28px; }
.roof-svg { width: 220px; height: 140px; }
.roof-line { fill: none; stroke: var(--primary-2); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw 1.4s var(--ease) .2s forwards; filter: drop-shadow(0 0 10px rgba(255, 143, 63, .7)); }
.roof-line.delay { stroke: #fff; stroke-width: 4; animation-delay: .9s; filter: none; }
.roof-line.delay2 { stroke: #fff; stroke-width: 4; animation-delay: 1.4s; filter: none; }
.hero-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hero-list li { display: flex; gap: 12px; align-items: center; color: #d0d6e0; animation: fadeUp .6s var(--ease) both; }
.hero-list li:nth-child(1) { animation-delay: .5s; } .hero-list li:nth-child(2) { animation-delay: .6s; }
.hero-list li:nth-child(3) { animation-delay: .7s; } .hero-list li:nth-child(4) { animation-delay: .8s; }
.hero-list .icon { color: var(--primary-2); }
.login-card {
  background: rgba(255, 255, 255, .97); color: var(--text); border-radius: 24px; padding: 38px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  animation: scaleIn .7s var(--ease) .15s both; max-width: 440px; width: 100%; justify-self: center;
}
.login-card.shake { animation: shake .5s; }
.login-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 10px 26px rgba(232, 89, 12, .45); margin-bottom: 18px; }
.login-logo-img {
  display: block; height: 52px; width: auto; max-width: 180px;
  object-fit: contain; margin-bottom: 18px;
}
.login-hero-logo {
  display: block; height: 72px; width: auto; max-width: min(280px, 100%);
  object-fit: contain; margin-bottom: 18px; filter: brightness(1.08);
  animation: fadeUp .6s var(--ease) both;
}
.login-card h2 { font-size: 26px; }
.login-card .muted { margin: 6px 0 22px; }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 8px; align-items: center; }
.alert-error { background: #fef2f2; color: #b91c1c; }
.float-field { position: relative; display: block; margin-bottom: 16px; }
.float-field input { padding: 22px 14px 8px !important; border-radius: 12px !important; font-size: 15px; }
.float-field span { position: absolute; left: 15px; top: 15px; color: var(--muted); pointer-events: none; transition: all .2s var(--ease); }
.float-field input:focus + span, .float-field input:not(:placeholder-shown) + span { top: 6px; font-size: 11px; color: var(--primary); font-weight: 600; }
.pass-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; }
/* ================= responsive ================= */
.only-mobile { display: none; }
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats.stats-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .operator-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .only-mobile { display: inline-grid; }
  .stats.stats-3 { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 35; animation: fadeIn .2s; }
  .content { padding: 12px 12px 16px; }
  .topbar { padding: 0 14px; }
  .user-meta, .clock { display: none; }
  .grid-2, .grid-1-1, .order-summary { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4, .nom-meta, .nom-extra-row, .nom-yield-grid, .nom-size-grid, .nom-output-row, .lead-party { grid-template-columns: 1fr; }
  .lead-modal-foot { flex-direction: column; align-items: stretch; }
  .lead-form-hint { margin: 0; }
  .span-2, .span-4 { grid-column: auto; }
  .login-wrap { grid-template-columns: 1fr; padding: 20px; }
  .login-hero { display: none; }
  .hbar { grid-template-columns: 1fr; gap: 4px; }
  .cut-row, .op-card .cut-row { grid-template-columns: 1fr; }
  .calc-stats { grid-template-columns: 1fr 1fr 1fr; }
  .result-card { position: static; }
  .table { font-size: 13px; }
  .stepper small { font-size: 10px; }
}
@media (max-width: 700px) {
  .page-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .page-head h1 { font-size: 20px; }
  .page-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 6px; }
  .page-actions > .btn,
  .page-actions > a.btn,
  .page-actions > form { flex: 1 1 calc(50% - 6px); min-width: 0; max-width: 100%; }
  .page-actions > form { display: flex; margin: 0; }
  .page-actions .btn { width: 100%; justify-content: center; padding: 8px 10px; font-size: 13px; white-space: normal; line-height: 1.2; min-height: 36px; }
  .page-actions .btn-lg { padding: 8px 8px; font-size: 13px; border-radius: 10px; }
  .form-actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; white-space: normal; line-height: 1.2; min-height: 36px; }
  .form-actions .btn-primary,
  .form-actions .btn-success,
  .form-actions .btn-warning,
  .form-actions .btn-info,
  .form-actions .btn-danger { flex-basis: 100%; }
  .lead-actions { display: flex; }
  .lead-actions > .btn,
  .lead-actions > a,
  .lead-actions > form { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .lead-actions > form { display: flex; margin: 0; }
  .lead-actions .btn { width: 100%; justify-content: center; }
  .stats, .stats.stats-3 { grid-template-columns: 1fr 1fr; }
  .stat-card small { font-size: 11px; }
  .stat-card b { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.cart-fields { grid-column: 2 / -1; display: grid; grid-template-columns: 1.2fr 1.2fr 1fr; gap: 10px; }
.cart-line-sum b { display: flex; align-items: center; min-height: 38px; font-size: 16px; font-variant-numeric: tabular-nums; }
.cart-field span { display: flex; align-items: center; gap: 6px; }
.cart-field input { padding: 8px 10px !important; font-weight: 600; }
.cart-sum b { font-size: 17px; }
.markup-box input { width: 70px !important; padding: 6px 8px !important; }

/* ---------- debts & cashbox ---------- */
.debts-table { font-size: 13px; }
.debts-table th, .debts-table td { padding: 8px 10px; vertical-align: middle; }
.debts-table th { white-space: nowrap; font-size: 11px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.debt-client-link { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; min-width: 0; max-width: 160px; }
.debt-client-link b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debt-client-link small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.debt-sales { display: flex; flex-wrap: wrap; gap: 4px; max-width: 280px; }
.debt-chip { display: inline-flex; gap: 4px; align-items: center; padding: 1px 6px; border-radius: 6px; background: #fef2f2; color: var(--text); font-size: 11px; line-height: 1.4; border: 1px solid #fecaca; white-space: nowrap; }
.debt-chip b, .debt-sum { color: var(--red); white-space: nowrap; }
.debt-chip:hover { background: #fee2e2; }
.debt-sum { font-size: 13px; }
.debt-client { margin: 0 0 14px; padding: 12px 14px; background: #fef2f2; border-radius: 10px; }
.btn-xs { padding: 4px 8px; font-size: 12px; min-height: 28px; }
.progress i.bar-red { background: linear-gradient(90deg, #f87171, var(--red)); }
.cash-method { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 14px; padding: 10px 0; border-bottom: 1px dashed var(--border); align-items: center; }
.cash-method:last-child { border-bottom: 0; }
.cash-method small { grid-column: 1 / -1; }
.cashbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 4px 0 8px; }
.cashbox-tile { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--card, #fff); transition: border-color .15s, opacity .15s; }
.cashbox-tile.is-off { opacity: .55; }
.cashbox-tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.cashbox-tile-top b { font-size: 14px; }
.cashbox-bal { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.cashbox-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 12px; }
.pay-parts { display: flex; flex-direction: column; gap: 8px; }
.pay-part-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.pay-part-row .field { margin: 0; }
@media (max-width: 560px) {
  .pay-part-row { grid-template-columns: 1fr auto; }
  .pay-part-row .field:nth-child(2) { grid-column: 1 / -1; }
}
.grid > div > .card + .card { margin-top: 20px; }

/* ---------- dashboard charts ---------- */
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card.kpi { flex-direction: column; align-items: stretch; gap: 4px; padding: 18px 20px 0; color: inherit; }
.stat-card.kpi > * { position: relative; z-index: 1; }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.kpi-trend { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 99px; }
.kpi-trend.up { background: #dcfce7; color: var(--green); }
.kpi-trend.down { background: #fee2e2; color: var(--red); }
.kpi-trend.neutral { background: #f1f5f9; color: var(--muted); }
.stat-card.kpi b { font-size: 26px; }
.stat-card.kpi b em { font-style: normal; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.stat-card.kpi .inline-b { display: inline; font-size: 12px; font-weight: 700; letter-spacing: 0; }
.spark { height: 44px; margin: 6px -20px 0; }
.spark svg { display: block; overflow: visible; }
.kpi-progress { margin: 14px 0 20px; flex: none; }
a.stat-card.kpi:hover { color: inherit; }

.chart-card .card-head h3 { margin: 0; }
.chart-card .card-head small { display: block; margin-top: 3px; }
.seg { display: inline-flex; background: #f1f4f9; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .2s var(--ease); }
.seg button.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(16, 24, 40, .12); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 6px; }
.lg-item { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--border); background: #fff; border-radius: 99px; padding: 5px 11px; font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer; transition: all .2s var(--ease); }
.lg-item i, .dl-row i, .chart-tip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.lg-item b { color: var(--muted); font-weight: 600; }
.lg-item:hover { border-color: #cbd5e1; transform: translateY(-1px); }
.lg-item.off { opacity: .45; text-decoration: line-through; }
.line-chart, .col-chart { width: 100%; min-height: 240px; }
.line-chart svg, .col-chart svg { display: block; overflow: visible; }
.grid-line { stroke: #eef1f6; stroke-dasharray: 3 4; }
.axis { fill: #94a3b8; font-size: 11px; }
.guide { stroke: #cbd5e1; stroke-dasharray: 4 4; opacity: 0; transition: opacity .15s; }
.guide.show, .lc-dot.show { opacity: 1; }
.lc-dot { opacity: 0; transition: opacity .15s; pointer-events: none; }
.lc-area.fade-in, .spark-area { animation: fadeIn 1.2s var(--ease) both; }

.chart-tip { position: fixed; z-index: 100; pointer-events: none; background: rgba(17, 24, 39, .94); color: #fff; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; min-width: 150px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip > b { display: block; margin-bottom: 5px; font-size: 13px; }
.chart-tip div { display: flex; align-items: center; gap: 7px; line-height: 1.7; }
.chart-tip span { margin-left: auto; padding-left: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pie { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pie-wrap { position: relative; width: 200px; height: 200px; }
.pie-svg { width: 100%; height: 100%; overflow: visible; }
.pie-track { fill: none; stroke: #f1f4f9; stroke-width: 24; }
.pie-seg { fill: none; stroke-width: 24; cursor: pointer; transition: stroke-dasharray 1.1s var(--ease), opacity .2s, stroke-width .2s; }
.pie-seg:hover { stroke-width: 30; }
.pie-seg.dim { opacity: .25; }
.pie-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; padding: 0 44px; }
.pie-center small { color: var(--muted); font-size: 12px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pie-center b { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.pie-center span { font-size: 12px; color: var(--muted); }
.pie-legend { width: 100%; display: flex; flex-direction: column; gap: 2px; }
.dl-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; font-size: 13px; cursor: default; transition: background .15s; }
.dl-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-row.active, .dl-row:hover { background: #f6f7fa; }

.gauge { display: flex; justify-content: center; padding-top: 8px; }
.gauge-svg { width: 100%; max-width: 260px; overflow: visible; }
.gauge-track { fill: none; stroke: #f1f4f9; stroke-width: 18; stroke-linecap: round; }
.gauge-val { fill: none; stroke-width: 18; stroke-linecap: round; transition: stroke-dasharray 1.3s var(--ease); }
.gauge-num { font-size: 34px; font-weight: 800; fill: var(--text); letter-spacing: -1px; }
.gauge-cap { font-size: 12px; fill: var(--muted); }
.gauge-legend { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; font-size: 13px; }
.gauge-legend div { display: flex; align-items: center; gap: 8px; }
.gauge-legend b { margin-left: auto; }

.col { transform-box: fill-box; transform-origin: bottom; transition: transform .8s var(--ease), filter .15s; }
.col.hover { filter: brightness(1.12) drop-shadow(0 4px 8px rgba(37, 99, 235, .35)); }
.col-val { fill: var(--muted); font-size: 11px; font-weight: 700; }

.top-client { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); color: inherit; animation: fadeUp .5s var(--ease) both; animation-delay: calc(var(--d) * 70ms); }
.top-client:last-child { border-bottom: 0; }
.top-client:hover b { color: var(--primary); }
.rank { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: #f1f4f9; color: var(--muted); flex-shrink: 0; }
.rank.r1 { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #fff; }
.rank.r2 { background: linear-gradient(135deg, #94a3b8, #cbd5e1); color: #fff; }
.rank.r3 { background: linear-gradient(135deg, #c2410c, #fb923c); color: #fff; }
.top-client-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.top-client-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.top-client-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }
.top-client-head span { font-weight: 700; white-space: nowrap; }
.coil-mini { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.coil-mini .progress { margin-top: 6px; }
.coil-mini-val { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; }
@media (max-width: 1200px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .grid-3 { grid-template-columns: 1fr; } }

/* ---------- dashboard, dense ---------- */
.content:has(.dash) { padding: 14px 16px 16px; }
.dash .page-head { margin-bottom: 12px; align-items: center; }
.dash .page-head h1 { font-size: 22px; }
.dash .page-head p { margin-top: 2px; font-size: 13px; }
.dash .card { margin: 0; padding: 12px 14px; }
.dash .card-head { margin-bottom: 8px; }
.dash .card-head h3 { font-size: 14.5px; }
.dash .card-head.mt { margin-top: 12px; }
.dash .empty { padding: 10px; }
.dash-kpis, .dash-main, .dash-duo, .dash-split { display: grid; gap: 12px; margin-bottom: 12px; }
.dash-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-main { grid-template-columns: 1.4fr 1fr; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dash-duo { grid-template-columns: 1fr 1fr; }
.dash-split { grid-template-columns: 1.35fr .9fr; align-items: start; }
.dash-split:last-child { margin-bottom: 0; }
.dash-kpi {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto;
  grid-template-areas: "icon body" "spark spark";
  gap: 0 10px; align-items: center; height: 100%;
  background: var(--card); border: 1px solid rgba(231, 234, 241, .7); border-radius: 14px;
  box-shadow: var(--shadow); padding: 10px 12px 0; color: inherit; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
a.dash-kpi:hover { border-color: #fecaca; box-shadow: var(--shadow-lg); color: inherit; }
.dash-kpi .stat-icon { grid-area: icon; width: 34px; height: 34px; border-radius: 10px; align-self: start; margin-top: 1px; }
.dash-kpi-body { grid-area: body; min-width: 0; }
.dash-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.dash-kpi-body small { color: var(--muted); font-size: 12px; line-height: 1.2; }
.dash-kpi-body b { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.4px; line-height: 1.15; font-variant-numeric: tabular-nums; margin-top: 2px; }
.dash-kpi-body b em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.dash-kpi-body .trend { display: block; margin-top: 1px; font-size: 11.5px; line-height: 1.25; }
.dash-kpi-body .inline-b { display: inline; font-size: inherit; font-weight: 700; letter-spacing: 0; }
.dash-kpi .kpi-trend { flex-shrink: 0; padding: 2px 7px; font-size: 11px; }
.dash-kpi .spark { grid-area: spark; height: 32px; margin: 4px -12px 0; }
.dash-kpi-bar { grid-area: spark; padding: 8px 0 10px; }
.dash-kpi-bar .progress { height: 5px; flex: none; }
.dash .chart-legend { gap: 6px; margin: 0 0 2px; }
.dash .lg-item { padding: 2px 8px; font-size: 12px; gap: 5px; }
.dash .seg button { padding: 4px 10px; font-size: 12px; }
.dash .line-chart, .dash .col-chart { min-height: 0; }
.dash .pie { flex-direction: row; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.dash .pie-wrap { width: 108px; height: 108px; flex-shrink: 0; }
.dash .pie-legend { min-width: 0; flex: 1; }
.dash .pie-center { padding: 0 26px; }
.dash .pie-center small { font-size: 10px; max-width: 72px; }
.dash .pie-center b { font-size: 15px; }
.dash .pie-center span { font-size: 10px; }
.dash .pie-legend { gap: 0; }
.dash .dl-row { padding: 3px 4px; font-size: 12px; gap: 6px; }
.dash .gauge { padding: 0; }
.dash .gauge-svg { max-width: 150px; }
.dash .gauge-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dash .gauge-row .gauge { flex: 0 0 116px; }
.dash .gauge-legend div, .dash .gauge-legend b { white-space: nowrap; }
.dash .gauge-row .gauge-svg { max-width: none; width: 100%; }
.dash .gauge-legend { margin-top: 0; gap: 4px; font-size: 12.5px; min-width: 0; flex: 1; }
.dash .top-client { padding: 5px 0; gap: 8px; }
.dash .rank { width: 24px; height: 24px; border-radius: 7px; font-size: 12px; }
.dash .top-client-body { gap: 3px; }
.dash .top-client-head { font-size: 13px; }
.dash .coil-mini { padding: 5px 0; gap: 8px; }
.dash .coil-mini .progress { margin-top: 3px; }
.dash .low-row { padding: 4px 0; font-size: 13px; }
.dash .table th, .dash .table td { padding: 7px 8px; }
.dash .table { font-size: 13px; }
@media (max-width: 1100px) {
  .dash-kpis, .dash-duo { grid-template-columns: 1fr 1fr; }
  .dash-main, .dash-split { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .dash-kpis, .dash-duo { grid-template-columns: 1fr; }
  .dash .pie, .dash .gauge-row { flex-direction: column; }
  .dash .page-head h1 { font-size: 20px; }
}

/* ---------- inventory ---------- */
.info-note { display: flex; gap: 12px; align-items: flex-start; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; font-size: 13.5px; line-height: 1.5; animation: fadeUp .4s var(--ease) both; }
.info-note .icon { flex-shrink: 0; margin-top: 2px; }
.card-head h3 .icon { vertical-align: -3px; color: var(--primary); }
.inv-hint { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.inv-card { padding-top: 18px; }
.inv-card .segmented { margin-bottom: 20px; }
.inv-card .segmented span { display: inline-flex; align-items: center; gap: 6px; }
.inv-form .form-actions { margin-top: 8px; }
.field-hint { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.field-hint b { color: var(--text); font-weight: 700; }
.inv-sections { display: flex; flex-direction: column; gap: 16px; }
.inv-coil-extra { display: flex; gap: 6px; margin-top: 6px; }
.inv-coil-extra input, .inv-coil-extra select { max-width: none; width: 100%; padding: 6px 8px !important; font-size: 12.5px; }
.inv-table td { vertical-align: middle; }
.inv-table input { max-width: 150px; padding: 8px 10px !important; }
.inp-unit { display: flex; align-items: center; gap: 6px; }
.inp-unit span { color: var(--muted); font-size: 12px; min-width: 22px; white-space: nowrap; }
.inp-unit select { flex: 1; }
[data-qty-unit], [data-cost-unit] { font-style: normal; font-weight: 600; }
.inv-table tr.inv-filled td, .inv-table tr.inv-same td { background: #f0fdf4; }
.inv-table tr.inv-plus td { background: #f0fdf4; }
.inv-table tr.inv-plus [data-diff], .inv-table tr.inv-plus [data-diff-sum] { color: var(--green); font-weight: 700; }
.inv-table tr.inv-minus td { background: #fef2f2; }
.inv-table tr.inv-minus [data-diff], .inv-table tr.inv-minus [data-diff-sum] { color: var(--red); font-weight: 700; }
.inv-table tr.inv-same [data-diff] { color: var(--muted); }
.inv-table tr.inv-hide { display: none; }
.inv-table td, .inv-table tr { transition: background .2s; }
.inv-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--border); }
.inv-footer.sticky { position: sticky; bottom: 0; z-index: 5; background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; box-shadow: 0 -6px 24px rgba(16, 24, 40, .08); margin: 16px 0 20px; }
.inv-reason { flex: 1; min-width: 220px; margin: 0; }
.inv-summary { font-size: 13.5px; }
.inv-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 20px; }
.inv-toolbar.bare { padding: 0 0 12px; border: 0; box-shadow: none; background: none; }
.inv-toolbar .search { flex: 1; max-width: 420px; }
.seg a { display: inline-block; padding: 7px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); transition: all .2s var(--ease); }
.seg a.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(16, 24, 40, .12); }
