/* ============================================================
   MyHSRSP design system
   ============================================================ */
:root {
  --bg: #070b17;
  --bg-2: #0b1120;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2ff;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --brand: #7c6cff;
  --brand-2: #b06bff;
  --accent: #22d3ee;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #fb4d6d;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --gradient: linear-gradient(120deg, #7c6cff 0%, #b06bff 48%, #22d3ee 100%);
  --gradient-soft: linear-gradient(120deg, rgba(124, 108, 255, 0.16), rgba(34, 211, 238, 0.1));
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.16; letter-spacing: -0.025em; font-weight: 700; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg, canvas { max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code, pre { font-family: var(--mono); font-size: 0.9em; }
::selection { background: rgba(124, 108, 255, 0.4); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.25); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1380px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.tiny { font-size: 0.74rem; }
.mono { font-family: var(--mono); }
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.03em; font-size: 1.12rem; }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--gradient); color: #fff; font-size: 15px;
  box-shadow: 0 8px 24px rgba(124, 108, 255, 0.35);
}
.brand-mark svg { width: 19px; height: 19px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 11px; padding: 10px 18px;
  font-weight: 600; font-size: 0.9rem; line-height: 1.2; white-space: nowrap;
  transition: transform .15s ease, box-shadow .2s ease, background .2s, border-color .2s;
  background: var(--panel-2); color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 10px 30px rgba(124, 108, 255, 0.3); }
.btn-primary:hover { box-shadow: 0 14px 38px rgba(124, 108, 255, 0.45); }
.btn-secondary { background: rgba(124, 108, 255, 0.12); border-color: rgba(124, 108, 255, 0.35); color: #c7c1ff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: rgba(251, 77, 109, 0.12); border-color: rgba(251, 77, 109, 0.3); color: #fda4af; }
.btn-success { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.32); color: #86efac; }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; border-radius: 9px; }
.btn-xs { padding: 4px 9px; font-size: 0.72rem; border-radius: 7px; }
.btn-lg { padding: 14px 26px; font-size: 1rem; border-radius: 13px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.link { color: #a5b4fc; font-weight: 600; }
.link:hover { color: #c7d2fe; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 0.71rem; font-weight: 700; letter-spacing: .02em;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
  white-space: nowrap; text-transform: capitalize;
}
.badge-success { background: rgba(34, 197, 94, 0.12); color: #4ade80; border-color: rgba(34, 197, 94, 0.25); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #fbbf24; border-color: rgba(245, 158, 11, 0.25); }
.badge-danger { background: rgba(251, 77, 109, 0.12); color: #fb7185; border-color: rgba(251, 77, 109, 0.25); }
.badge-info { background: rgba(34, 211, 238, 0.1); color: #67e8f9; border-color: rgba(34, 211, 238, 0.22); }
.badge-brand { background: rgba(124, 108, 255, 0.14); color: #c4b5fd; border-color: rgba(124, 108, 255, 0.3); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------- cards / panels ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; position: relative;
}
.card-hover:hover { border-color: var(--border-strong); background: var(--panel-2); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h3 { font-size: 1rem; }
.card-title .sub { font-size: 0.78rem; color: var(--muted); }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-body { padding: 20px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; border: 0; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label { font-size: 0.8rem; font-weight: 600; color: #cbd5e1; display: flex; justify-content: space-between; gap: 8px; }
.field .hint { font-size: 0.72rem; color: var(--muted-2); font-weight: 400; }
.input, .select, .textarea {
  width: 100%; background: rgba(8, 13, 26, 0.7); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 13px; color: var(--text); font-size: 0.88rem;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: #526079; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(124, 108, 255, 0.65); box-shadow: 0 0 0 3px rgba(124, 108, 255, 0.14); }
.input[readonly] { color: var(--muted); }
.textarea { min-height: 92px; resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%); background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.input-group { display: flex; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .btn { border-radius: 0 10px 10px 0; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.checkbox input { margin-top: 3px; accent-color: var(--brand); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error-text { color: #fb7185; font-size: 0.8rem; }
.help-text { color: var(--muted-2); font-size: 0.76rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.055); vertical-align: middle; }
.table th { color: var(--muted-2); font-size: 0.7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; white-space: nowrap; background: rgba(255, 255, 255, 0.014); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; }
.table-empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 0.86rem; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .empty-icon { font-size: 2rem; margin-bottom: 10px; opacity: .85; }
.empty h4 { color: var(--text); font-size: 1rem; margin-bottom: 6px; }
.empty p { font-size: 0.84rem; max-width: 380px; margin: 0 auto 16px; }

/* ---------- toast / modal ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start; background: #0f172a; border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 13px 15px; box-shadow: var(--shadow); font-size: 0.84rem;
  animation: toast-in .22s ease; color: #e2e8f0;
}
.toast.success { border-color: rgba(34, 197, 94, 0.4); }
.toast.error { border-color: rgba(251, 77, 109, 0.45); }
.toast.warning { border-color: rgba(245, 158, 11, 0.4); }
.toast .toast-icon { flex-shrink: 0; width: 16px; text-align: center; }
.toast.success .toast-icon { color: #4ade80; }
.toast.error .toast-icon { color: #fb7185; }
.toast.warning .toast-icon { color: #fbbf24; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(3, 6, 15, 0.72); backdrop-filter: blur(6px);
  z-index: 900; display: grid; place-items: center; padding: 20px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 520px; background: #0c1322; border: 1px solid var(--border-strong);
  border-radius: 18px; box-shadow: var(--shadow); animation: modal-in .18s ease;
  max-height: calc(100vh - 40px); display: flex; flex-direction: column;
}
.modal.modal-lg { max-width: 760px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { font-size: 1.02rem; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #060a14; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px;
  font-family: var(--mono); font-size: 0.78rem; overflow-wrap: anywhere;
}

/* ---------- tabs / segmented ---------- */
.tabs { display: flex; gap: 4px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--border); padding: 4px; border-radius: 11px; flex-wrap: wrap; }
.tab { padding: 7px 13px; border-radius: 8px; font-size: 0.8rem; color: var(--muted); font-weight: 600; border: 0; background: transparent; }
.tab:hover { color: var(--text); }
.tab.active { background: rgba(124, 108, 255, 0.16); color: #d7d2ff; box-shadow: inset 0 0 0 1px rgba(124, 108, 255, 0.25); }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; padding: 3px; background: rgba(255, 255, 255, 0.025); }
.segmented button { border: 0; background: none; color: var(--muted); padding: 5px 11px; font-size: 0.76rem; border-radius: 7px; font-weight: 600; }
.segmented button.active { background: var(--panel-2); color: var(--text); }

/* ---------- misc ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gradient-soft); border: 1px solid var(--border); font-size: 0.78rem; font-weight: 700; color: #d8d4ff; flex-shrink: 0; }
.kbd { font-family: var(--mono); font-size: 0.68rem; padding: 2px 5px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.progress { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--gradient); transition: width .4s ease; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.s-pending { background: #fbbf24; box-shadow: 0 0 10px rgba(251, 191, 36, .5); }
.s-success { background: #22c55e; box-shadow: 0 0 10px rgba(34, 197, 94, .5); }
.s-failed, .s-expired, .s-refunded { background: #fb7185; }
.s-created { background: #38bdf8; }
.copy-btn { background: transparent; border: 0; color: var(--muted); padding: 4px; border-radius: 6px; }
.copy-btn:hover { color: var(--text); background: var(--panel-2); }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.08), rgba(255,255,255,.04)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-side {
  position: relative; padding: 46px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 600px at 10% 10%, rgba(124, 108, 255, .22), transparent 60%),
              radial-gradient(700px 500px at 90% 90%, rgba(34, 211, 238, .14), transparent 55%), var(--bg-2);
  overflow: hidden;
}
.auth-side::after {
  content: ""; position: absolute; width: 460px; height: 460px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .08); right: -140px; top: -120px;
  box-shadow: 0 0 0 60px rgba(255,255,255,.02), 0 0 0 130px rgba(255,255,255,.012);
}
.auth-side .quote { font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; max-width: 460px; line-height: 1.25; }
.auth-side .points { display: grid; gap: 13px; margin-top: 26px; font-size: .86rem; color: var(--muted); }
.auth-side .points li { display: flex; gap: 10px; align-items: flex-start; }
.auth-side .points .tick { color: #4ade80; font-weight: 800; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 410px; }
.auth-card h1 { font-size: 1.65rem; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: .88rem; margin-bottom: 26px; }
.auth-alt { text-align: center; font-size: .82rem; color: var(--muted); margin-top: 20px; }
.demo-box { margin-top: 18px; padding: 12px 14px; border: 1px dashed rgba(124,108,255,.35); border-radius: 10px; background: rgba(124,108,255,.06); font-size: .76rem; color: var(--muted); }
.demo-box strong { color: #c4b5fd; }
.auth-back { position: absolute; top: 24px; left: 24px; z-index: 2; }

/* ---------- error page ---------- */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(700px 500px at 50% 0%, rgba(124,108,255,.15), transparent 60%), var(--bg); }
.error-card { max-width: 460px; text-align: center; background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 40px 32px; box-shadow: var(--shadow); }
.error-code { font-size: 3.4rem; font-weight: 800; letter-spacing: -.05em; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 20px 0 4px; }
.error-card h1 { font-size: 1.45rem; margin-bottom: 8px; }
.error-card p { color: var(--muted); font-size: .9rem; }
.error-actions { display: flex; gap: 10px; justify-content: center; margin: 22px 0 18px; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 620px) {
  .container { padding: 0 18px; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .btn { padding: 9px 14px; }
}
