:root{
  --bg:#2a2d33;
  --panel:#0f1b33;
  --panel2:#0c1730;
  --text:#eaf0ff;
  --muted:#a9b7da;
  --line:rgba(255,255,255,.08);
  --primary:#4f8cff;
  --danger:#ff5c7a;
  --ok:#40d18b;
  --shadow: 0 18px 60px rgba(0,0,0,.45);
  --radius: 14px;
}

*{box-sizing:border-box}
.hidden{display:none !important}
html,body{height:100%}
body{
  margin:0;
  background: var(--bg);
  color:var(--text);
  font: 14px/1.35 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.app{max-width:1200px;margin:24px auto;padding:0 16px}

.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:16px 18px;border:1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand{display:flex;gap:12px;align-items:center}
.logo{
  width:44px;height:44px;border-radius:12px;
  display:grid;place-items:center;
  background: rgba(79,140,255,.18);
  border:1px solid rgba(79,140,255,.25);
  font-weight:800;letter-spacing:.5px;
}
.brand-title{font-weight:800;font-size:16px}
.brand-sub{color:var(--muted);font-size:12px;margin-top:2px}

.top-actions{display:flex;align-items:center;gap:10px}
.pill{
  padding:8px 10px;border-radius:999px;
  border:1px solid var(--line);
  color:var(--muted);
  background: rgba(255,255,255,.03);
}

.grid{
  margin-top:16px;
  display:grid;
  grid-template-columns: 380px 1fr;
  gap:16px;
}
@media (max-width: 980px){
  .grid{grid-template-columns:1fr}
}

.panel{
  border:1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border-radius: var(--radius);
  padding:16px;
  box-shadow: var(--shadow);
}
.panel-title{font-weight:800;margin-bottom:10px;font-size:14px}
.subnote{color:var(--muted);margin-top:-6px;margin-bottom:14px;font-size:12px}

.stats{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.stat{
  padding:12px;border:1px solid var(--line);
  background: rgba(0,0,0,.12);
  border-radius: 12px;
}
.stat-label{color:var(--muted);font-size:12px}
.stat-value{font-weight:900;font-size:18px;margin-top:6px}

.divider{height:1px;background:var(--line);margin:14px 0}

.actions{display:flex;flex-direction:column;gap:10px}
.btn{
  cursor:pointer;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color:var(--text);
  padding:10px 12px;
  font-weight:700;
  transition: transform .06s ease, background .2s ease, border-color .2s ease;
}
.btn:hover{background: rgba(255,255,255,.06)}
.btn:active{transform: translateY(1px)}
.btn.primary{
  background: rgba(79,140,255,.22);
  border-color: rgba(79,140,255,.35);
}
.btn.primary:hover{background: rgba(79,140,255,.28)}
.btn.ghost{
  background: transparent;
}

.hint{
  margin-top:12px;
  color:var(--muted);
  padding:10px 12px;
  border:1px dashed rgba(255,255,255,.14);
  border-radius:12px;
  background: rgba(0,0,0,.10);
}

.hint.pending{
  border-color: rgba(255,92,122,.35);
  background: rgba(255,92,122,.12);
  color: #ffd6de;
  font-weight: 700;
}

.inline-actions{
  display:flex;
  gap:10px;
  margin-bottom:12px;
  flex-wrap:wrap;
}

.two-col{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
@media (max-width: 980px){
  .two-col{grid-template-columns:1fr}
}
.mini-title{font-weight:800;margin-bottom:8px;font-size:13px;color:var(--text)}
.table{
  border:1px solid var(--line);
  border-radius:12px;
  overflow:hidden;
  background: rgba(0,0,0,.12);
}
.row{
  display:grid;
  grid-template-columns: 84px 1fr 110px;
  gap:10px;
  padding:10px 12px;
  border-top:1px solid var(--line);
}
.row:first-child{border-top:none}
.cell-muted{color:var(--muted);font-size:12px}
.cell-strong{font-weight:800}
.badge{
  display:inline-flex;align-items:center;gap:6px;
  padding:6px 10px;border-radius:999px;
  border:1px solid var(--line);
  background: rgba(255,255,255,.03);
  color:var(--muted);
  font-size:12px;
}
.badge.ok{border-color: rgba(64,209,139,.3); background: rgba(64,209,139,.12); color:#c9ffe7}
.badge.warn{border-color: rgba(255,92,122,.25); background: rgba(255,92,122,.10); color:#ffd0d8}

.modal-backdrop{
  position:fixed;inset:0;
  background: rgba(0,0,0,.55);
  display:grid;place-items:center;
  padding:18px;
  overflow-y:auto;
  z-index:50;
}
.modal-backdrop.hidden{display:none}
.modal{
  width:min(860px, 100%);
  max-height:calc(100vh - 36px);
  display:flex;
  flex-direction:column;
  border-radius: 16px;
  border:1px solid var(--line);
  background: linear-gradient(180deg, rgba(18,31,58,.96), rgba(12,23,48,.96));
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal-header{
  display:flex;justify-content:space-between;align-items:flex-start;
  padding:14px 16px;border-bottom:1px solid var(--line);
}
.modal-title{font-weight:900;font-size:15px}
.modal-sub{color:var(--muted);font-size:12px;margin-top:4px}
.modal-body{padding:16px;overflow-y:auto}
.modal-footer{
  display:flex;justify-content:flex-end;gap:10px;
  padding:12px 16px;border-top:1px solid var(--line);
  background: rgba(0,0,0,.10);
}
.icon-btn{
  background: transparent;
  border:1px solid var(--line);
  color:var(--text);
  border-radius:10px;
  width:36px;height:36px;
  cursor:pointer;
}

.form{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
@media (max-width: 780px){
  .form{grid-template-columns:1fr}
}
.field label{
  display:block;
  color:var(--muted);
  font-size:12px;
  margin-bottom:6px;
}
.field input,.field select,.field textarea{
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(0,0,0,.16);
  color:var(--text);
  outline:none;
}
.field select{
  background: #253041;
  color: #f3f7ff;
}
.field select option{
  background: #253041;
  color: #f3f7ff;
}
.field textarea{min-height:90px;resize:vertical}
.full{grid-column: 1 / -1}

.kv{
  display:grid;
  grid-template-columns: 160px 1fr;
  gap:10px;
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px;
  background: rgba(0,0,0,.12);
  margin-bottom:12px;
}
.k{color:var(--muted);font-size:12px}
.v{font-weight:800}

.split{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
@media (max-width: 900px){
  .split{grid-template-columns:1fr}
}

.toast{
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: rgba(10,18,34,.95);
  box-shadow: var(--shadow);
  padding:12px 14px;
  color: var(--text);
  z-index: 60;
}
.toast.hidden{display:none}
.toast .t-title{font-weight:900;margin-bottom:4px}
.toast .t-msg{color:var(--muted);font-size:12px}

.credit-search-wrap{
  min-height:180px;
  display:grid;
  place-items:center;
  text-align:center;
  gap:10px;
}

.credit-search-spinner{
  width:54px;
  height:54px;
  border-radius:50%;
  border:4px solid rgba(79,140,255,.25);
  border-top-color: rgba(79,140,255,.95);
  animation: creditSpin 1s linear infinite;
}

.credit-search-title{
  font-weight:800;
  font-size:15px;
}

.credit-search-sub{
  color:var(--muted);
  font-size:12px;
}

@keyframes creditSpin {
  to { transform: rotate(360deg); }
}
