:root {
  --bg: #0b0e14;
  --panel: #111520;
  --card: #0b0e14;
  --line: #1e2433;
  --line-soft: #171d29;
  --line2: #26304a;
  --btn: #151b2b;

  --text: #d5dced;
  --text2: #8fa0bd;
  --muted: #6b7689;
  --dim: #5c6880;

  --brand: #2b52c9;
  --brand-deep: #12224e;
  --brand-mid: #1a3585;
  --brand-light: #8fb8f0;
  --heading: #6b93e8;
  --eyebrow: #a8c0ee;

  --gold: #EF9F27;
  --gold-bg: rgba(239, 159, 39, 0.10);
  --gold-line: rgba(239, 159, 39, 0.28);

  --accent: #8fb8f0;
  --accent-bg: rgba(107, 147, 232, 0.14);
  --ok: #6fce9a; --ok-bg: rgba(111, 206, 154, 0.12);
  --warn: #EF9F27; --warn-bg: rgba(239, 159, 39, 0.10);
  --bad: #ef8f8f; --bad-bg: rgba(239, 143, 143, 0.10);

  --radius: 7px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 16px 14px 60px; }

.panel { background: transparent; border: none; }
.header {
  background: linear-gradient(100deg, var(--brand-deep) 0%, var(--brand-mid) 45%, var(--brand) 100%);
  border-radius: 10px; padding: 20px 24px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { width: 40px; height: 40px; border-radius: 9px; object-fit: contain; background: rgba(0,0,0,.25); flex-shrink: 0; }
.brand .t1 {
  font-family: Georgia, "Times New Roman", serif; font-weight: 700;
  font-size: 24px; color: #fff; line-height: 1.1;
}
.brand .t2 {
  font-size: 10px; letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--eyebrow); margin-bottom: 4px;
}
.brand .rule { width: 48px; height: 3px; background: var(--gold); border-radius: 2px; margin-top: 9px; }
.header .right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 11px; color: #dce7fb; background: rgba(255,255,255,.11);
  border: 1px solid rgba(255,255,255,.16); padding: 5px 11px; border-radius: 6px;
}
.badge.sim { color: #ffe4b3; border-color: var(--gold-line); background: rgba(239,159,39,.18); }
.header button {
  font-size: 11px; color: var(--brand-deep); background: #fff; border: none;
  padding: 6px 13px; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.header button:hover { background: #e8eefc; }

.section {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px 20px; margin-bottom: 12px;
}
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 1.6px;
  color: var(--heading); text-transform: uppercase; margin: 0 0 14px;
}
.countbadge {
  font-size: 11px; color: var(--gold); background: var(--gold-bg);
  border: 1px solid var(--gold-line); padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.sechead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sechead .eyebrow { margin: 0; }

label { display: block; font-size: 12px; color: var(--text2); margin: 0 0 6px; }
textarea, input, select {
  width: 100%; background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; font: inherit; outline: none;
}
textarea::placeholder, input::placeholder { color: var(--dim); }
textarea:focus, input:focus, select:focus { border-color: var(--brand); }
#msg { min-height: 270px; font-size: 16px; line-height: 1.6; resize: vertical; }
#nums { min-height: 84px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.hint { font-size: 11px; color: var(--muted); margin-top: 5px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.drop {
  border: 1px dashed var(--line2); border-radius: var(--radius);
  padding: 14px; text-align: center; color: var(--text2); font-size: 12px; background: var(--card);
}
.drop.over { border-color: var(--brand-light); background: rgba(43,82,201,.08); }

button {
  background: var(--btn); color: #9fc0f5; border: 1px solid var(--line2);
  border-radius: 6px; padding: 7px 14px; font: inherit; font-size: 13px; cursor: pointer;
}
button:hover { border-color: var(--brand-light); color: #cfe0fb; }
button.primary {
  background: var(--brand); color: #fff; border: none; font-weight: 600; padding: 9px 20px;
}
button.primary:hover { background: #3a61d8; }
button.small { font-size: 11px; padding: 4px 11px; }
button:disabled { opacity: .4; cursor: default; }
button.dangerbtn { color: var(--bad); background: rgba(239,143,143,.07); border-color: rgba(239,143,143,.3); }
button.dangerbtn:hover { background: rgba(239,143,143,.14); border-color: var(--bad); color: var(--bad); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.note { font-size: 11px; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 600; margin-top: 2px; color: var(--text); }
.stat.ok { background: var(--ok-bg); border-color: rgba(111,206,154,.25); }
.stat.ok .k, .stat.ok .v { color: var(--ok); }
.stat.bad { background: var(--bad-bg); border-color: rgba(239,143,143,.25); }
.stat.bad .k, .stat.bad .v { color: var(--bad); }

.msgbox { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: var(--card); }
.msgbox .body { font-size: 16px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; min-height: 16em; }
.msgbox .foot { font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }

.alert { border-radius: var(--radius); padding: 12px 16px; margin-top: 14px; font-size: 13px; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--gold-line); }
.alert.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid rgba(111,206,154,.3); }
.alert.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid rgba(239,143,143,.3); }

.progress { background: var(--card); border: 1px solid var(--line); border-radius: 10px; height: 12px; overflow: hidden; margin: 10px 0 6px; }
.progress > div { background: var(--brand); height: 100%; width: 0%; transition: width .4s; border-radius: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; font-weight: 600; color: var(--muted);
  padding: 6px 8px; border-bottom: 1px solid var(--line); letter-spacing: .4px;
}
td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--text); }
tr.click { cursor: pointer; } tr.click:hover td { background: rgba(43,82,201,.07); }
.pill { font-size: 10px; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.acc { background: var(--accent-bg); color: var(--accent); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.ellip { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.listbox { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.userrow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.userrow:last-child { border-bottom: none; }
.setrow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 12px; border-bottom: 1px solid var(--line-soft);
}
.setrow:last-child { border-bottom: none; }
.setrow .d { font-size: 11px; color: var(--muted); }
.collapsewrap { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.reclist {
  display: none; margin-top: 10px; max-height: 220px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.7;
}
.reclist.open { display: block; }
.linky { color: var(--brand-light); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.authcard {
  width: 100%; max-width: 390px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 0; overflow: hidden;
}
.authbanner {
  background: linear-gradient(100deg, var(--brand-deep) 0%, var(--brand-mid) 45%, var(--brand) 100%);
  padding: 22px 24px 20px; text-align: left;
}
.authbanner img { width: 42px; height: 42px; border-radius: 9px; object-fit: contain; background: rgba(0,0,0,.25); }
.authbanner .eb { font-size: 10px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--eyebrow); margin: 12px 0 4px; }
.authbanner h1 { font-family: Georgia, serif; font-size: 22px; color: #fff; margin: 0; line-height: 1.15; }
.authbanner .rule { width: 44px; height: 3px; background: var(--gold); border-radius: 2px; margin-top: 10px; }
.authbody { padding: 20px 24px 24px; }
.authbody p.lead { font-size: 12px; color: var(--text2); margin: 0 0 18px; }
.field { margin-bottom: 12px; }
.err { color: var(--bad); font-size: 12px; margin-top: 10px; min-height: 18px; }

.hidden { display: none !important; }
a { color: var(--brand-light); }
@media (max-width: 640px) {
  .section { padding: 14px; }
  .header { padding: 16px 16px; }
  .brand .t1 { font-size: 20px; }
}

/* ---------- review modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(6, 10, 20, .62);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 28px 16px; overflow-y: auto;
  animation: overlayFadeIn .55s ease both;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(42px) scale(.96); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal {
  width: 100%; max-width: 790px;
  background: #111a2e; border: 1px solid #2c4a8a; border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(96,140,240,.22),
    0 0 34px rgba(59,106,224,.30),
    0 0 90px rgba(59,106,224,.20),
    0 22px 60px rgba(0,0,0,.62);
  padding: 26px 30px; margin: auto 0;
  animation: modalSlideUp .68s cubic-bezier(.16,1,.3,1) both;
  will-change: transform, opacity, filter;
}
@media (prefers-reduced-motion: reduce) { .modal, .modal-overlay { animation: none; } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.modal-head h2 { margin: 0 0 10px; font-size: 20px; color: #fff; font-weight: 600; }
.modal-x {
  background: none; border: none; color: #7e8aa6; font-size: 19px;
  cursor: pointer; line-height: 1; padding: 2px 6px;
}
.modal-x:hover { color: #cfd8ea; border: none; background: none; }
.statepill {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 11px; border-radius: 20px; border: 1px solid transparent;
}
.statepill.gold { background: rgba(239,159,39,.13); color: #EF9F27; border-color: rgba(239,159,39,.35); }
.statepill.blue { background: rgba(59,106,224,.15); color: #8fb8f0; border-color: rgba(143,184,240,.35); }
.statepill.green { background: rgba(111,206,154,.14); color: #6fce9a; border-color: rgba(111,206,154,.35); }
.statepill.red { background: rgba(239,143,143,.12); color: #ef8f8f; border-color: rgba(239,143,143,.35); }
.mlabel {
  margin: 18px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  color: #7e8aa6; text-transform: uppercase;
}
.mlabel.gold { color: var(--gold); }
.mbox {
  background: #0b1120; border: 1px solid #1d2947; border-radius: 9px;
  padding: 14px 16px; min-height: 16em; font-size: 15px; line-height: 1.6;
  color: #e4e9f5; white-space: pre-wrap; word-break: break-word;
}
.mstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; }
.mstat { background: #0b1120; border: 1px solid #1d2947; border-radius: 9px; padding: 11px 13px; }
.mstat .k { font-size: 10px; color: #7e8aa6; }
.mstat .v { margin-top: 2px; font-size: 19px; font-weight: 600; color: #fff; }
.mstat.ok { background: rgba(111,206,154,.1); border-color: rgba(111,206,154,.25); }
.mstat.ok .k, .mstat.ok .v { color: var(--ok); }
.mstat.bad { background: rgba(239,143,143,.09); border-color: rgba(239,143,143,.25); }
.mstat.bad .k, .mstat.bad .v { color: var(--bad); }
.mfrom { margin: 3px 0 0; font-size: 14px; color: #e4e9f5; font-family: ui-monospace, Menlo, Consolas, monospace; }
.mstatus {
  margin-top: 20px; background: #0b1120; border: 1px solid #1d2947;
  border-radius: 9px; padding: 13px 15px;
}
.mprogress { background: #182238; border-radius: 20px; height: 8px; overflow: hidden; }
.mprogress > div { background: #3b6ae0; height: 100%; width: 2%; border-radius: 20px; transition: width .35s; }
.modal-actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.modal-actions .primary { background: #3b4fd0; padding: 11px 22px; border-radius: 9px; }
.modal-actions .primary:hover { background: #4a5ee0; }
.mcancel {
  background: rgba(239,143,143,.07); color: #ef8f8f;
  border: 1px solid rgba(239,143,143,.45);
  padding: 10px 18px; border-radius: 9px;
  font: inherit; font-size: 13px; cursor: pointer;
}
.mcancel:hover { background: rgba(239,143,143,.15); border-color: #ef8f8f; color: #ef8f8f; }
body.modal-open { overflow: hidden; }
@media (max-width: 640px) { .modal { padding: 18px 16px; } }
.mstat .mfrom { margin-top: 4px; font-size: 13px; font-weight: 600; color: #fff; font-family: ui-monospace, Menlo, Consolas, monospace; }
