/* DG Algo — design tokens + shared components (site, app, admin) */
@font-face { font-family: 'Geist'; src: url('/assets/fonts/geist.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/assets/fonts/geist-mono.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root, [data-theme='dark'] {
  color-scheme: dark;
  /* Casino palette: emerald-felt black, metallic gold, emerald wins, ruby losses */
  --bg: #050c09; --bg-2: #08130e; --surface: #0d1a14; --surface-2: #12231b; --surface-3: #1a3125;
  --border: #1d3428; --border-2: #2a4838;
  --text: #f7f1e1; --text-muted: #aab4a6; --text-dim: #8d9a8c;
  --accent: #f4c242; --accent-2: #ffd96e; --accent-soft: rgb(244 194 66 / .13); --accent-text: #1c1300;
  --gold-grad: linear-gradient(180deg, #ffe596 0%, #f4c242 42%, #d39a24 78%, #b07a14 100%);
  --felt: radial-gradient(ellipse 80% 60% at 50% 0%, rgb(16 120 74 / .22), transparent 70%);
  --good: #1fe08a; --good-soft: rgb(31 224 138 / .13); --bad: #ff3d52; --bad-soft: rgb(255 61 82 / .13); --warn: #ffb320; --warn-soft: rgb(255 179 32 / .13); --info: #7cc4ff;
  --glow-good: 0 0 18px rgb(31 224 138 / .35); --glow-gold: 0 8px 28px rgb(244 194 66 / .28);
  --shadow: 0 1px 0 rgb(255 255 255 / .035) inset; --ring: 0 0 0 3px rgb(244 194 66 / .38);
}
[data-theme='light'] {
  color-scheme: light;
  --bg: #fbf8ee; --bg-2: #f3efe1; --surface: #ffffff; --surface-2: #f6f2e4; --surface-3: #ece6d2;
  --border: #e3dcc6; --border-2: #d2c9ad;
  --text: #13170f; --text-muted: #555c4c; --text-dim: #687060;
  --accent: #9c6b08; --accent-2: #b8841f; --accent-soft: rgb(156 107 8 / .1); --accent-text: #1c1300;
  --gold-grad: linear-gradient(180deg, #ffe596 0%, #f4c242 45%, #d39a24 100%);
  --felt: radial-gradient(ellipse 80% 60% at 50% 0%, rgb(16 120 74 / .08), transparent 70%);
  --good: #0a8a4a; --good-soft: rgb(10 138 74 / .1); --bad: #c81e34; --bad-soft: rgb(200 30 52 / .08); --warn: #a8640a; --warn-soft: rgb(168 100 10 / .1); --info: #2563c9;
  --glow-good: none; --glow-gold: 0 6px 18px rgb(156 107 8 / .18);
  --shadow: 0 1px 2px rgb(19 23 15 / .06); --ring: 0 0 0 3px rgb(156 107 8 / .3);
}

:root { --r-card: 16px; --r-btn: 10px; --ease: cubic-bezier(.22, 1, .36, 1); --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; --mono: 'Geist Mono', ui-monospace, monospace; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--felt), var(--bg); background-attachment: fixed; color: var(--text); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 650; }
p { margin: 0; }
.num, .mono { font-variant-numeric: tabular-nums; font-family: var(--mono); letter-spacing: -.01em; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); } .dim { color: var(--text-dim); }
.pos { color: var(--good); text-shadow: var(--glow-good); } .neg { color: var(--bad); }
.i { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }
::selection { background: var(--accent); color: var(--accent-text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: var(--r-btn); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-weight: 560; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .12s var(--ease), opacity .15s; }
.btn:hover { background: var(--surface-3); border-color: var(--border-2); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.loading::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-primary { background: var(--gold-grad); border-color: #c8901e; color: var(--accent-text); font-weight: 650; box-shadow: inset 0 1px 0 rgb(255 255 255 / .45), var(--glow-gold); text-shadow: 0 1px 0 rgb(255 255 255 / .25); }
.btn-primary:hover { filter: brightness(1.07); background: var(--gold-grad); border-color: #c8901e; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-good { background: linear-gradient(180deg, #4ff0a6, var(--good) 55%, #0fae66); border-color: #0fae66; color: #021209; font-weight: 650; box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), var(--glow-good); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--text-muted); position: relative; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards, chips */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .01em; background: var(--surface-3); color: var(--text-muted); white-space: nowrap; }
.chip-good { background: var(--good-soft); color: var(--good); } .chip-bad { background: var(--bad-soft); color: var(--bad); } .chip-warn { background: var(--warn-soft); color: var(--warn); } .chip-gold { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot.live { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.badge-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; font-weight: 560; color: var(--text); }
.field .hint { font-size: 13px; color: var(--text-dim); }
.input, select.input, textarea.input { width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text); font-size: 16px; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input[aria-invalid='true'] { border-color: var(--bad); }
.field-error { font-size: 13px; color: var(--bad); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-muted); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.otp { letter-spacing: .5em; text-align: center; font-family: var(--mono); font-size: 22px; height: 54px; }
.form-error { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 14px; margin-bottom: 14px; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; color: var(--text-muted); }
.notice .i { margin-top: 2px; color: var(--accent); }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--text); } .notice.warn .i { color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: transparent; color: var(--text); } .notice.bad .i { color: var(--bad); }
.notice.good { background: var(--good-soft); border-color: transparent; color: var(--text); } .notice.good .i { color: var(--good); }

/* Toggle switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; position: absolute; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 999px; transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-muted); transition: transform .2s var(--ease), background .15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--accent-text); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-weight: 560; color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .12s; } .t tbody tr:hover { background: var(--surface-2); }
.t .r { text-align: right; }

/* Skeleton, empty */
.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 40px 20px; color: var(--text-muted); }
.empty .i { width: 28px; height: 28px; color: var(--accent); }
.empty h3 { color: var(--text); font-size: 17px; }

/* Toasts, modal */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border-2); box-shadow: 0 10px 30px rgb(0 0 0 / .35); font-size: 14px; pointer-events: auto; animation: toastIn .25s var(--ease); }
.toast.good .i { color: var(--good); } .toast.bad .i { color: var(--bad); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgb(0 0 0 / .6); display: grid; place-items: center; padding: 16px; animation: fade .2s var(--ease); }
.modal { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 20px; padding: 24px; animation: pop .25s var(--ease); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal-head h3 { font-size: 19px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
@media (max-width: 560px) { .modal-back { align-items: end; padding: 0; } .modal { border-radius: 20px 20px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); animation: sheet .3s var(--ease); } @keyframes sheet { from { transform: translateY(40px); opacity: 0; } } }

[hidden] { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; } .row.wrap { flex-wrap: wrap; width: auto; margin-inline: 0; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 16px; } .stack-sm { display: grid; gap: 8px; }
.hr { height: 1px; background: var(--border); border: 0; margin: 18px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
