:root {
  --bg: #0d1017; --panel: #151a23; --panel2: #1b212c; --line: #262e3b;
  --text: #e6e9ef; --muted: #8a93a6; --accent: #3ddc97; --accent2: #4c8dff;
  --red: #ff6b6b; --yellow: #ffc857; --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--accent2); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 1em; }
.ok { color: var(--accent); }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 8px 0; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.logo { color: var(--accent); }
.brand-icon { width: 34px; height: 34px; border-radius: 10px; }
.pwa-card { display: flex; gap: 20px; align-items: center; padding: 24px; margin-bottom: 24px; border: 1px solid #65202d; border-radius: 16px; background: linear-gradient(120deg, #29131c, var(--panel) 65%); }
.pwa-icon { width: 76px; height: 76px; border-radius: 19px; flex-shrink: 0; }
.pwa-copy { flex: 1; min-width: 0; }
.pwa-eyebrow { font-size: 10px; font-weight: 750; letter-spacing: .14em; color: #ff8591; }
.pwa-copy h2 { margin: 7px 0; font-size: clamp(18px, 2vw, 23px); letter-spacing: -.03em; }
.pwa-copy p { margin: 5px 0; line-height: 1.5; color: var(--muted); }
.pwa-copy .pwa-status { font-size: 12px; color: #c5cbd6; }
.pwa-actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; flex-shrink: 0; }
.btn.pwa-primary { background: #d60018; border-color: #e52b42; color: #fff; font-weight: 650; }
.btn.pwa-primary:hover { background: #ed1530; }
@media (max-width: 600px) {
  .pwa-card { flex-wrap: wrap; gap: 14px; padding: 18px; }
  .pwa-icon { width: 52px; height: 52px; border-radius: 13px; align-self: flex-start; }
  .pwa-copy { flex-basis: calc(100% - 70px); }
  .pwa-actions { width: 100%; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .filters { flex-wrap: wrap; }
}
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { color: var(--muted); text-decoration: none; padding: 9px 12px; border-radius: 8px; }
.side nav a:hover { background: var(--panel2); color: var(--text); }
.side nav a.active { background: var(--panel2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }

.main { padding: 20px 28px 60px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: 22px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }

input, select, textarea { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent2); outline-offset: -1px; }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
label input, label select { display: block; width: 100%; margin-top: 4px; color: var(--text); font-size: 14px; }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; font: inherit; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: #062b1b; border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: wait; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card + .card { margin-top: 16px; }
.grid > .card { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 16px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.kpi.hero .value { color: var(--accent); }
.pos { color: var(--accent); } .neg { color: var(--red); }
.two { grid-template-columns: 2fr 1fr; }
.three { grid-template-columns: repeat(3, 1fr); }

.chart { width: 100%; height: 240px; }
.chart .bar-rev { fill: var(--accent); }
.chart .bar-sp { fill: var(--accent2); }
.chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; background: var(--panel); }
td.num, th.num { text-align: right; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel2); }
.name-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--panel2); }
.pill.approved { background: rgba(61,220,151,.15); color: var(--accent); }
.pill.pending { background: rgba(255,200,87,.15); color: var(--yellow); }
.pill.refused { background: rgba(138,147,166,.15); color: var(--muted); }
.pill.refunded, .pill.chargeback, .pill.protest { background: rgba(255,107,107,.15); color: var(--red); }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button.active { background: var(--accent); color: #062b1b; border-color: var(--accent); }
.crumbs { color: var(--muted); margin-bottom: 10px; }
.crumbs a { cursor: pointer; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.copy { display: flex; gap: 8px; align-items: stretch; margin: 6px 0; }
.copy input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 12.5px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-item:last-child { border-bottom: 0; }
.steps { padding-left: 18px; color: var(--muted); line-height: 1.7; }
.steps b { color: var(--text); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 10; padding: 16px; }
.modal-box { width: 100%; max-width: 760px; max-height: 88vh; overflow: auto; position: relative; }
.modal-x { position: absolute; right: 12px; top: 8px; background: none; border: 0; color: var(--muted); font-size: 24px; cursor: pointer; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; z-index: 20; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
  .side nav { flex-direction: row; flex-wrap: wrap; flex-basis: 100%; order: 3; }
  .main { padding: 16px; }
  .two, .three { grid-template-columns: 1fr; }
}
