:root {
  --bg: #0c0b09;
  --bg-2: #16130f;
  --line: rgba(226, 177, 90, 0.16);
  --ink: #f7f1e6;
  --muted: #a89880;
  --gold: #e7c17a;
  --gold-2: #a67c3d;
  --gold-deep: #6e4e22;
  --ok: #9dcea0;
  --bad: #e5927e;
  --info: #9eb6e8;
  --card: rgba(28, 24, 19, 0.86);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body {
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(226, 177, 90, 0.16), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(110, 78, 34, 0.28), transparent 50%),
    var(--bg);
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--gold); }
::selection { background: rgba(226, 177, 90, 0.28); }

.ico { width: 18px; height: 18px; flex: 0 0 auto; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  pointer-events: none;
  animation: float 9s var(--ease) infinite alternate;
}
.orb.a {
  width: 280px; height: 280px;
  left: -60px; top: 8%;
  background: radial-gradient(circle, rgba(226, 177, 90, 0.35), transparent 68%);
}
.orb.b {
  width: 340px; height: 340px;
  right: -80px; bottom: -40px;
  background: radial-gradient(circle, rgba(158, 182, 232, 0.16), transparent 70%);
  animation-duration: 12s;
}
.card, .panel, .metric, .stat {
  background: linear-gradient(180deg, rgba(255, 248, 235, 0.035), transparent 42%), var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.card {
  width: min(540px, 100%);
  padding: 32px;
  position: relative;
  animation: rise 0.7s var(--ease) both;
}
.mark {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-size: 11px;
  margin: 0 0 8px;
  font-weight: 700;
}
h1, h2, h3 { font-weight: 650; letter-spacing: -0.03em; margin: 0 0 8px; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.15rem; margin-top: 22px; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); line-height: 1.55; }
.steps { margin: 18px 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.steps li {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  animation: rise 0.6s var(--ease) both;
}
.steps li:nth-child(2) { animation-delay: 0.08s; }
.steps li:nth-child(3) { animation-delay: 0.16s; }
.step-n {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(226, 177, 90, 0.14);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #f0d7a4, #c99645);
  color: #241c0e;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(201, 150, 69, 0.25);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn.bad { background: linear-gradient(180deg, #f0b2a4, #c86b58); color: #2a100c; box-shadow: none; }
.btn.ok { background: linear-gradient(180deg, #c6e4c4, #6ea874); color: #10210f; box-shadow: none; }
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: grid; gap: 10px; }

.shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.side {
  background: rgba(12, 10, 8, 0.78);
  border-right: 1px solid var(--line);
  padding: 18px 12px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(18px);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 8px 12px; }
.logo {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #f3ddb0, #8d6430);
  color: #241c0e;
  box-shadow: 0 10px 24px rgba(226, 177, 90, 0.25);
}
.side nav { display: grid; gap: 3px; margin-top: 8px; }
.side button[data-nav] {
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  border-radius: 12px;
  padding: 9px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s var(--ease), color 0.2s, transform 0.2s var(--ease);
}
.side button[data-nav]:hover { background: rgba(255, 255, 255, 0.04); color: var(--ink); transform: translateX(2px); }
.side button[data-nav].on {
  background: linear-gradient(90deg, rgba(226, 177, 90, 0.18), rgba(226, 177, 90, 0.05));
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--gold);
}
.side .group {
  margin: 16px 10px 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-2);
}
.who strong { display: block; }
.badge {
  display: inline-flex;
  margin-top: 4px;
  border: 1px solid rgba(226, 177, 90, 0.4);
  color: var(--gold);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.side-foot { margin-top: auto; padding: 12px 8px 4px; }
main {
  padding: 28px 32px 48px;
  max-width: 1180px;
  animation: fade 0.35s var(--ease);
}
main.enter > * { animation: rise 0.45s var(--ease) both; }
main.enter > *:nth-child(2) { animation-delay: 0.04s; }
main.enter > *:nth-child(3) { animation-delay: 0.08s; }
main.enter > *:nth-child(4) { animation-delay: 0.12s; }

.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}
.pill.open, .pill.warn { color: #241c0e; background: var(--gold); border-color: transparent; }
.pill.answered { color: #10182a; background: var(--info); border-color: transparent; }
.pill.closed, .pill.ok { color: #10210f; background: var(--ok); border-color: transparent; }
.pill.bad { color: #2a100c; background: var(--bad); border-color: transparent; }

.metrics, .grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.metric, .stat {
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s;
}
.metric:hover, .stat:hover { transform: translateY(-3px); border-color: rgba(226, 177, 90, 0.38); }
.metric b, .stat b {
  display: block;
  font-size: 1.45rem;
  margin-top: 8px;
  letter-spacing: -0.03em;
}
.metric small, .stat small { color: var(--muted); display: block; margin-top: 4px; }
.metric-ico {
  width: 34px; height: 34px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(226, 177, 90, 0.12);
  color: var(--gold);
  margin-bottom: 10px;
}

.charts { display: grid; grid-template-columns: 1.35fr 0.85fr; gap: 12px; margin-top: 12px; }
.chart-card { padding: 16px 16px 10px; }
.chart-card header { margin-bottom: 6px; }
.chart { width: 100%; height: auto; display: block; }
.chart .line {
  stroke: #f0d7a4;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 1800;
  stroke-dashoffset: 1800;
  animation: draw 1.15s var(--ease) forwards;
}
.chart .area { opacity: 0; animation: fade 0.8s ease 0.15s forwards; }
.chart text { fill: #a89880; font-size: 11px; }
.chart circle { fill: #f7f1e6; stroke: #e7c17a; stroke-width: 1.5; }
.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 168px;
  padding-top: 8px;
}
.bar {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.bar span {
  display: block;
  width: 100%;
  max-width: 28px;
  height: var(--h);
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #f3ddb0, #b8883a);
  transform-origin: bottom;
  animation: grow 0.7s var(--ease) both;
  animation-delay: var(--d);
}
.bar.cool span { background: linear-gradient(180deg, #d5e2ff, #6d8ed4); }
.bar small { color: var(--muted); font-size: 10px; white-space: nowrap; }

.donut-wrap { display: flex; gap: 16px; align-items: center; min-height: 180px; }
.donut { width: 148px; height: 148px; flex: 0 0 auto; }
.donut .track { stroke: rgba(255, 255, 255, 0.08); fill: none; stroke-width: 12; }
.donut .seg {
  fill: none;
  stroke-width: 12;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  animation: fade 0.6s ease both;
}
.legend { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.legend li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid rgba(226, 177, 90, 0.1); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(226, 177, 90, 0.05); }
input, textarea, select {
  width: 100%;
  background: rgba(8, 7, 6, 0.65);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(226, 177, 90, 0.7);
  box-shadow: 0 0 0 3px rgba(226, 177, 90, 0.15);
}
textarea { min-height: 90px; resize: vertical; }
label span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.err { color: var(--bad); }
.okmsg { color: var(--ok); }
.split { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 16px; margin-top: 14px; }
.note {
  background: rgba(226, 177, 90, 0.08);
  border-left: 3px solid var(--gold);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
}
pre.job {
  white-space: pre-wrap;
  background: #100e0b;
  border-radius: 12px;
  padding: 12px;
  min-height: 80px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  border: 1px solid var(--line);
}
img.qr { width: 220px; height: 220px; background: white; border-radius: 12px; }

.ticket {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  display: grid;
  gap: 4px;
  transition: transform 0.2s var(--ease), border-color 0.2s, background 0.2s;
}
.ticket:hover { transform: translateY(-2px); border-color: rgba(226, 177, 90, 0.45); background: rgba(226, 177, 90, 0.06); }
.ticket strong { font-weight: 650; }
.ticket small { color: var(--muted); }
.thread { display: grid; gap: 8px; margin: 12px 0; max-height: 420px; overflow: auto; padding-right: 4px; }
.bubble {
  max-width: 92%;
  border-radius: 16px;
  padding: 10px 12px;
  animation: rise 0.35s var(--ease) both;
}
.bubble p { margin: 4px 0; white-space: pre-wrap; }
.bubble time, .bubble .who { color: var(--muted); font-size: 12px; }
.bubble.theirs { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.bubble.mine {
  margin-left: auto;
  background: linear-gradient(180deg, rgba(226, 177, 90, 0.2), rgba(226, 177, 90, 0.08));
  border: 1px solid rgba(226, 177, 90, 0.28);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes grow { from { transform: scaleY(0.08); } to { transform: scaleY(1); } }
@keyframes float { from { transform: translateY(0); } to { transform: translateY(18px); } }

@media (max-width: 980px) {
  .metrics, .grid, .charts, .split { grid-template-columns: 1fr 1fr; }
  .charts, .split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; max-height: none; }
  .side nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow: auto; padding-bottom: 6px; }
  .side .group { display: none; }
  .side-foot { margin-top: 8px; }
  main { padding: 16px; }
  .metrics, .grid { grid-template-columns: 1fr 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
