:root {
  --teal: #16b6a5;
  --teal-dark: #10a394;
  --ink: #263238;
  --muted: #84929a;
  --line: #e8edef;
  --bg: #f4f7f8;
  --panel: #fff;
  --nav: #26343b;
  --nav-text: #aebbc0;
  --shadow: 0 2px 12px rgba(45, 65, 72, .08);
}

* { box-sizing: border-box; }
html, body, #admin-app { min-height: 100%; margin: 0; }
body {
  color: var(--ink);
  background: var(--bg);
  font: 13px/1.5 "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; z-index: 5; inset: 0 auto 0 0;
  width: 264px; overflow-y: auto; color: var(--nav-text); background: var(--nav);
}
.brand {
  display: flex; align-items: center; justify-content: center;
  height: 104px; padding: 9px 14px; overflow: hidden; color: #fff;
  background: #1f2028; font-size: 15px; font-weight: 700; white-space: nowrap;
}
.brand img { display: block; width: 100%; height: 86px; object-fit: contain; }
.brand small { display: block; color: rgba(255,255,255,.75); font-size: 10px; font-weight: 400; }
.nav-group { border-bottom: 1px solid rgba(255,255,255,.035); }
.nav-title {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 67px; padding: 0 22px 0 48px; color: #e4ebed; cursor: pointer;
  font-size: 22px;
}
.nav-title .icon { width: 28px; margin-right: 34px; color: #c1cccf; text-align: center; font-size: 22px; }
.nav-title span:nth-of-type(2) { flex: 1; }
.nav-title .chevron { font-size: 20px; transition: transform .2s; }
.nav-group.closed .chevron { transform: rotate(-90deg); }
.nav-items { padding: 0 0 7px; }
.nav-group.closed .nav-items { display: none; }
.nav-item {
  display: block; min-height: 48px; padding: 11px 12px 11px 108px;
  color: var(--nav-text); cursor: pointer; white-space: nowrap; font-size: 18px;
}
.nav-item:hover, .nav-item.active { color: #fff; background: rgba(22,182,165,.18); }

.main { display: flex; flex: 1; flex-direction: column; min-width: 0; margin-left: 264px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 34px; padding: 0 18px; background: #fff; border-bottom: 1px solid var(--line);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 18px; }
.hamburger { color: #859297; font-size: 17px; }
.top-link { color: #8b979b; }
.top-action { cursor: pointer; }
.top-action:hover { color: var(--teal-dark); }
.user { display: flex; align-items: center; gap: 6px; color: #7d888c; }
.avatar {
  display: grid; width: 26px; height: 26px; place-items: center;
  border-radius: 50%; color: #fff; background: #a8b4b6; font-size: 12px;
}
.top-popover {
  position: fixed; z-index: 15; top: 43px; right: 18px; width: 300px;
  padding: 13px; color: #66747a; background: #fff; border: 1px solid var(--line);
  border-radius: 3px; box-shadow: 0 5px 18px rgba(45, 65, 72, .16);
}
.top-popover-title { padding-bottom: 9px; color: #536168; font-size: 14px; border-bottom: 1px solid var(--line); }
.top-popover-row { display: flex; align-items: center; gap: 8px; padding: 14px 0; }
.top-popover-link { width: 100%; }
.top-recharge-hint { padding: 12px 0 4px; color: #9ba6aa; }
.top-recharge-row { display: flex; align-items: center; gap: 9px; padding: 10px 0; }
.top-recharge-row label { white-space: nowrap; }
.top-recharge-row input { flex: 1; }
.top-popover-actions { display: flex; justify-content: flex-end; padding-top: 6px; }
.top-user-name { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); color: #536168; }
.top-menu-item { display: block; width: 100%; padding: 10px 4px; color: #66747a; background: #fff; border: 0; border-bottom: 1px solid var(--line); text-align: left; }
.top-menu-item:last-child { border-bottom: 0; }
.top-menu-item:hover { color: var(--teal-dark); }
.tabs {
  display: flex; align-items: stretch; height: 34px; overflow-x: auto;
  background: #fff; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tab { padding: 8px 12px; color: #66747a; border-bottom: 2px solid transparent; cursor: pointer; }
.tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.tab .close { margin-left: 7px; color: #a5afb2; }
.content { flex: 1; padding: 10px; }
.panel { background: var(--panel); border: 1px solid #eef1f2; border-radius: 2px; box-shadow: var(--shadow); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 47px; padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.welcome-panel { margin: 0; }
.welcome-row {
  min-height: 39px; padding: 11px 14px; border-bottom: 1px solid var(--line);
  color: #657278;
}
.welcome-row strong { color: #ef5d35; font-weight: 600; }
.panel-title { color: #536168; font-size: 13px; }
.panel-help { color: #9ba6aa; font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 12px 14px 4px; }
.field { display: flex; align-items: center; gap: 7px; color: #6e7a80; }
input, select, textarea {
  min-width: 0; height: 31px; padding: 5px 10px; color: #657278;
  background: #fff; border: 1px solid #dfe6e8; border-radius: 2px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #6ccfc4; box-shadow: 0 0 0 2px rgba(22,182,165,.08); }
textarea { height: 74px; resize: vertical; }
.input-sm { width: 120px; }
.input-md { width: 180px; }
.input-wide { flex: 1; min-width: 220px; }
.btn {
  min-width: 47px; height: 31px; padding: 4px 13px; color: #fff;
  background: var(--teal); border: 1px solid var(--teal); border-radius: 3px;
}
.btn:hover { background: var(--teal-dark); }
.btn.gray { color: #657278; background: #fff; border-color: #dfe6e8; }
.btn.red { background: #f36d76; border-color: #f36d76; }
.btn.green { background: #58c676; border-color: #58c676; }
.btn.warn { background: #f5a623; border-color: #f5a623; }
.btn + .btn { margin-left: 5px; }
.table-wrap { overflow-x: auto; padding: 8px 12px 0; }
table { width: 100%; min-width: 650px; border-collapse: collapse; color: #68757a; }
th, td { height: 38px; padding: 7px 9px; border: 1px solid var(--line); text-align: center; white-space: nowrap; }
th { color: #69777c; background: #fff; font-weight: 600; }
tbody tr:hover { background: #fbfdfd; }
.banner-table { min-width: 980px; }
.banner-thumb { display: block; width: 165px; height: 70px; margin: auto; object-fit: cover; background: #f3f5f5; }
.banner-url { max-width: 310px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.notice-table { min-width: 980px; }
.notice-content-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.empty { height: 76px; color: #aab3b6; }
.status {
  display: inline-block; padding: 2px 7px; border-radius: 3px;
  color: #46a85a; background: #edf9ee; font-size: 12px;
}
.status.off { color: #a0a7aa; background: #f3f4f4; }
.status.pending { color: #d98b19; background: #fff7e6; }
.status.danger { color: #df6262; background: #fff0f0; }
.pagination {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 14px; color: #7f8b90;
}
.page-btn { padding: 2px 8px; border: 1px solid var(--line); background: #fff; color: #7d898d; }
.page-current { color: var(--teal-dark); font-weight: 700; }

.form-panel { max-width: 100%; padding: 13px; }
.form-row { display: flex; align-items: center; min-height: 39px; }
.form-label { width: 75px; color: #68757a; text-align: right; margin-right: 10px; }
.form-row input, .form-row select { flex: 1; }
.form-actions { padding: 10px 0 0; margin-left: 85px; }
.balance-card { max-width: 520px; padding: 15px 20px; }
.balance-card h3 { margin: 0 0 22px; font-size: 13px; font-weight: 400; }
.balance-line { display: flex; align-items: center; margin: 15px 0; font-size: 15px; }
.balance-line label { width: 120px; }
.balance-line strong { font-size: 16px; font-weight: 400; }

.modal-mask {
  position: fixed; z-index: 20; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.42);
}
.modal { width: min(560px, calc(100vw - 28px)); background: #fff; border-radius: 3px; box-shadow: 0 8px 30px rgba(0,0,0,.18); }
.modal-head { display: flex; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
.modal-close { color: #9aa4a7; cursor: pointer; font-size: 18px; }
.modal-body { padding: 14px 26px; }
.modal-row { display: flex; align-items: center; margin: 12px 0; }
.modal-row label { width: 145px; color: #68757a; text-align: right; margin-right: 10px; }
.modal-row input, .modal-row select, .modal-row textarea { flex: 1; }
.banner-preview { margin: 0 0 12px 155px; }
.banner-preview img { display: block; width: 220px; height: 94px; object-fit: cover; background: #f3f5f5; }
.notice-editor-row { align-items: flex-start; }
.notice-field[data-field="content"] { min-height: 110px; }
.balance-target { display: flex; justify-content: space-between; padding: 4px 0 14px; color: #68757a; }
.balance-target strong { color: var(--teal-dark); }
.detail-row { display: flex; min-height: 38px; align-items: center; border-bottom: 1px solid var(--line); }
.detail-row span { width: 145px; color: #8a969a; text-align: right; margin-right: 14px; }
.detail-row strong { color: #536168; font-weight: 400; word-break: break-all; }
.modal-foot { display: flex; justify-content: flex-end; padding: 10px 18px 16px; }
.notice { padding: 10px 14px; color: #e65a61; text-align: center; font-weight: 700; }
.toast {
  position: fixed; z-index: 30; top: 48px; left: 50%; transform: translateX(-50%);
  padding: 10px 22px; color: #fff; background: #26343b; border-radius: 3px;
  box-shadow: 0 4px 14px rgba(0,0,0,.16);
}
.toast.error { background: #df6262; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 12px; }
.metric { padding: 20px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.metric small { color: #89959a; }
.metric strong { display: block; margin-top: 7px; color: var(--teal-dark); font-size: 24px; font-weight: 400; }
.overview-panel .metric-grid { padding: 14px; }
.overview-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 14px 14px; color: #9ba6aa; font-size: 12px; }
.member-day-settings { max-width: 760px; }
.member-day-preview {
  margin: 14px;
  padding: 22px;
  color: #fff;
  background: linear-gradient(135deg, #27333a, #167f7c);
  border-radius: 4px;
  text-align: center;
}
.member-day-preview-title { font-size: 20px; font-weight: 600; }
.member-day-countdown { margin-top: 10px; color: #ffe28a; font-size: 22px; font-variant-numeric: tabular-nums; }
.member-day-preview-date { margin-top: 7px; color: rgba(255,255,255,.75); font-size: 12px; }
.member-day-hint { margin-left: 10px; color: #9ba6aa; font-size: 12px; }
.provider-config-panel { max-width: 760px; }
.provider-config-hint { margin: 2px 0 18px; padding: 10px 12px; color: #68757a; background: #f5f8f8; border-left: 3px solid var(--teal); }
.provider-status { margin: 14px 0 0 85px; color: #d98b19; font-size: 12px; }
.provider-status.is-ready { color: #46a85a; }
.game-config-table { min-width: 1380px; }
.game-launch-url { max-width: 220px; word-break: break-all; color: #68757a; }
.game-config-modal { max-width: 640px; }
.game-config-modal-hint, .game-config-modal-status { margin-bottom: 14px; color: #68757a; font-size: 12px; }
.game-config-modal-status { margin: 4px 0 0 105px; color: #46a85a; }
.game-category-table { min-width: 720px; }
.catalog-game-modal { max-width: 700px; }
.catalog-image-cell img { width: 54px; height: 40px; object-fit: cover; border-radius: 4px; }
.co-config-field { min-width: 360px; }
.co-config-panel { max-width: 820px; }
.co-accounts-table, .co-transfers-table, .co-bets-table { min-width: 980px; }
.co-transfer-username, .co-transfer-amount, .co-bet-username { min-width: 145px; }
.co-transfer-reason { min-width: 180px; }
.co-config-field + .status { margin-left: 8px; }
.sbt-events-table { min-width: 1040px; }
.sbt-event-modal { max-width: 760px; }
.sbt-event-modal .modal-body { max-height: 70vh; overflow-y: auto; }
.modal-section-title { margin: 16px 0 4px; padding-bottom: 5px; color: var(--teal-dark); border-bottom: 1px solid var(--line); font-weight: 700; }
.sbt-settings-bar .field { min-width: 150px; }
.payment-product-icon { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; border-radius: 50%; }

@media (max-width: 700px) {
  .sidebar { width: 58px; }
  .brand { height: 68px; padding: 4px; text-align: center; font-size: 0; }
  .brand::before { display: none; }
  .brand img { width: 50px; height: 60px; }
  .brand small, .nav-title span:not(.icon), .nav-title .chevron { display: none; }
  .nav-title { justify-content: center; padding: 0; }
  .nav-title .icon { margin: 0; }
  .nav-item { overflow: hidden; padding: 8px 0; text-align: center; text-indent: -999px; }
  .main { margin-left: 58px; }
  .topbar { padding: 0 10px; }
  .topbar-left .top-link { display: none; }
  .content { padding: 7px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .field { justify-content: space-between; }
  .field input, .field select { flex: 1; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { align-items: stretch; flex-direction: column; padding: 5px 0; }
  .co-config-field { min-width: 0; width: 100%; }
  .co-transfer-username, .co-transfer-amount, .co-bet-username, .co-transfer-reason { min-width: 0; width: 100%; }
  .sbt-settings-bar .field { min-width: 0; }
  .form-label { width: auto; margin: 0 0 4px; text-align: left; }
  .form-actions { margin-left: 0; }
}
