:root {
  --bg: #0d1117;
  --panel: #151b23;
  --panel-2: #1b232d;
  --line: #28313d;
  --text: #e8edf3;
  --muted: #8b98a8;
  --accent: #6c8cff;
  --accent-2: #8a6cff;
  --good: #3fb97a;
  --warn: #e0a93b;
  --bad: #f0605d;
  --info: #4da3ff;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--bad); min-height: 20px; font-size: 14px; }
[hidden] { display: none !important; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 12px; text-align: center; padding: 28px; }
.logo { width: 46px; height: 46px; margin: 0 auto; border-radius: 14px; display: grid; place-items: center; font-size: 20px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.logo.sm { width: 30px; height: 30px; margin: 0; border-radius: 9px; font-size: 13px; }

/* Layout */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: rgba(13,17,23,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; white-space: nowrap; }
nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav button { position: relative; background: none; border: 0; color: var(--muted); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; }
nav button:hover { color: var(--text); background: var(--panel); }
nav button.active { color: #fff; background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }
.dot { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
main { max-width: 1100px; margin: 0 auto; padding: 22px 20px 80px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 16px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cols { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; margin-bottom: 16px; }
.card h3 { margin-bottom: 12px; }
.empty { color: var(--muted); padding: 14px 0; text-align: center; }
.alert { border-color: rgba(224,169,59,.5); background: rgba(224,169,59,.08); color: #f0cf8c; }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.btn.good { background: rgba(63,185,122,.15); border-color: rgba(63,185,122,.4); color: #7ee2ab; }
.btn.danger { background: transparent; border-color: rgba(240,96,93,.4); color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.icon { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon:hover { color: var(--text); background: var(--panel-2); }
input, select, textarea { width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(108,140,255,.55); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; min-height: 90px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 550; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
label.check input { width: auto; }
.form { display: grid; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
code { background: var(--bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }

/* Chips & badges */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.good { background: rgba(63,185,122,.15); color: #7ee2ab; }
.badge.warn { background: rgba(224,169,59,.15); color: #f0cf8c; }
.badge.info { background: rgba(77,163,255,.15); color: #8ec6ff; }
.badge.bad { background: rgba(240,96,93,.15); color: #ff9a97; }
.badge.mute { background: var(--panel-2); color: var(--muted); }

/* Lists */
.list { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.card .row { background: var(--panel-2); }
.row-main { flex: 1 1 220px; min-width: 0; }
.row-main b { word-break: break-word; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.search { max-width: 280px; }

/* Catalog */
.products { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.product { display: grid; gap: 10px; align-content: start; }
.product.off { opacity: .6; }
.price { font-size: 22px; font-weight: 700; }
.product-top { display: flex; justify-content: space-between; gap: 8px; align-items: start; }

/* Support */
.split { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.tickets { display: grid; gap: 8px; }
.ticket { text-align: left; width: 100%; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--text); font: inherit; cursor: pointer; display: grid; gap: 3px; }
.ticket.active { border-color: var(--accent); }
.ticket .t1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.ticket .t2 { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread { display: grid; gap: 12px; }
.bubbles { display: grid; gap: 8px; max-height: 52vh; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: 82%; padding: 9px 12px; border-radius: 14px; background: var(--panel-2); white-space: pre-wrap; word-break: break-word; }
.bubble.out { justify-self: end; background: rgba(108,140,255,.22); }
.bubble .when { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }

/* Modal */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal.wide { max-width: 680px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 0; }
.modal-body { padding: 16px 18px 20px; display: grid; gap: 14px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 60; max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.good { border-color: rgba(63,185,122,.5); }
#toast.bad { border-color: rgba(240,96,93,.6); }
#toast.warn { border-color: rgba(224,169,59,.6); }

@media (max-width: 760px) {
  .top { padding: 8px 12px; gap: 8px; }
  .brand span:last-child { display: none; }
  main { padding: 16px 12px 80px; }
  .split { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .search { max-width: none; width: 100%; }
}
