:root {
  --blue: #0067c0;
  --blue-dark: #004e96;
  --red: #c42b1c;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e3e7ee;
  --text: #1a1f29;
  --dim: #5b6472;
  --success: #0f7b0f;
  --warn: #9d5d00;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 6px 20px rgba(16,24,40,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Brand ─── */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; }
.brand-sm .brand-logo { width: 30px; height: 30px; }
.brand-text { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.brand-sm .brand-text { font-size: 17px; }
.brand-ck { color: var(--text); }
.brand-pro { color: var(--red); }

/* ─── Buttons ─── */
.btn { font-family: inherit; font-size: 14px; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: #eef1f6; }
.btn-danger { background: transparent; border-color: #f0c9c5; color: var(--red); }
.btn-danger:hover { background: #fdeeec; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Auth ─── */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 18px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 400px; }
.auth-card .brand { justify-content: center; }
.auth-sub { text-align: center; color: var(--dim); margin: 4px 0 22px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--dim); }
.auth-form input { font-family: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe; }
.auth-form input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,103,192,.12); }
.auth-form .btn { margin-top: 6px; }
.auth-foot { color: var(--dim); font-size: 13px; }
.tabs { display: flex; background: #eef1f6; border-radius: 8px; padding: 4px; margin-bottom: 20px; }
.tab { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 6px; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--dim); cursor: pointer; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.1); }

/* ─── Topbar ─── */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 0 24px; height: 62px; display: flex; align-items: center; gap: 24px; }
.nav { display: flex; gap: 4px; flex: 1; }
.navlink { border: none; background: transparent; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--dim); padding: 8px 14px; border-radius: 8px; cursor: pointer; }
.navlink:hover { background: #eef1f6; color: var(--text); }
.navlink.active { background: #e3effb; color: var(--blue); }
.user { display: flex; align-items: center; gap: 12px; }
.user-email { font-size: 13px; color: var(--dim); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Content ─── */
.content { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }
.view h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.lead { color: var(--dim); margin-bottom: 24px; max-width: 640px; }
.muted { color: var(--dim); font-size: 14px; }

/* ─── Cards / Grid ─── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-bottom: 28px; }
.product { display: flex; flex-direction: column; }
.product-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.product-ico { width: 44px; height: 44px; border-radius: 10px; background: #e3effb; display: flex; align-items: center; justify-content: center; }
.product-ico img { width: 28px; height: 28px; object-fit: contain; }
.product h3 { font-size: 17px; font-weight: 700; }
.product .tagline { font-size: 13px; color: var(--dim); }
.product .desc { font-size: 14px; color: var(--text); margin: 4px 0 16px; flex: 1; }
.product-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price { font-size: 20px; font-weight: 800; }
.price small { font-size: 12px; font-weight: 600; color: var(--dim); }
.version { font-size: 12px; color: var(--dim); }
.soon { font-size: 13px; font-weight: 600; color: var(--warn); }

/* ─── Redeem row ─── */
.redeem h3 { font-size: 16px; margin-bottom: 4px; }
.row { display: flex; gap: 10px; margin-top: 12px; }
.row input { flex: 1; font-family: inherit; font-size: 14px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; }
.row input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,103,192,.12); }

/* ─── Lists / Tables ─── */
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 12px; }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.item-title { font-size: 16px; font-weight: 700; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: var(--dim); }
.item-meta b { color: var(--text); font-weight: 600; }
.item-actions { display: flex; gap: 8px; }
.keybox { font-family: "Consolas", "SF Mono", monospace; font-size: 13px; background: #f0f3f8; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; letter-spacing: .5px; }

.badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge-active { background: #e6f4ea; color: var(--success); }
.badge-expired { background: #fdeeec; color: var(--red); }
.badge-disabled { background: #eef1f6; color: var(--dim); }

.empty { text-align: center; color: var(--dim); padding: 48px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-ico { font-size: 34px; margin-bottom: 8px; opacity: .5; }

/* ─── Messages / Toast ─── */
.msg { font-size: 13px; margin-top: 12px; min-height: 18px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--success); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1a1f29; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); z-index: 100; }
.toast.err { background: var(--red); }

.foot { text-align: center; color: var(--dim); font-size: 13px; padding: 24px; border-top: 1px solid var(--border); }

@media (max-width: 640px) {
  .topbar-inner { gap: 12px; padding: 0 14px; }
  .brand-sm .brand-text { display: none; }
  .nav { gap: 0; }
  .navlink { padding: 8px 10px; font-size: 13px; }
  .user-email { display: none; }
  .content { padding: 22px 14px 48px; }
}
