/* Boom In Certify — brand blue #2C469D, Poppins */
@font-face { font-family: "Poppins"; src: url("../fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/Poppins-Bold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("../fonts/Poppins-Light.ttf") format("truetype"); font-weight: 300; font-display: swap; }

:root {
  --blue: #2C469D; --blue-d: #22377C; --blue-l: #EEF1FA;
  --ink: #111827; --muted: #6B7280; --line: #E5E7EB; --bg: #F6F7FB; --card: #FFFFFF;
  --ok: #157F3B; --ok-l: #E7F6EC; --warn: #9A6200; --warn-l: #FFF4DB; --err: #B42318; --err-l: #FDECEA;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.55 "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 12px; font-weight: 700; }
h2 { font-size: 18px; margin: 0 0 12px; font-weight: 600; }
p { margin: 0 0 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--blue-l); padding: 1px 6px; border-radius: 5px; }
img { max-width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 40px; min-height: 70vh; }
.foot { color: var(--muted); font-size: 13px; padding-bottom: 24px; }

/* Top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand img { height: 44px; width: auto; display: block; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a, .nav .linklike { padding: 8px 12px; border-radius: 8px; color: var(--ink); font-size: 14px; }
.nav a:hover, .nav .linklike:hover { background: var(--blue-l); text-decoration: none; }
.nav a.on { background: var(--blue); color: #fff; }
.menu-btn { display: none; margin-left: auto; font-size: 22px; background: none; border: 0; cursor: pointer; padding: 6px 10px; }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: #fff; border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  .nav.open { display: flex; }
}

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--blue); text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); }
.btn-danger { color: var(--err); border-color: #F3C4BF; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; color: var(--blue); }
form.inline { display: inline; }
input, select, textarea { font: inherit; font-size: 15px; width: 100%; padding: 10px 12px; border: 1px solid #D1D5DB; border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { padding: 2px; height: 38px; }
label { display: block; font-size: 14px; font-weight: 600; }
label > input, label > select, label > textarea { margin-top: 6px; font-weight: 400; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap, .wrap.row { flex-wrap: wrap; }
.w-auto { width: auto; } .w-sm { width: 110px; } .w-xs { width: 60px; display: inline-block; }
.code-input { font-size: 22px; letter-spacing: 6px; text-align: center; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--blue); background: var(--blue-l); }

/* Panels and layout */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 18px; }
.narrow { max-width: 560px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid2 > .panel { margin-bottom: 0; }
.grid2 + * { margin-top: 18px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head-row h1, .head-row h2 { margin: 0; }
.center { text-align: center; }
.right { text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.dim { opacity: .55; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr; } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-num { font-size: 24px; font-weight: 700; }
.stat-num small { font-size: 14px; color: var(--muted); font-weight: 400; }
.bar { height: 6px; background: var(--blue-l); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--blue); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table th.right, .table td.right { text-align: right; }
.panel .table { margin-bottom: 8px; }
@media (max-width: 700px) {
  .hide-sm { display: none; }
  .panel { padding: 14px; overflow-x: auto; }
  .table th, .table td { padding: 8px 6px; }
}

/* Pills and alerts */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #EEF0F3; color: #374151; vertical-align: middle; }
.pill-ok { background: var(--ok-l); color: var(--ok); }
.pill-warn { background: var(--warn-l); color: var(--warn); }
.pill-err { background: var(--err-l); color: var(--err); }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-l); color: var(--ok); border-color: #BFE5CB; }
.alert-err { background: var(--err-l); color: var(--err); border-color: #F6C6C0; }
.alert-warn { background: var(--warn-l); color: #6B4500; border-color: #F5DCA2; }
.alert-info { background: var(--blue-l); color: var(--blue-d); border-color: #D5DCF1; }

/* Plain pages (sign in, install, errors) */
body.plain { background: linear-gradient(180deg, var(--blue-l), var(--bg) 320px); }
.plain-wrap { max-width: 440px; margin: 0 auto; padding: 40px 16px; }
.plain-wrap.wide { max-width: 680px; }
.plain-logo { display: block; text-align: center; margin-bottom: 20px; }
.plain-logo img { height: 64px; width: auto; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 6px 24px rgba(44, 70, 157, .07); }
.card h1 { font-size: 22px; }
.card h2 { margin-top: 22px; font-size: 16px; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.qr-setup { text-align: center; margin: 10px 0; }
.qr-setup img { border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.secret { display: inline-block; margin-top: 6px; font-size: 14px; letter-spacing: 1px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0 18px; }
.codes code { font-size: 17px; text-align: center; padding: 8px; }

/* Certificate pages */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.tpl-card { display: block; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #fff; color: var(--ink); }
.tpl-card:hover { border-color: var(--blue); text-decoration: none; }
.tpl-card img { display: block; width: 100%; aspect-ratio: 1.414; object-fit: cover; background: var(--bg); }
.tpl-card > span { display: block; padding: 10px 12px; font-weight: 600; }
.preview-img img { display: block; width: 100%; border-radius: 6px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 14px; }
.dl dt { color: var(--muted); font-size: 14px; }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }
.qr-img { border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { font-size: 13px; }
.search { margin-bottom: 14px; }
.search input { max-width: 420px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }

/* Admin bits */
.upload-box { margin-top: 10px; }
.upload-box > summary { list-style: none; display: inline-flex; }
.upload-box > summary::-webkit-details-marker { display: none; }
.upload-box[open] > summary { margin-bottom: 14px; }
.actions { position: relative; display: inline-block; text-align: left; }
.actions > summary { list-style: none; }
.actions > summary::-webkit-details-marker { display: none; }
.actions-menu { position: absolute; right: 0; top: 110%; z-index: 10; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  width: 300px; box-shadow: 0 10px 30px rgba(0,0,0,.12); display: flex; flex-direction: column; gap: 10px; }
.actions-menu .btn { width: 100%; }
.row.wrap > form.row { margin-right: auto; }
.row label.small { display: flex; align-items: center; gap: 6px; }
.row label.small > select, .row label.small > input { margin-top: 0; }

/* Design editor */
.editor { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .editor { grid-template-columns: 1fr; } }
.ed-stage { position: relative; width: 100%; background: #ddd; border-radius: 6px; overflow: hidden; user-select: none; touch-action: none; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.ed-stage img { display: block; width: 100%; height: 100%; pointer-events: none; }
.ed-el { position: absolute; border: 1.5px dashed rgba(44,70,157,.65); cursor: move; display: flex; align-items: center; white-space: nowrap; overflow: visible; line-height: 1; }
.ed-el.sel { border-style: solid; border-color: var(--blue); background: rgba(44,70,157,.08); z-index: 3; }
.ed-el .ed-txt { width: 100%; overflow: hidden; text-overflow: clip; }
.ed-el .ed-tag { position: absolute; top: -18px; left: -1px; font: 600 10px/16px "Poppins", sans-serif; color: #fff; background: var(--blue); padding: 0 5px; border-radius: 3px 3px 0 0; white-space: nowrap; }
.ed-el .ed-h { position: absolute; right: -6px; top: 50%; width: 10px; height: 22px; margin-top: -11px; background: var(--blue); border-radius: 3px; cursor: ew-resize; }
.ed-qr { background: #fff; display: block; }
.ed-qr .ed-qrimg { display: block; width: 100%; height: 100%; pointer-events: none; }
.ed-qr .ed-h { right: -6px; bottom: -6px; top: auto; width: 12px; height: 12px; margin: 0; cursor: nwse-resize; border-radius: 50%; }
.ed-side { position: sticky; top: 80px; }
.ed-list { display: flex; flex-direction: column; gap: 4px; margin: 14px 0; }
.ed-list button { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px; cursor: pointer; }
.ed-list button.sel { border-color: var(--blue); background: var(--blue-l); font-weight: 600; }
.ed-align { display: flex; gap: 4px; }
.ed-align button { flex: 1; }
.ed-align button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.ed-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ed-check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.ed-rename { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }

/* Invoice (print) */
.print-body { background: #fff; }
.invoice { max-width: 820px; margin: 30px auto; padding: 0 20px; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--blue); padding-bottom: 14px; margin-bottom: 20px; }
.inv-head h1 { color: var(--blue); margin: 0; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.inv-table tfoot th { font-size: 16px; color: var(--ink); text-transform: none; letter-spacing: 0; }
@media print {
  .noprint, .topbar, .foot, .nav { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; padding: 0; }
}
.mt { margin-top: 8px; }
