.form-grid select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #3b4555;
  background: #0e1218;
  color: #fff;
  outline: none;
}

.topbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.environment-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #c6cfdb;
  font-size: 13px;
}
.environment-switch select {
  border: 1px solid #c79b36;
  background: #18130a;
  color: #ffd97b;
  padding: 7px 30px 7px 10px;
}
.environment-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #b73b3b;
  background: #3b1010;
  color: #ffb1b1;
  font-weight: 700;
}
.environment-test .topbar {
  box-shadow: inset 0 -3px 0 #ffb020;
}
.environment-test .environment-badge {
  border-color: #d7921e;
  background: #3a2806;
  color: #ffe08a;
}
.environment-test .environment-switch select {
  border-color: #ffb020;
  background: #2b1d04;
  color: #ffe08a;
}

.form-grid select:focus {
  border-color: var(--gold);
}

.form-grid small,
.field-note {
  color: var(--muted);
  font-size: 12px;
}

.field-note { margin: 0; }
.target-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.target-actions button { width: auto; }
.grant-builder { display: grid; gap: 14px; }
.grant-builder h3 { margin: 6px 0 0; }
.grant-builder > label { display: grid; gap: 7px; color: #c6cfdb; font-size: 14px; }
.grant-builder > label select,
.account-import textarea {
  width: 100%;
  border: 1px solid #3b4555;
  background: #0e1218;
  color: #fff;
  padding: 10px 12px;
}
.account-import {
  display: grid;
  grid-template-columns: minmax(280px,1fr) auto;
  gap: 10px;
  align-items: end;
}
.account-import label { display: grid; gap: 7px; color: #c6cfdb; font-size: 14px; }
.account-import button { width: auto; }
.compact-result { margin: 0; min-height: 0; white-space: pre-wrap; }
.reclaim-mode .grant-quantity,
.reclaim-mode .grant-copies { opacity: .45; cursor: not-allowed; }
.repeater-list { display: grid; gap: 12px; }
.repeater-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(190px, 1fr) minmax(110px, .55fr) minmax(110px, .55fr) auto;
  gap: 10px;
  align-items: start;
  padding: 14px;
  border: 1px solid #3b4555;
  background: #0e1218;
}
.target-repeater-row { grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr) auto; }
.repeater-row label { display: grid; gap: 7px; color: #c6cfdb; font-size: 14px; min-width: 0; }
.repeater-row input { width: 100%; background: #0e1218; color: #fff; border: 1px solid #3b4555; padding: 10px 12px; outline: none; }
.repeater-row input:focus { border-color: var(--gold); }
.repeater-row small { color: var(--muted); font-size: 12px; min-height: 16px; }
.remove-repeater-row { width: 38px; height: 38px; padding: 0; margin-top: 22px; }
.target-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #3b4555;
  background: #0e1218;
}
.target-list p {
  margin: 0;
  color: var(--muted);
}
.target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #29313d;
}
.target-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.target-row button {
  width: auto;
  flex: 0 0 auto;
}
.autocomplete { position: relative; display: block; }
.suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  background: #10151d;
  border: 1px solid #556174;
  box-shadow: 0 12px 30px #000a;
}
.suggestions button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid #29313d;
  background: transparent;
  text-align: left;
}
.suggestions button:hover { background: #252d39; }
.suggestions button span,
.suggestions em { color: var(--muted); font-size: 12px; }
.suggestions em { display: block; padding: 12px; }

.compact-form {
  align-content: start;
}

.actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

#playerPanel,
#characterPanel {
  margin-top: 16px;
}
.history-search { grid-template-columns: minmax(260px,1fr) 150px auto auto; }
.history-search select {
  background: #0e1218;
  color: #fff;
  border: 1px solid #3b4555;
  padding: 10px 12px;
}
td small { display: block; margin-top: 3px; color: var(--muted); }
.status { display: inline-block; min-width: 42px; text-align: center; padding: 3px 6px; border: 1px solid #556174; }
.status.success { color: #80d5aa; border-color: #327c5c; }
.status.failed { color: #ff8d92; border-color: #8d4145; }
.status.warning { min-width: 72px; color: #ffd36b; border-color: #99752c; }
.status.offline { color: #ff8d92; border-color: #8d4145; }
.signal { display: inline-block; min-width: 38px; text-align: center; font-size: 12px; }
.signal.on { color: #80d5aa; }
.signal.off { color: var(--muted); }
.online-row { background: rgba(50,124,92,.12); }
.offline-row { background: rgba(141,65,69,.06); }
.suspect-row { background: rgba(153,117,44,.09); }
.player-status-head { margin-top: 22px; }
.online-player-list { max-height: 560px; overflow: auto; }
.audit-safety-note {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #99752c;
  color: #ffd36b;
  background: rgba(153,117,44,.09);
}
.audit-search {
  display: grid;
  grid-template-columns: minmax(260px,2fr) repeat(5,minmax(110px,.7fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.audit-search label { display: grid; gap: 7px; color: #c6cfdb; font-size: 14px; }
.audit-search input,
.audit-search select {
  width: 100%;
  border: 1px solid #3b4555;
  background: #0e1218;
  color: #fff;
  padding: 10px 12px;
}
.audit-table-wrap { max-height: 620px; overflow: auto; }
.audit-table-wrap th { position: sticky; top: 0; z-index: 1; background: #18202c; }
.shop-listing {
  display: grid;
  grid-template-columns: minmax(260px,1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.shop-listing-title { grid-column: 1 / -1; }
.shop-listing-title h3 { margin: 0 0 5px; }
.shop-listing-title p { margin: 0; color: var(--muted); }
.shop-listing label,
.shop-listing-row label {
  display: grid;
  gap: 7px;
  color: #c6cfdb;
  font-size: 14px;
}
.shop-listing input,
.shop-listing select,
.shop-listing-row input,
.shop-listing-row select {
  width: 100%;
  min-width: 78px;
  background: #0e1218;
  color: #fff;
  border: 1px solid #3b4555;
  padding: 9px 10px;
}
.shop-listing-rows { grid-column: 1 / -1; display: grid; gap: 10px; }
.shop-listing-row {
  display: grid;
  grid-template-columns: minmax(220px,1.4fr) 130px 105px 100px 160px 155px 110px auto;
  gap: 9px;
  align-items: end;
  border: 1px solid #354052;
  background: rgba(9,13,19,.55);
  padding: 10px;
}
.shop-listing-row .remove-shop-listing-row { width: auto; white-space: nowrap; }
.shop-listing-actions { display: flex; align-items: center; gap: 10px; }
.shop-listing-actions button { width: auto; }
.shop-listing-reason { min-width: 260px; }
.shop-search {
  display: grid;
  grid-template-columns: minmax(240px,1.5fr) 150px 190px 150px 130px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.shop-search label,
.shop-batch label {
  display: grid;
  gap: 7px;
  color: #c6cfdb;
  font-size: 14px;
}
.shop-search input,
.shop-search select,
.shop-batch input,
.shop-table input,
.shop-table select {
  width: 100%;
  min-width: 78px;
  background: #0e1218;
  color: #fff;
  border: 1px solid #3b4555;
  padding: 9px 10px;
}
.shop-batch {
  display: grid;
  grid-template-columns: auto minmax(280px,1fr) 150px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}
.shop-batch > strong { align-self: center; white-space: nowrap; }
.shop-batch-actions { display: flex; gap: 8px; }
.shop-batch-actions button { width: auto; white-space: nowrap; }
.shop-table-wrap { margin-top: 10px; }
.shop-table { min-width: 1320px; }
.shop-table th:first-child,
.shop-table td:first-child { width: 42px; text-align: center; }
.shop-table td:nth-child(4) { min-width: 220px; }
.shop-table .shop-save { width: auto; white-space: nowrap; }
.shop-hidden-row { opacity: .66; }
.shop-unsafe { color: #ff8d92; font-weight: 700; }
@media(max-width:900px){.repeater-row,.target-repeater-row,.account-import{grid-template-columns:1fr}.remove-repeater-row{margin-top:0;width:100%}}
@media(max-width:900px){.history-search{grid-template-columns:1fr}}
@media(max-width:1450px){.shop-listing-row{grid-template-columns:repeat(4,minmax(0,1fr))}.shop-listing-row .remove-shop-listing-row{width:100%}}
@media(max-width:1100px){.shop-search,.shop-batch{grid-template-columns:1fr}.shop-batch-actions{flex-wrap:wrap}}
@media(max-width:760px){.shop-listing,.shop-listing-row{grid-template-columns:1fr}.shop-listing-title,.shop-listing-reason,.shop-listing-rows{grid-column:auto}}
.lottery-admin-layout{display:grid;grid-template-columns:240px minmax(0,1fr);gap:16px}.lottery-pool-list{border-right:1px solid #34404e;padding-right:14px}.lottery-pool-list>button,.lottery-pool-list div button{display:block;width:100%;margin-bottom:8px;text-align:left}.lottery-fields textarea{width:100%;resize:vertical}.lottery-reward-head,.lottery-reward-row{display:grid;grid-template-columns:minmax(210px,.8fr) minmax(280px,1fr) 100px 120px 80px 44px;gap:8px;align-items:start}.lottery-reward-head{padding:8px 0;color:#9eabbc;font-size:13px}.lottery-reward-row{margin:8px 0}.lottery-reward-row input{width:100%;min-width:0}.lottery-item-picker{position:relative}.lottery-item-picker small{display:block;min-height:18px;padding:3px 2px 0;color:#d9c27a}.lottery-suggestions{position:absolute;z-index:20;top:44px;left:0;right:0;max-height:260px;overflow:auto;border:1px solid #596677;background:#10161f;box-shadow:0 10px 24px rgba(0,0,0,.5)}.lottery-suggestions button{display:block;width:100%;border:0;border-bottom:1px solid #303946;text-align:left;background:#171e28}.lottery-pity{display:flex;align-items:center;gap:6px;padding:10px 2px}.lottery-pity input{width:auto}.lottery-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}.badge.ok{border-color:#2d9b68;color:#83e0ae}.badge.warn{border-color:#b9822a;color:#f2c66d}@media(max-width:1100px){.lottery-reward-head{display:none}.lottery-reward-row{grid-template-columns:1fr 1fr 90px 100px}.lottery-pity,.lottery-remove{align-self:center}}@media(max-width:900px){.lottery-admin-layout{grid-template-columns:1fr}.lottery-pool-list{border:0;padding:0}.lottery-reward-row{grid-template-columns:1fr 1fr}.lottery-item-picker{grid-column:auto}}@media(max-width:560px){.lottery-reward-row{grid-template-columns:1fr}.lottery-pity,.lottery-remove{align-self:center}}
.lottery-pity-toggle span:last-child{display:flex;align-items:center;gap:8px;min-height:42px}.lottery-pity-toggle input{width:auto}
.lottery-formal-preview{width:100%;aspect-ratio:16/9;overflow:hidden;border:1px solid #3b4555;background:#080b10}
.lottery-formal-preview iframe{display:block;width:100%;height:100%;border:0;background:#080b10}
.lottery-banner-preview>img{position:absolute;inset:0;z-index:-2;display:block;width:100%;height:100%;object-fit:fill}
.lottery-banner-preview>#lotteryBannerPreviewEmpty{position:absolute;z-index:-1;color:#8d99aa;font-size:14px}
.lottery-banner-preview [hidden]{display:none}
.lottery-preview-copy{position:absolute;top:4%;right:4%;z-index:1;max-width:38%;text-align:right;color:#fff;text-shadow:0 2px 4px #000}
.lottery-preview-copy strong{display:block;font-size:clamp(14px,2vw,26px)}
.lottery-preview-copy p{margin:5px 0 0;white-space:pre-wrap;font-size:clamp(10px,1.15vw,16px);line-height:1.4}
.lottery-preview-machine{position:absolute;top:20%;left:14%;width:72%;color:#fff}
.lottery-preview-reel{position:relative;height:clamp(60px,10vw,118px);overflow:hidden;border:2px solid #202733;background:rgba(9,11,15,.94);display:flex;align-items:center}
.lottery-preview-reel i{position:absolute;left:50%;top:0;bottom:0;width:3px;background:#e53935;z-index:2}
.lottery-preview-reel div{flex:0 0 31%;height:76%;margin:0 1%;border:1px solid #5a6675;background:#202733;display:grid;place-items:center;text-align:center;font-size:clamp(10px,1.1vw,15px)}
.lottery-preview-status{display:flex;justify-content:space-between;gap:8px;padding:1.2% 0;color:#fff;text-shadow:0 1px 3px #000;font-size:clamp(9px,1.05vw,14px)}
.lottery-preview-actions{display:flex;flex-direction:column;align-items:center;gap:3px;margin-top:9%}
.lottery-preview-actions button{min-width:clamp(88px,12vw,130px);padding:clamp(6px,.8vw,10px);background:#8b1f24;font-size:clamp(11px,1.3vw,18px);pointer-events:none}
.lottery-preview-actions span{color:#fff;text-shadow:0 1px 3px #000;font-size:clamp(10px,1.1vw,15px)}
.online-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  border: 1px solid #344054;
  background: #101722;
  padding: 18px;
}

.metric span {
  display: block;
  color: #9fb0c7;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  color: #f5f7fb;
  font-size: 28px;
}

.ghost-panel {
  max-width: 900px;
}

.ghost-panel > .danger {
  margin-top: 12px;
}

@media (max-width: 720px) {
  .online-metrics {
    grid-template-columns: 1fr;
  }
  .audit-search { grid-template-columns: 1fr; }
}
.local-icon-import {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-top: 12px;
}

.local-icon-import p {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}
.lottery-reward-head,.lottery-reward-row{grid-template-columns:minmax(210px,.8fr) minmax(280px,1fr) 100px 120px 80px 90px 44px}
.lottery-prize-tier{width:100%;min-width:0}
.announcement-form textarea{width:100%;resize:vertical}
.announcement-table .announcement-message{min-width:320px;max-width:640px;white-space:pre-wrap;overflow-wrap:anywhere}
.announcement-table .cancel-announcement{width:auto;white-space:nowrap}
.announcement-stage{position:relative;aspect-ratio:4/3;max-width:1024px;max-height:520px;background:linear-gradient(145deg,#09111a,#182433);border:1px solid #44566b;overflow:hidden}
.announcement-preview{position:absolute;left:0;top:0;width:40%;aspect-ratio:1024/128;background:linear-gradient(90deg,#101722,#1c2b3b,#101722);background-size:cover;background-position:center;border:1px solid #44566b;display:flex;align-items:center;justify-content:center;overflow:hidden;color:#fff;font-size:18px;font-weight:700;text-align:center;text-shadow:0 1px 3px #000;padding:6px}
.announcement-preview::after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(0,0,0,.35),rgba(0,0,0,.08),rgba(0,0,0,.35));pointer-events:none}
.announcement-preview span{position:relative;z-index:1;white-space:pre-wrap}
.announcement-thumb{width:128px;height:32px;object-fit:cover;border:1px solid #44566b}
.announcement-colors{display:grid;grid-template-columns:repeat(5,minmax(90px,1fr));gap:10px}
.announcement-colors label{display:flex;align-items:center;justify-content:space-between;gap:8px}
.announcement-colors input[type=color]{width:48px;height:34px;padding:2px}
