:root {
  color-scheme: light;
  --bg: #eef3f7;
  --panel: #ffffff;
  --ink: #1d2733;
  --muted: #697789;
  --line: #d6dee8;
  --nav: #0d252b;
  --nav-soft: #153a42;
  --nav-muted: #a7bac2;
  --teal: #19a7a6;
  --blue: #2563eb;
  --green: #0f8f70;
  --amber: #b26a00;
  --red: #c93636;
  --shadow: 0 16px 40px rgba(31, 49, 68, 0.12);
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.hidden {
  display: none !important;
}

.bootstrap-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.bootstrap-loader {
  display: grid;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
}

.bootstrap-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(25, 167, 166, 0.2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: bootstrap-spin 0.8s linear infinite;
}

.bootstrap-text {
  min-width: 72px;
  text-align: center;
  font-size: 14px;
}

@keyframes bootstrap-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bootstrap-spinner {
    animation-duration: 1.8s;
  }
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #e9f1f4 0%, #f8fbfd 100%);
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand {
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

.login-brand strong,
.brand strong {
  display: block;
  font-size: 18px;
}

.login-brand small,
.brand small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.login-panel h1 {
  margin: 0 0 22px;
  font-size: 26px;
}

.login-panel label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.login-panel input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  outline: 0;
}

.login-panel input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 167, 166, 0.12);
}

.login-error {
  margin: 0 0 14px;
  color: var(--red);
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--nav);
  color: #eff8fa;
  padding: 12px 12px 18px;
}

.brand {
  height: 54px;
  padding: 0 2px 16px;
  margin-bottom: 16px;
}

.brand small {
  color: var(--nav-muted);
}

nav {
  display: grid;
  gap: 6px;
}

.nav-item,
.nav-group-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  background: transparent;
  color: var(--nav-muted);
  text-align: left;
  cursor: pointer;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-group-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-caret {
  color: #8aa0a8;
}

.nav-item:hover,
.nav-group-button:hover,
.nav-item.active {
  background: var(--nav-soft);
  color: #fff;
}

.nav-children {
  display: grid;
  gap: 4px;
  margin: 4px 0 8px;
}

.nav-children .nav-item {
  padding-left: 48px;
  min-height: 38px;
  font-size: 14px;
}

.nav-icon {
  width: 18px;
  color: inherit;
  text-align: center;
}

.main {
  margin-left: 240px;
  min-height: 100vh;
  padding: 14px 22px 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 86px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

h1 {
  margin: 0;
  font-size: 24px;
}

.page-heading p {
  margin-top: 6px;
  font-size: 15px;
}

p {
  margin: 5px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-refresh-button,
.dashboard-refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.page-refresh-button.is-loading > span[aria-hidden],
.dashboard-refresh-button.is-loading > span[aria-hidden] {
  animation: refresh-spin 0.7s linear infinite;
}

@keyframes refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard-bot-filter {
  min-width: 280px;
}

.dashboard-bot-filter select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  padding: 0 36px 0 12px;
  outline: 0;
}

.dashboard-bot-filter select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 167, 166, 0.12);
}

.dashboard-controls {
  min-height: 58px;
  margin-bottom: 18px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.dashboard-control-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.dashboard-period button {
  min-width: 62px;
  min-height: 36px;
  font-weight: 600;
}

.dashboard-updated-at {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.primary-button,
.ghost-button,
.danger-button,
.table-button,
.soft-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

.primary-button {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.login-panel .primary-button {
  width: 100%;
}

.ghost-button,
.table-button {
  background: #fff;
  color: var(--ink);
}

.danger-button {
  border-color: #f2c4c4;
  background: #fff;
  color: var(--red);
}

.user-menu {
  position: relative;
}

.user-menu-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #62758a;
  padding: 0 12px 0 6px;
  cursor: pointer;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #159a9a;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.user-menu-caret {
  color: #7890a6;
  font-size: 13px;
}

.user-menu-panel {
  position: absolute;
  top: 46px;
  right: 0;
  width: 90px;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 10px 28px rgba(30, 48, 64, 0.18);
  padding: 8px 0;
  z-index: 15;
}

.user-menu-panel::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 38px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #fff;
}

.user-menu-panel button {
  width: 100%;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: #5e6c7b;
  cursor: pointer;
  text-align: center;
}

.user-menu-panel button:hover {
  background: #f3f7fa;
  color: var(--ink);
}

.soft-button {
  background: #eefafa;
  color: #397072;
  border-color: #bfe4e4;
}

.alert {
  --notice-color: #17684d;
  --notice-bg: #e8f6ee;
  --notice-border: #c9e4d6;
  --notice-gutter: 22px;
  position: fixed;
  inset: 20px 0 auto;
  z-index: 1000;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 30px;
  align-items: start;
  gap: 10px;
  width: max-content;
  max-width: min(440px, calc(100% - 2 * var(--notice-gutter)));
  margin-inline: auto;
  padding: 10px 10px 10px 13px;
  border: 1px solid var(--notice-border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(25, 42, 59, 0.14);
  font-size: 14px;
  line-height: 1.5;
  pointer-events: none;
  animation: notice-in 0.16s ease-out;
}

.alert[data-type="error"] {
  --notice-color: #a82d36;
  --notice-bg: #fdeff0;
  --notice-border: #edcdd0;
}

.alert[data-type="info"] {
  --notice-color: #28598d;
  --notice-bg: #edf4fc;
  --notice-border: #cfdded;
}

.alert-icon {
  display: grid;
  width: 24px;
  height: 24px;
  margin-top: 3px;
  place-items: center;
  border-radius: 50%;
  background: var(--notice-bg);
  color: var(--notice-color);
  font-weight: 700;
}

.alert-message {
  padding-block: 4px;
  overflow-wrap: anywhere;
}

.alert-dismiss,
.modal-close {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.alert-dismiss {
  width: 30px;
  height: 30px;
  pointer-events: auto;
}

.alert-dismiss:hover,
.modal-close:hover {
  border-color: var(--line);
  background: #edf2f6;
  color: var(--ink);
}

@keyframes notice-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.dashboard-stat-card,
.dashboard-chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dashboard-stat-values small {
  font-size: 12px;
  font-weight: 500;
}

.tone-blue {
  background: #e9f3ff;
  color: #2184ef;
}

.tone-cyan {
  background: #e7f8fd;
  color: #20b9e6;
}

.tone-green {
  background: #e8f8f1;
  color: #25bd83;
}

.tone-gray {
  background: #f1f5f7;
  color: #8493a1;
}

.dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-stat-card {
  min-height: 178px;
  padding: 16px;
}

.dashboard-stat-card header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.dashboard-stat-card h2,
.dashboard-chart-card h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.dashboard-stat-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 17px;
}

.dashboard-stat-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}

.dashboard-stat-values span {
  display: block;
  margin-bottom: 7px;
  color: #8994a3;
  font-size: 12px;
}

.dashboard-stat-values strong {
  display: block;
  min-width: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-chart-card {
  min-width: 0;
  min-height: 388px;
  padding: 20px 18px 12px;
}

.dashboard-chart-header {
  min-height: 54px;
  border-bottom: 1px solid #e7edf3;
  margin-bottom: 10px;
}

.dashboard-chart-header p {
  margin-top: 6px;
  font-size: 13px;
}

.dashboard-chart-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  color: #6f7e91;
  font-size: 12px;
}

.dashboard-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dashboard-chart-legend-item i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.dashboard-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 292px;
}

.dashboard-axis-label,
.dashboard-chart-with-axis .trend-tip text {
  font-size: 14px;
}

.trend-hit {
  cursor: pointer;
  outline: 0;
}

.dashboard-chart-with-axis .trend-hit {
  -webkit-tap-highlight-color: transparent;
}

.trend-hit:hover > line,
.trend-hit:focus > line,
.trend-hit:hover .trend-tip,
.trend-hit:focus .trend-tip {
  opacity: 1;
}

.dashboard-chart-empty {
  min-height: 278px;
  display: grid;
  place-items: center;
  color: #9aa6b3;
  font-size: 14px;
}

.ops-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.right-toolbar {
  justify-content: flex-end;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.list-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.list-toolbar input,
.list-toolbar select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  outline: 0;
}

.list-toolbar input:focus,
.list-toolbar select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 167, 166, 0.12);
}

.search-field {
  min-width: 240px;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.list-total {
  margin-left: auto;
  min-height: 36px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.pagination-summary {
  color: var(--muted);
  font-size: 13px;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ops-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.ops-card.ok {
  border-left-color: var(--green);
}

.ops-card.warn {
  border-left-color: var(--amber);
}

.ops-card.bad {
  border-left-color: var(--red);
}

.ops-card span,
.kv-grid span,
.wallet-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.ops-card strong {
  display: block;
  font-size: 20px;
}

.template-metrics {
  margin-bottom: 14px;
}

.template-preview-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
  padding: 16px;
}

.telegram-preview {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  padding: 12px;
}

.telegram-preview-header {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.telegram-message {
  margin: 0;
  word-break: break-word;
  line-height: 1.45;
  color: var(--ink);
}

.keyboard-preview {
  display: grid;
  gap: 6px;
}

.keyboard-row {
  display: grid;
  gap: 6px;
}

.keyboard-row.cols-1 {
  grid-template-columns: 1fr;
}

.keyboard-row.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.keyboard-row.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.keyboard-button {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 6px;
  background: #dfe7ef;
  color: #162633;
  font-size: 13px;
  padding: 6px 8px;
  text-align: center;
}

.button-config-list {
  display: grid;
  gap: 10px;
}

.button-config-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #fbfcfe;
}

.keyboard-config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  padding: 16px;
  align-items: start;
}

.keyboard-config-main,
.keyboard-config-side {
  min-width: 0;
}

.keyboard-config-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 160px;
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.keyboard-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.keyboard-field input {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  outline: 0;
  background: #fff;
}

.keyboard-field input:focus,
.keyboard-table-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 167, 166, 0.12);
}

.segmented-control {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #f3f7fa;
}

.segmented-control button {
  min-height: 32px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control button.active {
  background: var(--teal);
  color: #fff;
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  color: var(--ink);
  cursor: pointer;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-field b {
  font-size: 13px;
  color: var(--blue);
}

.toggle-field.compact {
  min-height: 24px;
}

.keyboard-list-heading {
  margin: 4px 0 10px;
  font-weight: 700;
}

.keyboard-list-heading.with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
}

button.danger-link {
  color: #dc2626;
}

.keyboard-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.keyboard-config-table th:first-child,
.keyboard-config-table td:first-child {
  width: 42px;
  text-align: center;
}

.keyboard-config-table th:nth-child(5),
.keyboard-config-table td:nth-child(5) {
  width: 72px;
}

.keyboard-config-table th:nth-child(6),
.keyboard-config-table td:nth-child(6) {
  width: 88px;
}

.keyboard-table-input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  outline: 0;
  background: #fff;
}

.keyboard-row-actions {
  display: grid;
  gap: 6px;
}

button.inline-link {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.keyboard-phone {
  padding: 14px;
}

.keyboard-message {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  border-radius: 7px;
  background: #fff;
  padding: 12px;
}

.keyboard-message strong {
  font-size: 16px;
}

.wide-button {
  width: 100%;
  margin-top: 12px;
}

.form-label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 7px;
}

.kv-grid,
.wallet-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.kv-grid > div,
.wallet-grid > div {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fbfcfe;
}

.kv-grid strong,
.wallet-grid strong {
  display: block;
  word-break: break-all;
}

.kv-grid > .kv-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kv-action-card > div {
  min-width: 0;
}

.kv-action-card .soft-button {
  flex: 0 0 auto;
}

.copy-value {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.copy-value strong {
  min-width: 0;
}

.copy-icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.copy-icon-button:hover {
  color: var(--teal);
  border-color: #bfe4e4;
  background: #eefafa;
}

.copy-icon-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bot-list-table-scroll {
  overflow-x: auto;
}

.bot-list-table {
  min-width: 1500px;
  table-layout: fixed;
}

.bot-list-table th,
.bot-list-table td {
  white-space: nowrap;
}

.bot-list-table th:nth-child(1),
.bot-list-table td:nth-child(1) {
  width: 48px;
}

.bot-list-table th:nth-child(2),
.bot-list-table td:nth-child(2) {
  width: 92px;
}

.bot-list-table th:nth-child(3),
.bot-list-table td:nth-child(3),
.bot-list-table th:nth-child(4),
.bot-list-table td:nth-child(4) {
  width: 145px;
}

.bot-list-table th:nth-child(5),
.bot-list-table td:nth-child(5) {
  width: 78px;
}

.bot-list-table th:nth-child(6),
.bot-list-table td:nth-child(6),
.bot-list-table th:nth-child(7),
.bot-list-table td:nth-child(7) {
  width: 92px;
}

.bot-list-table th:nth-child(8),
.bot-list-table td:nth-child(8),
.bot-list-table th:nth-child(9),
.bot-list-table td:nth-child(9),
.bot-list-table th:nth-child(10),
.bot-list-table td:nth-child(10),
.bot-list-table th:nth-child(11),
.bot-list-table td:nth-child(11) {
  width: 92px;
}

.bot-list-table th:nth-child(12),
.bot-list-table td:nth-child(12),
.bot-list-table th:nth-child(13),
.bot-list-table td:nth-child(13) {
  width: 155px;
}

.bot-list-table th:nth-child(14),
.bot-list-table td:nth-child(14) {
  width: 76px;
}

.bot-list-table th:nth-child(15),
.bot-list-table td:nth-child(15) {
  width: 74px;
}

.bot-energy-address-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.bot-energy-address-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bot-energy-address-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-energy-address-row .copy-icon-button {
  width: 26px;
  height: 26px;
}

.section {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.section-header h2 {
  margin: 0;
  font-size: 16px;
}

.skeleton-line {
  display: block;
  width: var(--w, 100%);
  max-width: 100%;
  height: 13px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef3f7 0%, #f7fafc 45%, #eef3f7 100%);
  background-size: 220% 100%;
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}

.loading-card {
  display: grid;
  align-content: start;
  gap: 12px;
}

.metric.loading-card .skeleton-line:last-child {
  height: 24px;
}

.loading-table .skeleton-line {
  height: 12px;
}

@keyframes skeleton-pulse {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: -100% 0;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-scroll {
  overflow-x: auto;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfcfe;
}

tr:last-child td {
  border-bottom: 0;
}

.stack {
  display: grid;
  gap: 4px;
}

.muted-line {
  color: var(--muted);
  font-size: 12px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.inline-link {
  color: var(--blue);
  text-decoration: none;
}

.inline-link:hover {
  text-decoration: underline;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 300px;
}

.action-row .table-button,
.action-row .danger-button {
  min-height: 30px;
  padding: 0 9px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  background: #eef2f6;
}

.badge.active,
.badge.completed,
.badge.paid,
.badge.succeeded {
  background: #e7f6f1;
  color: var(--green);
}

.badge.queued,
.badge.retry,
.badge.pending {
  background: #fff4db;
  color: var(--amber);
}

.badge.failed,
.badge.disabled,
.badge.invalid {
  background: #ffe9e9;
  color: var(--red);
}

.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

.empty.compact {
  padding: 16px;
}

.security-wrap {
  max-width: 520px;
  margin: 30px auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.security-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.security-row:last-child {
  margin-bottom: 0;
}

.security-row strong {
  display: block;
  margin-bottom: 4px;
}

.security-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.switch-button {
  width: 40px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: #d9dee6;
  position: relative;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.16s ease;
}

.switch-button::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
  transition: transform 0.16s ease;
}

.switch-button.on {
  background: #8dbbff;
}

.switch-button.on::after {
  transform: translateX(20px);
}

.switch-button:focus-visible {
  outline: 3px solid rgba(141, 187, 255, 0.35);
  outline-offset: 2px;
}

.toggle {
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: #d9dee6;
  position: relative;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
}

.toggle.on {
  background: #8dbbff;
}

.toggle.on::after {
  left: 23px;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  --modal-gutter: 24px;
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--modal-gutter);
  background: rgba(16, 32, 39, 0.46);
  z-index: 20;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  min-width: 0;
  max-height: calc(100vh - 2 * var(--modal-gutter));
  max-height: calc(100dvh - 2 * var(--modal-gutter));
  overflow: hidden;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: notice-in 0.16s ease-out;
}

.modal:focus {
  outline: none;
}

.modal-header,
.modal-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
}

.modal-footer > button {
  max-width: 100%;
  min-width: 68px;
  min-height: 38px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.modal-footer > .ghost-button:hover:not(:disabled) {
  background: #edf2f6;
}

.modal-footer > .primary-button:hover:not(:disabled) {
  background: #117e7e;
  border-color: #117e7e;
}

.modal-footer > #confirmDialogButton {
  min-width: 92px;
}

.modal-footer > #confirmDialogButton.danger-button {
  background: #b73039;
  border-color: #b73039;
  color: #fff;
}

.modal-footer > #confirmDialogButton.danger-button:hover:not(:disabled) {
  background: #a1262f;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 20px;
}

.modal-message {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.api-key-display-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-key-display-row input {
  min-width: 0;
  flex: 1 1 auto;
}

.api-key-display-row button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.json-preview {
  margin: 16px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
}

.modal-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #edcdd0;
  border-radius: 6px;
  background: #fdeff0;
  color: #a82d36;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.modal-message + .modal-error {
  margin-top: 12px;
}

.modal-close {
  flex: 0 0 34px;
  height: 34px;
}

.modal[aria-busy="true"] [data-close-modal] {
  opacity: 0.48;
  cursor: not-allowed;
}

.modal button:focus-visible,
.alert-dismiss:focus-visible {
  outline: 2px solid #087e80;
  outline-offset: 2px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  outline: 0;
  background: #fff;
}

.form-grid textarea {
  min-height: 120px;
  resize: vertical;
}

.telegram-format-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}

.format-button {
  border: 1px solid #cfe0f0;
  border-radius: 6px;
  background: #f8fbfd;
  color: #496176;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
}

.format-button:hover {
  border-color: var(--teal);
  color: #0f8f70;
  background: #eefdfb;
}

.form-grid input:focus,
.form-grid textarea:focus,
.form-grid select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 167, 166, 0.12);
}

.danger-text {
  color: var(--red);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.announcement-modal {
  width: min(1100px, 100%);
}

.announcement-modal .modal-body {
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.announcement-modal .modal-footer {
  flex: 0 0 auto;
  background: #fff;
  z-index: 1;
}

.announcement-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.95fr);
  height: min(620px, calc(100vh - 150px));
  min-height: 0;
}

.announcement-form {
  padding: 18px 20px 28px;
  overflow: auto;
  border-right: 1px solid var(--line);
  min-height: 0;
}

.announcement-preview-panel {
  padding: 18px 14px;
  overflow: auto;
  background: #fff;
  min-height: 0;
}

.announcement-top-grid {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
}

.announcement-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.announcement-field.required > span::before {
  content: "* ";
  color: var(--red);
}

.announcement-field input,
.announcement-field textarea,
.announcement-top-grid select,
.announcement-image-input input,
.announcement-inline-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  outline: 0;
  background: #fff;
}

.announcement-field textarea {
  min-height: 158px;
  resize: vertical;
}

.announcement-field input:focus,
.announcement-field textarea:focus,
.announcement-top-grid select:focus,
.announcement-image-input input:focus,
.announcement-inline-row input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 167, 166, 0.12);
}

.announcement-emoji-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--muted);
}

.announcement-emoji-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emoji-button {
  width: 34px;
  height: 34px;
  border: 1px solid #cfe0f0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
}

.announcement-image-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px 14px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.announcement-image-row > strong {
  grid-column: 1 / -1;
}

.announcement-image-box {
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  border: 1px dashed #bdd0e5;
  border-radius: 8px;
  background: #f8fbfd;
  color: #778899;
  font-size: 34px;
  cursor: pointer;
}

.announcement-image-input {
  display: grid;
  align-content: start;
  gap: 8px;
}

.announcement-image-input p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.announcement-inline-box {
  margin-bottom: 14px;
}

.announcement-inline-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
}

.link-button {
  border: 0;
  background: transparent;
  color: #1677ff;
  cursor: pointer;
  font-weight: 700;
}

.announcement-inline-row {
  display: grid;
  grid-template-columns: 1fr 1.35fr auto;
  gap: 8px;
  margin-top: 8px;
}

.announcement-radio-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.announcement-radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}

.announcement-radio-row input {
  width: 14px;
  height: 14px;
}

.announcement-preview-title {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: #1677ff;
  font-weight: 700;
}

.announcement-phone {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #101b28;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
}

.announcement-phone-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #172534;
  color: #fff;
}

.announcement-phone-head span:not(.announcement-avatar) {
  display: block;
  margin-top: 2px;
  color: #9fb0c3;
  font-size: 12px;
}

.announcement-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #3b8bdc;
  font-size: 20px;
}

.announcement-phone-body {
  min-height: 350px;
  padding: 22px 26px;
  color: #dce7f5;
  background-color: #101b28;
  background-image: radial-gradient(rgba(105, 145, 190, 0.16) 1px, transparent 1px);
  background-size: 18px 18px;
}

.announcement-preview-message {
  line-height: 1.6;
  word-break: break-word;
}

.announcement-preview-message strong {
  color: #fff;
}

.announcement-preview-text {
  margin-top: 10px;
}

.announcement-preview-text pre,
.announcement-preview-text code {
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.muted-preview {
  color: #9fb0c3;
  font-style: italic;
}

.announcement-preview-image img {
  display: block;
  max-width: 100%;
  max-height: 180px;
  object-fit: cover;
  margin-bottom: 12px;
  border-radius: 8px;
}

.announcement-preview-buttons {
  display: grid;
  gap: 7px;
  margin-top: 14px;
}

.announcement-preview-buttons button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: #2d8cff;
  color: #fff;
  font-weight: 700;
}

.checkbox-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 9px !important;
  color: var(--ink) !important;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.totp-setup {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: start;
}

.totp-setup img {
  width: 180px;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.secret-box {
  word-break: break-all;
  padding: 10px;
  border-radius: 6px;
  background: #f4f8fb;
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #1f3a4a;
}

@media (max-width: 1280px) {
  .dashboard-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .main {
    margin-left: 0;
    padding: 16px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-grid,
  .kv-grid,
  .wallet-grid,
  .template-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .list-toolbar {
    align-items: stretch;
  }

  .list-toolbar label,
  .search-field,
  .filter-actions,
  .list-total {
    width: 100%;
    min-width: 0;
  }

  .filter-actions {
    justify-content: flex-start;
  }

  .list-total {
    margin-left: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .dashboard-bot-filter {
    flex: 1 1 240px;
    min-width: 0;
  }

  .user-menu {
    margin-left: auto;
  }

  .dashboard-controls {
    align-items: stretch;
  }

  .dashboard-control-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .alert {
    --notice-gutter: 12px;
    top: 12px;
  }

  .announcement-modal .modal-body {
    overflow: auto;
  }

  .announcement-editor {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .announcement-form {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .totp-setup {
    grid-template-columns: 1fr;
  }

  .button-config-row {
    grid-template-columns: 1fr;
  }

  .keyboard-config-layout,
  .keyboard-config-controls {
    grid-template-columns: 1fr;
  }

  .keyboard-config-side {
    order: -1;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
  }

  .dashboard-period {
    width: auto;
  }
}

@media (max-width: 600px) {
  .modal-backdrop {
    --modal-gutter: 10px;
  }

  .modal-header,
  .modal-footer {
    padding: 10px 14px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal input:not([type="checkbox"]):not([type="radio"]),
  .modal select,
  .modal textarea {
    font-size: 16px;
  }

  .announcement-top-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .main {
    padding: 12px;
  }

  .topbar {
    min-height: 0;
    margin-bottom: 12px;
    padding: 14px;
  }

  .toolbar {
    align-items: stretch;
  }

  .dashboard-bot-filter {
    flex-basis: 100%;
  }

  .user-menu {
    margin-left: 0;
  }

  .dashboard-controls {
    margin-bottom: 12px;
  }

  .dashboard-control-actions {
    gap: 10px;
  }

  .dashboard-updated-at {
    order: 3;
    width: 100%;
  }

  .dashboard-stat-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  .dashboard-chart-grid {
    gap: 12px;
  }

  .dashboard-chart-card {
    min-height: 330px;
    padding: 16px 12px 10px;
  }

  .dashboard-chart-legend {
    gap: 7px 12px;
  }

  .dashboard-axis-label,
  .dashboard-chart-with-axis .trend-tip text {
    font-size: 20px;
  }

  .dashboard-chart-empty {
    min-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .alert,
  .modal {
    animation: none;
  }
}

.badge.credit,
.badge.recharge,
.badge.refund,
.badge.approved,
.badge.confirmed {
  background: #e7f6f1;
  color: var(--green);
}

.badge.debit,
.badge.withdrawal,
.badge.purchase {
  background: #eef2ff;
  color: #315fca;
}

.badge.commission,
.badge.pending,
.badge.queued,
.badge.retry {
  background: #fff4db;
  color: var(--amber);
}

.badge.rejected,
.badge.cancelled,
.badge.expired,
.badge.failed,
.badge.disabled,
.badge.invalid {
  background: #ffe9e9;
  color: var(--red);
}

.badge.adjustment,
.badge.freeze,
.badge.unfreeze {
  background: #f0ecff;
  color: #6c45c7;
}

.emoji-library-tabs {
  margin-bottom: 2px;
}

.emoji-filter-bar,
.emoji-manual-form,
.emoji-dynamic-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 14px 16px;
}

.emoji-dynamic-toolbar {
  justify-content: space-between;
  padding-bottom: 0;
}

.emoji-dynamic-toolbar .emoji-filter-bar {
  padding: 0;
}

.emoji-filter-bar label,
.emoji-manual-form label {
  display: grid;
  gap: 6px;
  min-width: 210px;
  color: var(--muted);
  font-size: 12px;
}

.emoji-filter-bar input,
.emoji-filter-bar select,
.emoji-manual-form input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  outline: 0;
}

.emoji-filter-bar input:focus,
.emoji-filter-bar select:focus,
.emoji-manual-form input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 167, 166, 0.12);
}

.emoji-library-note {
  margin: 0 16px 14px;
  padding: 10px 12px;
  border-left: 3px solid #3b82f6;
  background: #f4f8fd;
  color: #516579;
  font-size: 13px;
  line-height: 1.6;
}

.emoji-grid {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.emoji-static-grid {
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
}

.emoji-dynamic-grid {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.emoji-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.emoji-static-card {
  display: grid;
  grid-template-rows: 54px auto auto;
  align-items: center;
  gap: 4px;
  min-height: 116px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
}

.emoji-static-card:hover {
  border-color: var(--teal);
  background: #f5fbfb;
}

.emoji-static-symbol {
  font-size: 38px;
  line-height: 1;
}

.emoji-static-card strong,
.emoji-static-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emoji-static-card strong {
  font-size: 12px;
}

.emoji-static-card small,
.emoji-dynamic-card small {
  color: var(--muted);
  font-size: 11px;
}

.emoji-dynamic-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 142px;
  overflow: hidden;
}

.emoji-preview {
  display: grid;
  place-items: center;
  width: 72px;
  min-height: 94px;
  background: #f3f7fa;
  overflow: hidden;
}

.emoji-preview > span {
  font-size: 38px;
}

.emoji-preview svg,
.emoji-preview img,
.emoji-preview video {
  display: block;
  width: 60px !important;
  height: 60px !important;
  object-fit: contain;
}

.emoji-preview.preview-failed::after {
  content: "预览失败";
  color: var(--muted);
  font-size: 11px;
}

.emoji-card-body {
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
  padding: 12px;
}

.emoji-card-body strong,
.emoji-card-body code,
.emoji-card-body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emoji-card-body code {
  color: #516579;
  font-size: 11px;
}

.emoji-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.emoji-card-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 34px 34px;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #516579;
  cursor: pointer;
}

.icon-button.danger {
  border-color: #f2c4c4;
  color: var(--red);
}

.emoji-pagination {
  padding: 0 16px 16px;
}

.emoji-total {
  padding: 0 16px 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

@media (max-width: 900px) {
  .emoji-filter-bar,
  .emoji-manual-form,
  .emoji-dynamic-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .emoji-filter-bar label,
  .emoji-manual-form label {
    min-width: 0;
    width: 100%;
  }

  .emoji-static-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .emoji-static-card strong,
  .emoji-static-card small {
    display: none;
  }

  .emoji-static-card {
    grid-template-rows: 54px;
    min-height: 72px;
  }
}
