/* BadgeDesk admin styles */
@font-face { font-family: 'BonumBD'; src: url('../fonts/bonum-bold.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
:root {
  --brand: #16523F; --brand-2: #1F6E56; --brand-soft: #E7F0EC;
  --ink: #15201B; --ink-2: #4B5852; --ink-3: #7A8781; --line: #DDE3E0; --line-2: #EEF2F0;
  --bg: #F5F7F6; --card: #FFFFFF;
  --good: #1E7A4C; --good-bg: #E5F4EC; --warn: #8A5A00; --warn-bg: #FFF4DB; --bad: #B4232C; --bad-bg: #FDECEC; --info: #1E4E8A; --info-bg: #E8F0FB;
  --r: 10px; --shadow: 0 1px 2px rgba(16, 32, 24, .06), 0 1px 1px rgba(16, 32, 24, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.2; margin: 2px 0 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 16px; margin: 6px 0 2px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid rgba(255,255,255,.5); border-radius: 4px; margin-left: 6px; opacity: .85; }
.muted { color: var(--ink-3); } .small { font-size: 13px; } .right { text-align: right; } .center { justify-content: center; } .nowrap { white-space: nowrap; }
.grow { flex: 1; } .mt { margin-top: 14px; } .mt4 { margin-top: 4px; }
[hidden] { display: none !important; }

/* layout */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 18px; padding-bottom: 60px; }
.top { background: var(--brand); color: #fff; }
.topbar { display: flex; align-items: center; gap: 16px; min-height: 54px; }
.brand { color: #fff; display: flex; align-items: center; gap: 10px; font-size: 17px; }
.brand:hover { text-decoration: none; }
.logo { width: 22px; height: 26px; border-radius: 4px; background: #fff; position: relative; display: inline-block; flex: none; }
.logo::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 4px; height: 6px; border-radius: 2px; background: #5FB98F; }
.top .logo { box-shadow: 0 0 0 2px rgba(255,255,255,.15); }
.usernav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.usernav a { color: #fff; opacity: .9; } .usernav .muted { color: rgba(255,255,255,.7); }
.usernav .me { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.narrow { max-width: 460px; }
.pwshow { font: 600 22px var(--mono); letter-spacing: .06em; background: var(--brand-soft); color: var(--brand); padding: 10px 14px; border-radius: 8px; text-align: center; user-select: all; }
.pwmsg { min-height: 150px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between, .between { justify-content: space-between; }
.wrapline { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 16px; }
.empty { padding: 28px 16px; text-align: center; color: var(--ink-3); }
.inline { display: inline-flex; align-items: center; gap: 6px; }
form.inline { display: inline; }

/* forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
label.check, .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); font-size: 14px; }
label.inline { flex-direction: row; align-items: center; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #C9D2CE; border-radius: 8px; padding: 9px 11px; min-height: 40px; width: 100%; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--brand); flex: none; }
input[type=color] { width: 46px; padding: 3px; flex: none; }
input[type=file] { padding: 7px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 0; border-color: var(--brand-2); }
input:disabled, select:disabled { background: var(--line-2); color: var(--ink-3); }
textarea { min-height: 120px; font-family: var(--mono); font-size: 13px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 0; }
legend { font-weight: 600; padding: 0 6px; }
.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 14px; border-radius: 8px; border: 1px solid #C9D2CE; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--line-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0F3F30; }
.btn.danger { color: var(--bad); border-color: #EBC3C5; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.big { min-height: 46px; padding: 10px 20px; font-size: 16px; }
.btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.alert { padding: 10px 14px; border-radius: 8px; border: 1px solid transparent; margin-bottom: 12px; }
.card .alert, .stack .alert { margin-bottom: 0; }
.alert.good { background: var(--good-bg); color: var(--good); border-color: #BFE3CF; }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: #F2C4C7; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #F1DBA6; }
.alert.info { background: var(--info-bg); color: var(--info); border-color: #C7D8F2; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth > .card, .auth > form { width: 100%; max-width: 400px; }
.auth.wide > form { max-width: 620px; }
.brandline { display: flex; align-items: center; gap: 10px; font-size: 17px; color: var(--brand); }
.brandline .logo { background: var(--brand); } .brandline .logo::after { background: #5FB98F; }

/* tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tablewrap.tall { max-height: 60vh; overflow-y: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
.tbl thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; background: #FAFBFA; position: sticky; top: 0; z-index: 1; }
.tbl tbody tr:hover { background: #FAFCFB; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .c { text-align: center; }
.tbl td input:not([type=checkbox]), .tbl td select { min-height: 34px; padding: 5px 8px; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); }
.chip.st-live { background: var(--good-bg); color: var(--good); }
.chip.st-draft { background: var(--warn-bg); color: var(--warn); }
.chip.st-closed { background: #ECEDEE; color: #555; }
.catchip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.catchip::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.count:empty { display: none; }

/* events */
.evgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.evcard { display: block; padding: 16px; color: var(--ink); border-top: 4px solid var(--ev); transition: transform .12s, box-shadow .12s; }
.evcard:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(16,32,24,.08); }
.evtop { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.evnums { display: flex; gap: 16px; margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.evnums b { font-size: 18px; color: var(--ink); margin-right: 3px; }
.linkcard { display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.linkcard:hover { text-decoration: none; background: #FAFCFB; }
.side { position: sticky; top: 12px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.logoprev { max-width: 180px; max-height: 70px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
details.inline { display: inline-block; position: relative; }
details.inline > summary { list-style: none; }
details.inline > summary::-webkit-details-marker { display: none; }
details.inline[open] > form { position: absolute; right: 0; top: 34px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 5; width: 280px; }
.danger-zone { border-color: #F2C4C7; }
.danger-zone h2 { color: var(--bad); }

/* console */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font: inherit; font-weight: 600; color: var(--ink-2); background: none; border: 0; padding: 10px 14px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button[aria-selected=true] { color: var(--brand); border-bottom-color: var(--brand); }
.tabs button:hover { color: var(--ink); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-weight: 600; font-size: 14px; border: 0; background: transparent; padding: 7px 14px; border-radius: 7px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.lookup { padding: 10px 12px; border-radius: 8px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.lookup.warn { background: var(--warn-bg); color: #5E3E00; border: 1px solid #F1DBA6; }
.lookup.info { background: var(--info-bg); color: #16365F; border: 1px solid #C7D8F2; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.recent { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow-y: auto; }
.recent li { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.recent li.empty { display: block; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 340px; }
.toolbar select { width: auto; }
.bulkbar { display: flex; gap: 8px; align-items: center; background: var(--brand-soft); border-top: 1px solid var(--line); }
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menulist { position: absolute; right: 0; top: 32px; z-index: 20; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; display: flex; flex-direction: column; }
.menulist button { font: inherit; font-size: 14px; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.menulist button:hover { background: var(--line-2); }
.menulist button.danger { color: var(--bad); }
.grouptbl td:first-child { width: 32px; }
.impchoices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.impchoice { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 18px; border: 1.5px dashed #B8C5BF; border-radius: var(--r); background: #FAFCFB; cursor: pointer; color: var(--ink); }
.impchoice:hover { border-color: var(--brand); background: var(--brand-soft); }
.impchoice b { font-size: 15px; color: var(--ink); }
.maptbl th { min-width: 150px; vertical-align: top; text-transform: none; letter-spacing: 0; }
.maptbl select.mapped { border-color: var(--brand-2); background: var(--brand-soft); font-weight: 600; }
.prevtbl input, .prevtbl select { min-width: 120px; }
.prevtbl tr.st-bad { background: #FFF8F8; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--good-bg); color: var(--good); } .pill.dup { background: var(--info-bg); color: var(--info); }
.pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.bad { background: var(--bad-bg); color: var(--bad); }
.fchip { font: inherit; font-size: 13px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 12px; cursor: pointer; color: var(--ink-2); }
.fchip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.tn { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tl { font-size: 13px; color: var(--ink-2); font-weight: 600; margin-top: 2px; }
.tbl.grid td.today, .tbl.grid th.today { background: var(--brand-soft); }
.replist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.repbtn { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; cursor: pointer; color: var(--ink); }
.repbtn:hover { border-color: var(--brand); background: var(--brand-soft); }
.repbtn:disabled { opacity: .6; }
.repbtn b::before { content: "⬇ "; color: var(--brand); }
.fieldtbl input:not([type=checkbox]) { min-width: 150px; }
.fieldtbl tr.fixed td { background: #FAFBFA; }
.matrix th:first-child { white-space: nowrap; }
.locked { background: #FBFCFB; }
.daylabels { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.daylabels:empty { display: none; }
.logo-row .btn input { display: none; }
.scanset { display: flex; gap: 18px; align-items: flex-start; }
.qrbox { width: 150px; flex: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.qrbox svg { display: block; width: 100%; height: auto; }
input.pin { max-width: 120px; font-size: 20px; letter-spacing: .3em; text-align: center; font-family: var(--mono); }

/* badge artwork designer */
.artwrap { display: grid; grid-template-columns: minmax(220px, 320px) minmax(0, 1fr); gap: 20px; align-items: start; }
.artcol { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 8px; }
.artprev { position: relative; width: 100%; background: #eee center / 100% 100% no-repeat; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); touch-action: none; user-select: none; }
.nbox { position: absolute; display: flex; align-items: center; justify-content: center; outline: 1.5px dashed rgba(255, 200, 0, .95); cursor: move; font-weight: 700; overflow: hidden; }
.nbox span { white-space: nowrap; line-height: 1; }
.qbox { position: absolute; aspect-ratio: 1; outline: 1.5px dashed #E0414B; cursor: move; background: #fff; }
.qbox svg { width: 100%; height: 100%; display: block; }
.artctl fieldset { padding: 12px; }
.endbtn { display: flex; align-items: flex-end; }

/* modal + toast */
.mwrap { position: fixed; inset: 0; background: rgba(12, 22, 18, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.mbox { background: #fff; border-radius: 12px; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.mbox.wide { max-width: 680px; }
.mhead { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.mhead .x { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--ink-3); padding: 4px 8px; border-radius: 6px; }
.mbody { padding: 16px; overflow-y: auto; }
.mfoot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 200; max-width: calc(100vw - 32px); font-weight: 500; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); } .toast.warn { background: #7A5200; }

/* phones */
@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 21px; }
  .grid2, .grid3, .checks, .impchoices, .replist { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .hide-sm { display: none; }
  .pad { padding: 14px; }
  .tbl th, .tbl td { padding: 8px 8px; }
  .toolbar input[type=search] { max-width: none; flex: 1 1 100%; }
  .usernav { gap: 12px; font-size: 14px; }
  .scanset { flex-direction: column; }
  .artwrap { grid-template-columns: 1fr; }
  .artcol { position: static; max-width: 300px; }
  .btn.big { width: 100%; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tn { font-size: 24px; }
}
