:root {
  --bg: #121418;
  --panel: #1b1f26;
  --line: #2c3340;
  --text: #e8eaed;
  --muted: #8b93a2;
  --accent: #3d8bfd;
  --ok: #3dbe7a;
  --warn: #e6b325;
  --bad: #e05555;
  --lift: 0 8px 22px rgba(0, 0, 0, 0.28);
  --ease: 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 "Segoe UI", sans-serif; }
body {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(61, 139, 253, 0.12), transparent 50%),
    radial-gradient(900px 400px at 100% 0%, rgba(61, 190, 122, 0.06), transparent 45%),
    var(--bg);
}
body.ready #app { animation: pageIn 0.35s var(--ease); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
button, input, select, textarea { font: inherit; color: inherit; }
#app { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.shop-head .bar-nav,
.shop-head .bar-work { display: flex; align-items: center; gap: 8px; }
.shop-head .bar-work { margin-top: 8px; flex-wrap: wrap; }
.shop-head .stations { display: flex; gap: 6px; flex-wrap: wrap; margin-right: auto; }
.shop-head .tool { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.shop-head .tool input { width: 72px; }
body:not(.office) main { overflow: hidden; }
body:not(.office) .side { min-height: 0; }
body:not(.office) #view { position: relative; overflow: hidden; }
header, footer { padding: 10px 16px; border-bottom: 1px solid var(--line); background: rgba(27, 31, 38, 0.92); backdrop-filter: blur(10px); }
footer { border-bottom: 0; border-top: 1px solid var(--line); max-height: 28vh; overflow: auto; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
label { color: var(--muted); font-size: 12px; }
input, select, textarea { background: #101318; border: 1px solid var(--line); padding: 6px 8px; border-radius: 6px; color: var(--text); caret-color: var(--text); color-scheme: dark; transition: border-color var(--ease), box-shadow var(--ease), background var(--ease); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(61, 139, 253, 0.22); }
textarea { resize: vertical; min-height: 64px; }
.scan { width: 100%; font-size: 22px; padding: 12px 14px; }
button { background: #2a3140; border: 1px solid var(--line); padding: 8px 12px; border-radius: 6px; cursor: pointer; transition: transform var(--ease), background var(--ease), box-shadow var(--ease), border-color var(--ease); }
button:hover { background: #343d50; transform: translateY(-1px); }
button:active, button.tap { transform: translateY(1px) scale(0.98); }
button.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(61, 139, 253, 0.28); }
button.primary:hover { background: #5aa0ff; }
button.danger { background: #5a2222; color: #ffd5d5; border-color: #7a3333; }
button.danger:hover { background: var(--bad); color: #fff; }
.add-mebel input { flex: 1; min-width: 260px; }
.pill { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; transition: transform var(--ease), background var(--ease), box-shadow var(--ease); }
.pill:hover { transform: translateY(-1px); }
.pill.on { color: #111; border-color: transparent; box-shadow: 0 0 0 3px rgba(255,255,255,0.08); }
.st-laukia { color: #e6b325; border-color: #e6b325; }
.st-laukia.on { background: #e6b325; }
.st-raspil { color: #9aa3b2; border-color: #9aa3b2; }
.st-raspil.on { background: #9aa3b2; }
.st-kromka { color: #e67e22; border-color: #e67e22; }
.st-kromka.on { background: #e67e22; }
.st-cnc { color: #14b8a6; border-color: #14b8a6; }
.st-cnc.on { background: #14b8a6; }
.st-sverlovka { color: #3d8bfd; border-color: #3d8bfd; }
.st-sverlovka.on { background: #3d8bfd; }
.st-sborka { color: #9b59b6; border-color: #9b59b6; }
.st-sborka.on { background: #9b59b6; }
.st-montazh { color: #1abc9c; border-color: #1abc9c; }
.st-montazh.on { background: #1abc9c; }
main { display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.side { padding: 14px; border-right: 1px solid var(--line); overflow: auto; }
#view { min-height: 0; position: relative; }
#mebelHost { position: absolute; inset: 0; z-index: 1; background: #1a1d24; }
#btnMebel.on, #btnNest.on { background: var(--accent); color: #fff; border-color: transparent; }
.view-top { position: absolute; z-index: 3; left: 12px; top: 12px; display: flex; align-items: flex-start; gap: 8px; max-width: calc(100% - 24px); pointer-events: none; }
.view-top > * { pointer-events: auto; }
.mebel-tools { display: flex; gap: 8px; flex-shrink: 0; }
.mebel-tools button { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(16, 19, 24, 0.92); color: #e8e6e1; cursor: pointer; }
.mebel-tools button.on { background: var(--accent); color: #fff; border-color: transparent; }
.view-hint { position: absolute; z-index: 2; left: 12px; bottom: 12px; background: rgba(16, 19, 24, 0.92); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; color: #c9d4e5; font-size: 12px; max-width: 420px; }
.view-tools { position: absolute; z-index: 2; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; background: rgba(16, 19, 24, 0.92); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; color: var(--muted); font-size: 12px; }
.view-tools input[type="range"] { width: 120px; accent-color: var(--accent); }
.view-tools span { min-width: 34px; color: #fff; }
.view-badge { background: rgba(16, 19, 24, 0.92); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; max-width: 360px; }
.view-badge b { display: block; }
.view-badge span { display: block; color: var(--muted); font-size: 12px; }
.laukia-bar { display: flex; gap: 8px; margin: 0 0 8px; }
.laukia-bar label { display: flex; align-items: center; gap: 4px; }
.laukia-bar input { width: 118px; }
.lt-cal-btn { padding: 6px 8px; }
.lt-cal { position: fixed; z-index: 40; width: 260px; background: #1b1f26; border: 1px solid var(--line); border-radius: 12px; padding: 10px; box-shadow: var(--lift); }
.lt-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.lt-cal-head b { font-size: 14px; font-weight: 600; text-transform: capitalize; }
.lt-cal-head button { padding: 4px 8px; }
.lt-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.lt-cal-grid span { color: var(--muted); font-size: 11px; padding: 4px 0; }
.lt-cal-grid button { background: transparent; border: 0; padding: 6px 0; border-radius: 6px; }
.lt-cal-grid button:hover { background: #243044; }
.lt-cal-grid button.on { background: var(--accent); color: #fff; }
.lt-cal-grid button.today { box-shadow: inset 0 0 0 1px var(--accent); }
.projects.queue { max-height: none; }
.flash { min-height: 88px; padding: 12px; border-radius: 8px; background: #101318; margin: 12px 0; transition: outline-color var(--ease), transform var(--ease); }
.flash.ok { outline: 2px solid var(--ok); animation: pop 0.35s var(--ease); }
.flash.bad { outline: 2px solid var(--bad); animation: shake 0.35s var(--ease); }
.big { font-size: 42px; font-weight: 700; letter-spacing: -0.03em; }
.muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); }
tbody tr { transition: background var(--ease); }
tbody tr:hover { background: rgba(61, 139, 253, 0.08); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.s-wait_cut, .s-cut { background: #8b93a2; }
.s-edge { background: #e6b325; }
.s-edged { background: #e67e22; }
.s-cnced { background: #14b8a6; }
.s-drilled { background: #3d8bfd; }
.s-in_assembly { background: #9b59b6; }
.s-packed { background: #3dbe7a; }
.s-installed { background: #1abc9c; }
.s-scrap { background: #e05555; }
#log { margin: 0; padding: 0 16px 12px; font-size: 12px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 8px; margin-bottom: 8px; }
.stat { background: #101318; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease); }
.stat:hover { transform: translateY(-2px); border-color: #3d4a60; box-shadow: var(--lift); }
.stat.live { border-color: rgba(61, 190, 122, 0.45); box-shadow: 0 0 0 1px rgba(61, 190, 122, 0.15); }
.stat b { display: block; font-size: 13px; margin-bottom: 4px; }
.stat span { display: block; color: var(--muted); font-size: 12px; }
.projects { margin: 0 0 12px; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.proj { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; padding: 8px 10px; border-left: 3px solid transparent; animation: rowIn 0.28s var(--ease) both; }
.proj:last-child { border-bottom: 0; }
.proj:hover { background: #202733; border-left-color: var(--accent); }
.proj.on { background: #243044; border-left-color: var(--accent); }
.proj.locked { opacity: 0.4; pointer-events: auto; cursor: default; color: #8b93a2; }
.proj.locked b { color: #8b93a2; }
.proj.locked span { color: #6b7382; }
.proj.locked:hover { background: transparent; border-left-color: transparent; }
.proj.gray { border-left-color: #8b93a2; }
.proj.green { border-left-color: var(--ok); }
.login-page #app.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px 22px;
  box-shadow: var(--lift);
  display: grid;
  gap: 12px;
}
.login-brand {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.login-card h1 { margin: 0; font-size: 28px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input {
  background: #12161d;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.login-card button { margin-top: 6px; width: 100%; }
.session-user { color: var(--muted); font-size: 13px; white-space: nowrap; }
.session-user b { color: var(--text); font-weight: 600; }
.proj b { display: block; }
.proj span { color: var(--muted); font-size: 12px; }
.roles { display: flex; gap: 6px; }
.roles a { color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px; transition: background var(--ease), color var(--ease), transform var(--ease), box-shadow var(--ease); }
.roles a:hover { color: #fff; transform: translateY(-1px); border-color: #4a5568; }
.roles a.on { color: #fff; background: var(--accent); border-color: transparent; box-shadow: 0 4px 14px rgba(61, 139, 253, 0.3); }
.search-wrap { position: relative; }
.search-hits { position: absolute; right: 0; top: 36px; z-index: 20; width: min(420px, 80vw); background: #1b1f26; border: 1px solid var(--line); border-radius: 8px; padding: 6px; max-height: 360px; overflow: auto; box-shadow: var(--lift); animation: dropIn 0.16s var(--ease); }
.search-hit { display: block; padding: 8px 10px; border-bottom: 1px solid var(--line); border-radius: 6px; transition: background var(--ease); }
.search-hit:hover { background: #243044; }
.search-hit:last-child { border-bottom: 0; }
.search-hit a { color: var(--accent); text-decoration: none; }
.search-hit a:hover { text-decoration: underline; }
.search-links { display: block; margin-top: 4px; font-size: 12px; }
.work-links { font-size: 12px; }
.office main { grid-template-columns: 320px 1fr; }
.office main.tg-main { grid-template-columns: 1fr; }
.tg-texts { display: grid; gap: 10px; margin: 0 0 12px; }
.tg-texts textarea { width: 100%; min-height: 56px; }
.office .panel { padding: 18px; overflow: auto; }
.clock { display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.clock .stat b { font-size: 12px; color: var(--muted); font-weight: 600; }
.clock .stat span { color: var(--text); font-size: 16px; }
.drop { border: 1px dashed var(--line); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); margin: 12px 0; background: #101318; transition: border-color var(--ease), background var(--ease), transform var(--ease); }
.drop:hover { border-color: #4a5568; }
.drop.over { outline: 2px solid var(--accent); background: rgba(61, 139, 253, 0.08); transform: scale(1.01); animation: pulse 1s ease-in-out infinite; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.files li .kind-x { margin-left: auto; flex: 0 0 auto; }
.files a { color: var(--accent); }
.flash-line { margin: 10px 0; min-height: 24px; }
.flash-line.pop { animation: pop 0.35s var(--ease); }
.flash-line.ok { font-weight: 600; }
.flash-line.bad { font-weight: 600; }
.office h1 { font-size: 20px; margin: 0 0 8px; }
.stats-page main { grid-template-columns: 1fr; }
.dash { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 0 0 18px; }
.dash .stat .num { color: var(--text); font-size: 22px; font-weight: 700; }
.stats-block { margin: 0 0 22px; }
.stats-block h2 { font-size: 13px; margin: 0 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stats-block table { font-size: 13px; }
.stats-page .stats { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.period-bar { margin: 0 0 16px; }
.period-bar button { border-radius: 999px; }
.period-bar button.on { background: var(--accent); color: #fff; border-color: transparent; }
.period-bar label { display: flex; align-items: center; gap: 6px; }
.range-lt { color: var(--text); font-size: 13px; padding: 4px 10px; background: #141820; border: 1px solid var(--line); border-radius: 999px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 22px; }
.chart-card { background: #101318; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 8px; min-height: 260px; transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease); }
.chart-card:hover { transform: translateY(-2px); box-shadow: var(--lift); border-color: #3d4a60; }
.chart-card h2 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.chart-card canvas { width: 100% !important; height: 220px !important; }
.click-row { cursor: pointer; }
.click-row:hover { background: #243044; }
@media (max-width: 980px) { .chart-grid { grid-template-columns: 1fr; } }
.office .lead { color: var(--muted); margin: 0 0 16px; }
.source { background: #101318; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; }
.source b { display: block; margin-bottom: 4px; }
.queued { margin: 8px 0 0; color: var(--warn); font-size: 13px; }
.kinds { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.kinds label { display: flex; align-items: center; gap: 6px; color: var(--text); border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px; cursor: pointer; transition: transform var(--ease), background var(--ease), border-color var(--ease); }
.kinds label:hover { transform: translateY(-1px); border-color: var(--accent); }
.kinds label:has(input:checked) { background: rgba(61, 139, 253, 0.16); border-color: var(--accent); }
.kinds input { accent-color: var(--accent); }
.tg-order { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.kind-move { width: 26px; height: 22px; padding: 0; line-height: 20px; border-radius: 6px; font-size: 13px; }
.kind-move:disabled { opacity: 0.35; }
.kind-x { width: 22px; height: 22px; padding: 0; line-height: 20px; border-radius: 50%; background: #5a2222; color: #ffd5d5; border-color: #7a3333; font-size: 14px; }
.kind-x:hover { background: var(--bad); color: #fff; }
.admin-form { margin: 0 0 16px; }
.admin-grid { display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)); gap: 10px; margin: 0 0 12px; }
.admin-grid label { display: block; color: var(--muted); font-size: 12px; }
.admin-grid input, .admin-grid select { display: block; width: 100%; margin-top: 4px; }
.rights-group { margin: 14px 0; }
.rights-group b { display: block; margin: 0 0 8px; font-size: 13px; }
.add-mebel { margin: 0 0 14px; }
.item-card { background: #101318; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease); }
.item-card:hover { transform: translateY(-2px); box-shadow: var(--lift); border-color: #3d4a60; }
.item-card textarea { width: 100%; min-height: 64px; margin: 8px 0; background: #121418; border: 1px solid var(--line); border-radius: 6px; padding: 8px; color: inherit; resize: vertical; }
.item-card .drop { margin: 8px 0; padding: 14px; }
.contact-box { display: grid; grid-template-columns: 1fr 160px 200px; gap: 10px; margin: 0 0 14px; }
.contact-box label { display: block; color: var(--muted); font-size: 12px; }
.contact-box input, .contact-box textarea { display: block; width: 100%; margin-top: 4px; background: #101318; color: var(--text); }
.contact-box textarea { min-height: 64px; grid-column: 1 / -1; }
.contact-box .row { grid-column: 1 / -1; }

@keyframes pop {
  0% { transform: scale(0.98); }
  50% { transform: scale(1.02); }
  100% { transform: none; }
}
@keyframes shake {
  0%, 100% { transform: none; }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes rowIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61, 139, 253, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(61, 139, 253, 0); }
}
#rows tr { cursor: pointer; }
.files li { transition: background var(--ease); }
.files li:hover { background: rgba(61, 139, 253, 0.06); }
.period-bar button { transition: transform var(--ease), background var(--ease), box-shadow var(--ease); }
.period-bar button:hover { transform: translateY(-1px); }
.source { transition: border-color var(--ease), box-shadow var(--ease); }
.source:hover { border-color: #3d4a60; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.filter-card {
  background: #141820;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 18px;
}
.filter-card .period-bar { margin: 0; }
.ops-wrap {
  background: #141820;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin: 0 0 14px;
}
.ops-table { font-size: 13px; }
.ops-table thead th {
  background: #101318;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
}
.ops-table tbody td { padding: 10px 12px; }
.ops-table tbody tr { border-left: 3px solid var(--glow, transparent); cursor: pointer; }
.op-link { color: #fff; font-weight: 700; text-decoration: none; }
.ops-table tbody tr:hover .op-link { color: var(--accent); text-decoration: underline; }
a.flow-step { display: block; text-decoration: none; color: inherit; }
.ops-table tbody tr.on, .flow-step.on { background: rgba(61, 139, 253, 0.16); }
.flow-step { cursor: pointer; text-align: left; color: inherit; }
button.flow-step { background: #141820; }
button.flow-step.on { background: rgba(61, 139, 253, 0.16); }
.ops-detail { margin-top: 14px; }
.ops-detail-head { display: flex; gap: 10px; align-items: baseline; margin: 0 0 10px; }
.ops-table tbody tr:hover { background: rgba(61, 139, 253, 0.08); }

.dash-page .panel.dash-root { padding: 20px 22px 40px; }
.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-end; margin: 0 0 18px; }
.dash-head h1 { font-size: 28px; letter-spacing: -0.03em; margin: 0 0 4px; }
.dash-sec { margin: 0 0 26px; }
.dash-sec h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 12px; }
.kpi-row { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 10px; margin: 0 0 22px; }
.shop-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 8px 0 0; }
.shop-kpi .kpi { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 10px; }
.shop-kpi .kpi-val { font-size: 18px; margin: 0; }
.shop-kpi .kpi-sub { margin: 0 0 0 auto; }
.kpi { background: #141820; border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 12px; overflow: hidden; position: relative; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.kpi-val { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin: 4px 0 8px; }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 6px; }
.bar { height: 6px; border-radius: 99px; background: #222833; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.7s var(--ease); }
.tone-sale { --glow: #3d8bfd; }
.tone-zamer { --glow: #14b8a6; }
.tone-design { --glow: #9b59b6; }
.tone-laukia { --glow: #e6b325; }
.tone-shop { --glow: #3dbe7a; }
.tone-ok { --glow: #1abc9c; }
.tone-bad { --glow: #e05555; }
.tone-admin { --glow: #8b93a2; }
.kpi.tone-sale, .kpi.tone-zamer, .kpi.tone-design, .kpi.tone-shop, .kpi.tone-ok, .kpi.tone-bad {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02), 0 10px 24px rgba(0,0,0,0.18);
}
.kpi .bar i { background: var(--glow, var(--accent)); }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; }
.flow-step { flex: 1 1 90px; min-width: 90px; background: #141820; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.flow-step b { display: block; font-size: 12px; }
.flow-step em { display: block; font-style: normal; font-size: 18px; font-weight: 700; margin: 4px 0 8px; }
.flow-step small { display: block; color: var(--muted); margin-top: 6px; font-size: 11px; }
.flow-step .bar i { background: var(--glow, var(--accent)); }
.flow-step.done { border-color: rgba(61, 190, 122, 0.35); }
.flow-arrow { align-self: center; color: #4a5568; font-size: 16px; }
.dash-split { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 16px; }
.kind-bars { display: flex; flex-direction: column; gap: 10px; }
.kind-row { display: grid; grid-template-columns: 110px 1fr 28px; gap: 8px; align-items: center; }
.kind-row b { font-size: 13px; }
.kind-row em { font-style: normal; color: var(--muted); }
.kind-row .bar i { background: linear-gradient(90deg, #3d8bfd, #14b8a6); }
.chart-card.tall { min-height: 220px; }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.who { display: grid; grid-template-columns: 40px 1fr auto; grid-template-rows: auto auto auto; gap: 4px 10px; text-align: left; padding: 12px; border-radius: 14px; background: #141820; border: 1px solid var(--line); }
.who .bar { grid-column: 1 / -1; }
.who em { grid-column: 1 / -1; font-style: normal; font-size: 12px; color: var(--muted); }
.who.on { border-color: var(--glow, var(--accent)); box-shadow: 0 0 0 2px rgba(61,139,253,0.25); transform: translateY(-2px); }
.ava { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; background: color-mix(in srgb, var(--glow, #3d8bfd) 28%, #1b1f26); color: #fff; }
.ava.big { width: 52px; height: 52px; font-size: 22px; }
.who-name b, .who-name small { display: block; }
.who-name small { color: var(--muted); font-size: 11px; }
.who-meta { color: var(--muted); font-size: 12px; }
.person-head { margin: 0 0 12px; }
.person-hero { display: flex; align-items: center; gap: 12px; flex: 1; }
.person-hero b { font-size: 20px; }
.job-grid, .proj-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.job, .p-card { background: #141820; border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; border-top: 3px solid var(--glow, var(--accent)); }
.job.run { animation: pulse 2s ease-in-out infinite; }
.job-id { color: var(--accent); font-weight: 700; text-decoration: none; }
.job-id:hover { text-decoration: underline; }
.job-role, .stage-pill { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.job em { font-style: normal; font-size: 18px; font-weight: 700; }
.p-nums { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.p-nums .bad { color: var(--bad); }
.empty-jobs { grid-column: 1 / -1; padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }
.gam-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 12px; }
.gam-bar:empty { display: none; }
.gam-label { font-weight: 700; }
.gam-now { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.gam-now.taken { color: #3dbe7a; border-color: #3dbe7a; }
.gam-list { display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; }
.gam-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #141820; }
.gam-row.off { opacity: 0.45; }
.gam-row b { font-size: 13px; }
.gam-row .muted { flex: 1; font-size: 12px; }
.gam-new { margin: 0 0 8px; }
.gam-check { display: flex; align-items: center; gap: 6px; }
.gam-pick { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ops-table select { max-width: 220px; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.file-btn { display: inline-block; padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; background: #1b2029; color: var(--fg); font-size: 13px; cursor: pointer; }
.file-btn:hover { background: #232a35; border-color: var(--accent); }
.team { margin: 8px 0 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #11151c; }
.team-head { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 6px; }
.team-row { display: grid; grid-template-columns: 120px minmax(90px, 1fr) 1fr 160px; align-items: center; gap: 10px; padding: 3px 0; font-size: 13px; }
.team-role { color: var(--accent); font-size: 12px; }
.team-row small { text-align: right; font-size: 11px; }
@media (max-width: 900px) {
  .team-row { grid-template-columns: 110px 1fr; }
  .team-row .muted, .team-row small { display: none; }
}
.role-tabs { margin: 0 0 8px; flex-wrap: wrap; }
.role-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.dispatch-box {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #141820;
}
.dispatch-loads { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.dispatch-loads b { color: var(--fg); }
.mark-picks { display: flex; gap: 6px; align-items: center; }
.mark-dot {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #4a5160;
  background: #2a303a;
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
}
.mark-dot.green { background: #3dbe7a; border-color: #3dbe7a; }
.mark-dot.yellow { background: #e6b325; border-color: #e6b325; }
.mark-dot.red { background: #e05555; border-color: #e05555; }
.mark-dot.on { box-shadow: 0 0 0 2px #fff; }
.mark-text-red, a.mark-text-red, .ord-mini.mark-text-red { color: #e05555 !important; }
.mark-text-yellow, a.mark-text-yellow, .ord-mini.mark-text-yellow { color: #e6b325 !important; }
.mark-text-green, a.mark-text-green, .ord-mini.mark-text-green { color: #3dbe7a !important; }
.desk { margin: 0 0 12px; }
.desk-stats {
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141820;
  font-size: 12px;
  max-height: 380px;
  overflow-y: auto;
}
.desk-kpis { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 6px 0 8px; }
.desk-kpis span { color: var(--muted); }
.desk-kpis b { color: var(--fg); }
.desk-work { margin: 4px 0; color: var(--muted); line-height: 1.35; }
.desk-work a { color: var(--accent); }
.desk-assign { margin: 0 0 10px; }
#roleSum { margin: 0 0 10px; font-size: 12px; }
.ord-filter { margin: 0 0 12px; flex-wrap: wrap; }
.ord-filter button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ord-board { display: flex; flex-direction: column; gap: 12px; max-height: 620px; overflow-y: auto; padding-right: 4px; }
.ord-card { background: #141820; border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 14px; padding: 12px 14px; }
.ord-card.st-naujas { border-left-color: #8b93a2; }
.ord-card.st-vyksta { border-left-color: #3d8bfd; }
.ord-card.st-baigta { border-left-color: #3dbe7a; }
.ord-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ord-head b { font-size: 15px; }
.ord-state { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.st-vyksta .ord-state { color: #3d8bfd; border-color: #3d8bfd; }
.st-baigta .ord-state { color: #3dbe7a; border-color: #3dbe7a; }
.ord-bar { margin: 8px 0 10px; }
.ord-items { display: flex; flex-direction: column; gap: 6px; }
.ord-item { display: grid; grid-template-columns: 74px minmax(120px, 1fr) 150px 110px 110px 120px; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; background: #11151c; text-decoration: none; color: var(--fg); }
.ord-item:hover { background: #1a1f28; }
.ord-item-id { color: var(--accent); font-weight: 700; font-size: 13px; }
.ord-item b { font-weight: 600; font-size: 13px; }
.ord-item em { font-style: normal; font-size: 12px; color: var(--muted); }
.ord-item small { font-size: 11px; color: var(--muted); }
.ord-pill { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-align: center; }
.ord-item.tone-ruosia .ord-pill { color: #9b59b6; border-color: #9b59b6; }
.ord-item.tone-gamyba .ord-pill { color: #3d8bfd; border-color: #3d8bfd; }
.ord-item.tone-baigta .ord-pill { color: #3dbe7a; border-color: #3dbe7a; }
.ord-item .bar { display: block; width: 100%; }
.ord-item.tone-gamyba .bar i { background: #3d8bfd; }
.ord-item.tone-baigta .bar i { background: #3dbe7a; }
@media (max-width: 900px) {
  .ord-item { grid-template-columns: 70px 1fr 120px; }
  .ord-item .bar, .ord-item em, .ord-item small { display: none; }
}
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .dash-split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
body.mat-win {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
}
.mat-preview {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: min(42vw, 560px);
  height: min(72vh, 560px);
  z-index: 30;
  pointer-events: none;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--lift);
  background: #101318;
}
.mat-preview[hidden] { display: none; }
.mat-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (max-width: 860px) {
  .mat-preview {
    left: 50%;
    top: 12px;
    transform: translateX(-50%);
    width: min(92vw, 360px);
    height: 180px;
  }
}
.mat-box {
  width: min(520px, 100%);
  height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--lift);
  overflow: hidden;
}
.mat-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mat-head strong { font-size: 18px; }
.mat-head input { width: 100%; padding: 10px 12px; font-size: 16px; }
.mat-list { flex: 1; overflow: auto; padding: 8px; }
.mat-row {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  text-align: left;
  margin-bottom: 6px;
  padding: 10px 12px;
  background: #101318;
}
.mat-row img, .mat-ph {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #1a1f26;
}
.mat-ph { display: inline-block; }
.mat-row .mat-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mat-row b { font-size: 15px; }
.mat-row .mat-meta span { color: var(--muted); font-size: 13px; }
.proj-items { padding-left: 12px; }
.proj-head { background: #161b22; }
.mat-empty, .mat-status { padding: 12px 16px; color: var(--muted); }
.mat-status { border-top: 1px solid var(--line); }
.office.plan-page main.plan-main {
  grid-template-columns: 340px 1fr;
  min-height: 0;
}
.plan-side {
  padding: 16px;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: rgba(27, 31, 38, 0.55);
}
.plan-parts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.plan-parts button { padding: 6px 10px; border-radius: 999px; }
.plan-parts button.on { background: var(--accent); color: #fff; border-color: transparent; }
.plan-mats { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.plan-list { max-height: 38vh; overflow: auto; margin: 10px 0; }
.plan-list .mat-row.on { outline: 2px solid var(--accent); }
.plan-sizes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 0 0 10px; }
.plan-sizes label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.plan-sizes input { width: 100%; padding: 6px 8px; background: #101318; border: 1px solid var(--line); border-radius: 6px; }
.plan-placed { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.plan-chip {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #101318;
  cursor: pointer;
}
.plan-chip.on { background: var(--accent); color: #fff; border-color: transparent; }
.plan-stage { position: relative; min-height: 0; }
.plan-stage #view { position: absolute; inset: 0; }
.plan-stage canvas { display: block; width: 100%; height: 100%; }
.plan-views {
  position: absolute; left: 14px; top: 14px; z-index: 3;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.plan-views button { padding: 6px 10px; border-radius: 999px; background: rgba(16,19,24,0.88); }
.plan-views button.on { background: var(--accent); color: #fff; border-color: transparent; }
.plan-legend {
  position: absolute; left: 14px; bottom: 14px; z-index: 3;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(16,19,24,0.92); border: 1px solid var(--line);
  font-size: 13px; line-height: 1.55;
}
.plan-legend .ax { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.plan-legend .ax.x { background: #e05555; }
.plan-legend .ax.y { background: #3dbe7a; }
.plan-legend .ax.z { background: #3d8bfd; }
.plan-xyz { margin-top: 6px; color: var(--text); font-weight: 600; }
.axis-tag {
  position: absolute; z-index: 2; pointer-events: none;
  font-weight: 700; font-size: 14px; text-shadow: 0 1px 4px #000;
}
.axis-tag.x { color: #e05555; }
.axis-tag.y { color: #3dbe7a; }
.axis-tag.z { color: #3d8bfd; }
.plan-quote {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  min-width: 220px;
  max-width: min(420px, 46vw);
  max-height: 42vh;
  overflow: auto;
  padding: 12px 14px;
  background: rgba(16, 19, 24, 0.92);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--lift);
}
.plan-total { font-weight: 700; margin-bottom: 8px; }
.plan-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
@media (max-width: 900px) {
  .office.plan-page main.plan-main { grid-template-columns: 1fr; }
  .plan-stage { min-height: 52vh; }
  .plan-list { max-height: 28vh; }
}