* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink-2); color: var(--white); font-family: Roboto, sans-serif; }
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
#root { height: 100%; }

.login {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 360px;
  background: var(--ink-4);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 22px 22px 18px;
}
.brand-row { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.brand-row img { width: 22px; height: 22px; image-rendering: pixelated; }
.brand-name { font-family: MinecraftFont, "Pixelify Sans", sans-serif; font-size: 16px; letter-spacing: 0.04em; }
.brand-sub { font-size: 8.5px; letter-spacing: 0.14em; color: var(--text-disabled); margin-top: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-disabled); }
.field input, .field textarea, .select, .search {
  background: var(--ink-3);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
}
.field textarea { min-height: 72px; resize: vertical; }
.btn {
  height: 34px;
  padding: 0 16px;
  border-radius: 4px;
  border: 0;
  background: var(--kenny-orange);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.btn:hover { background: var(--kenny-orange-hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }
.oauth { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.btn.vk { width: 100%; background: #0077ff; }
.btn.vk:hover { background: #1a86ff; }
.btn.ya, .btn.tg { width: 100%; background: var(--ink-1); border: 1px solid var(--hairline); color: var(--text-secondary); }
.btn.ya:hover { background: #1a1a1a; }
.login-or { text-align: center; color: var(--text-disabled); font-size: 11px; margin: 8px 0 12px; }
#tg-slot { display: flex; justify-content: center; min-height: 34px; }
.btn.secondary {
  background: var(--ink-1);
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
}
.btn.ghost {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--kenny-orange) 50%, transparent);
  color: var(--kenny-orange);
}
.err { color: var(--red); font-size: 12px; margin: 0 0 10px; }
.hint { color: var(--text-disabled); font-size: 11px; }

.shell { display: flex; height: 100vh; background: var(--ink-2); }
.side {
  width: 190px;
  flex: none;
  background: var(--ink-1);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
}
.side nav { flex: 1; overflow: auto; padding-top: 8px; }
.group-title {
  display: flex;
  justify-content: space-between;
  width: calc(100% - 12px);
  margin: 8px 6px 2px;
  padding: 4px 8px;
  background: none;
  border: 0;
  color: var(--text-disabled);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.group-title.on { color: var(--kenny-orange); }
.item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 12px);
  margin: 0 6px 2px;
  padding: 7px 14px 7px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: left;
}
.item .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.item.active {
  background: color-mix(in srgb, var(--kenny-orange) 14%, transparent);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--kenny-orange);
}
.item.active .dot { background: var(--kenny-orange); opacity: 1; }
.badge {
  margin-left: auto;
  min-width: 16px;
  text-align: center;
  font-size: 10px;
  color: var(--kenny-orange);
}
.me {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px;
  padding: 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
}
.me:hover { background: rgba(255,255,255,0.03); }
.avatar, .ava {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--kenny-orange); color: #fff;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700; flex: none;
}
.ava.lg { width: 34px; height: 34px; font-size: 12px; }
.me b { display: block; font-size: 11.5px; font-weight: 600; }
.me small, .meta { color: var(--text-disabled); font-size: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { padding: 11px 20px 8px; }
.crumbs { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-disabled); }
.top h1 { margin: 4px 0 0; font-size: 15px; font-weight: 700; }
.body { flex: 1; overflow: auto; padding: 0 20px 20px; }
.banner { margin: 0 20px 10px; color: var(--red); font-size: 12px; }

.panel {
  background: var(--ink-4);
  border: 1px solid var(--hairline);
  border-radius: 6px;
}
.panel-h {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--hairline);
}
.panel-h h2 { margin: 0; font-size: 14px; }
.tabs { display: flex; gap: 4px; }
.tab {
  border: 0; background: transparent; color: var(--text-secondary);
  padding: 5px 10px; border-radius: 4px; font-size: 11.5px; font-weight: 600;
}
.tab.on { background: color-mix(in srgb, var(--kenny-orange) 16%, transparent); color: var(--kenny-orange); }
.grow { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.legend { display: flex; gap: 10px; color: var(--text-disabled); font-size: 10.5px; }
.legend i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; }
.search { width: 190px; }

.row, .head {
  display: grid;
  grid-template-columns: 2.4fr 1.1fr 96px 92px 76px;
  gap: 10px;
  align-items: center;
  padding: 11px 16px;
}
.head { color: var(--text-disabled); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; padding-bottom: 6px; }
.row { width: 100%; border: 0; border-bottom: 1px solid var(--hairline); background: transparent; text-align: left; color: inherit; }
.row:hover { background: rgba(255,255,255,0.03); }
.subj { font-size: 12.5px; font-weight: 600; }
.idline { font-size: 10.5px; color: var(--text-disabled); margin-top: 2px; }
.who { font-size: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 3px;
  font-size: 10px; font-weight: 700;
}
.st-open, .st-waiting_staff { color: var(--blue); background: color-mix(in srgb, var(--blue) 16%, transparent); }
.st-waiting_user { color: var(--kenny-orange); background: color-mix(in srgb, var(--kenny-orange) 16%, transparent); }
.st-closed { color: var(--tier-emerald); background: color-mix(in srgb, var(--tier-emerald) 16%, transparent); }
.pr-high { color: var(--red); background: color-mix(in srgb, var(--red) 16%, transparent); }
.pr-medium { color: var(--yellow); background: color-mix(in srgb, var(--yellow) 16%, transparent); }
.pr-low { color: var(--tier-iron); background: color-mix(in srgb, var(--tier-iron) 16%, transparent); }
.empty { padding: 28px 16px; color: var(--text-disabled); font-size: 12.5px; }
.dot-st { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.dot-open, .dot-waiting_staff { background: var(--blue); }
.dot-waiting_user { background: var(--kenny-orange); }
.dot-closed { background: var(--tier-emerald); }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.metric { padding: 14px 16px; }
.metric span { display: block; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-disabled); }
.metric b { display: block; margin-top: 6px; font-size: 26px; font-weight: 700; }
.metric em { font-style: normal; color: var(--text-disabled); font-size: 11px; }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.ticket-split { display: grid; grid-template-columns: 1fr 264px; gap: 14px; height: calc(100vh - 78px); }
.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-h { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--hairline); }
.back {
  width: 28px; height: 28px; border-radius: 4px; border: 1px solid var(--hairline);
  background: var(--ink-1); color: #fff;
}
.thread-tabs { display: flex; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--hairline); }
.thread-tabs button {
  background: none; border: 0; color: var(--text-secondary);
  padding: 10px 0; font-size: 12px; font-weight: 600;
}
.thread-tabs button.on { color: #fff; box-shadow: inset 0 -2px 0 var(--kenny-orange); }
.feed { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #0e0e0e; }
.bubble { max-width: 64%; padding: 9px 12px; border-radius: 5px; font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; color: #fff; background: #171717; }
.bubble.player { border: 1px solid var(--hairline); align-self: flex-start; }
.bubble.staff { background: #2a140c; border: 1px solid rgba(254, 94, 16, 0.38); align-self: flex-end; }
.when { font-size: 9.5px; color: var(--text-disabled); margin-top: 4px; }
.when.right { text-align: right; }
.file {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
  font-size: 11px; color: var(--text-secondary);
}
.file button { background: none; border: 0; color: var(--kenny-orange); font-size: 11px; padding: 0; }
.shot { width: 120px; height: 86px; object-fit: cover; border-radius: 4px; margin-top: 6px; cursor: zoom-in; display: block; }
.composer { border-top: 1px solid var(--hairline); padding: 10px 12px; position: relative; background: #0e0e0e; }
.composer textarea {
  width: 100%;
  min-height: 58px;
  background: #111;
  color: #fff;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 8px 10px;
}
.composer textarea::placeholder { color: rgba(255, 255, 255, 0.4); }
.composer-row { display: flex; gap: 8px; margin-top: 8px; }
.composer-row .btn:last-child { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.filechip {
  display: flex; gap: 6px; align-items: center;
  background: var(--ink-3); border-radius: 4px; padding: 4px 8px; font-size: 11px;
}
.filechip button { background: none; border: 0; color: var(--text-disabled); }
.macros-pop {
  position: absolute; left: 12px; right: 12px; bottom: 108px;
  max-height: 240px; overflow: auto;
  background: var(--ink-1); border: 1px solid var(--hairline); border-radius: 6px;
  box-shadow: 0 -10px 28px rgba(0,0,0,.5); z-index: 5;
}
.macros-pop button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 8px 12px; color: inherit;
}
.macros-pop button:hover { background: rgba(255,255,255,0.04); }
.macros-pop .cat { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-disabled); padding: 8px 12px 2px; }
.note {
  background: var(--ink-3); border-left: 2px solid var(--kenny-orange);
  border-radius: 4px; padding: 8px 10px; font-size: 12.5px;
}
.card { overflow: auto; padding: 14px; }
.subbox { background: var(--ink-3); border-radius: 5px; padding: 10px; margin: 10px 0; font-size: 12px; }
.subbox .k { font-size: 9px; letter-spacing: 0.1em; color: var(--text-disabled); }
.tier { display: flex; align-items: center; gap: 6px; margin: 6px 0; font-weight: 700; }
.tier img { width: 14px; height: 14px; image-rendering: pixelated; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px; margin-bottom: 10px; }
.kv b { display: block; font-size: 12px; }
.block-title { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-disabled); margin: 12px 0 6px; }
.pill {
  display: block; border-left: 2px solid var(--blue); padding: 4px 8px; margin-bottom: 4px;
  font-size: 12px; background: rgba(255,255,255,0.02);
}
.pill.tr { border-left-color: var(--purple); }
.linkrow { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 6px; }
.sq { width: 18px; height: 18px; border-radius: 3px; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff; }
.off { opacity: 0.45; }
.pay, .prev { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; margin-bottom: 6px; }
.prev { width: 100%; background: none; border: 0; color: inherit; text-align: left; padding: 0; }

.macro-split { display: grid; grid-template-columns: 210px 1fr; gap: 14px; min-height: calc(100vh - 110px); }
.catbtn {
  display: flex; width: calc(100% - 12px); margin: 0 6px 2px; padding: 7px 10px;
  border: 0; border-radius: 4px; background: transparent; color: var(--text-secondary); text-align: left;
}
.catbtn.on { background: color-mix(in srgb, var(--kenny-orange) 14%, transparent); color: #fff; }
.macro-line { padding: 12px 14px; border-bottom: 1px solid var(--hairline); }
.macro-line b { font-size: 12.5px; }
.macro-line p { margin: 4px 0; color: var(--text-disabled); font-size: 11.5px; white-space: pre-wrap; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; z-index: 20; }
.modal { width: 420px; background: var(--ink-4); border: 1px solid var(--hairline); border-radius: 6px; padding: 16px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.82); display: grid; place-items: center; z-index: 30; }
.lightbox img { max-width: 80vw; max-height: 72vh; object-fit: contain; }
.settings { max-width: 460px; display: flex; flex-direction: column; gap: 14px; }
.switch { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 13px; }
.switch input { accent-color: var(--kenny-orange); }
.ok { color: var(--tier-emerald); font-size: 12px; }
.select { height: 28px; padding: 0 8px; }
