:root {
  --ink: #1d2330; --muted: #5d6677; --line: #d9dde4; --bg: #eef0f4; --card: #fff;
  --accent: #2f6fdf; --accent-dark: #245bc0; --accent-soft: #e6eefc;
  --ok: #1d7a46; --ok-soft: #e3f4ea; --bad: #b42318; --bad-soft: #fdecea; --warn: #8a5a00; --warn-soft: #fff4dc;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: #b7bfcc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.small { padding: 4px 9px; font-size: 13px; border-radius: 7px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.msg { border-radius: 9px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Buyer unlock page ---------- */
.unlock { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.card { background: var(--card); border-radius: 16px; box-shadow: 0 6px 30px rgba(20, 30, 50, .10); padding: 28px; width: 100%; max-width: 440px; }
.card h1 { font-size: 24px; margin: 0 0 4px; }
.card .sub { color: var(--muted); margin: 0 0 20px; font-size: 15px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #f1f3f6; border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.tab { border: 0; background: none; border-radius: 8px; padding: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab[aria-selected=true] { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.field .help { font-size: 13px; color: var(--muted); margin-top: 5px; }
#code { text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.card .btn.primary { width: 100%; padding: 12px; font-size: 16px; }
.fine { font-size: 13px; color: var(--muted); margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.fine p { margin: 0 0 6px; }

/* ---------- Admin ---------- */
.admin { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-top h1 { font-size: 22px; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-bottom: 16px; }
.panel { background: #fff; border-radius: 12px; border: 1px solid var(--line); padding: 16px; min-width: 0; }
.panel h2 { font-size: 16px; margin: 0 0 4px; }
.panel p.desc { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.row > label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1 1 90px; }
.codes-out { margin-top: 12px; }
.codes-out textarea { font-family: Consolas, "Courier New", monospace; height: 120px; resize: vertical; }
.table-wrap { background: #fff; border-radius: 12px; border: 1px solid var(--line); overflow-x: auto; }
.table-tools { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; border-bottom: 1px solid var(--line); align-items: center; }
.table-tools input[type=search] { max-width: 280px; }
.table-tools select { width: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; position: sticky; top: 0; }
td code { font-family: Consolas, "Courier New", monospace; font-weight: 700; letter-spacing: .04em; }
.pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; background: #eef0f3; }
.pill.active { background: var(--ok-soft); color: var(--ok); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.revoked, .pill.expired { background: var(--bad-soft); color: var(--bad); }
.pill.unused { background: var(--accent-soft); color: var(--accent-dark); }
.acts { display: flex; gap: 4px; flex-wrap: wrap; }
.empty-row td { text-align: center; color: var(--muted); padding: 24px; }
@media (max-width: 600px) { .card { padding: 22px 18px; } }

/* ---------- Pack home page ---------- */
.hub { max-width: 920px; margin: 0 auto; padding: 28px 16px 60px; }
.hub-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hub-top h1 { font-size: 26px; margin: 0 0 4px; }
.hub-top p { margin: 0; max-width: 560px; }
.hub-acct { font-size: 14px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.link { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; cursor: pointer; font-size: 14px; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.hub-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: 1fr auto; gap: 10px 14px; background: #fff; border: 2px solid #cbd6e8; border-radius: 16px; padding: 16px; }
.hub-card:hover { border-color: #a9c1ec; }
.hub-card.not-owned { background: #f7f8fa; border-style: dashed; }
.hub-ic { grid-row: span 2; width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; }
.hub-card.not-owned .hub-ic { background: #eceef2; color: var(--muted); }
.hub-txt h2 { font-size: 17px; margin: 2px 0 4px; }
.hub-txt p { margin: 0; font-size: 14px; color: var(--muted); }
.hub-act { align-self: end; }
.hub-act .btn { text-decoration: none; display: inline-block; }
.hub-upsell { margin-top: 22px; background: #fff; border: 2px solid #cbd6e8; border-radius: 16px; padding: 18px; }
.hub-upsell h2 { margin: 0 0 4px; font-size: 18px; }
.hub-upsell .btn { text-decoration: none; display: inline-block; margin-top: 10px; }
