:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --brand: #0f766e;
  --brand-2: #14b8a6;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --info: #1d4ed8;
}

* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; margin: 0; }
a { color: var(--brand); }

.topbar { align-items: center; background: linear-gradient(135deg, #0b1220 0%, #0f3b3a 60%, #0f766e 100%); color: #fff; display: flex; flex-wrap: wrap; gap: 18px; padding: 12px 24px; }
.brand { align-items: center; color: #fff; display: flex; gap: 10px; text-decoration: none; }
.brand strong { display: block; font-size: 17px; line-height: 1; }
.brand small { color: #99f6e4; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.menu { display: flex; flex: 1; flex-wrap: wrap; gap: 4px; }
.menu a { border-radius: 10px; color: #ccfbf1; font-weight: 700; padding: 8px 12px; text-decoration: none; }
.menu a:hover, .menu a.is-active { background: rgba(255,255,255,.12); color: #fff; }
.user { align-items: center; display: flex; gap: 12px; font-size: 14px; }
.user a { color: #99f6e4; }

.page { margin: 0 auto; max-width: 1200px; padding: 24px 20px 40px; }
.page-title { font-size: 24px; margin: 0 0 18px; }
.foot { color: var(--muted); font-size: 12px; padding: 0 0 24px; text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(15,23,42,.05); margin-bottom: 18px; padding: 18px 20px; }
.card h2 { font-size: 17px; margin: 0 0 12px; }
.card-head { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; text-decoration: none; color: inherit; }
.stat span { color: var(--muted); display: block; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.stat strong { display: block; font-size: 28px; line-height: 1.2; margin-top: 4px; }
.stat small { color: var(--muted); }
.stat.is-ok strong { color: var(--ok); }
.stat.is-warn strong { color: var(--warn); }
.stat.is-danger strong { color: var(--danger); }
.stat.is-brand strong { color: var(--brand); }

.grid-2 { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .03em; text-align: left; text-transform: uppercase; }
th, td { border-bottom: 1px solid var(--line); padding: 9px 8px; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.badge { border-radius: 999px; display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 10px; white-space: nowrap; }
.badge-ok { background: #dcfce7; color: var(--ok); }
.badge-info { background: #dbeafe; color: var(--info); }
.badge-warn { background: #fef3c7; color: var(--warn); }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-muted { background: #e2e8f0; color: #334155; }

.alert { border-radius: 12px; margin-bottom: 14px; padding: 12px 14px; }
.alert-ok { background: #dcfce7; color: #14532d; }
.alert-error { background: #fee2e2; color: #7f1d1d; }
.alert-warn { background: #fef3c7; color: #78350f; }
.alert-info { background: #e0f2fe; color: #0c4a6e; }

.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
input, select, textarea { background: #fff; border: 1px solid #cbd5e1; border-radius: 10px; color: var(--ink); font: inherit; padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(20,184,166,.2); outline: none; }
input[type="checkbox"] { width: auto; }
.check { align-items: center; display: flex; font-weight: 600; gap: 8px; margin: 0; }
.hint { color: var(--muted); font-size: 12px; margin-top: 4px; }

.btn { align-items: center; background: var(--brand); border: 0; border-radius: 10px; color: #fff; cursor: pointer; display: inline-flex; font: inherit; font-weight: 800; gap: 6px; padding: 9px 16px; text-decoration: none; }
.btn:hover { background: #115e59; }
.btn-light { background: #e2e8f0; color: var(--ink); }
.btn-light:hover { background: #cbd5e1; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }
.btn-sm { font-size: 13px; padding: 6px 11px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline { display: inline; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters a { background: #fff; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: 13px; font-weight: 700; padding: 6px 12px; text-decoration: none; }
.filters a.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.search { display: flex; gap: 8px; max-width: 380px; }

.code-box { background: #0f172a; border-radius: 10px; color: #a7f3d0; font: 12px/1.5 ui-monospace, Menlo, monospace; padding: 10px 12px; resize: none; width: 100%; word-break: break-all; }
.dl { display: grid; gap: 6px 14px; grid-template-columns: 160px minmax(0, 1fr); margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.dl dd { margin: 0; }

.auth { align-items: center; display: flex; justify-content: center; min-height: calc(100vh - 120px); }
.auth .card { max-width: 420px; width: 100%; }

.pay { margin: 30px auto; max-width: 520px; }
.pay .total { color: var(--brand); font-size: 34px; font-weight: 900; }
