/* Spin & Win — Direct Rewards theme. Brand tokens are overridden per client from _head.php. */
:root {
  --primary: #00253b;
  --primary-2: #0b3a5c;
  --gold: #caa755;
  --gold-2: #e2c982;
  --teal: #00a99d;
  --page-bg: #f4f6f8;
  --card: #ffffff;
  --card-border: #e3e7ec;
  --text: #0b0b0b;
  --muted: #5f6b76;
  --danger: #b23a48;
  --success: #1e8a5a;
  --warning: #b7791f;
  --button: #caa755;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(0, 37, 59, 0.08);
  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--text); background: var(--page-bg); line-height: 1.5; font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--primary-2); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; font-weight: 600; color: var(--primary); }
h1 { font-size: 26px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
p { margin: 0 0 10px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; background: #eef2f5; padding: 2px 6px; border-radius: 6px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 24px; padding-bottom: 96px; }
.sub { color: var(--muted); font-size: 14px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.muted { opacity: 0.55; }
.neg { color: var(--danger); font-weight: 600; }
.pos { color: var(--success); font-weight: 600; }
.gold-text { color: var(--gold); }
.hidden { display: none !important; }
.inline { display: inline; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--card-border); }
.plain li:last-child { border-bottom: 0; }

/* cards */
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.ok { border-color: var(--success); color: var(--success); font-weight: 500; }
.card > h2:first-child, .card > h1:first-child { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.count { display: inline-block; background: var(--page-bg); color: var(--muted); border-radius: 999px; padding: 0 10px; font-size: 13px; font-weight: 500; vertical-align: middle; margin-left: 6px; }

/* buttons + forms */
.btn { display: inline-block; font: inherit; font-weight: 600; border: 0; border-radius: 999px; padding: 10px 20px; cursor: pointer; text-decoration: none; line-height: 1.2; transition: transform .08s ease, filter .15s ease; color: #fff; background: var(--primary); }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.gold { background: var(--button); color: var(--primary); }
.btn.teal { background: var(--teal); color: #fff; }
.btn.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn.ghost { background: transparent; color: var(--primary-2); border: 1px solid var(--card-border); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.tiny { padding: 4px 10px; font-size: 12px; }
.btn.big { padding: 14px 34px; font-size: 18px; }
.btn.block { display: block; width: 100%; text-align: center; margin-top: 10px; }
a.ghost { color: inherit; opacity: 0.8; text-decoration: none; font-size: 13px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 10px; }
input, select, textarea { display: block; width: 100%; font: inherit; font-size: 15px; color: var(--text); background: #fff; border: 1px solid var(--card-border); border-radius: 10px; padding: 10px 12px; margin-top: 4px; }
input[type="color"] { height: 42px; padding: 4px; }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: auto; margin: 0 6px 0 0; vertical-align: middle; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
textarea { resize: vertical; }
label.check { display: flex; align-items: center; gap: 4px; color: var(--text); font-weight: 500; }
label.radio { display: inline-block; margin: 0 10px 0 0; color: var(--text); font-weight: 400; }
.row { display: flex; gap: 8px; align-items: center; }
.row input, .row select { margin-top: 0; }
.row.wrap { flex-wrap: wrap; }
.search-row { display: flex; gap: 8px; margin-bottom: 16px; }
.search-row input, .search-row select { margin: 0; }
.error { color: var(--danger); font-weight: 500; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; }
.flash-success { background: #e6f6ee; color: #14603f; border: 1px solid #b8e4cd; }
.flash-error { background: #fbe9ec; color: #7d2430; border: 1px solid #f0c3ca; }
.flash a { color: inherit; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.pill.gold { background: var(--gold); color: var(--primary); }
.badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.badge-approved, .badge-active { background: #e6f6ee; color: #14603f; }
.badge-pending { background: #fff5db; color: #8a5a00; }
.badge-rejected, .badge-disqualified, .badge-critical { background: #fbe9ec; color: #7d2430; }
.badge-warning { background: #fff5db; color: #8a5a00; }
.badge-info, .badge-type { background: #eef2f5; color: var(--muted); }
.chip { display: inline-block; background: #eef2f5; border-radius: 999px; padding: 2px 10px; margin: 2px 4px 2px 0; font-size: 13px; }
.chip .x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; }
details > summary { cursor: pointer; font-weight: 600; color: var(--primary-2); margin: 8px 0; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; }
details[open] > summary::before { content: "▾ "; }
details > summary h2 { display: inline; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--card-border); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table.kv th { width: 35%; text-transform: none; font-size: 14px; }
.perm-table td:first-child { width: 45%; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--gold); vertical-align: middle; margin-right: 6px; }

/* auth screens */
body.auth { background: var(--primary); background-image: radial-gradient(circle at 20% 0%, rgba(202,167,85,.25), transparent 45%), radial-gradient(circle at 100% 100%, rgba(0,169,157,.18), transparent 40%); min-height: 100vh; }
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 40px 16px; }
.auth-logo { text-align: center; margin-bottom: 8px; }
.auth-logo img { width: 200px; }
.auth-card { padding: 28px; }
.auth-card h1 { text-align: center; }
.auth-card .sub { text-align: center; }
.auth-foot { color: var(--gold); text-align: center; font-size: 13px; margin-top: 10px; }
.user-pick { display: block; width: 100%; font: inherit; font-size: 15px; font-weight: 500; text-align: left; background: var(--page-bg); border: 1px solid var(--card-border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.user-pick:hover { border-color: var(--gold); }

/* member shell */
.topbar { background: var(--primary); color: #fff; }
.bar { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand img { height: 44px; display: block; }
.topnav { display: flex; gap: 18px; margin-left: 8px; }
.topnav a { color: rgba(255,255,255,.8); text-decoration: none; font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent; }
.topnav a.active, .topnav a:hover { color: #fff; border-bottom-color: var(--gold); }
.who { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 14px; }
.tabbar { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--primary); border-top: 1px solid rgba(255,255,255,.1); z-index: 20; }
.tabbar a { flex: 1; text-align: center; color: rgba(255,255,255,.75); text-decoration: none; font-size: 11px; padding: 8px 0 10px; }
.tabbar a span { display: block; font-size: 20px; }
.tabbar a.active { color: var(--gold); }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
@media (max-width: 700px) {
  .topnav { display: none; }
  .tabbar { display: flex; }
  .who .hi { display: none; }
  .bar { height: 56px; }
  .brand img { height: 36px; }
}

/* voucher rows */
.voucher-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--card-border); }
.voucher-row:first-of-type { border-top: 0; }
.voucher-row .sub { margin: 2px 0 0; }
.code-box code { font-size: 15px; font-weight: 600; color: var(--primary); background: #fff8e6; border: 1px dashed var(--gold); padding: 6px 10px; }

/* wheel */
.play h1 { text-align: center; }
.wheel-wrap { position: relative; width: min(340px, 86vw); margin: 10px auto 12px; text-align: center; }
#wheel { width: 100%; height: auto; display: block; border-radius: 50%; box-shadow: 0 0 0 8px var(--primary), 0 0 0 11px var(--gold), 0 14px 40px rgba(0,37,59,.35); transition: transform 5.2s cubic-bezier(.12,.75,.16,1); transform: rotate(0deg); }
.pointer { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 30px solid var(--gold); z-index: 3; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); }
#spin-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 50%; width: 92px; height: 92px; padding: 0; font-size: 15px; box-shadow: 0 0 0 5px #fff, 0 6px 20px rgba(0,0,0,.35); z-index: 2; }
.result { text-align: center; padding: 16px; border-radius: 12px; margin: 12px auto; max-width: 420px; font-weight: 500; }
.result.win { background: #fff8e6; border: 1px solid var(--gold); color: var(--primary); }
.result.lose { background: var(--page-bg); border: 1px solid var(--card-border); color: var(--muted); }
.result .big-text { font-size: 20px; font-weight: 700; display: block; margin-bottom: 4px; }
.legend { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend em { font-style: normal; color: var(--danger); }

/* admin shell */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex: 0 0 230px; background: var(--primary); color: #fff; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand img { width: 150px; margin: 0 auto 10px; display: block; }
.admin-user { text-align: center; font-size: 13px; margin-bottom: 14px; color: rgba(255,255,255,.8); }
.admin-user strong { display: block; color: #fff; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: rgba(255,255,255,.8); text-decoration: none; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: var(--gold); color: var(--primary); }
.sidebar-foot { margin-top: auto; padding-top: 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.sidebar-foot a { color: rgba(255,255,255,.7); text-decoration: none; }
.admin-content { flex: 1; min-width: 0; padding: 28px 32px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { margin: 22px 0 10px; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--card-border); }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--gold); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-tile span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat-tile strong { display: block; font-size: 28px; color: var(--primary); line-height: 1.1; margin: 4px 0; }
.stat-tile small { color: var(--muted); font-size: 12px; }
.tile-critical { border-color: var(--danger); } .tile-critical strong { color: var(--danger); }
.tile-warning { border-color: var(--warning); } .tile-warning strong { color: var(--warning); }
.tile-ok strong { color: var(--success); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; display: flex; align-items: flex-end; overflow: hidden; }
.bar-win { width: 100%; background: var(--gold); }
.bar-col small { font-size: 10px; color: var(--muted); margin-top: 4px; }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 8px; }
.pool { margin-bottom: 0; }
.pool.new { border-style: dashed; box-shadow: none; }
.pool-low { border-color: var(--warning); }
.pool-empty { border-color: var(--danger); }
.pool-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.pool-stats { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 13px; color: var(--muted); margin: 6px 0; }
.pool-stats strong { color: var(--primary); }
.message-row { padding: 10px 0; border-top: 1px solid var(--card-border); }
.message-row:first-of-type { border-top: 0; }
.message-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.message-row textarea { margin-top: 0; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; margin: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #cfd6dd; border-radius: 999px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--teal); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.issue { border-left: 5px solid var(--card-border); }
.issue-critical { border-left-color: var(--danger); }
.issue-warning { border-left-color: var(--warning); }
.issue-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
@media (max-width: 860px) {
  .admin-shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .sidebar .brand img { width: 110px; margin: 0; }
  .admin-user { margin: 0 8px; text-align: left; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar nav a { padding: 6px 10px; font-size: 13px; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; flex-direction: row; gap: 12px; }
  .admin-content { padding: 18px 16px 40px; }
}
