/* MaxiPay admin console — same palette as the MaxiPay app */
:root {
  --bl: #0B63F6; --bl2: #0432C4; --bl3: #1A7DFF;
  --ink: #0E1A33; --mu: #7683A0; --ln: #E4EAF4; --bg: #F2F5FB; --card: #fff;
  --ok: #14A86B; --okbg: #E3F7EE; --bad: #E5484D; --badbg: #FDECEC; --warn: #B7791F; --warnbg: #FFF4DE;
  --info: #3A5BD9; --infobg: #E8EEFF;
  --side: #0A1430; --side2: #101D42;
  --r: 16px;
  --sh: 0 6px 18px rgba(11, 99, 246, .07);
  --grad: linear-gradient(135deg, #1A7DFF 0%, #0A4BE8 55%, #0432C4 100%);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--bl); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--mu); margin: 18px 0 10px; }
hr { border: 0; border-top: 1px solid var(--ln); margin: 16px 0; }
small, .small { font-size: 12px; }
.muted { color: var(--mu); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.pos { color: var(--ok); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }
.num, td, .stat b { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.hide { display: none !important; }

/* ── shell ── */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, var(--side) 0%, var(--side2) 100%); color: #C9D3EE; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand b { color: #fff; font-size: 16px; display: block; }
.brand small { color: #8FA0CC; }
.logo { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 19px; box-shadow: 0 8px 18px rgba(11, 99, 246, .45); border: 1px solid rgba(255,255,255,.25); }
.nav-group p { margin: 14px 10px 6px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #6E80B3; font-weight: 700; }
.nav-group a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: #C9D3EE; font-weight: 500; position: relative; }
.nav-group a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav-group a.on { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(11, 99, 246, .35); }
.nav-group svg { width: 18px; height: 18px; fill: currentColor; opacity: .9; flex: none; }
.count { margin-left: auto; background: #FFC53D; color: #3A2A00; font-size: 11px; font-weight: 800; border-radius: 20px; padding: 1px 7px; min-width: 20px; text-align: center; }
.count:empty, .count[data-zero] { display: none; }

main { min-width: 0; }
.top { display: flex; align-items: center; gap: 14px; padding: 14px 26px; background: rgba(255,255,255,.88); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--ln); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 19px; font-weight: 800; }
.top .who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.top .who small { color: var(--mu); font-weight: 500; margin-left: 4px; }
.menu { display: none; border: 1px solid var(--ln); background: #fff; border-radius: 10px; width: 38px; height: 38px; font-size: 18px; cursor: pointer; }
.env { background: var(--warnbg); color: var(--warn); font-weight: 800; font-size: 11px; letter-spacing: .1em; padding: 4px 8px; border-radius: 6px; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--mu); font-size: 12px; font-weight: 600; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(20,168,107,.5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(20,168,107,.45); } 70% { box-shadow: 0 0 0 8px rgba(20,168,107,0); } 100% { box-shadow: 0 0 0 0 rgba(20,168,107,0); } }
.content { padding: 22px 26px 60px; max-width: 1440px; }

/* ── cards & grids ── */
.card { background: var(--card); border: 1px solid var(--ln); border-radius: var(--r); padding: 18px; box-shadow: var(--sh); margin-bottom: 18px; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -2px 0 14px; }
.card > header h2 { font-size: 15.5px; font-weight: 800; }
.card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.wide-left { grid-template-columns: 1.6fr 1fr; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid { margin-top: 18px; }

.hero { background: var(--grad); color: #fff; border-radius: 20px; padding: 22px; position: relative; overflow: hidden; box-shadow: 0 14px 30px rgba(11, 99, 246, .30); margin-bottom: 18px; }
.hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(rgba(255,255,255,.22), rgba(255,255,255,0) 70%); }
.hero::before { content: ""; position: absolute; left: -40px; bottom: -120px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.06); }
.hero-row { display: flex; gap: 28px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-row > div span { display: block; color: rgba(255,255,255,.75); font-size: 12.5px; }
.hero-row > div b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.hero-row > div small { color: rgba(255,255,255,.75); display: block; margin-top: 2px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats.small { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat { background: #fff; border: 1px solid var(--ln); border-radius: 14px; padding: 14px 16px; box-shadow: var(--sh); }
.stat span { display: block; color: var(--mu); font-size: 12.5px; font-weight: 600; }
.stat b { display: block; font-size: 21px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat small { color: var(--mu); }
.stat.ok b { color: var(--ok); } .stat.bad b { color: var(--bad); } .stat.blue b { color: var(--bl); }
.stat.flash-in { animation: flashin .9s ease; }
@keyframes flashin { from { background: #EAF2FF; } to { background: #fff; } }

.queue { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.queue a { background: #fff; border: 1px solid var(--ln); border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; color: var(--ink); box-shadow: var(--sh); }
.queue a:hover { text-decoration: none; border-color: #C9D8F5; }
.queue b { font-size: 22px; font-weight: 800; color: var(--bl); min-width: 34px; }
.queue a.hot b { color: var(--bad); }
.queue span { color: var(--mu); font-weight: 600; font-size: 12.5px; }

/* ── tables ── */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--mu); font-weight: 700; padding: 10px 10px; border-bottom: 1px solid var(--ln); white-space: nowrap; background: #FAFBFE; }
td { padding: 11px 10px; border-bottom: 1px solid #EEF2F9; vertical-align: top; }
tbody tr:hover td { background: #F8FAFF; }
tbody tr:last-child td { border-bottom: 0; }
td.empty { text-align: center; color: var(--mu); padding: 28px; }
tr.new td { animation: flashin 1.2s ease; }

.badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.badge.ok { background: var(--okbg); color: var(--ok); }
.badge.bad { background: var(--badbg); color: var(--bad); }
.badge.warn { background: var(--warnbg); color: var(--warn); }
.badge.info { background: var(--infobg); color: var(--info); }
.badge.muted { background: #EEF1F6; color: var(--mu); }

dl.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 9px 14px; margin: 0; }
dl.kv dt { color: var(--mu); font-weight: 600; }
dl.kv dd { margin: 0; word-break: break-word; }

/* ── forms & buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--ln); background: #fff; color: var(--ink); font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; font-family: inherit; }
.btn:hover { border-color: #C3D2EE; text-decoration: none; }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 8px 16px rgba(11, 99, 246, .28); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: #fff; color: var(--bad); border-color: #F5C6C7; }
.btn.danger:hover { background: var(--badbg); }
.btn.ghost { background: transparent; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn.block { width: 100%; height: 46px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.stack { display: grid; gap: 12px; }
.narrow { max-width: 440px; }
label.field { display: grid; gap: 6px; }
label.field > span { font-weight: 700; font-size: 12.5px; color: #34405C; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], input[type=tel], input[type=date], select, textarea {
  height: 40px; border: 1px solid var(--ln); border-radius: 11px; padding: 0 12px; font: inherit; color: var(--ink); background: #fff; min-width: 0; width: 100%;
}
.inline-form input:not([type=checkbox]):not([type=radio]), .inline-form select, .filters input, .filters select, .card-actions input, .card-actions select { width: auto; min-width: 150px; }
.plan-row input:not([type=checkbox]), .plan-row select { width: auto; min-width: 0; }
.plan-row select { min-width: 110px; }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--bl); box-shadow: 0 0 0 3px rgba(11, 99, 246, .14); }
input.num { width: 96px !important; min-width: 0 !important; text-align: right; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filters label.field { gap: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle i { width: 40px; height: 23px; border-radius: 20px; background: #D5DCEA; position: relative; flex: none; transition: .2s; }
.toggle i::after { content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input:checked + i { background: var(--bl); }
.toggle input:checked + i::after { left: 20px; }
.toggle span b { display: block; font-size: 13px; }
.toggle span small { color: var(--mu); }
.radio-row { display: grid; gap: 10px; margin-top: 14px; }
.radio { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--ln); border-radius: 12px; padding: 12px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--bl); background: #F3F7FF; }
.radio b { display: block; } .radio small { color: var(--mu); }
.sticky-save { position: sticky; bottom: 0; background: rgba(242,245,251,.94); backdrop-filter: blur(6px); padding: 12px 0; display: flex; gap: 14px; align-items: center; border-top: 1px solid var(--ln); margin-top: 6px; z-index: 3; }

/* ── flashes ── */
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; border: 1px solid; }
.flash.ok { background: var(--okbg); color: #0E7A4E; border-color: #BDE9D3; }
.flash.error { background: var(--badbg); color: #B4282D; border-color: #F5C6C7; }
.flash.warn { background: var(--warnbg); color: #8A5A10; border-color: #F3DDAE; }

/* ── specific ── */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.checklist li a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px dashed #F0C77A; background: #FFFBF1; border-radius: 12px; color: #6E4E10; font-weight: 600; }
.checklist li a::before { content: "!"; width: 20px; height: 20px; border-radius: 50%; background: #F5A524; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 900; flex: none; }
.checklist li.done a { border-style: solid; border-color: #BDE9D3; background: var(--okbg); color: #0E7A4E; }
.checklist li.done a::before { content: "✓"; background: var(--ok); }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 10px; fill: var(--mu); }
.chart .bar-in { fill: var(--ok); } .chart .bar-out { fill: var(--bl); } .chart .grid-line { stroke: #EEF2F9; }
.legend { display: flex; gap: 16px; color: var(--mu); font-size: 12px; margin-top: 8px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend .k-in { background: var(--ok); } .legend .k-out { background: var(--bl); }
.wallet { background: var(--grad); color: #fff; border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.wallet span { color: rgba(255,255,255,.8); font-size: 12.5px; display: block; }
.wallet b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.explain { background: #F5F8FF; border: 1px solid #DCE6FB; border-radius: 12px; padding: 14px 16px; }
.explain p { margin: 0 0 6px; } .explain p:last-child { margin: 0; }
.fee-table th.grp { text-align: center; background: #F1F5FD; color: var(--bl2); }
.fee-table td { vertical-align: middle; }
.fee-table input.num { width: 78px !important; }
.fee-table th[scope=row] { min-width: 150px; background: transparent; text-transform: none; letter-spacing: 0; font-size: 13.5px; color: var(--ink); font-weight: 700; white-space: normal; }
.fee-table td.desc { font-weight: 800; color: var(--bl2); white-space: nowrap; }
.fee-table td.desc small { display: block; font-weight: 500; color: var(--mu); }
.calc-out { margin-top: 12px; }
.calc-out .total { font-size: 24px; font-weight: 800; color: var(--bl2); }
.calc-out dl.kv { grid-template-columns: 1fr auto; }
.calc-out dl.kv dd { text-align: right; font-variant-numeric: tabular-nums; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tabs a { padding: 8px 14px; border-radius: 20px; background: #fff; border: 1px solid var(--ln); color: var(--ink); font-weight: 600; }
.tabs a small { color: var(--mu); margin-left: 4px; }
.tabs a.on { background: var(--grad); color: #fff; border-color: transparent; }
.tabs a.on small { color: rgba(255,255,255,.8); }
.tabs a:hover { text-decoration: none; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.thread { display: grid; gap: 10px; max-height: 520px; overflow-y: auto; padding: 4px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; background: #F1F4FA; }
.msg.agent { margin-left: auto; background: var(--grad); color: #fff; }
.msg p { margin: 0 0 4px; }
.msg small { opacity: .75; }
pre.code { background: #0B1530; color: #D7E1FF; padding: 14px; border-radius: 12px; overflow: auto; max-height: 520px; font-size: 12px; margin: 0; }
.big-key { font-size: 18px; letter-spacing: .08em; background: #F5F8FF; padding: 12px; border-radius: 10px; border: 1px dashed #C9D8F5; }
.plan-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.plan-row input[type=text] { width: 170px; }
.journal { border: 1px solid var(--ln); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.journal header { display: flex; gap: 12px; align-items: center; padding: 9px 12px; background: #FAFBFE; border-bottom: 1px solid var(--ln); flex-wrap: wrap; }
.journal table td, .journal table th { padding: 7px 12px; }

/* ── auth / install ── */
body.auth { display: grid; place-items: center; min-height: 100vh; background: var(--grad); padding: 20px; }
body.auth::before { content: ""; position: fixed; inset: 0; background: radial-gradient(circle at 85% 10%, rgba(255,255,255,.22), transparent 40%), radial-gradient(circle at 10% 100%, rgba(255,255,255,.08), transparent 45%); pointer-events: none; }
.auth-box { width: 100%; max-width: 430px; background: #fff; border-radius: 22px; padding: 28px; box-shadow: 0 30px 60px rgba(4, 30, 110, .35); position: relative; }
.auth-box.wide { max-width: 760px; }
.auth-box h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.auth-box .brand { padding: 0 0 18px; }
.auth-box .brand b { color: var(--ink); }
.auth-box .brand small { color: var(--mu); }

@media (max-width: 1100px) { .grid.two, .grid.wide-left, .grid.three { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 20, 48, .45); }
  .menu { display: inline-block; }
  .content { padding: 16px; }
  .top { padding: 12px 16px; }
  .top .who small, .live span { display: none; }
  .toggles { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; gap: 2px 0; } dl.kv dd { margin-bottom: 8px; }
}
