/* web admin panel */
.adm-body { min-height: 100vh; }
.adm-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 10, .92);
  backdrop-filter: blur(10px);
}
.adm-tag {
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--soft);
  font-size: 11px;
  letter-spacing: .06em;
}
.adm-top-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.adm-me { color: var(--muted); font-size: 13px; }
.adm-gate { display: grid; place-items: center; gap: 18px; min-height: 60vh; color: var(--muted); text-align: center; }

.adm { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 64px); }
.adm-nav {
  position: sticky;
  top: 64px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 22px 12px;
  height: calc(100vh - 64px);
  border-right: 1px solid var(--line);
}
.adm-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.adm-nav a:hover { color: var(--text); background: var(--surface); }
.adm-nav a.on { color: var(--text); background: var(--surface-raised); }
.adm-count {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--text);
  color: var(--black);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.adm-main { min-width: 0; padding: 30px 34px 60px; }
.adm-main h1 { margin: 0 0 22px; font-size: 30px; font-weight: 500; letter-spacing: -.03em; }
.adm-h2 { margin: 34px 0 12px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }

.adm-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 1px solid var(--text);
  border-radius: 10px;
  background: var(--surface-raised);
  font-weight: 500;
}
.adm-alert::after { content: "Открыть →"; color: var(--muted); font-size: 13px; font-weight: 400; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { padding: 18px 18px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.kpi span { display: block; color: var(--muted); font-size: 12px; }
.kpi strong { display: block; margin-top: 8px; font-size: 26px; font-weight: 500; letter-spacing: -.03em; }
.kpi small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }

/* tables as lists */
.table { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.tr {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .8fr);
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.tr:first-child { border-top: 0; }
.tr.head { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
a.tr:hover, button.tr:hover { background: var(--surface-raised); }
button.tr { width: 100%; border: 0; border-top: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tr .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tr .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr .sub { display: block; color: var(--muted); font-size: 12px; }
.tr.empty { display: block; color: var(--muted); }
.ini {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface-raised);
  color: var(--soft);
  font-size: 13px;
  font-weight: 600;
}
.pill {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.pill.on { border-color: var(--text); color: var(--text); }
.pill.warn { border-color: #ff9b9b; color: #ff9b9b; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* inbox */
.inbox {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 64px - 60px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.inbox-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.inbox-head { padding: 18px 16px 12px; border-bottom: 1px solid var(--line); }
.inbox-head h1 { margin: 0 0 12px; font-size: 22px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.seg button { padding: 6px 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--surface-raised); color: var(--text); }
.inbox-items { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.tk {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 4px 12px;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tk:hover { background: var(--surface-raised); }
.tk.on { background: var(--surface-raised); box-shadow: inset 2px 0 0 var(--text); }
.tk .ini { grid-row: span 2; width: 36px; height: 36px; position: relative; }
.tk.waiting .ini::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--text);
}
.tk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.tk.answered .tk-name, .tk.closed .tk-name { font-weight: 500; color: var(--soft); }
.tk-time { color: var(--muted); font-size: 11px; text-align: right; }
.tk-prev { grid-column: 2 / -1; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.tk-prev b { color: var(--soft); font-weight: 500; }
.inbox-more { display: block; width: 100%; padding: 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }

.inbox-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.inbox-empty { display: grid; place-content: center; justify-items: center; gap: 14px; flex: 1; color: var(--muted); }
.inbox-empty img { width: 34px; opacity: .35; }
.inbox-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.thread-bar { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.thread-who { display: flex; flex-direction: column; min-width: 0; }
.thread-who strong { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.thread-actions { display: flex; gap: 8px; margin-left: auto; }
.thread-actions .button { margin: 0; }
.back-mobile { display: none; font-size: 20px !important; }
.thread-check { margin: 0; padding: 8px 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
#tk-chat { flex: 1; display: flex; min-height: 0; }
#tk-chat .chat { flex: 1; border: 0; }
#tk-chat .chat-scroll { max-height: none; }

/* user card */
.card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.card-head .ini { width: 54px; height: 54px; font-size: 20px; }
.card-head h1 { margin: 0; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.card-head .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.actions-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.actions-bar .button { margin: 0; cursor: pointer; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.box { padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: 0; }
.box h3 { margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.box .list li { font-size: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* search & forms */
.search { display: flex; gap: 8px; margin-bottom: 16px; max-width: 560px; }
.search input, .promo-form input, .promo-form select, .modal input, .modal textarea {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.search input { flex: 1; }
.search .button, .promo-form .button { margin: 0; cursor: pointer; }
.promo-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.promo-form label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.promo-form input { width: 130px; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* modal */
.modal {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
}
.modal::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
.modal form { display: grid; gap: 14px; padding: 22px; }
.modal h3 { margin: 0; font-size: 18px; font-weight: 500; }
.modal label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.modal textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.modal p { margin: 0; color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .button { margin: 0; cursor: pointer; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .inbox { grid-template-columns: 290px 1fr; }
}
@media (max-width: 860px) {
  .adm { grid-template-columns: 1fr; }
  .adm-nav {
    position: sticky;
    top: 64px;
    z-index: 4;
    flex-direction: row;
    height: auto;
    padding: 8px 12px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    scrollbar-width: none;
  }
  .adm-nav a { flex: none; gap: 8px; padding: 8px 12px; }
  .adm-main { padding: 20px 14px 50px; }
  .adm-me { display: none; }
  .inbox { grid-template-columns: 1fr; height: calc(100vh - 64px - 52px - 34px); border-radius: 10px; }
  .inbox.reading .inbox-list { display: none; }
  .inbox:not(.reading) .inbox-thread { display: none; }
  .back-mobile { display: block; }
  .thread-bar { padding: 10px 12px; gap: 10px; }
  .cols { grid-template-columns: 1fr; }
  .tr { grid-template-columns: minmax(0, 1fr) auto; }
  .tr > :nth-child(3), .tr > :nth-child(4) { display: none; }
}
@media (max-width: 560px) {
  .adm-top { padding: 0 14px; gap: 10px; }
  .adm-tag { display: none; }
  .kpi strong { font-size: 22px; }
  .thread-actions .button { padding-inline: 10px; }
}

.search input:focus, .promo-form input:focus, .promo-form select:focus, .modal input:focus, .modal textarea:focus {
  outline: none;
  border-color: var(--muted);
}

/* statistics exclusion */
.ov-hidden { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.pill.muted-pill { border-style: dashed; color: var(--muted); }
.history .tx-toggle { display: inline-block; margin-top: 4px; padding: 0; color: var(--muted); font-size: 12px; opacity: 0; transition: opacity .15s, color .15s; }
.history li:hover .tx-toggle, .history .tx-toggle:focus-visible, .history li.tx-off .tx-toggle { opacity: 1; }
.history .tx-toggle:hover { color: var(--text); }
.history li.tx-off > span:first-child { color: var(--muted); }
.history li.tx-off .amount { color: var(--muted); text-decoration: line-through; }
@media (hover: none) { .history .tx-toggle { opacity: 1; } }

/* servers dashboard */
.srv-upd { margin-left: 10px; color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.srv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 12px; }
.srv-card { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.srv-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.srv-name { font-size: 17px; font-weight: 500; }
.srv-big { display: flex; align-items: baseline; gap: 10px; }
.srv-big strong { font-size: 34px; font-weight: 500; letter-spacing: -.03em; }
.srv-big span { color: var(--muted); font-size: 12px; }
.srv-meter { display: grid; gap: 6px; }
.srv-mrow { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.srv-mrow b { color: var(--text); font-weight: 400; }
.srv-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.srv-bar i { display: block; height: 100%; border-radius: 3px; background: #8fd19e; transition: width .6s; }
.srv-bar.warm i { background: #e6c35c; }
.srv-bar.hot i { background: #e8735c; }
.srv-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; color: var(--muted); font-size: 12px; }
.pill.off { opacity: .6; }
.srv-chart { display: grid; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.srv-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.srv-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; background: currentColor; vertical-align: -1px; }
.srv-day { display: grid; grid-template-columns: 64px 1fr 80px; align-items: center; gap: 10px; font-size: 12px; }
.srv-dlabel { color: var(--muted); }
.srv-dval { text-align: right; }
.srv-stack { display: flex; height: 14px; min-width: 2px; border-radius: 3px; overflow: hidden; }
.c0 { color: #7fb3ff; } .srv-stack .c0 { background: #7fb3ff; }
.c1 { color: #f2a65a; } .srv-stack .c1 { background: #f2a65a; }
.c2 { color: #8fd19e; } .srv-stack .c2 { background: #8fd19e; }
.c3 { color: #c79bff; } .srv-stack .c3 { background: #c79bff; }
.srv-tr { grid-template-columns: 2fr 1fr 1.4fr 1fr !important; }

/* anonymous site stats */
.dom-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dom-search { display: flex; gap: 8px; flex: 1; min-width: 240px; max-width: 460px; }
.dom-search input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.dom-days { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dom-days button { padding: 8px 12px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.dom-days button.on { background: var(--line); color: var(--text); }
#dom-search { margin-bottom: 12px; }
.dom-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.dom-head strong { font-size: 20px; font-weight: 500; }
.dom-head span { color: var(--muted); font-size: 13px; flex: 1; }
.dom-sub { margin: 10px 0 2px; color: var(--muted); font-size: 12px; }
.dom-host { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.dom-tr { grid-template-columns: 3fr 1fr .7fr !important; width: 100%; border-left: 0; border-right: 0; border-bottom: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dom-site { display: grid; gap: 6px; }
.dom-line { display: block; height: 3px; border-radius: 2px; background: var(--line); }
.dom-line i { display: block; height: 100%; border-radius: 2px; background: #7fb3ff; }
.dom-svc { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; }
.dom-id { display: flex; align-items: center; gap: 12px; }
.dom-logo { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--line); color: var(--muted); font-size: 14px; font-weight: 500; overflow: hidden; }
.dom-logo.img { background: #fff; }
.dom-logo img { width: 22px; height: 22px; object-fit: contain; }
.dom-names { display: grid; line-height: 1.25; }
.dom-names b { font-weight: 500; font-size: 15px; }
.dom-names small { color: var(--muted); font-size: 12px; }
.dom-head .dom-logo { align-self: center; }
.dom-logo img.wait { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dom-logo { position: relative; }
.dom-end { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.dom-del { width: 26px; height: 26px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; opacity: .35; }
.dom-tr:hover .dom-del, .dom-host:hover .dom-del, .dom-del:focus { opacity: 1; }
.dom-del:hover { border-color: #e8735c66; color: #e8735c; }
.dom-danger { color: #e8735c !important; border-color: #e8735c55 !important; }
@media (hover: none) { .dom-del { opacity: .8; } }
