/* Elite Roleplay — admin panel
   Desktop-first. The reference design was a mobile capture of GrandRP's panel;
   this is the same visual language rebuilt for a wide screen: fixed sidebar,
   sticky topbar, and tables that scroll inside their card rather than pushing
   the page sideways. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e6e8eb;
  --text: #1f2430;
  --muted: #8b93a1;
  --accent: #4a90d9;
  --green: #27ae60;
  --red: #e74c3c;
  --amber: #e67e22;
  --sidebar: 216px;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* ── Login ────────────────────────────────────────────────────────────────── */
#login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #eceef1;
}
.login-card {
  width: 380px; background: #fff; border-radius: 8px;
  padding: 34px 32px; box-shadow: 0 8px 30px rgba(0,0,0,.09);
}
.login-card h1 { font-size: 19px; text-align: center; font-weight: 700; }
.login-card p.sub { text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0 22px; }
.login-card input {
  width: 100%; margin-bottom: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 5px;
  background: #f3f7fd; font-family: inherit; font-size: 13px; color: var(--text);
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button {
  width: 100%; padding: 12px; border: none; border-radius: 5px;
  background: #7ac043; color: #fff; font-family: inherit;
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.login-card button:hover { filter: brightness(1.06); }
.login-err {
  margin-top: 14px; padding: 10px 12px; border-radius: 5px;
  background: #fdecea; color: #c0392b; font-size: 12px; text-align: center;
}
.login-note { margin-top: 16px; color: var(--muted); font-size: 11px; text-align: center; line-height: 1.6; }

/* ── Shell ────────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.sb {
  width: var(--sidebar); min-width: var(--sidebar);
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; overflow-y: auto;
}
.sb-logo {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.sb-logo b { font-size: 17px; letter-spacing: .04em; }
.sb-logo b i { color: var(--red); font-style: normal; }
.sb-logo span { display: block; font-size: 9px; color: var(--muted);
  letter-spacing: .1em; text-transform: uppercase; }
.sb-nav { flex: 1; padding: 8px 0 24px; }
.sb-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 18px; cursor: pointer; color: #4a5262;
  font-size: 12.5px; border-left: 3px solid transparent; user-select: none;
}
.sb-item:hover { background: #f7f8fa; color: var(--text); }
.sb-item.active { color: var(--text); font-weight: 600; border-left-color: #2b3342; background: #f5f6f8; }
.sb-item .ico { width: 16px; text-align: center; opacity: .6; }
.sb-item .exp { margin-left: auto; color: #b7bdc7; font-size: 12px; }
.sb-sub { background: #fbfbfc; }
.sb-sub .sb-item { padding-left: 45px; font-size: 12px; color: #6b7382; }
.sb-sub .sb-item.active { color: var(--accent); background: none; border-left-color: transparent; }
.sb-owner { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.sb-owner-label {
  padding: 4px 18px 6px; font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; color: #b7bdc7; font-weight: 700;
}

.main { flex: 1; margin-left: var(--sidebar); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 24px; height: 52px;
  display: flex; align-items: center; gap: 14px;
}
.topbar h2 { font-size: 13px; font-weight: 700; color: #5b6270; letter-spacing: .04em; flex: 1; }
.live-dot { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.live-dot i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }
.who { font-size: 12px; color: #5b6270; }
.who b { color: var(--text); }
.lvl-badge {
  background: #2b3342; color: #fff; border-radius: 4px;
  padding: 2px 8px; font-size: 11px; font-weight: 700; margin-left: 6px;
}
.lvl-badge.owner { background: linear-gradient(90deg, #d4a017, #e8b923); color: #1f2430; }
.logout { font-size: 12px; color: var(--muted); cursor: pointer; }
.logout:hover { color: var(--red); }

.content { padding: 22px 24px 60px; }

/* ── Cards / stats ────────────────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-box { background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 16px 18px; }
.stat-box h4 { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.stat-nums { display: flex; gap: 6px; }
.stat-num { flex: 1; background: #f8f9fb; border-radius: 5px; padding: 12px 8px; text-align: center; }
.stat-num .n { font-size: 25px; font-weight: 800; line-height: 1; }
.stat-num .l { font-size: 10px; color: var(--muted); margin-top: 5px; }

.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.charts-full { margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 7px; margin-bottom: 16px; }
.card-head {
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.card-head h3 { font-size: 13px; font-weight: 700; flex: 1; }
.card-body { padding: 16px 18px; }
.chart-wrap { padding: 16px 18px 14px; }
.chart-wrap h3 { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.chart-wrap .chart-box { position: relative; height: 160px; width: 100%; }
.chart-wrap .chart-box-wide { position: relative; height: 155px; width: 100%; }
.legend { display: flex; gap: 18px; margin: 0 0 12px; font-size: 11px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 2px; border-radius: 2px; display: inline-block; }
canvas { width: 100% !important; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.tbl-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #fafbfc; }
th {
  padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700;
  color: #8b93a1; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid #f2f3f5; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfc; }
td.wrap { white-space: normal; max-width: 380px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; }
.nick { color: var(--accent); cursor: pointer; font-weight: 600; }
.nick:hover { text-decoration: underline; }
.empty { padding: 34px; text-align: center; color: var(--muted); font-size: 12.5px; }

.badge { padding: 2px 9px; border-radius: 4px; font-size: 11px; font-weight: 700; color: #fff; display: inline-block; }
.b-green { background: var(--green); }
.b-red { background: var(--red); }
.b-grey { background: #9aa2ae; }
.b-amber { background: var(--amber); }
.t-green { color: var(--green); font-weight: 600; }
.t-red { color: var(--red); font-weight: 600; }
.money { font-weight: 600; }
.money.pos { color: var(--green); }
.money.neg { color: var(--red); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.search-form { background: var(--card); border: 1px solid var(--line); border-radius: 7px; padding: 14px 18px; margin-bottom: 16px; }
.search-form h4 { font-size: 12px; font-weight: 700; color: #5b6270; margin-bottom: 11px; }
.frow { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
.frow:last-child { margin-bottom: 0; }
input.inp, select.inp {
  border: 1px solid var(--line); border-radius: 5px; padding: 7px 11px;
  font-size: 12px; width: 165px; font-family: inherit; color: var(--text); background: #fff;
}
input.inp:focus, select.inp:focus { outline: none; border-color: var(--accent); }
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 5px;
  padding: 7px 18px; font-size: 12px; font-family: inherit; cursor: pointer; color: #4a5262;
}
.btn:hover { background: #f5f6f8; }
.btn-p { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-p:hover { background: #3d81c9; }
.btn-d { background: var(--red); border-color: var(--red); color: #fff; }
.btn-d:hover { filter: brightness(1.06); }
.btn-s { padding: 4px 10px; font-size: 11px; }

.pager { display: flex; gap: 6px; align-items: center; padding: 12px 18px; }
.pager .pg { padding: 3px 10px; border-radius: 4px; font-size: 12px; cursor: pointer; color: var(--muted); }
.pager .pg:hover { background: #f2f3f5; color: var(--text); }
.pager .pg.on { background: var(--green); color: #fff; }
.pager .info { margin-left: auto; font-size: 11.5px; color: var(--muted); }

/* ── Character page ───────────────────────────────────────────────────────── */
.char-grid { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.kv { display: flex; justify-content: space-between; align-items: center;
      padding: 7px 0; border-bottom: 1px solid #f4f5f7; font-size: 12px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; }
.list-item { display: flex; justify-content: space-between; padding: 6px 0;
             border-bottom: 1px solid #f4f5f7; font-size: 12px; }
.list-item:last-child { border-bottom: none; }
.serials { font-family: ui-monospace, Consolas, monospace; font-size: 10.5px;
           color: #6b7382; line-height: 1.9; word-break: break-all; }

/* ── Management ───────────────────────────────────────────────────────────── */
.matrix { width: 100%; border-collapse: collapse; }
.matrix th { text-align: center; }
.matrix th:first-child { text-align: left; }
.matrix td { text-align: center; }
.matrix td:first-child { text-align: left; font-weight: 600; }
.matrix input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--green); }
.matrix .locked { color: #c9ced6; font-size: 15px; }
.owner-note {
  background: #fff8e6; border: 1px solid #f0dda6; border-radius: 6px;
  padding: 11px 14px; font-size: 12px; color: #7a5c11; margin-bottom: 16px; line-height: 1.6;
}
.sec-name { font-size: 12px; }
.sec-name em { font-style: normal; color: var(--muted); font-size: 11px; display: block; }

/* ── Security warnings ────────────────────────────────────────────────────── */
.card-danger { border-color: #e8b4b4; }
.card-danger .card-head { background: #fdf3f3; border-bottom-color: #e8b4b4; }
.owner-note-tight { margin: 14px 18px 4px; }
.row-danger { background: #fdf6f6; }
.sub-em { font-style: normal; color: var(--muted); font-size: 11px; display: block; }

/* ── Salary management ────────────────────────────────────────────────────── */
.inp-n { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.muted-cell { color: var(--muted); font-size: 11.5px; }
/* A row whose figure no longer matches the config default */
.row-edited { background: #f4f9ff; }
.row-edited td:first-child b { color: #2f6db5; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: #2b3342; color: #fff; border-radius: 6px;
  padding: 11px 16px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.18);
  max-width: 340px;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* ── Modal ────────────────────────────────────────────────────────────────── */
#modal { position: fixed; inset: 0; background: rgba(20,24,32,.45); z-index: 150;
         display: flex; align-items: center; justify-content: center; }
.modal-card { background: #fff; border-radius: 8px; width: 420px; padding: 22px 24px;
              box-shadow: 0 14px 44px rgba(0,0,0,.2); }
.modal-card h3 { font-size: 15px; margin-bottom: 4px; }
.modal-card p.sub { color: var(--muted); font-size: 12px; margin-bottom: 16px; }
.modal-card input.inp, .modal-card select.inp { width: 100%; margin-bottom: 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

@media (max-width: 1180px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .char-grid { grid-template-columns: 1fr; }
}
