:root {
  --side-drawer-width: 200px;
  --admin-theme: #d7fd4e;
  --admin-theme-dark: #a7c83a;
  --ink: #111;
  --muted: #666;
  --line: #999;
  --soft-line: #ccc;
  --side: #333;
  --side-hover: #4b4b4b;
  --blue: #3c8dbc;
  --green: #00a65a;
  --red: #dd4b39;
  --amber: #f39c12;
  --yellow: #ffecb3;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: Verdana, Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.fa {
  display: inline-block;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  text-rendering: auto;
}
.fa:before { display: inline-block; width: 1em; text-align: center; }
.fa-bars:before { content: "\2630"; }
.fa-comments:before { content: "\2709"; }
.fa-exchange:before { content: "\21c4"; }
.fa-table:before { content: "\25a6"; }
.fa-user:before { content: "\25c9"; }
.fa-users:before { content: "\25ce"; }
.fa-line-chart:before { content: "\2571"; }
.fa-bar-chart:before { content: "\25a5"; }
.fa-money:before { content: "$"; }
.fa-bullhorn:before { content: "!"; }
.fa-bank:before { content: "\25b0"; }
.fa-id-card-o:before { content: "ID"; width: 1.6em; }
.fa-code-fork:before { content: "\22a2"; }
.fa-futbol-o:before { content: "\25ef"; }
.fa-cogs:before { content: "\2699"; }
.fa-paint-brush:before { content: "\25a8"; }
.fa-picture-o:before { content: "\25a7"; }
.fa-pencil:before { content: "\270e"; }
.fa-file:before { content: "\25a4"; }
.fa-lock:before { content: "\25cf"; }
.fa-user-times:before { content: "\2715"; }
.fa-shopping-cart:before { content: "$"; }
.fa-globe:before { content: "\25ce"; }
.fa-plug:before { content: "\2301"; }
.fa-history:before { content: "\21ba"; }
.fa-unlock-alt:before { content: "\25cc"; }
.fa-sign-out:before { content: "\2192"; }
.fa-refresh:before { content: "\21bb"; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(to right, #ffd0a7, #4a5482);
}
.login-panel {
  width: calc(100% - 60px);
  max-width: 400px;
  background: #fff;
  padding: 25px;
  border: 1px solid #aaa;
}
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #222;
  color: var(--admin-theme);
  font-weight: 700;
}
.logo-row h1, .logo-row p { margin: 0; }
.logo-row h1 { font-size: 19px; }
.logo-row p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.login-switch { display: flex; gap: 8px; margin-top: 20px; }
.login-switch button { flex: 1; }
.form-stack, .dialog-form { display: grid; gap: 13px; }
.form-stack { margin-top: 22px; }
label {
  display: grid;
  gap: 6px;
  color: #444;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}
input, select, textarea {
  width: 100%;
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 9px;
  background: #fff;
  color: #000;
}
textarea { min-height: 92px; resize: vertical; text-transform: none; }
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(60, 141, 188, .15);
}

.primary-btn, .ghost-btn, .danger-btn, .action-btn, .tab, .front-primary {
  min-height: 34px;
  border-radius: 4px;
  border: 1px solid transparent;
  padding: 7px 10px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0;
}
.primary-btn { background: var(--green); color: #fff; border-color: #008d4c; }
.ghost-btn { background: #eee; color: #000; border-color: #bbb; }
.danger-btn { background: var(--red); color: #fff; border-color: #d73925; }
.small { min-height: 28px; padding: 5px 8px; }

.main-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #fff;
}
#adminNotice {
  position: relative;
  display: block;
  background: #666;
  color: #fff;
  font-size: 13px;
  line-height: 18px;
}
.hide-admin-notice #adminNotice { display: none; }
#header {
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 55px;
  background: var(--admin-theme);
  color: #111;
  box-shadow: 0 0 3px rgba(0,0,0,.8);
  z-index: 3;
  display: flex;
  align-items: center;
}
.header-nav {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: stretch;
  height: 55px;
  overflow: hidden;
}
.header-item {
  width: 176px;
  max-width: 16vw;
  min-width: 92px;
  height: 55px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  text-align: center;
  font-size: 27px;
}
.header-item:hover,
.header-item.active { background: rgba(0,0,0,.12); }
.header-item .nav-label { display: none; }
.header-item .fa {
  width: auto;
  padding: 0;
  line-height: 55px;
}
.header-title {
  min-width: 0;
  display: none;
  gap: 2px;
}
.header-title strong {
  font-size: 17px;
  line-height: 1.1;
}
.header-title span {
  color: #333;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#header .user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  white-space: nowrap;
}
#header .score {
  background: #00c0ef;
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 10px;
}
#header .score-log {
  min-height: 21px;
  border: 0;
  background: #eee;
  color: #000;
  padding: 3px 8px;
  border-radius: 13px;
  font-size: 11px;
}
.api-status {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 11px;
  padding: 2px 7px;
  background: #eee;
  color: #111;
  font-size: 11px;
  font-weight: 700;
}
.api-status.warn { background: #fff3cd; color: #8a5b00; }
.api-status.error { background: #ffcdd2; color: #9b1c1c; }
.api-status.ok { background: #c8e6c9; color: #155724; }
.clock { color: #222; font-size: 11px; }
#menuToggle {
  width: 60px;
  height: 55px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  font-size: 26px;
  line-height: 55px;
  order: 3;
}
#menuToggle:hover { background: rgba(0,0,0,.18); }

#side-menu {
  width: var(--side-drawer-width);
  height: calc(100% - 55px);
  background: var(--side);
  color: #ccc;
  user-select: none;
  top: 55px;
  right: 0;
  position: absolute;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: inset 2px 2px 4px rgba(0,0,0,1);
  z-index: 4;
  transform: translateX(100%);
  transition: transform .3s;
}
.show-menu #side-menu { transform: translateX(0); }
.side-brand {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 15px;
  background: #222;
  border-bottom: 1px solid rgba(255,255,255,.16);
}
.side-brand .logo-mark {
  width: 36px;
  height: 36px;
  font-size: 12px;
}
.side-brand strong {
  display: block;
  color: #fff;
  font-size: 14px;
}
.side-brand span {
  display: block;
  margin-top: 2px;
  color: #aaa;
  font-size: 11px;
}
#side-menu .change-language {
  padding: 5px;
  margin: 15px 15px 0;
  width: calc(100% - 30px);
  min-height: 32px;
}
#side-menu .devicetz {
  padding: 10px 15px;
  font-size: 12px;
  line-height: 1.5;
}
#side-menu .devicetz span { color: #fff; font-weight: 700; }
.side-menu-item { display: block; }
.nav-item.menu-link {
  width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  position: relative;
  padding: 15px;
  display: block;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ccc;
  text-align: left;
  font-size: 13px;
  line-height: 1;
}
.nav-item.menu-link:hover { background: #bcaaa4; color: #111; }
.nav-item.menu-link.active { background: #555; color: #fff; }
.nav-item.menu-link .fa {
  position: relative;
  font-size: 16px;
  width: 30px;
  line-height: 0;
  text-align: center;
  padding-right: 15px;
}
.nav-item.menu-link .fa-user,
.nav-item.menu-link .fa-code-fork { font-size: 19px; top: 1px; }
.nav-item.menu-link .fa-lock { font-size: 21px; }

.content-style {
  position: absolute;
  top: 55px;
  bottom: 0;
  right: 0;
  left: 0;
  width: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  color: #000;
  transition: right .3s;
  z-index: 1;
}
.show-menu .content-style { right: var(--side-drawer-width); }
.workspace-head {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: #f9fafc;
  border-bottom: 1px solid #999;
}
.workspace-head p { margin: 0; color: #666; font-size: 11px; font-weight: 700; }
.workspace-head h2 { margin: 2px 0 0; font-size: 16px; }

.view { display: none; padding: 10px; }
.active-view { display: block; }
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.metric, .panel, .merchant-banner {
  background: #fff;
  border: 1px solid #999;
  border-radius: 0;
  box-shadow: none;
}
.metric {
  min-height: 90px;
  padding: 10px;
}
.metric span { display: block; color: #666; font-size: 12px; font-weight: 700; }
.metric strong { display: block; font-size: 22px; margin-top: 8px; }
.metric small { display: block; color: #666; font-size: 11px; margin-top: 5px; }
.metric.warning { background: #fff8e1; }
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 10px;
  margin-top: 10px;
}
.panel { padding: 10px; overflow: hidden; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.panel-head h3 { margin: 0; color: #000; font-size: 16px; }
.panel-head span { color: #666; font-size: 12px; }
.filter-bar {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px auto auto;
  gap: 8px;
  align-items: center;
  margin: -10px -10px 10px;
  padding: 10px;
  background: var(--yellow);
  border-bottom: 1px solid #000;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid #999;
  border-radius: 0;
}
table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  padding: 7px 8px;
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
th:last-child, td:last-child { border-right: 0; }
th {
  background: #333;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}
tbody tr:hover td { background: #bbdefb; }

.status, .tag {
  display: inline-block;
  min-height: 20px;
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.tag { color: #fff; background: #3f51b5; }
.status.active, .status.completed, .status.paid, .status.valid { color: #155724; background: #c8e6c9; }
.status.pending, .status.maintenance, .status.overdue, .status.draft { color: #7c4a00; background: #ffe082; }
.status.suspended, .status.rejected, .status.locked, .status.failed { color: #8b0000; background: #ffcdd2; }
.amount-positive { color: #008000; font-weight: 700; }
.amount-negative { color: #d32f2f; font-weight: 700; }
.actions { display: flex; gap: 5px; flex-wrap: wrap; }
.action-btn {
  min-height: 26px;
  padding: 4px 7px;
  background: #ddd;
  border-color: #bbb;
  color: #000;
}
.action-btn.approve { color: #008000; }
.action-btn.reject { color: #d32f2f; }

.alert-list { display: grid; gap: 8px; }
.alert {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #999;
  background: #eee;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--amber); }
.alert.danger .dot { background: var(--red); }
.alert.success .dot { background: var(--green); }
.alert strong { display: block; font-size: 13px; }
.alert span, .alert time { color: #666; font-size: 12px; }

.merchant-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px;
  margin-bottom: 10px;
  background: #ffecb3;
}
.merchant-banner h3, .merchant-banner p { margin: 0; }
.merchant-banner h3 { font-size: 20px; margin-top: 4px; }
#merchantBadge {
  display: inline-block;
  color: #fff;
  background: #333;
  padding: 4px 7px;
  font-size: 11px;
  font-weight: 700;
}
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-list { display: grid; gap: 8px; }
.chat-card {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #999;
  background: #f5f5f5;
}
.chat-card strong { display: block; }
.chat-card p { margin: 2px 0 0; color: #666; font-size: 13px; }
.reference-chat-list .chat-card {
  width: 100%;
  min-height: 52px;
  border-radius: 0;
  color: #000;
  text-align: left;
}
.reference-chat-list .chat-card:hover { background: #eee; }
.reference-chat-list .chat-card.unread { background: #fff8e1; }
.reply-messages {
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid #ccc;
  background: #fff;
}
.chat-panel {
  height: calc(100vh - 118px);
  min-height: 460px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.live-chat-admin {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #999;
}
.chat-inbox {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid #999;
  background: #f5f5f5;
}
.chat-inbox-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #ccc;
  border-radius: 0;
  background: #fff;
  color: #000;
  text-align: left;
}
.chat-inbox-item:hover,
.chat-inbox-item.active { background: #bbdefb; }
.chat-inbox-item.pinned {
  background: #fff8d5;
  border-left: 4px solid var(--admin-theme);
}
.chat-inbox-item.pinned.active { background: #d7ecff; }
.chat-inbox-item strong,
.chat-inbox-item span,
.chat-inbox-item small { min-width: 0; }
.chat-name-link,
.chat-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  border: 0;
  background: transparent;
  color: #1b4f9c;
  padding: 0;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}
.chat-profile-link .fa,
.chat-name-link .fa { color: #000; }
.chat-open {
  min-width: 0;
  display: grid;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #000;
  padding: 10px;
  text-align: left;
}
.chat-inbox-meta {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 5px;
  padding: 8px;
}
.chat-inbox-item p {
  margin: 2px 0 0;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unread-badge {
  min-width: 20px;
  min-height: 20px;
  padding: 2px 5px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  text-align: center;
}
.chat-thread {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #fff;
}
.chat-thread-head {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #999;
  background: #fafafa;
}
.chat-thread-head strong { display: block; }
.chat-thread-head span { color: #666; font-size: 12px; }
.chat-thread-head .chat-profile-link {
  display: flex;
  margin-bottom: 2px;
  font-size: 14px;
}
.chat-messages {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  background: #f7f7f7;
}
.chat-bubble {
  width: fit-content;
  max-width: min(680px, 78%);
  margin-bottom: 10px;
  padding: 9px 11px;
  border: 1px solid #c8c8c8;
  background: #fff;
}
.chat-bubble.admin {
  margin-left: auto;
  background: #eaf7e7;
  border-color: #b8d7b2;
}
.chat-bubble small {
  display: block;
  margin-top: 4px;
  color: #666;
  font-size: 11px;
}
.chat-bubble .bubble-name {
  display: flex;
  margin-bottom: 3px;
  color: #000;
  text-decoration: none;
}
.chat-bubble .bubble-name:hover { text-decoration: underline; }
.chat-attachments {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}
.chat-attachment {
  display: inline-grid;
  gap: 4px;
  color: #000;
  text-decoration: none;
  font-size: 12px;
}
.chat-attachment img {
  max-width: 180px;
  max-height: 150px;
  border: 1px solid #bbb;
  object-fit: contain;
  background: #fff;
}
.chat-reply {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #999;
  background: #fff;
}
.chat-tool-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.template-wrap { position: relative; }
.fast-template-list {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: min(420px, calc(100vw - 40px));
  max-height: 280px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #999;
  background: #fff;
  box-shadow: 3px 3px 10px rgba(0,0,0,.22);
  z-index: 5;
}
.template-btn,
.pin-btn,
.attach-btn,
.template-toggle {
  min-height: 26px;
  border: 1px solid #aaa;
  border-radius: 0;
  background: #eee;
  color: #000;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}
.template-btn:hover,
.pin-btn:hover,
.attach-btn:hover,
.template-toggle:hover { background: #ddd; }
.pin-btn.active { background: var(--admin-theme); }
.template-btn {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: auto;
  text-align: left;
  background: #f7f7f7;
}
.template-btn strong { font-size: 12px; }
.template-btn span {
  color: #555;
  font-weight: 400;
  white-space: normal;
  line-height: 1.35;
}
.template-btn.add { color: #008000; text-align: center; }
.template-edit-row {
  display: grid;
  gap: 6px;
}
#template {
  height: calc(100vh - 84px);
  overflow: hidden;
  padding: 0;
}
.template-manager {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  min-height: calc(100vh - 120px);
  height: 100%;
  border-top: 1px solid #999;
  background: #fff;
}
.template-left {
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid #999;
  background: #eee;
}
#templateKeys {
  display: grid;
  align-content: start;
  padding-top: 5px;
}
.template-key {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 0;
  padding: 6px 10px;
  background: transparent;
  color: #000;
  font-size: 13px;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.template-key:hover,
.template-key.selected { background: #ccc; }
.template-key.new {
  width: calc(100% - 20px);
  margin: 5px 10px 10px;
  border: 1px solid #f57c00;
  border-radius: 4px;
  background: #ff9800;
  color: #fff;
  font-weight: 700;
  text-align: center;
}
.template-key.new.selected { background: #f57c00; }
.template-right {
  min-width: 0;
  padding: 10px;
  overflow: auto;
  background: #fff;
}
.template-right input,
.template-right textarea {
  max-width: 780px;
  border-radius: 0;
}
.template-right textarea {
  height: 300px;
  min-height: 300px;
  margin-top: 10px;
  line-height: 1.45;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
}
.template-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.template-actions .primary-btn,
.template-actions .danger-btn {
  width: 100px;
  border-radius: 0;
}
.template-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.chat-reply-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.chat-reply-row .primary-btn {
  min-width: 76px;
  background: var(--green);
}
.attach-btn {
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.attach-btn input { display: none; }
.attachment-name {
  min-height: 16px;
  color: #555;
  font-size: 12px;
}
.chat-empty {
  padding: 18px;
  color: #666;
}
.report-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tab { background: #ddd; border-color: #bbb; }
.tab.active { background: var(--blue); color: #fff; }
.transaction-panel {
  min-height: calc(100vh - 120px);
  background: #ffefb3;
  border: 1px solid #999;
  color: #000;
}
.tx-filter-grid {
  display: grid;
  gap: 10px;
  padding: 10px;
}
.tx-filter-grid label {
  display: grid;
  grid-template-columns: 72px 8px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: #000;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
}
.tx-filter-grid label::after {
  content: ":";
  grid-column: 2;
  grid-row: 1;
}
.tx-filter-grid label > input,
.tx-filter-grid label > select,
.tx-filter-grid label > .inline-inputs {
  grid-column: 3;
  grid-row: 1;
}
.inline-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.tx-filter-grid input,
.tx-filter-grid select {
  border-radius: 0;
  min-height: 30px;
  border-color: #999;
  background: #fff;
}
.tx-filter-grid .primary-btn {
  width: 100%;
  border-radius: 4px;
  background: #5cb85c;
}
.tx-summary {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 10px 10px;
}
.link-btn {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #00f;
  font-size: 12px;
}
.tx-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  background: #222;
  color: #fff;
  font-weight: 700;
}
.tx-list-head span { padding: 9px; }
.tx-list {
  max-height: calc(100vh - 438px);
  min-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
}
.tx-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  border-bottom: 1px solid #ccc;
  background: #fff;
}
.tx-card.selected {
  background: #ffefb3;
}
.tx-main {
  min-width: 0;
  padding: 8px;
  border-right: 1px solid #ccc;
  line-height: 1.45;
}
.tx-member {
  display: block;
  color: #2454d6;
  font-weight: 700;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-type {
  display: inline-block;
  padding: 3px 5px;
  color: #fff;
  font-weight: 700;
}
.tx-type.withdraw { background: #ff5722; }
.tx-type.deposit { background: #2e7d32; }
.tx-type.manual { background: #555; }
.copy-btn {
  border: 0;
  border-radius: 2px;
  background: #435bd6;
  color: #fff;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
}
.slip-link {
  display: inline-block;
  margin-top: 5px;
  color: #00f;
  font-weight: 700;
}
.ccid-badge {
  display: inline-block;
  margin-top: 5px;
  padding: 3px 6px;
  border: 1px solid #999;
  background: #fff;
  font-weight: 700;
}
.ccid-badge.blacklisted {
  border-color: #e53935;
  background: #ffe5e5;
  color: #b00020;
}
.ccid-badge.clear {
  border-color: #43a047;
  background: #e8f5e9;
  color: #1b5e20;
}
.tx-action {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 9px;
}
.process-btn {
  width: 100px;
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  background: #5cb85c;
  color: #fff;
  font-weight: 700;
}
.tx-empty { padding: 18px; color: #666; }
.banktx-panel {
  background: #fff1b8;
  border: 1px solid #999;
  min-height: calc(100vh - 108px);
  overflow: hidden;
}
.banktx-toolbar {
  display: grid;
  grid-template-columns: 120px 120px 120px minmax(180px, 1fr) 110px;
  gap: 5px;
  padding: 6px;
  align-items: center;
}
.banktx-toolbar input,
.banktx-toolbar select {
  min-height: 31px;
  border-radius: 0;
}
.banktx-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px 6px;
}
.banktx-tabs button {
  max-width: 196px;
  min-height: 31px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #777;
  border-radius: 0;
  background: #e7e7e7;
  padding: 5px 8px;
  color: #000;
}
.banktx-tabs button.active {
  background: #009688;
  color: #fff;
}
.banktx-summary {
  display: grid;
  grid-template-columns: 96px 100px 96px 100px 96px 100px;
  width: max-content;
  border-top: 1px solid #222;
  border-bottom: 1px solid #222;
  background: #16b7c8;
}
.banktx-summary span,
.banktx-summary strong {
  min-height: 28px;
  padding: 6px;
  border-right: 1px solid #222;
}
.banktx-summary strong {
  background: #fff;
}
.banktx-table-wrap {
  max-height: calc(100vh - 274px);
  overflow: auto;
  background: #fff;
}
.banktx-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}
.banktx-table th {
  background: #3f51b5;
  color: #fff;
  text-align: left;
}
.banktx-table th,
.banktx-table td {
  border: 1px solid #222;
  padding: 6px;
  vertical-align: top;
}
.banktx-table tr.matched td {
  background: #eee;
}
.banktx-id-input {
  width: 100%;
  min-width: 110px;
  min-height: 26px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 3px 4px;
  color: #000;
}
.banktx-id-input:focus {
  background: #fffbe0;
  outline: 2px solid #3f51b5;
  box-shadow: none;
}
#handleTxDialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}
.tx-handle-form {
  width: 100%;
  box-sizing: border-box;
}
.tx-handle-form h3 {
  margin: 0;
  color: #f44336;
  border-bottom: 2px solid #f44336;
  padding-bottom: 10px;
}
.tx-handle-form .dialog-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  background: #fff;
}
.tx-handle-form .dialog-actions button {
  width: 100%;
  min-width: 0;
}
.handle-fields {
  display: grid;
  gap: 9px;
}
.handle-fields label {
  display: grid;
  grid-template-columns: 140px 10px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  color: #111;
  font-size: 14px;
  font-weight: 700;
  text-transform: none;
}
.handle-fields label::after {
  content: ":";
  grid-column: 2;
  grid-row: 1;
}
.handle-fields label > input,
.handle-fields label > select,
.handle-fields label > span {
  grid-column: 3;
  grid-row: 1;
}
.handle-fields input,
.handle-fields select {
  border-radius: 0;
  min-height: 32px;
  min-width: 0;
  width: 100%;
}
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex-wrap: wrap;
  font-weight: 400;
}
.checkbox-line input {
  width: auto;
  min-height: auto;
}
.ccid-inline {
  display: inline-grid;
  gap: 2px;
  padding: 4px 6px;
  border: 1px solid #aaa;
  background: #f7f7f7;
  font-weight: 700;
}
.ccid-inline small {
  font-weight: 400;
  color: #555;
}
.ccid-inline.blacklisted {
  border-color: #e53935;
  background: #ffe5e5;
  color: #b00020;
}
.ccid-inline.clear {
  border-color: #43a047;
  background: #e8f5e9;
  color: #1b5e20;
}
.ccid-inline.pending {
  color: #666;
}
.slip-input {
  display: grid;
  gap: 5px;
}
.existing-slips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.existing-slips a { color: #00f; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.settings-grid article {
  display: grid;
  gap: 10px;
  align-content: start;
  background: #eee;
  border: 1px solid #999;
  padding: 10px;
}
.settings-grid h4 { margin: 0; font-size: 14px; color: #000; }
.note { margin: 0; line-height: 1.6; color: #444; }

dialog {
  border: 1px solid #999;
  border-radius: 0;
  padding: 0;
  box-shadow: 3px 3px 10px rgba(0,0,0,.5);
  width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-form { padding: 15px; }
.dialog-form h3 { margin: 0 0 4px; color: var(--blue); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.frontend-dialog { width: min(430px, calc(100vw - 32px)); }
#profileDialog {
  width: min(880px, calc(100vw - 24px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
  box-sizing: border-box;
}
.profile-dialog {
  width: 100%;
  max-height: calc(100vh - 36px);
  overflow: hidden;
  box-sizing: border-box;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}
.profile-dialog .dialog-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 10px;
}
.profile-dialog h3,
.profile-dialog p { margin: 0; }
.profile-dialog p { color: #666; font-size: 12px; }
.profile-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 82px;
  overflow-y: auto;
  padding-bottom: 2px;
}
.profile-menu button {
  min-height: 28px;
  border: 1px solid #999;
  border-radius: 0;
  background: #eee;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}
.profile-menu button.active {
  background: #333;
  color: #fff;
}
.profile-body {
  min-height: 250px;
  overflow: auto;
  border: 1px solid #999;
  background: #fff;
}
.profile-scroll {
  max-height: 410px;
  overflow: auto;
}
.profile-table {
  width: 100%;
  border-collapse: collapse;
}
.profile-table th,
.profile-table td {
  padding: 7px;
  border: 1px solid #999;
  text-align: left;
  vertical-align: top;
}
.profile-table th {
  background: #333;
  color: #fff;
}
.profile-table:not(.list) td:first-child {
  width: 130px;
  background: #eee;
  font-weight: 700;
}
.profile-empty {
  padding: 20px;
  color: #666;
}
.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}
.profile-tags span {
  border: 1px solid #999;
  background: #eee;
  padding: 6px 10px;
  font-weight: 700;
}
.frontend-preview { background: #101820; color: white; min-height: 640px; }
.frontend-preview header { display: flex; align-items: center; justify-content: space-between; padding: 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.front-hero { padding: 28px 18px; background: linear-gradient(135deg, rgba(43,179,163,.42), rgba(23,107,135,.24)); }
.front-hero h3 { margin: 0 0 8px; font-size: 34px; }
.front-hero p { color: #dbe7ee; }
.front-primary { background: #2bb3a3; color: white; }
.front-games { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding: 14px; }
.front-game { min-height: 98px; border-radius: 8px; padding: 12px; background: rgba(255,255,255,.1); display: grid; align-content: end; }

@media (max-width: 1120px) {
  #header .user .clock { display: none; }
  .metrics-grid, .two-col, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  :root { --side-drawer-width: 200px; }
  .header-nav { overflow-x: auto; }
  .header-item { min-width: 64px; max-width: none; font-size: 22px; }
  .show-menu .content-style { right: 0; }
  #header .user { display: none; }
  .workspace-head { align-items: flex-start; }
  .filter-bar { grid-template-columns: 1fr; }
  .live-chat-admin { grid-template-columns: 1fr; }
  .chat-inbox { height: 180px; max-height: 180px; border-right: 0; border-bottom: 1px solid #999; }
  .chat-reply-row { grid-template-columns: 1fr; }
  .template-manager { grid-template-columns: 1fr; }
  .template-left { max-height: 220px; border-right: 0; border-bottom: 1px solid #999; }
  .banktx-toolbar { grid-template-columns: 1fr 1fr; }
  .banktx-toolbar #bankTxSearch,
  .banktx-toolbar #syncBankBtn { grid-column: 1 / -1; }
  .banktx-summary { grid-template-columns: 76px 92px; width: 100%; }
  .tx-list-head,
  .tx-card { grid-template-columns: 1fr; }
  .tx-main { border-right: 0; border-bottom: 1px solid #ccc; }
  .tx-list { max-height: none; }
  .handle-fields label,
  .tx-filter-grid label { grid-template-columns: 1fr; }
  .handle-fields label::after,
  .tx-filter-grid label::after { display: none; }
  .handle-fields label > input,
  .handle-fields label > select,
  .handle-fields label > span,
  .tx-filter-grid label > input,
  .tx-filter-grid label > select,
  .tx-filter-grid label > .inline-inputs {
    grid-column: 1;
    grid-row: auto;
  }
  .view { padding: 8px; }
  #template { padding: 0; }
  .merchant-banner { align-items: flex-start; flex-direction: column; }
}
