/* FAGE Admin — shared styles. Brand red is --brand. */
:root {
  --brand: #eb2027;
  --brand-dark: #c8141b;
  --brand-soft: #fdecec;
  --ink: #17181c;
  --ink-2: #4a4d57;
  --ink-3: #8a8d98;
  --line: #e7e8ee;
  --bg: #f2f3f7;
  --panel: #fff;
  --tile: #f6f6f8;
  --ok: #12a150;
  --ok-soft: #e4f6ec;
  --warn: #c77700;
  --warn-soft: #fff1d9;
  --radius: 18px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- Shell ---- */
.shell { min-height: 100vh; border-top: 3px solid var(--brand); display: grid; grid-template-columns: 88px 1fr; }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0; }
.rail__logo { width: 46px; height: 46px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; margin-bottom: 14px; }
.rail__link { position: relative; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--ink-2); transition: background .15s, color .15s; }
.rail__link:hover { background: #e6e7ee; }
.rail__link.is-active { background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }
.rail__link::after { content: attr(data-tip); position: absolute; left: 58px; background: var(--ink); color: #fff; font-size: 12px; padding: 4px 9px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateX(-4px); transition: .15s; z-index: 20; }
.rail__link:hover::after { opacity: 1; transform: none; }
.rail__spacer { flex: 1; }
.rail form { margin: 0; }
.rail button.rail__link { border: 0; background: none; cursor: pointer; }

.main { min-width: 0; padding: 0 28px 24px 0; }
.topbar { height: 74px; display: flex; align-items: center; gap: 6px; }
.topbar nav { display: flex; gap: 2px; margin-left: 6px; }
.topbar nav a { padding: 8px 14px; border-radius: 10px; color: var(--ink-2); font-weight: 500; }
.topbar nav a:hover { background: #e6e7ee; }
.topbar nav a.is-active { color: var(--brand); font-weight: 600; }
.topbar__user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }

.page { background: var(--panel); border-radius: 26px; padding: 32px 36px 40px; min-height: calc(100vh - 140px); box-shadow: 0 1px 2px rgba(20,20,40,.04); }
.page__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page__head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.page__head p { color: var(--ink-2); margin-top: 2px; }
.page__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.footer { display: flex; justify-content: space-between; padding: 16px 12px 0; color: var(--ink-2); font-size: 14px; }

.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 12px; }
.section { margin-top: 34px; }

/* ---- Buttons / forms ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; transition: background .15s, transform .05s; }
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn--dark { background: var(--ink); } .btn--dark:hover { background: #000; }
.btn--ghost { background: #fff; color: var(--ink); border-color: #c9cad3; } .btn--ghost:hover { background: var(--tile); }
.btn--danger-ghost { background: #fff; color: var(--brand); border-color: #f3b6b9; } .btn--danger-ghost:hover { background: var(--brand-soft); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn--lg { height: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; height: 44px; padding: 0 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 84px; padding: 10px 14px; resize: vertical; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(235,32,39,.15); }
.field .err, .err { color: var(--brand); font-size: 13px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row--3 { grid-template-columns: repeat(3, 1fr); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.filters .input { width: auto; min-width: 160px; }
.filters .input[type=search] { flex: 1; min-width: 220px; }

/* ---- Tiles / cards ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.stat { background: var(--tile); border-radius: var(--radius); padding: 18px 20px; }
.stat__label { color: var(--ink-2); font-size: 14px; }
.stat__value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat__sub { color: var(--ink-3); font-size: 13px; }
.stat--brand { background: var(--brand); color: #fff; }
.stat--brand .stat__label, .stat--brand .stat__sub { color: rgba(255,255,255,.8); }

.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); text-align: center; }
.quick a span.ico { width: 100%; max-width: 104px; height: 100px; border-radius: 18px; background: var(--tile); display: grid; place-items: center; color: var(--ink-2); transition: .15s; }
.quick a:hover span.ico { background: var(--brand-soft); color: var(--brand); }
.quick a span.ico svg { width: 30px; height: 30px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.split--raffle { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } /* col-md-5 / col-md-7 */
.aside { background: var(--tile); border-radius: 22px; padding: 22px; }
.card { background: var(--tile); border-radius: var(--radius); padding: 20px; }
.card--white { background: #fff; border: 1px solid var(--line); }

.hero { border-radius: 22px; padding: 38px 40px; color: #fff; background: linear-gradient(135deg, #f0343a 0%, var(--brand) 40%, #a70f15 100%); position: relative; overflow: hidden; }
.hero h2 { font-size: 36px; font-weight: 700; letter-spacing: -.02em; }
.hero p { margin: 10px 0 22px; opacity: .9; max-width: 460px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 15px; }
.hero .btn { background: #fff; color: var(--ink); } .hero .btn--dark { background: var(--ink); color: #fff; }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 320px; height: 320px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); box-shadow: 0 0 0 40px rgba(255,255,255,.06); }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.tabs a { padding: 10px 20px; border-radius: 999px; color: var(--ink-2); font-weight: 500; }
.tabs a.is-active { background: var(--brand); color: #fff; }

/* ---- Tables ---- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; padding: 12px 16px; background: var(--tile); white-space: nowrap; }
.t td { padding: 14px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.t tr:hover td { background: #fafafc; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.t .sub { color: var(--ink-3); font-size: 13px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .04em; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-3); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--tile); color: var(--ink-2); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--brand-soft); color: var(--brand); }
.badge--dark { background: var(--ink); color: #fff; }
.badge--live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: var(--ink-2); font-size: 14px; }
.flash { padding: 12px 16px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); font-weight: 500; margin-bottom: 20px; }
.flash--err { background: var(--brand-soft); color: var(--brand); }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(15,16,20,.5); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal.is-open { display: flex; }
.modal__box { background: #fff; border-radius: 22px; padding: 28px; width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; }
.modal__box h2 { font-size: 22px; margin-bottom: 18px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---- Confirm dialog ---- */
.cdlg { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15,16,20,.55); backdrop-filter: blur(3px); animation: cdfade .15s; }
@keyframes cdfade { from { opacity: 0; } }
.cdlg__box { width: 100%; max-width: 400px; background: #fff; border-radius: 24px; padding: 30px 28px 24px; text-align: center; box-shadow: 0 30px 80px rgba(15,16,20,.35); animation: cdpop .22s cubic-bezier(.2,1.3,.4,1); }
@keyframes cdpop { from { transform: scale(.9); opacity: 0; } }
.cdlg__icon { width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: var(--tile); color: var(--ink); }
.cdlg__icon svg { width: 28px; height: 28px; }
.cdlg__icon--danger { background: var(--brand-soft); color: var(--brand); }
.cdlg__box h3 { font-size: 20px; letter-spacing: -.01em; }
.cdlg__box p { color: var(--ink-2); margin-top: 8px; font-size: 15px; }
.cdlg__actions { display: flex; gap: 10px; margin-top: 24px; }
.cdlg__actions .btn { flex: 1; height: 46px; }
@media (prefers-reduced-motion: reduce) { .cdlg, .cdlg__box { animation: none; } }

/* ---- Tickets ---- */
.ticketcard { display: flex; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.ticketcard__main { flex: 1; padding: 18px 20px; }
.ticketcard__stub { width: 130px; display: grid; place-items: center; padding: 12px; border-left: 2px dashed var(--line); background: var(--tile); }
.ticketcard__stub canvas, .ticketcard__stub img, .ticketcard__stub svg { width: 100px; height: 100px; }
.ticketcard--red .ticketcard__main { background: var(--brand); color: #fff; }
.ticketcard h3 { font-size: 18px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---- Raffle ---- */
.stage { container-type: inline-size; background: #17181c; color: #fff; border-radius: 26px; padding: 44px 30px; text-align: center; position: relative; overflow: hidden; }
.stage::before { content: ''; position: absolute; inset: auto -20% -60% -20%; height: 100%; background: radial-gradient(closest-side, rgba(235,32,39,.55), transparent); }
.stage > * { position: relative; }
.stage__label { color: rgba(255,255,255,.65); text-transform: uppercase; letter-spacing: .12em; font-size: 13px; }
.stage__code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: clamp(22px, 8cqw, 72px); font-weight: 700; letter-spacing: .06em; white-space: nowrap; margin: 14px 0 6px; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.stage__code.is-spinning { opacity: .75; filter: blur(.6px); }
.stage__name { font-size: 26px; font-weight: 600; min-height: 1.4em; }
.stage__prize { color: #ff8a8e; margin-top: 4px; min-height: 1.4em; }
.stage.is-won .stage__code { color: #fff; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.7); } to { transform: scale(1); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.prize { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 10px; }
.prize__img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex: none; background: #f0f1f5; }
.prize__img--none { display: grid; place-items: center; color: var(--ink-3); }
.prize__img--none svg { width: 22px; height: 22px; }
.stage__img[hidden] { display: none; }
.stage__img { display: block; width: 150px; height: 150px; object-fit: cover; border-radius: 20px; margin: 0 auto 16px; border: 2px solid rgba(255,255,255,.25); }
.modal__preview { display: block; width: 100%; max-height: 160px; object-fit: cover; border-radius: 12px; margin-bottom: 8px; }
.prize__body { flex: 1; min-width: 0; }
.prize__winners { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.prize__winners li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 0; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; color: var(--ink-2); }
.toggle input { accent-color: var(--brand); width: 18px; height: 18px; }

/* ---- Scanner ---- */
.scan { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.viewfinder { position: relative; aspect-ratio: 1; max-width: 520px; width: 100%; border-radius: 26px; overflow: hidden; background: #17181c; display: grid; place-items: center; color: #fff; }
.viewfinder video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.viewfinder__frame { position: absolute; inset: 14%; border-radius: 22px; pointer-events: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35);
  background:
    linear-gradient(var(--brand),var(--brand)) top left/36px 4px, linear-gradient(var(--brand),var(--brand)) top left/4px 36px,
    linear-gradient(var(--brand),var(--brand)) top right/36px 4px, linear-gradient(var(--brand),var(--brand)) top right/4px 36px,
    linear-gradient(var(--brand),var(--brand)) bottom left/36px 4px, linear-gradient(var(--brand),var(--brand)) bottom left/4px 36px,
    linear-gradient(var(--brand),var(--brand)) bottom right/36px 4px, linear-gradient(var(--brand),var(--brand)) bottom right/4px 36px;
  background-repeat: no-repeat; }
.viewfinder__idle { position: relative; text-align: center; padding: 24px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.viewfinder__idle svg { width: 54px; height: 54px; opacity: .7; }
.viewfinder.is-live .viewfinder__idle { display: none; }
.verdict { border-radius: 22px; padding: 26px; text-align: center; background: var(--tile); min-height: 260px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; transition: background .2s; }
.verdict__icon { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--ink-3); margin-bottom: 8px; }
.verdict__icon svg { width: 38px; height: 38px; stroke-width: 2.2; }
.verdict h2 { font-size: 28px; }
.verdict--valid { background: var(--ok-soft); } .verdict--valid .verdict__icon { color: var(--ok); }
.verdict--admitted { background: var(--ok); color: #fff; } .verdict--admitted .verdict__icon { color: var(--ok); }
.verdict--duplicate { background: var(--warn-soft); } .verdict--duplicate .verdict__icon { color: var(--warn); }
.verdict--invalid { background: var(--brand-soft); } .verdict--invalid .verdict__icon { color: var(--brand); }
.verdict__sub { color: var(--ink-2); }
.verdict--admitted .verdict__sub { color: rgba(255,255,255,.85); }
.verdict .kv { text-align: left; margin-top: 12px; }
.verdict--admitted .kv dt { color: rgba(255,255,255,.75); }
.verdict__actions { display: flex; gap: 10px; margin-top: 16px; }
.progress { height: 10px; border-radius: 99px; background: #e4e5ec; overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }

/* ---- Auction ---- */
.lotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.lot { background: var(--tile); border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.lot__no { font-family: ui-monospace, Menlo, monospace; color: var(--ink-3); font-size: 13px; }
.lot h3 { font-size: 20px; }
.lot__price { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lot__meta { color: var(--ink-2); font-size: 14px; }
.lot__foot { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.bigprice { font-size: clamp(40px, 6vw, 68px); font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.bidlist { list-style: none; margin: 0; padding: 0; }
.bidlist li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.bidlist li:first-child { border-top: 0; }
.bidlist li.is-top .bidlist__amt { color: var(--brand); }
.paddle { min-width: 44px; height: 32px; padding: 0 10px; border-radius: 8px; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; }
.bidlist__amt { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.quickbids { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---- Login ---- */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.authcard { width: 100%; max-width: 556px; background: #f8f8f8; border-radius: 40px; padding: 64px; box-shadow: 0 20px 60px rgba(30,30,60,.07), inset 0 -4px 0 #fff; }
.authcard h1 { font-size: 46px; font-weight: 700; letter-spacing: -.03em; display: flex; align-items: center; gap: 10px; }
.authcard .lede { font-size: 20px; font-weight: 500; color: var(--ink-2); margin: 6px 0 28px; }
.authcard .btn { width: 100%; }
.authlink { color: var(--brand); font-weight: 600; }

@media (max-width: 1100px) {
  .split, .split--raffle, .scan { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; padding-bottom: 76px; }
  .rail { position: fixed; z-index: 30; bottom: 0; left: 0; right: 0; top: auto; height: 68px; flex-direction: row; justify-content: space-around; background: #fff; border-top: 1px solid var(--line); padding: 0 8px; }
  .rail__logo, .rail__spacer, .rail__link::after { display: none; }
  .main { padding: 0 12px 16px; }
  .topbar nav { display: none; }
  .page { padding: 22px 18px 30px; border-radius: 20px; }
  .row, .row--3 { grid-template-columns: 1fr; }
  .authcard { padding: 36px 26px; border-radius: 30px; }
}
