:root {
  --brand: #5b21b6;
  --brand-2: #7c3aed;
  --brand-soft: #f3efff;
  --brand-line: #ddd3fb;
  --ink: #1f1933;
  --ink-2: #4b4560;
  --muted: #8a85a0;
  --line: #ebe8f2;
  --bg: #faf9fd;
  --card: #ffffff;
  --ok: #059669;
  --ok-soft: #e7f8f1;
  --warn: #d97706;
  --warn-soft: #fff7e6;
  --err: #dc2626;
  --err-soft: #fdecec;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 25, 51, .04), 0 8px 24px rgba(31, 25, 51, .06);
  --font: "Alexandria", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; outline: none; }
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; }
button, input, select, textarea { font: inherit; color: inherit; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ltr { direction: ltr; unicode-bidi: embed; }
.hidden { display: none !important; }

/* ---------- Icons ---------- */
.i { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -0.22em; display: inline-block; }
.card-title .i { color: var(--brand); width: 1.2em; height: 1.2em; }
.title-ic { display: flex; align-items: center; gap: 10px; }
.title-ic .i { color: var(--brand); }
.more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.hint-line { display: flex; gap: 8px; align-items: flex-start; }
.hint-line .i { color: var(--warn); margin-top: 3px; }
.big-ic { width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.big-ic .i { width: 34px; height: 34px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 20px; height: 70px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex-shrink: 0; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  box-shadow: 0 4px 12px rgba(91, 33, 182, .3);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 17px; color: var(--brand); }
.brand-text small { font-size: 9px; letter-spacing: 2px; color: var(--muted); }
.search { flex: 1; max-width: 460px; display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.search input { flex: 1; border: 0; background: transparent; padding: 9px 16px; outline: none; min-width: 0; }
.search button { border: 0; background: transparent; padding: 0 14px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.search button:hover { color: var(--brand); }
.search:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.nav { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.nav a { color: var(--ink-2); padding: 8px 12px; border-radius: 10px; font-size: 14px; white-space: nowrap; position: relative; display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover { background: var(--brand-soft); color: var(--brand); }
.nav a.active { color: var(--brand); font-weight: 600; }
.cart-link .count {
  position: absolute; top: -2px; left: 0; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--brand); color: #fff; font-size: 11px; display: grid; place-items: center; line-height: 1;
}

@media (max-width: 820px) {
  .header-row { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .nav a { padding: 6px 8px; font-size: 13px; }
  .brand-text small { display: none; }
}

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; transition: .15s; white-space: nowrap;
  background: var(--card); color: var(--ink);
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 4px 14px rgba(91, 33, 182, .25); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(91, 33, 182, .35); }
.btn-ghost { border-color: var(--brand-line); color: var(--brand); background: #fff; }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--err-soft); color: var(--err); }
.btn-danger:hover { background: var(--err); color: #fff; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 14px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=color]), .field select, .field textarea, select.input {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: .15s;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.field input[type=color] { width: 56px; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: #fff; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg label, .seg button { padding: 7px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); border: 0; background: transparent; }
.seg input { display: none; }
.seg input:checked + span, .seg button.on { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.seg label span { display: block; padding: 0; }
.seg label:has(input:checked) { background: #fff; color: var(--brand); box-shadow: var(--shadow); }

/* ---------- Cards / generic ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-title { font-size: 17px; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 600; }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.badge-err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.notice { padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); color: #92400e; font-size: 13px; border-inline-start: 4px solid var(--warn); }
.notice.info { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-2); }
.notice.ok { background: var(--ok-soft); color: #065f46; border-color: var(--ok); }

.section { padding: 48px 16px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.section-head h2 { font-size: 24px; margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.page-head { padding: 32px 0 8px; }
.page-head h1 { font-size: 28px; margin: 0; display: flex; align-items: center; gap: 10px; }
.page-head h1 .i { color: var(--brand); }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }

/* ---------- Hero ---------- */
.hero {
  color: #fff; overflow: hidden;
  background:
    linear-gradient(100deg, rgba(26, 16, 54, .97) 0%, rgba(42, 22, 96, .9) 45%, rgba(31, 16, 72, .72) 100%),
    url("https://images.pexels.com/photos/6683392/pexels-photo-6683392.jpeg?auto=compress&cs=tinysrgb&w=1600") center / cover no-repeat,
    #1a1036;
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; padding: 64px 16px 72px; }
.hero .pill { background: rgba(255, 255, 255, .1); color: #d9ccff; border: 1px solid rgba(255, 255, 255, .15); }
.hero h1 { font-size: clamp(30px, 4.4vw, 48px); font-weight: 800; margin: 18px 0 14px; }
.hero h1 em { font-style: normal; color: #c4b1ff; display: block; }
.hero p { color: #d7d0ee; font-size: 16px; max-width: 560px; margin: 0 0 26px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-ghost { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .25); }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .16); }
.hero-stats { display: flex; gap: 28px; margin-top: 34px; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 24px; }
.hero-stats span { font-size: 12px; color: #b9b0d6; }
.hero-art { position: relative; }
.hero-art .paper { transform: rotate(-3deg); box-shadow: 0 30px 60px rgba(0, 0, 0, .35); }
.hero-badge {
  position: absolute; top: 18px; left: -12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  background: var(--ok); color: #fff; font-weight: 700; font-size: 13px; padding: 6px 14px; border-radius: 999px;
  box-shadow: 0 8px 18px rgba(5, 150, 105, .4); transform: rotate(-6deg);
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; padding-top: 40px; padding-bottom: 48px; gap: 32px; }
  .hero-art { max-width: 420px; margin: 0 auto; width: 100%; }
}

/* ---------- Paper sample (personalisation mockup) ---------- */
.paper {
  --fc: #1e3a8a;
  position: relative; background: #fff; color: #222; border-radius: 10px; padding: 22px 22px 14px;
  border: 1px solid var(--line); overflow: hidden; aspect-ratio: 1 / 1.25; display: flex; flex-direction: column;
}
.paper-wm { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.paper-wm span { font-size: clamp(28px, 5vw, 46px); font-weight: 800; color: var(--fc); opacity: .1; transform: rotate(-35deg); white-space: nowrap; }
.paper-wm img { max-width: 60%; max-height: 50%; opacity: .1; object-fit: contain; }
.paper-head { text-align: center; font-weight: 800; color: #b91c1c; font-size: 14px; margin-bottom: 4px; }
.paper-sub { text-align: center; font-size: 10px; color: #777; margin-bottom: 12px; border-bottom: 1px dashed #ccc; padding-bottom: 8px; }
.paper-q { font-size: 11.5px; font-weight: 700; color: #1e3a8a; margin: 10px 0 6px; }
.paper-opt { font-size: 10.5px; color: #333; margin: 3px 0; padding-inline-start: 10px; display: flex; align-items: center; gap: 6px; }
.paper-opt i { font-style: normal; width: 15px; height: 15px; border: 1px solid #444; border-radius: 50%; display: grid; place-items: center; font-size: 8.5px; font-weight: 700; flex-shrink: 0; }
.paper-line { height: 7px; border-radius: 4px; background: #eeedf3; margin: 6px 0; }
.paper-line.short { width: 65%; }
.paper-foot {
  margin-top: auto; border-top: 2px solid var(--fc); padding-top: 7px;
  display: flex; justify-content: space-between; gap: 8px; color: var(--fc); font-weight: 700; font-size: 11.5px;
}
.paper-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper-foot span:nth-child(2) { text-align: center; }

/* ---------- Subjects ---------- */
.subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.subject-tile {
  --c: var(--brand);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
  display: flex; flex-direction: column; transition: .15s; position: relative; overflow: hidden;
}
.subject-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: transparent; }
.subject-tile .tile-img { display: block; height: 96px; background: color-mix(in srgb, var(--c) 18%, #fff); position: relative; overflow: hidden; }
.subject-tile .tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.subject-tile:hover .tile-img img { transform: scale(1.06); }
.subject-tile .tile-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%); }
.subject-tile .tile-body { display: flex; align-items: center; gap: 10px; padding: 12px 14px 14px; }
.subject-tile .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--c); color: #fff; display: grid; place-items: center; margin-top: -32px; position: relative; z-index: 1; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); flex-shrink: 0; }
.subject-tile .ic .i { width: 20px; height: 20px; }
.subject-tile b { font-size: 15px; display: block; line-height: 1.3; }
.subject-tile small { color: var(--muted); font-size: 12px; }

/* ---------- Product cards ---------- */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: .18s; }
.pcard:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.pcard-cover {
  --c: var(--brand);
  position: relative; height: 150px; display: block;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 18%, #fff), color-mix(in srgb, var(--c) 6%, #fff));
  overflow: hidden;
}
.pcard-sheet {
  position: absolute; bottom: -20px; inset-inline-start: 50%; transform: translateX(50%) rotate(-4deg);
  width: 120px; height: 150px; background: #fff; border-radius: 6px; box-shadow: 0 8px 22px rgba(0, 0, 0, .12);
  padding: 12px 10px; display: flex; flex-direction: column; gap: 5px;
}
.pcard-sheet i { display: block; height: 5px; border-radius: 3px; background: #eceaf2; }
.pcard-sheet i:first-child { background: var(--c); opacity: .7; width: 70%; margin: 0 auto 4px; height: 6px; }
.pcard-sheet i:nth-child(3n) { width: 70%; }
.pcard-cover.has-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.pcard:hover .pcard-cover.has-img img { transform: scale(1.05); }
.pcard-cover.has-img::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, color-mix(in srgb, var(--c) 70%, transparent), rgba(0, 0, 0, .05) 65%); }
.pcard-icon { position: absolute; bottom: 12px; inset-inline-start: 12px; z-index: 1; width: 38px; height: 38px; border-radius: 11px; background: #fff; color: var(--c); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.pcard-icon .i { width: 20px; height: 20px; }
.pcard-cover:not(.has-img) .pcard-icon { top: 12px; bottom: auto; }
.pcard-type { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 1; background: #fff; color: var(--c); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; }
.pcard-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.pcard-meta { font-size: 12px; color: var(--muted); }
.pcard h3 { font-size: 15px; margin: 4px 0 12px; font-weight: 600; }
.pcard h3 a { color: var(--ink); }
.pcard h3 a:hover { color: var(--brand); }
.pcard-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { font-weight: 800; color: var(--brand); font-size: 17px; }
.price s { color: var(--muted); font-weight: 400; font-size: 13px; margin-inline-start: 6px; }

.empty { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty .ic { width: 72px; height: 72px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 14px; }
.empty .ic .i { width: 34px; height: 34px; }
.empty h3 { color: var(--ink); }

/* ---------- Steps ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: s; }
.step { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: relative; }
.step::before {
  counter-increment: s; content: counter(s, arabic-indic);
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; font-weight: 800;
  display: grid; place-items: center; margin-bottom: 12px;
}
.step h3 { font-size: 16px; }
.step p { margin: 0; color: var(--ink-2); font-size: 14px; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

.feature-band { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.feature-grid ul { list-style: none; padding: 0; margin: 18px 0 24px; }
.feature-grid li { padding: 8px 0; display: flex; gap: 10px; align-items: center; }
.feature-grid li .i { color: var(--ok); width: 20px; height: 20px; }
@media (max-width: 860px) { .feature-grid { grid-template-columns: 1fr; } }

/* ---------- Shop ---------- */
.shop-layout { display: grid; grid-template-columns: 250px 1fr; gap: 24px; padding: 20px 16px 56px; align-items: start; }
.filters { position: sticky; top: 90px; }
.filters h3 { font-size: 15px; }
.filters .field { margin-bottom: 12px; }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.results-bar select { width: auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.chip.on, .chip:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (max-width: 860px) {
  .shop-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
}

/* ---------- Product page ---------- */
.product-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; padding: 24px 16px 40px; align-items: start; }
@media (max-width: 900px) { .product-layout { grid-template-columns: 1fr; } }
.preview { position: sticky; top: 90px; }
.preview-box { position: relative; border-radius: var(--radius); overflow: hidden; background: #fff; border: 1px solid var(--line); min-height: 420px; box-shadow: var(--shadow); }
.preview-box canvas { display: block; width: 100%; height: auto; }
.preview-box .veil {
  position: absolute; inset: 52% 0 0 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, .92) 35%, #fff);
  display: flex; align-items: end; justify-content: center; padding-bottom: 22px;
}
.preview-box .veil span { background: var(--ink); color: #fff; padding: 6px 16px; border-radius: 999px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.preview-box .loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); gap: 10px; text-align: center; }
.preview-box.ready .loading { display: none; }
.preview-box:not(.ready) .veil { display: none; }
.preview-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 10px; flex-wrap: wrap; }
.product-info h1 { font-size: 26px; }
.meta-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 18px; }
.buy-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 18px 0; }
.buy-box .price { font-size: 30px; }
.buy-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.buy-actions .btn { flex: 1; }
.includes { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.includes li { display: flex; gap: 12px; align-items: start; font-size: 14px; color: var(--ink-2); }
.includes li span:first-child { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex-shrink: 0; }
.includes li span:first-child .i { width: 18px; height: 18px; }
.desc { white-space: pre-line; color: var(--ink-2); }

/* ---------- Cart / checkout ---------- */
.two-col { display: grid; grid-template-columns: 1fr 360px; gap: 24px; padding: 20px 16px 56px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.line-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-thumb { --c: var(--brand); width: 52px; height: 58px; border-radius: 12px; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); display: grid; place-items: center; flex-shrink: 0; }
.line-thumb .i { width: 24px; height: 24px; }
.line-info { flex: 1; min-width: 0; }
.line-info b { display: block; font-weight: 600; }
.line-info small { color: var(--muted); }
.summary-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; }
.summary-row.total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 14px; font-size: 18px; font-weight: 800; }
.summary-row .disc { color: var(--ok); }
.coupon-form { display: flex; gap: 8px; margin: 14px 0; }
.coupon-form input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; text-transform: uppercase; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.pay-method { border: 2px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; display: flex; gap: 10px; align-items: center; background: #fff; }
.pay-method input { accent-color: var(--brand); }
.pay-method > .i { color: var(--brand); width: 24px; height: 24px; }
.pay-method:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.pay-method b { display: block; font-size: 14px; }
.pay-method small { color: var(--muted); font-size: 12px; }
.processing { position: fixed; inset: 0; background: rgba(26, 16, 54, .6); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 200; }
.processing div { background: #fff; padding: 30px 40px; border-radius: 20px; text-align: center; box-shadow: var(--shadow); }
.processing .spin { width: 36px; height: 36px; border-width: 4px; margin: 0 auto 14px; display: block; border-color: var(--brand-soft); border-top-color: var(--brand); }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 520px; margin: 40px auto 64px; padding: 0 16px; }
.auth-wrap.wide { max-width: 760px; }
.auth-wrap .card { padding: 30px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }

/* ---------- Account ---------- */
.account-layout { display: grid; grid-template-columns: 230px 1fr; gap: 24px; padding: 20px 16px 56px; align-items: start; }
.side-nav { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; position: sticky; top: 90px; }
.side-nav .who { padding: 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side-nav .who b { display: block; }
.side-nav .who small { color: var(--muted); word-break: break-all; }
.side-nav a, .side-nav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-size: 14px; width: 100%; border: 0; background: none; cursor: pointer; text-align: start; }
.side-nav a:hover, .side-nav button:hover { background: var(--bg); }
.side-nav a .i, .side-nav button .i { width: 18px; height: 18px; color: var(--muted); }
.side-nav a.on .i { color: var(--brand); }
.side-nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
@media (max-width: 860px) {
  .account-layout { grid-template-columns: 1fr; }
  .side-nav { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .side-nav .who { width: 100%; }
  .side-nav a, .side-nav button { width: auto; }
}
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.lib-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.lib-item header { display: flex; gap: 12px; align-items: center; }
.lib-item h3 { font-size: 15px; margin: 0; font-weight: 600; }
.lib-item .actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.profile-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.profile-grid .paper { position: sticky; top: 90px; }
@media (max-width: 1000px) { .profile-grid { grid-template-columns: 1fr; } .profile-grid .paper { position: static; max-width: 360px; } }
.logo-drop { display: flex; align-items: center; gap: 14px; }
.logo-drop .thumb { width: 72px; height: 72px; border-radius: 12px; border: 1px dashed var(--brand-line); display: grid; place-items: center; background: var(--bg); overflow: hidden; color: var(--muted); }
.logo-drop .thumb .i { width: 28px; height: 28px; }
.logo-drop .thumb img { max-width: 100%; max-height: 100%; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; background: var(--bg); color: var(--ink-2); font-weight: 600; font-size: 13px; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 24px 16px 56px; align-items: start; }
@media (max-width: 860px) { .admin-layout { grid-template-columns: 1fr; } }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-head h1 { font-size: 22px; margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .kpis { grid-template-columns: 1fr 1fr; } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.kpi small { color: var(--muted); font-size: 13px; }
.kpi b { display: block; font-size: 24px; margin-top: 4px; }
.bars { display: flex; align-items: end; gap: 6px; height: 180px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .bar i { display: block; width: 100%; max-width: 30px; background: linear-gradient(to top, var(--brand), var(--brand-2)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bars .bar small { font-size: 10px; color: var(--muted); white-space: nowrap; }
.hbar { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; }
.hbar span:first-child { width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--brand-2); border-radius: 5px; }
.meter { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; margin: 8px 0; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter.warn i { background: var(--warn); }
.meter.err i { background: var(--err); }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.dash-grid .card + .card { margin-top: 0; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.file-drop .i { width: 22px; height: 22px; color: var(--brand); vertical-align: middle; }
.file-drop { border: 2px dashed var(--brand-line); border-radius: 14px; padding: 22px; text-align: center; background: var(--brand-soft); cursor: pointer; display: block; }
.file-drop:hover { border-color: var(--brand-2); }
.file-drop input { display: none; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat-list li:last-child { border-bottom: 0; }
.cat-thumb { --c: var(--brand); width: 44px; height: 44px; border-radius: 12px; overflow: hidden; position: relative; display: grid; place-items: center; background: var(--c); color: #fff; flex-shrink: 0; }
.cat-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .45; }
.cat-thumb .i { position: relative; width: 20px; height: 20px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-top: 14px; }
.inline-form .field { margin: 0; flex: 1; min-width: 120px; }

/* ---------- Success / invoice ---------- */
.success-hero { text-align: center; padding: 40px 16px 10px; }
.success-hero .ic { width: 72px; height: 72px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto 16px; }
.success-hero .ic .i { width: 36px; height: 36px; stroke-width: 2.5; }
.invoice { max-width: 760px; margin: 30px auto 60px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; }
.invoice-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--brand); padding-bottom: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.invoice-head .brand-text b { font-size: 20px; }
.invoice .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; font-size: 14px; }
.invoice .meta b { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }

/* ---------- Footer ---------- */
.site-footer { background: #1a1036; color: #b9b0d6; padding: 36px 0 22px; margin-top: 40px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 28px; }
.site-footer h4 { color: #fff; font-size: 15px; }
.site-footer a { color: #d9ccff; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-footer li { display: flex; align-items: center; gap: 8px; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 26px; padding-top: 16px; font-size: 12px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.site-footer .brand-text b { color: #fff; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Toast & spinner ---------- */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100% - 32px); }
.toast { display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: tin .2s ease-out; transition: .3s; }
.toast-error { background: var(--err); }
.toast-ok { background: #1f1933; }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: currentColor; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite; }
.btn-ghost .spin, .btn-soft .spin, .loading .spin { border-color: var(--brand-soft); border-top-color: var(--brand); }
.loading .spin { width: 28px; height: 28px; border-width: 3px; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- Print (invoice) ---------- */
@media print {
  .site-header, .site-footer, #toasts, .no-print { display: none !important; }
  body { background: #fff; }
  .invoice { border: 0; margin: 0; max-width: none; padding: 0; }
}
