/* Qwiks License Manager — single stylesheet, no build step. Brand colour comes from Settings. */
:root {
  --brand: #4f46e5;
  --brand-ink: #fff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --bg: #f6f7fb;
  --card: #fff;
  --side: #0b1020;
  --side-ink: #c7cbe0;
  --green: #059669; --green-bg: #ecfdf5;
  --amber: #b45309; --amber-bg: #fffbeb;
  --red: #dc2626; --red-bg: #fef2f2;
  --blue: #2563eb; --blue-bg: #eff6ff;
  --gray-bg: #f1f5f9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
img { max-width: 100%; }

/* ---------- layout ---------- */
.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .container { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.1rem; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo img { height: 32px; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; }
.nav { display: flex; gap: 4px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--ink-2); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover, .nav a.active { background: var(--gray-bg); text-decoration: none; color: var(--ink); }
main { min-height: calc(100vh - 160px); }
.page { padding: 32px 0 56px; }
.footer { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; padding-top: 36px; padding-bottom: 24px; }
.footer-links { display: flex; flex-direction: column; gap: 7px; }
.footer-links strong { text-transform: uppercase; letter-spacing: .08em; color: var(--ink); margin-bottom: 2px; }
.footer-links a { color: var(--ink-2); }
.footer-bottom { border-top: 1px solid var(--line); padding-top: 14px; padding-bottom: 18px; }
.cookie-note { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: var(--ink); color: #e2e8f0; border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: .88rem; z-index: 60; box-shadow: 0 10px 30px rgba(15,23,42,.25); }
.cookie-note a { color: #c7d2fe; }
.legal h2 { font-size: 1.1rem; margin-top: 1.6em; }
.legal table { margin: 10px 0; }
.legal ul { padding-left: 20px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 18px; } }

.hero { padding: 56px 0 28px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); max-width: 740px; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 640px; }

/* account layout */
.with-side { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
.side-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 88px; }
.side-nav a { color: var(--ink-2); padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.side-nav a:hover, .side-nav a.active { background: #fff; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }

/* admin layout */
.admin { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.admin-side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side .logo { color: #fff; padding: 4px 8px 18px; }
.admin-side nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side .group { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7290; padding: 16px 10px 6px; }
.admin-side nav a { color: var(--side-ink); padding: 8px 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; }
.admin-side nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.admin-side nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.admin-side .count { background: var(--brand); color: var(--brand-ink); border-radius: 99px; font-size: .72rem; padding: 1px 7px; font-weight: 700; }
.admin-main { min-width: 0; }
.admin-top { background: #fff; border-bottom: 1px solid var(--line); height: 60px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.admin-body { padding: 28px; max-width: 1280px; }
.menu-toggle { display: none; }

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card + .card, .stack > * + * { margin-top: 20px; }
.grid > .card, .plans > .card, .products > .card { margin-top: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; background: var(--brand); color: var(--brand-ink); line-height: 1.2; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn-light:hover { background: var(--gray-bg); filter: none; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--gray-bg); filter: none; }
.btn-sm { padding: 6px 11px; font-size: .84rem; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.link-danger { color: var(--red); background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
form.inline { display: inline; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .76rem; font-weight: 650; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-gray { background: var(--gray-bg); color: var(--muted); }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; }
.alert-success { background: var(--green-bg); color: #065f46; border-color: #a7f3d0; }
.alert-error { background: var(--red-bg); color: #991b1b; border-color: #fecaca; }
.alert-info { background: var(--blue-bg); color: #1e40af; border-color: #bfdbfe; }
.alert-warn { background: var(--amber-bg); color: #92400e; border-color: #fde68a; }
.alert ul { margin: 0; padding-left: 18px; }

/* forms */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--ink-2); }
.field { margin-bottom: 16px; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.field .error { font-size: .8rem; color: var(--red); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 30%, transparent); border-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; }
input[type=color] { width: 54px; height: 38px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input, .filters select { width: auto; min-width: 160px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 2px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; font-size: .9rem; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; background: #fafbfd; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbff; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* key/value lists */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* stats */
.stat { padding: 18px 20px; }
.stat .label { color: var(--muted); font-size: .84rem; font-weight: 500; }
.stat .value { font-size: 1.6rem; font-weight: 750; margin-top: 2px; letter-spacing: -.02em; }
.stat .sub { font-size: .8rem; color: var(--muted); }

/* license key */
.key { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); background: var(--gray-bg); border: 1px dashed var(--line-2); padding: 7px 10px; border-radius: 8px; font-size: .92rem; letter-spacing: .03em; }
.key button { border: 0; background: #fff; border-radius: 6px; padding: 3px 8px; font: 600 .74rem var(--font); cursor: pointer; color: var(--ink-2); box-shadow: var(--shadow); }
.key-lg { font-size: 1.1rem; padding: 12px 14px; }
pre.code { background: #0b1020; color: #d7dcf5; padding: 16px; border-radius: 10px; overflow-x: auto; font: 12.5px/1.6 var(--mono); margin: 0; white-space: pre; }

/* store */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.product-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .15s, box-shadow .15s; color: inherit; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,.08); text-decoration: none; }
.product-media { aspect-ratio: 16 / 9; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 85%, #000), color-mix(in srgb, var(--brand) 55%, #fff)); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 2.2rem; overflow: hidden; }
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product-card .card-body { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.product-card .price { margin-top: auto; padding-top: 10px; font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); font-size: .86rem; font-weight: 500; }
.chip.active, .chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.plan { padding: 22px; display: flex; flex-direction: column; position: relative; }
.plan.highlight { border: 2px solid var(--brand); }
.plan .ribbon { position: absolute; top: -11px; left: 20px; background: var(--brand); color: var(--brand-ink); font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .05em; }
.plan .amount { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
.plan ul { list-style: none; padding: 0; margin: 14px 0 20px; display: grid; gap: 7px; }
.plan li { padding-left: 24px; position: relative; font-size: .92rem; }
.plan li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 12px; height: 7px; border-left: 2px solid var(--green); border-bottom: 2px solid var(--green); transform: rotate(-45deg); }
.plan .btn { margin-top: auto; }
.prose { max-width: 760px; }
.prose h2, .prose h3 { margin-top: 1.4em; }
.prose ul { padding-left: 20px; }
.summary-line { display: flex; justify-content: space-between; padding: 7px 0; }
.summary-line.total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-weight: 750; font-size: 1.1rem; }
.gateway { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; margin-bottom: 8px; cursor: pointer; font-weight: 500; }
.gateway:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, #fff); }
.auth-card { max-width: 420px; margin: 48px auto; }

/* tickets */
.thread { display: grid; gap: 14px; }
.msg { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.msg.staff { border-color: color-mix(in srgb, var(--brand) 35%, #fff); background: color-mix(in srgb, var(--brand) 3%, #fff); }
.msg.internal { border-style: dashed; border-color: #f59e0b; background: #fffdf5; }
.msg-head { padding: 10px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; }
.msg-body { padding: 14px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center; font-size: .74rem; font-weight: 700; flex: none; }

/* chart */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 10px; }
.bars .bar { flex: 1; background: color-mix(in srgb, var(--brand) 75%, #fff); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .bar:hover { background: var(--brand); }
.bars .bar:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: .74rem; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; }
.bars-axis { display: flex; justify-content: space-between; font-size: .74rem; color: var(--muted); margin-top: 6px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--ink); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
details.box { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
details.box > summary { padding: 12px 16px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
details.box > summary::-webkit-details-marker { display: none; }
details.box[open] > summary { border-bottom: 1px solid var(--line); }
details.box > .inner { padding: 16px; }
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: .88rem; }
.pagination .current { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.pagination .disabled { color: var(--line-2); }

/* invoice / print */
.invoice { max-width: 820px; margin: 0 auto; padding: 40px; }
@media print {
  .no-print, .topbar, .footer, .side-nav, .admin-side, .admin-top { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; border: 0; } .with-side { display: block; }
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-main { grid-template-columns: 1fr; }
  .admin { grid-template-columns: 1fr; }
  .admin-side { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 50; }
  .admin-side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .menu-toggle { display: inline-flex; }
  .admin-body { padding: 20px 16px; }
  .admin-top { padding: 0 16px; }
}
@media (max-width: 760px) {
  .with-side { grid-template-columns: 1fr; gap: 16px; }
  .side-nav { position: static; flex-direction: row; overflow-x: auto; }
  .side-nav a { white-space: nowrap; }
  .grid-2, .form-grid { grid-template-columns: 1fr; }
  .container { padding: 0 16px; }
  .topbar .container { gap: 12px; height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .nav { margin-left: 0; width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .invoice { padding: 16px; }
}
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr; } }
.admin-side .logo img { background: #fff; padding: 4px 8px; border-radius: 8px; height: 36px; }
