:root {
  --bg: #121514;
  --side: #161a19;
  --panel: #1a1e1d;
  --panel-2: #141817;
  --line: #2a302e;
  --line-2: #353c39;
  --text: #e9ecea;
  --muted: #8b9490;
  --accent: #6fb59a;
  --accent-strong: #5f9e86;
  --accent-soft: #233a32;
  --accent-ink: #0d1411;
  --neg: #f08a7e;
  --neg-soft: #3a201d;
  --warn: #e7b866;
  --pos: #7fd1ad;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--text); font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.ic { flex: none; display: block; }
.logo-img { flex: none; display: block; border-radius: 10px; box-shadow: 0 0 0 1px var(--line-2), 0 0 18px rgba(111,181,154,.18); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.nowrap { white-space: nowrap; } .r { text-align: right; }
.neg { color: var(--neg); } .pos { color: var(--pos); } .warn { color: var(--warn); }
.empty { text-align: center; color: var(--muted); padding: 28px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--side); border-right: 1px solid var(--line); padding: 22px 12px 14px;
}
.logo { display: flex; gap: 12px; align-items: center; color: var(--text); font-weight: 800; font-size: 16px; line-height: 1.25; padding: 0 8px; }
.logo:hover { text-decoration: none; }
.side-label { margin: 30px 10px 12px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav a {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 8px;
  color: #c4cbc8; font-weight: 500; border: 1px solid transparent;
}
.side-nav a:hover { background: rgba(255,255,255,.035); text-decoration: none; }
.side-nav a .ic { color: var(--muted); }
.side-nav a.on { background: var(--accent-soft); color: var(--text); border-color: #2f5145; box-shadow: inset 3px 0 0 var(--accent); }
.side-nav a.on .ic { color: var(--accent); }
.side-nav .dot { margin-left: auto; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 14px 6px 0; border-top: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--accent-ink); background: linear-gradient(135deg, #a5e3c8, #4d8f76); }
.side-user-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-user-t span { font-size: 12px; color: var(--muted); }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); color: var(--accent); cursor: pointer; padding: 0; }
.icon-btn:hover { border-color: var(--accent); text-decoration: none; }
.icon-btn.danger { color: var(--muted); } .icon-btn.danger:hover { color: var(--neg); border-color: var(--neg); }

.main { padding: 22px 40px 60px; min-width: 0; max-width: 1320px; }
.topbar { display: flex; justify-content: space-between; align-items: center; min-height: 34px; }
.crumbs { color: var(--muted); font-size: 13px; } .crumbs span { margin: 0 8px; opacity: .6; } .crumbs b { color: var(--text); font-weight: 600; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel-2); color: #cfd5d2; font-size: 12.5px; white-space: nowrap; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 30px 0 26px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.sub { margin: 8px 0 0; color: #b2bab6; font-size: 15px; }
.sub:empty { display: none; }
.page-actions { display: flex; gap: 10px; align-items: center; }
.page-actions .chip { height: 40px; }
.sec { font-size: 18px; margin: 30px 0 14px; }

/* ---------- panels ---------- */
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 24px; margin-bottom: 16px; }
.panel.frame { background: linear-gradient(180deg, rgba(111,181,154,.05), transparent 60%), var(--panel-2); }
.panel.frame::before, .panel.frame::after { content: ""; position: absolute; width: 14px; height: 14px; border: 0 solid #7d8a85; }
.panel.frame::before { top: 10px; left: 10px; border-top-width: 1px; border-left-width: 1px; }
.panel.frame::after { bottom: 10px; right: 10px; border-bottom-width: 1px; border-right-width: 1px; }
.eyebrow { font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: #aab3af; }
.ph { font-size: 22px; font-weight: 800; margin: 6px 0 14px; letter-spacing: -.01em; }
.ptitle { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; font-size: 18px; font-weight: 800; }
.pic { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); border: 1px solid #2f5145; flex: none; }
.pic .ic { width: 16px; height: 16px; }
.note { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; color: #cfd5d2; }
.note.warn { color: var(--warn); } .note.neg { color: var(--neg); }
.note + .note { border-top: 0; padding-top: 0; margin-top: 8px; }
.stack > .panel:last-child { margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 4px; }
.box { border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); padding: 16px; margin-bottom: 22px; }
.box-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.box-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.box-foot span { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- forms ---------- */
.field { margin-bottom: 20px; }
.flabel { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 700; font-size: 14px; }
.num { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1px solid #8c9692; border-radius: 3px; font: 600 12px var(--mono); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 4px; padding: 10px 14px; max-width: 100%; outline: none;
}
.field input, .field select, .field textarea { width: 100%; padding: 14px 16px; }
input::placeholder, textarea::placeholder { color: #7a837f; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(111,181,154,.15); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; padding: 0; }
input[type=date] { color-scheme: dark; }
input.need { border-color: var(--warn); }
label.inline { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 4px; background: var(--panel); color: var(--text);
  font: 600 13.5px Inter, sans-serif; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #56605c; text-decoration: none; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.soft { background: #23302b; border-color: #34463f; height: 48px; padding: 0 20px; }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #0e1613; }
.btn.primary:hover { background: var(--accent); }
.btn.wide { width: 100%; height: 54px; font-size: 15px; }
.alert { background: var(--neg-soft); border: 1px solid #5a2c27; color: var(--neg); border-radius: 6px; padding: 10px 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 16px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; padding-left: 36px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }

/* ---------- KPI / suppliers ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi { margin: 0; }
.kpi-v { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.suppliers { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.supplier { margin: 0; }
.sup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sup-id { display: flex; gap: 12px; align-items: center; }
.sup-name { font-weight: 800; font-size: 16px; }
.sup-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 18px 0 0; padding: 16px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.sup-stats dt { color: var(--muted); font-size: 12px; }
.sup-stats dd { margin: 2px 0 0; font: 600 15px var(--mono); }

/* ---------- tables ---------- */
.table-panel { padding: 0; overflow: hidden; }
.tp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 24px; flex-wrap: wrap; }
.tp-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.table-wrap { overflow-x: auto; }
.panel > .table-wrap { border-top: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel-2); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th:first-child, .tbl td:first-child { padding-left: 24px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 24px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr[onclick] { cursor: pointer; }
.tbl tbody tr[onclick]:hover { background: rgba(111,181,154,.05); }
.clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 16px; border-top: 1px solid var(--line); }

/* ---------- status ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid; }
.st i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-new { color: #9ec3ff; background: #1b2638; border-color: #2a3a55; }
.st-done { color: var(--pos); background: var(--accent-soft); border-color: #2f5145; }
.st-problem { color: var(--neg); background: var(--neg-soft); border-color: #5a2c27; }
.st-cancelled { color: var(--muted); background: #20252a; border-color: var(--line-2); }

/* ---------- order ---------- */
.props { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; }
.props dt { color: var(--muted); } .props dd { margin: 0; word-break: break-word; }
.msg { background: #0f1312; border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; white-space: pre-wrap; word-break: break-word; font: 12.5px/1.65 var(--mono); margin: 0; color: #cdd4d1; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.ev { border-radius: 8px; padding: 11px 14px; max-width: 620px; border: 1px solid var(--line); }
.ev.sup { background: #1f2421; border-left: 3px solid #c9a35c; }
.ev.team { background: var(--accent-soft); border-color: #2f5145; margin-left: auto; }
.ev-h { font-size: 12px; margin-bottom: 4px; } .ev-t { white-space: pre-wrap; word-break: break-word; }
.tag { font-size: 11px; border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 6px; margin-left: 6px; color: var(--muted); }
.thumb { display: block; max-width: 260px; max-height: 260px; border-radius: 6px; margin-top: 8px; border: 1px solid var(--line-2); }
.thumb.sm { max-width: 56px; max-height: 56px; margin: 0; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 400px; padding: 32px; }
.login-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; margin-bottom: 26px; }
.login h2 { font-size: 26px; margin: 6px 0 22px; }

/* ---------- mobile ---------- */
@media (max-width: 980px) {
  .grid2, .kpis { grid-template-columns: 1fr; }
  .main { padding: 18px 24px 48px; }
}
@media (max-width: 760px) {
  .app { display: block; }
  .side { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .logo span, .side-label, .side-user-t, .side-user .avatar, .side-nav .dot { display: none; }
  .logo { padding: 0; }
  .side-nav { flex-direction: row; gap: 2px; }
  .side-nav a { padding: 8px 10px; gap: 6px; font-size: 13px; white-space: nowrap; }
  .side-nav a.on { box-shadow: inset 0 -2px 0 var(--accent); }
  .side-user { border: 0; padding: 0; }
  .main { padding: 14px 16px 40px; }
  .page-head { margin: 18px 0 18px; }
  .page-head h1 { font-size: 26px; }
  .panel { padding: 18px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
  .tp-head { padding: 16px; }
}
.kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.kpi select.full { width: 100%; margin-top: 12px; padding: 12px 14px; }
@media (max-width: 980px) { .kpis.two { grid-template-columns: 1fr; } }

/* ---------- отметки ---------- */
.badge { display: inline-block; vertical-align: 1px; margin-left: 4px; padding: 1px 7px; border-radius: 4px; font: 600 11px Inter, sans-serif; white-space: nowrap; border: 1px solid; }
.b-dup { color: var(--warn); background: #33291a; border-color: #5a4524; }
.b-repl { color: #c3b5ff; background: #262140; border-color: #3d3566; }
.box-tags { margin-top: 10px; }
.box-tags .badge:first-child { margin-left: 0; }
.tbl td.mono { white-space: nowrap; }
