/* ---------- токены ---------- */
:root {
  --bg: #050505;
  --surface: #141416;
  --surface-2: #1e1e21;
  --border: #2c2c30;
  --border-strong: #45454b;
  --text: #ffffff;
  --muted: #c4c4c8;
  --faint: #9a9aa0;

  /* три уровня яркости текста */
  --l1: #ffffff;
  --l2: #a6a6ad;
  --l3: #6e6e75;

  --money: #3ddc84;
  --neg: #ff8a8a;            /* минус, убыток */
  --st-work: #f2b544;
  --st-cancel: #f06a6a;
  --pay-np: #5aa9ff;
  --pay-pp: #a78bfa;
  --pay-acc: #e2e8f0;
  --pay-parts: #f472b6;

  --menu-bg: #141416;
  --head-bg: #17171a;
  --foot-bg: #161618;

  --wide: 1680px;   /* ширина заказов и аналитики, шапка выравнивается по ней */
}
@media (min-width: 2100px) { :root { --wide: 1920px; } }
@media (min-width: 2500px) { :root { --wide: 2240px; } }

/* ---------- сброс ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  height: 100vh; overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
button, input { font: inherit; text-transform: inherit; }
.mono { font-family: "Inter", sans-serif; font-variant-numeric: tabular-nums; }

/* ---------- шапка ---------- */
header {
  position: relative; z-index: 10; flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 50px;
  width: min(100% - 64px, var(--wide) - 64px);   /* по ширине контента: --wide минус поля main */
  margin: 14px auto 0;
  padding: 0 12px 0 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
}
.brand-mark::before { content: ""; width: 8px; height: 8px; background: var(--text); border-radius: 2px; }
.brand-name { font-weight: 700; font-size: 13px; letter-spacing: .28em; }

nav {
  position: relative;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px;   /* кнопки одной ширины — по самой широкой */
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.link {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px; font-weight: 500; letter-spacing: .1em;
  height: 32px;
  padding: 0 20px;
  border-radius: 999px;
  transition: color .2s, background .2s;
}
.link:hover { color: var(--text); }
.link.active { color: var(--bg); background: var(--text); font-weight: 600; }
.link.active:hover { color: var(--bg); }

.tools { justify-self: end; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent;
  color: var(--muted); cursor: pointer;
  transition: color .2s, border-color .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px var(--bg); }
.sep { width: 1px; height: 24px; background: var(--border); margin: 0 8px; }

.user {
  display: flex; align-items: center; gap: 10px;
  margin-left: 6px; cursor: pointer;
}
.user-info { text-align: right; line-height: 1.2; }
.user-name { font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--l1); transition: color .2s; }
.user:hover .user-name { color: var(--l1); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); color: var(--l1);
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  transition: border-color .2s;
}

/* ---------- контент ---------- */
main {
  flex: 1; min-height: 0; overflow: auto;
  width: 100%; max-width: 1240px; margin: 0 auto; padding: 48px 32px 64px;
  scrollbar-width: none; -ms-overflow-style: none;
}
main::-webkit-scrollbar { display: none; width: 0; height: 0; }

.page { display: none; }
.animated .page.active { animation: fade .25s ease; }   /* только при переходах, не при загрузке */
.page.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 36px; gap: 16px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; letter-spacing: .14em; color: var(--muted); margin-bottom: 10px; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--text); color: var(--bg);
  border: 0; border-radius: 999px;
  padding: 13px 22px;
  font-size: 13px; font-weight: 600; letter-spacing: .08em;
  cursor: pointer;
}
.btn span { font-size: 16px; line-height: 0; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 12px 20px; font-size: 13px; font-weight: 600; letter-spacing: .08em;
  cursor: pointer; transition: background .2s, border-color .2s;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }

/* ---------- панель и таблица ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.empty { display: none; padding: 48px 26px; text-align: center; color: var(--faint); font-size: 11px; letter-spacing: .16em; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 16px 26px; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 11.5px; letter-spacing: .1em; border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid var(--border); color: var(--text); font-size: 15px; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
th:last-child, td:last-child { text-align: right; }
th.r, td.r { text-align: right; }
td.dim2 { color: #dcdce0; }
.g-after { border-left: 1px solid var(--border); padding-left: 22px !important; }

@media (max-width: 1700px) {
  header { width: calc(100% - 40px); margin-top: 12px; }
}
@media (max-width: 640px) {
  header { grid-template-columns: 1fr; justify-items: center; width: calc(100% - 20px); margin-top: 10px; padding: 0 6px; }
  .brand, .tools { display: none; }
  .link { padding: 10px 14px; }
  main { padding: 28px 16px 40px; }
  h1 { font-size: 26px; }
  th, td { padding: 14px 16px; }
}
