/* FullPlay.dev
   A plain, tool-like control panel: graphite surfaces, 1px borders, one signal-orange accent,
   IBM Plex Sans for reading and Plex Mono for numbers and addresses. No glow, glass or gradients.
   Light theme via [data-theme="light"]. */

:root {
  --bg: #111214;
  --surface: #18191c;
  --surface-2: #1e2023;
  --surface-3: #25272b;
  --border: #2a2c30;
  --border-strong: #3b3e43;
  --text: #e7e7e4;
  --text-2: #a8aaae;
  --text-3: #8a8d92;
  --accent: #F07A2E;
  --accent-ink: #121315;
  --accent-text: #f0954f;
  --accent-soft: rgba(232, 119, 46, .13);
  --green: #5cc27a;
  --green-soft: rgba(92, 194, 122, .12);
  --red: #ea6259;
  --red-soft: rgba(234, 98, 89, .12);
  --amber: #e0ae48;
  --amber-soft: rgba(224, 174, 72, .12);
  --blue: #6ea8e8;
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar: 232px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --pop-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f2f2f3;
  --surface-3: #e8e8ea;
  --border: #e0e0e3;
  --border-strong: #c7c7cc;
  --text: #18181b;
  --text-2: #50505a;
  --text-3: #6b6b74;
  --accent: #c8581a;
  --accent-ink: #ffffff;
  --accent-text: #b04c12;
  --accent-soft: rgba(200, 88, 26, .1);
  --green: #1f7a3c;
  --green-soft: rgba(31, 122, 60, .1);
  --red: #b8312a;
  --red-soft: rgba(184, 49, 42, .09);
  --amber: #8a5c00;
  --amber-soft: rgba(138, 92, 0, .1);
  --blue: #2563a8;
  --pop-shadow: 0 8px 24px rgba(20, 20, 30, .12);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
code, .mono { font-family: var(--mono); font-size: .93em; font-feature-settings: 'zero' 1; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 0 5px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 17px; height: 17px; flex: none; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 24px; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.gold { color: var(--amber); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.text-ok { color: var(--green); }
.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

/* ------------------------------------------------------------------ shell */

.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  display: flex; flex-direction: column; gap: 4px; padding: 18px 12px 12px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.content { padding: 4px 36px 56px; display: flex; flex-direction: column; gap: 24px; width: 100%; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 16px; }
.brand:hover { text-decoration: none; color: var(--text); }
.sidebar .brand { padding: 0 8px 16px; }
/* FP logo: orange tile on the dark UI, inverted (dark tile, orange mark) on the light theme. */
.brand-mark { --fp-tile: #F07A2E; --fp-ink: #121315; display: inline-block; width: 28px; height: 28px; flex: none; }
[data-theme="light"] .brand-mark { --fp-tile: #121315; --fp-ink: #F07A2E; }
.brand-mark svg, .brand-mono svg { width: 100%; height: 100%; display: block; }
.brand-mark .fp-tile { fill: var(--fp-tile); }
.brand-mark .fp-ink { fill: var(--fp-ink); }
.brand-mono { display: inline-block; width: 22px; height: 22px; flex: none; }
.auth-panel .brand-mark { width: 40px; height: 40px; }
.auth-panel .brand { font-size: 17px; gap: 12px; }
.brand-text { letter-spacing: -.005em; }

.side-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link .icon { color: var(--text-3); }
.nav-link.active { background: var(--surface-3); color: var(--text); }
.nav-link.active .icon { color: var(--accent); }

.side-foot { display: flex; align-items: center; gap: 8px; padding: 10px 6px 0; border-top: 1px solid var(--border); margin-top: 8px; }
.side-foot form { margin: 0; }
.side-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); }
.side-user:hover { text-decoration: none; }
.side-user span { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side-user strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 18px 36px; background: var(--bg); border-bottom: 1px solid transparent; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 21px; }
.topbar-title p { color: var(--text-2); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-avatar .avatar { width: 32px; height: 32px; }
.topbar .menu-btn { display: none; }
.sidebar-backdrop { display: none; }

/* ----------------------------------------------------------- primitives */

.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: var(--surface-3); }
.avatar-sm { width: 26px; height: 26px; }
.avatar-xl { width: 96px; height: 96px; border: 3px solid var(--surface); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { font-size: 16px; }
.link-more { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.link-more .icon { width: 14px; height: 14px; }

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); align-items: start; }
.grid-side-right { grid-template-columns: minmax(0, 1fr) minmax(260px, 320px); align-items: start; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 7px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  font: 500 14px/1.2 var(--font); cursor: pointer; white-space: nowrap;
  color: var(--text); background: var(--surface-2); transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.btn:active { background: var(--border); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { color: var(--accent-ink); background: var(--accent-text); border-color: var(--accent-text); }
.btn-gold { color: #1c1404; background: var(--amber); border-color: var(--amber); }
[data-theme="light"] .btn-gold { color: #fff; }
.btn-gold:hover { color: #1c1404; filter: brightness(1.08); background: var(--amber); }
.btn-success { color: var(--green); border-color: color-mix(in srgb, var(--green) 45%, transparent); background: var(--green-soft); }
.btn-success:hover { color: var(--green); background: color-mix(in srgb, var(--green) 20%, transparent); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); background: var(--red-soft); }
.btn-danger:hover { color: var(--red); background: color-mix(in srgb, var(--red) 20%, transparent); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 13.5px; }
.btn-xs { min-height: 28px; padding: 3px 9px; font-size: 13px; }
.btn-lg { min-height: 42px; padding: 9px 18px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px 9px; }
.btn.loading { pointer-events: none; opacity: .65; }
.btn.loading::after { content: ''; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row form { margin: 0; }
.btn-row-wide > * { flex: 1; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; transition: background-color .12s, color .12s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); text-decoration: none; }
.icon-btn-xs { width: 28px; height: 28px; }
.icon-btn-xs .icon { width: 15px; height: 15px; }
.icon-btn-danger:hover { color: var(--red); background: var(--red-soft); border-color: transparent; }
[data-theme="dark"] .only-light, [data-theme="light"] .only-dark { display: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--text-2); border: 1px solid var(--border); }
.chip .icon { width: 14px; height: 14px; }
.chip-gold { color: var(--text); font-family: var(--mono); }
.chip-gold .icon { color: var(--amber); }
.chip-gold:hover { text-decoration: none; border-color: var(--border-strong); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 4px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-off { background: var(--surface-3); color: var(--text-2); }
.badge-warn { background: var(--amber-soft); color: var(--amber); }
.badge-hidden { background: var(--surface-3); color: var(--text-2); }
.badge-members { background: var(--accent-soft); color: var(--accent-text); }

.tag { display: inline-block; padding: 0 7px; border-radius: 4px; font-size: 12.5px; font-weight: 500; background: var(--surface-3); color: var(--text-2); }
.tag-user { color: var(--blue); }
.tag-off { color: var(--text-3); text-decoration: line-through; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.role { display: inline-block; font-size: 12px; font-weight: 500; padding: 0 6px; border-radius: 4px; vertical-align: 1px; border: 1px solid currentColor; line-height: 1.5; }
.role-admin { color: var(--accent-text); }
.role-vip { color: var(--amber); }
.role-user { color: var(--text-2); }
.role-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; padding: 0; border: 0; }
.role-dot.role-admin { background: var(--accent); }
.role-dot.role-vip { background: var(--amber); }
.role-dot.role-user { background: var(--text-3); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; background: var(--text-3); }
.status-dot.on { background: var(--green); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.state { display: inline-flex; align-items: center; gap: 7px; font: 500 13px var(--mono); color: var(--text-2); }
.state em { font-style: normal; }
.state.on { color: var(--green); }

/* ------------------------------------------------------------------ forms */

.form { display: flex; flex-direction: column; gap: 14px; }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.form-inline > input { flex: 1 1 160px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); }
.field > small { font-size: 13px; }
.field-link { font-weight: 400; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
legend { padding: 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }

input, select, textarea {
  width: 100%; font: 15px/1.4 var(--font); color: var(--text);
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 11px; min-height: 38px; outline: none; transition: border-color .12s, box-shadow .12s;
}
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea { background: var(--surface); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: vertical; }
select { cursor: pointer; }
select[multiple] { padding: 4px; }
select[multiple] option { padding: 5px 8px; border-radius: 4px; }
select option, select optgroup { background: var(--surface); color: var(--text); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); margin: 0; }
input[type="color"] { height: 40px; padding: 3px; cursor: pointer; }
input[type="file"] { padding: 6px; font-size: 14px; }
input[type="file"]::file-selector-button { font: 500 13.5px var(--font); color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 4px; padding: 5px 10px; margin-right: 10px; cursor: pointer; }
.select-sm, .input-xs { padding: 4px 8px; min-height: 30px; font-size: 13.5px; width: auto; }
.input-xs { width: 84px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); font-size: 14px; }
.check-row { display: flex; flex-wrap: wrap; gap: 18px; }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-group-sm { gap: 6px; }
.input-coin { position: relative; }
.input-coin .icon { position: absolute; left: 11px; color: var(--amber); }
.input-coin input { padding-left: 36px; font-family: var(--mono); }

.search { position: relative; display: flex; align-items: center; flex: 1 1 220px; max-width: 340px; }
.search .icon { position: absolute; left: 11px; color: var(--text-3); width: 16px; height: 16px; pointer-events: none; }
.search input { padding-left: 34px; }

.strength { height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin-top: -6px; }
.strength span { display: block; height: 100%; width: 0; transition: width .2s, background-color .2s; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; border: 1px solid; margin-bottom: 14px; }
.alert .icon { margin-top: 2px; }
.alert-error { background: var(--red-soft); color: var(--text); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.alert-error .icon { color: var(--red); }
.alert-success { background: var(--green-soft); color: var(--text); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.alert-success .icon { color: var(--green); }

/* ---------------------------------------------------------------- toolbar */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.toolbar-tight { gap: 8px; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented > * { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-right: 1px solid var(--border-strong); font: 500 13.5px var(--font); color: var(--text-2); background: transparent; cursor: pointer; }
.segmented > *:last-child { border-right: 0; }
.segmented > *:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.segmented > .active { background: var(--surface-3); color: var(--text); }
.count { font: 12px var(--mono); color: var(--text-3); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-color: var(--accent); }
.tabs .icon { width: 16px; height: 16px; color: var(--text-3); }

/* ------------------------------------------------------------------ table */

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--text-2); padding: 8px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:not(.row-editor):hover td { background: var(--surface-2); }
.table .num { text-align: right; }
.row-editor td { background: var(--surface-2); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell div { display: flex; flex-direction: column; line-height: 1.35; }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty-state .icon { width: 28px; height: 28px; color: var(--text-3); }

/* ------------------------------------------------------------- stat strip */

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stats-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border-left: 1px solid var(--border); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text-2); }
.stat-label .icon { width: 15px; height: 15px; color: var(--text-3); }
.stat-value { font: 500 26px/1.25 var(--mono); letter-spacing: -.02em; }
.stat-value small { font-size: 15px; color: var(--text-3); letter-spacing: 0; }
.stat-hint { font-size: 13px; color: var(--text-3); }

/* -------------------------------------------------------------- dashboard */

.greeting { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.greeting h2 { font-size: 24px; margin-bottom: 2px; }

.metrics { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.metric { display: grid; grid-template-columns: 72px minmax(0, 1fr) 56px; grid-template-areas: 'label meter value' '. sub sub'; align-items: center; column-gap: 14px; }
.metric-label { grid-area: label; font-size: 14px; color: var(--text-2); }
.meter { grid-area: meter; height: 8px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--text-2); transition: width .6s ease-out; }
.metric[data-level="warn"] .meter i { background: var(--amber); }
.metric[data-level="high"] .meter i { background: var(--red); }
.metric-value { grid-area: value; text-align: right; font: 500 14px var(--mono); }
.metric [data-sub] { grid-area: sub; font-size: 12.5px; }
.spark-wrap { border-top: 1px solid var(--border); padding-top: 12px; }
.spark-legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.lg::before { content: ''; display: inline-block; width: 14px; height: 0; border-top: 2px solid; margin-right: 6px; vertical-align: middle; }
.lg-cpu::before { border-color: var(--accent); }
.lg-ram::before { border-color: var(--text-2); border-top-style: dashed; }
#spark { width: 100%; height: 110px; display: block; }

.mini-servers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 28px; align-content: start; }
/* Dashboard on a big screen: the host + servers row grows to fill the window height. */
@media (min-width: 1201px) and (min-height: 700px) {
  .dash-page .content { flex: 1; }
  .dash-page .grid-main { flex: 1; min-height: 0; }
  .dash-page .grid-main > .card { display: flex; flex-direction: column; }
  .dash-page .metrics { gap: 18px; }
  .dash-page .spark-wrap { flex: 1; min-height: 160px; display: grid; grid-template-rows: auto minmax(0, 1fr); }
  .dash-page #spark { height: 100%; contain: size; } /* ignore the canvas's own pixel size, or it keeps the row tall */
  .dash-page .mini-servers { flex: 1; align-content: stretch; }
}
/* Admin center: roles */
.role-panel { display: flex; flex-direction: column; gap: 16px; }
.role-panel[hidden] { display: none; }
.role-create { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.role-create .field:first-of-type { flex: 1 1 240px; }
.role-color-field input[type="color"] { width: 44px; height: 36px; padding: 3px; cursor: pointer; }
.role-color-row { display: flex; align-items: center; gap: 12px; }
.role-card { padding: 0; }
.role-card > summary { display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; list-style: none; }
.role-card > summary::-webkit-details-marker { display: none; }
.role-card > summary .role { font-size: 13.5px; }
.role-summary { margin-left: auto; }
.role-chevron { width: 16px; height: 16px; color: var(--text-3); transition: transform .15s; }
.role-card[open] .role-chevron { transform: rotate(180deg); }
.role-card[open] > summary { border-bottom: 1px solid var(--border); }
.role-form { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.role-basics { display: grid; grid-template-columns: minmax(0, 1fr) auto 96px; gap: 16px; align-items: end; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.perm-group { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.perm-group legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.perm { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.perm input { margin-top: 3px; flex: none; }
.perm span { display: flex; flex-direction: column; line-height: 1.35; }
.perm strong { font-weight: 500; font-size: 14px; }
.perm small { font-size: 12.5px; }
.role-server-list { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-left: 26px; }
.role-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 0 20px 16px; }
.text-danger { color: var(--red); }
@media (max-width: 640px) {
  .role-basics { grid-template-columns: minmax(0, 1fr) auto; }
  .role-order { grid-column: 1 / -1; }
  .role-summary { display: none; }
}

/* Admin database browser */
.db-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.db-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.db-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.db-tables ul { list-style: none; margin: 0; padding: 0; }
.db-tables a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 14px; }
.db-tables a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.db-tables a.active { background: var(--surface-3); color: var(--text); }
.db-query { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.db-query textarea { width: 100%; font-size: 13.5px; }
.db-table td { font-size: 13px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.db-table th small { display: block; font-weight: 400; font-size: 11.5px; }
.db-null { color: var(--text-3); font: 12px var(--mono); }
.db-masked { color: var(--text-3); font: 12px var(--mono); border: 1px dashed var(--border-strong); border-radius: 3px; padding: 0 5px; }
.db-query-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.db-table-tools { display: flex; align-items: center; gap: 12px; }
.db-actions { display: flex; gap: 4px; align-items: center; }
.db-actions .icon { width: 14px; height: 14px; }
.db-delete:hover { color: var(--red); }
.db-row-active td { background: var(--accent-soft); }
.db-edit .form-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.db-field-wide { grid-column: 1 / -1; }
.db-field-head { display: flex; align-items: baseline; gap: 8px; }
.db-field-head .db-null-check { margin-left: auto; font-size: 12.5px; }
.db-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 14px; }
@media (max-width: 980px) { .db-layout { grid-template-columns: minmax(0, 1fr); } }
.mini-servers li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.mini-servers li:last-child { border-bottom: 0; }
.mini-servers li div { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.mini-servers strong { font-weight: 500; }
.mini-servers small { font-size: 13px; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.feed li { display: flex; gap: 10px; align-items: flex-start; }
.feed li div { min-width: 0; }
.feed strong { font-weight: 500; }
.feed time { font-size: 13px; color: var(--text-3); margin-left: 4px; }
.feed p { color: var(--text-2); overflow-wrap: anywhere; font-size: 14px; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--border-strong); font-size: 14px; }
.timeline li strong { font-weight: 500; }
.timeline li.tl-start { border-color: var(--green); }
.timeline li.tl-stop, .timeline li.tl-fail { border-color: var(--red); }
.timeline li.tl-shutdown { border-color: var(--amber); }
.timeline li.tl-update, .timeline li.tl-reboot { border-color: var(--blue); }
.timeline time { font-size: 13px; color: var(--text-3); }

.avatar-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-pill { display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 99px; border: 1px solid var(--border); color: var(--text); font-size: 14px; }
.avatar-pill:hover { text-decoration: none; border-color: var(--border-strong); }

/* ---------------------------------------------------------------- servers */

.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.server-card { display: flex; flex-direction: column; gap: 14px; }
.server-card[data-running="1"] { border-color: color-mix(in srgb, var(--green) 35%, var(--border)); }
.server-top { display: flex; align-items: center; gap: 12px; }
.server-logo { width: 38px; height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; font: 600 14px var(--mono); color: var(--text-2); background: var(--surface-3); flex: none; }
.server-card[data-running="1"] .server-logo { color: var(--green); background: var(--green-soft); }
.server-meta { flex: 1; min-width: 0; }
.server-meta h3 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.server-stats div { padding: 8px 10px; border-left: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.server-stats div:first-child { border-left: 0; }
.server-stats .bar { border: 0; padding: 0; }
.server-stats span { font-size: 12.5px; color: var(--text-3); }
.server-stats strong { font: 500 14px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 3px; border-radius: 2px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--text-2); transition: width .5s; }
.server-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.server-facts div { min-width: 0; }
.server-facts dt { font-size: 12.5px; color: var(--text-3); }
.server-facts dd { margin: 1px 0 0; display: flex; align-items: center; gap: 4px; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-facts .icon-btn-xs { width: 22px; height: 22px; }
.server-facts .icon-btn-xs .icon { width: 13px; height: 13px; }
.server-admin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.server-admin-row.is-hidden > div:first-child { opacity: .6; }
.server-form { padding: 16px; margin: 8px 0 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.server-form h4 { margin-bottom: 4px; }
.vis-public { color: var(--green); }
.vis-members { color: var(--accent-text); }
.vis-hidden { color: var(--text-3); }

/* ------------------------------------------------------------------- chat */

.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; height: calc(100vh - 140px); min-height: 520px; }
.chat-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-card .card-head { padding: 14px 20px; margin: 0; border-bottom: 1px solid var(--border); }
.chat-stream { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; }
.msg { display: flex; gap: 12px; padding: 5px 8px; border-radius: var(--radius-sm); position: relative; }
.msg:hover { background: var(--surface-2); }
.msg.cont { padding-top: 0; padding-bottom: 2px; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg-body { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head strong { font-weight: 600; }
.msg-head time { font: 12px var(--mono); color: var(--text-3); }
.msg-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-text a { text-decoration: underline; }
.msg.mine .msg-head strong { color: var(--accent-text); }
.msg.mention { background: var(--amber-soft); }
.msg-del { position: absolute; right: 8px; top: 4px; opacity: 0; }
.msg:hover .msg-del, .msg-del:focus-visible { opacity: 1; }
.day-sep { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12.5px; margin: 14px 0 6px; }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.chat-compose { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.chat-compose input { flex: 1; }
.char-count { min-width: 52px; text-align: right; font-family: var(--mono); }
.chat-side { display: flex; flex-direction: column; gap: 24px; overflow-y: auto; }
.member-groups { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.member-groups h4 { font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 4px; }
.member-groups ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.member-groups a { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: var(--radius-sm); color: var(--text); }
.member-groups a:hover { background: var(--surface-2); text-decoration: none; }

/* ------------------------------------------------------------------ files */

.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 26px 16px; border-radius: var(--radius); border: 1px dashed var(--border-strong); cursor: pointer; transition: border-color .12s, background-color .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone > .icon { width: 24px; height: 24px; color: var(--text-2); }
.dropzone strong { font-weight: 500; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-list { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13.5px; }
.file-list { display: flex; flex-direction: column; }
.file-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.file-row:last-child { border-bottom: 0; }
.file-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center; font: 600 10.5px var(--mono); color: var(--text-2); background: var(--surface-3); }
.kind-image { color: var(--blue); }
.kind-pdf { color: var(--red); }
.kind-audio { color: var(--green); }
.kind-video { color: var(--accent-text); }
.kind-archive { color: var(--amber); }
.file-info { display: flex; flex-direction: column; min-width: 0; }
.file-info strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { display: flex; gap: 4px; align-items: center; }
.file-actions form { margin: 0; }
.share-editor { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); }

/* ----------------------------------------------------------------- casino */

.daily-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.daily-card h3 { font-size: 16px; }
.countdown { display: flex; flex-direction: column; align-items: flex-end; }
.countdown strong { font-size: 20px; font-weight: 500; }
.game-list { padding: 0; }
.game-row { display: flex; align-items: center; gap: 16px; padding: 18px 20px; color: var(--text); border-bottom: 1px solid var(--border); }
.game-row:last-child { border-bottom: 0; }
.game-row:hover { background: var(--surface-2); text-decoration: none; }
.game-row div { flex: 1; }
.game-row h3 { font-size: 17px; margin-bottom: 2px; }
.game-row > .icon { color: var(--text-3); }

.leaderboard { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.leaderboard li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.leaderboard li:last-child { border-bottom: 0; }
.leaderboard li.me a { color: var(--accent-text); }
.leaderboard a { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank { width: 22px; font: 500 13px var(--mono); color: var(--text-3); text-align: right; flex: none; }
.rank-1 { color: var(--amber); }

.roulette-card { padding: 20px; }
.roulette-top { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.round-info { display: flex; flex-direction: column; min-width: 90px; }
.round-info.right { align-items: flex-end; }
.round-info strong { font-size: 18px; font-weight: 500; }
.round-timer { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.timer-bar { width: 100%; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.timer-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.timer-bar.closed span { background: var(--text-3); }
#rl-phase { font: 500 14px var(--mono); }
.wheel { position: relative; height: 92px; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.wheel-track { position: absolute; top: 7px; left: 0; display: flex; gap: 6px; will-change: transform; }
.wheel-cell { width: 76px; height: 76px; flex: none; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 28px; }
.wheel-cell.win { outline: 2px solid var(--text); outline-offset: -2px; }
.sym-red { background: #b8342c; }
.sym-black { background: #2b2d31; }
.sym-bait { background: #2f5f9e; }
.sym-green { background: #2c7a45; }
.wheel-marker { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%); background: var(--accent); z-index: 2; }
.wheel-fade { display: none; }
.history-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.history { display: flex; gap: 4px; flex-wrap: wrap; }
.history span { width: 22px; height: 22px; border-radius: 4px; display: grid; place-items: center; font-size: 11px; }
.bet-amount { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.quick-bets { display: flex; gap: 6px; flex-wrap: wrap; }
.bet-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.bet-column { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bet-btn { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 11px 12px; border: 0; border-radius: var(--radius-sm); font: 600 14px var(--font); color: #fff; cursor: pointer; transition: filter .12s; }
.bet-btn:hover { filter: brightness(1.15); }
.bet-btn:disabled { filter: grayscale(.8) brightness(.7); cursor: not-allowed; }
.bet-btn b { font: 500 13px var(--mono); opacity: .85; }
.col-red .bet-btn { background: #b8342c; }
.col-black .bet-btn { background: #2b2d31; border: 1px solid var(--border-strong); }
.col-bait .bet-btn { background: #2f5f9e; }
.col-green .bet-btn { background: #2c7a45; }
.bet-total { display: flex; justify-content: space-between; align-items: center; padding: 5px 2px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.bet-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; font-size: 13.5px; max-height: 220px; overflow-y: auto; }
.bet-list li { display: flex; justify-content: space-between; gap: 6px; padding: 3px 2px; }
.bet-list li.me { color: var(--accent-text); }
.bet-list li.won { color: var(--green); }
.bet-list li.lost { color: var(--text-3); text-decoration: line-through; }
.bet-column.winner .bet-total { color: var(--green); border-color: var(--green); }

.coin-card { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 32px 24px; }
.coin-stage { position: relative; height: 180px; width: 180px; perspective: 900px; display: grid; place-items: center; }
.coin { width: 140px; height: 140px; position: relative; transform-style: preserve-3d; transition: transform 1.6s cubic-bezier(.2, .8, .25, 1); }
.coin-face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform: rotateY(0deg) translateZ(1px); font: 600 48px var(--mono); color: #4a3200; background: #d9a441; box-shadow: inset 0 0 0 6px #b98425; }
.coin-face.tails { transform: rotateY(180deg) translateZ(1px); color: #2c2f33; background: #b9bcc1; box-shadow: inset 0 0 0 6px #96999e; }
.coin-shadow { position: absolute; bottom: 2px; width: 100px; height: 10px; border-radius: 50%; background: rgba(0, 0, 0, .3); filter: blur(5px); }
.coin-result { font-size: 17px; font-weight: 500; min-height: 26px; text-align: center; }
.coin-result.win { color: var(--green); }
.coin-result.lose { color: var(--red); }
.coin-controls { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.flip-history { list-style: none; margin: 0; padding: 0; }
.flip-history li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.flip-history li:last-child { border-bottom: 0; }
.flip-history li strong { margin-left: auto; font-weight: 500; }
.flip-history li.win strong { color: var(--green); }
.flip-history li.lose strong { color: var(--red); }
.flip-badge { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--mono); background: #d9a441; color: #4a3200; }

/* --------------------------------------------------------------- invoices */

.invoice-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.template-bar { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.logo-pick { display: flex; align-items: center; gap: 8px; }
.logo-pick img { width: 38px; height: 38px; object-fit: contain; border-radius: 4px; background: #fff; }
.items-table input { padding: 6px 8px; min-height: 34px; font-size: 14px; }
.items-table td { padding: 5px 4px; }
.w-qty { width: 76px; } .w-price { width: 110px; } .w-we { width: 44px; text-align: center !important; }
.items-table td:nth-child(4) { text-align: center; }
.totals { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--border); }
.totals div { display: flex; justify-content: space-between; gap: 40px; min-width: 240px; color: var(--text-2); }
.totals strong { font: 500 15px var(--mono); color: var(--text); }
.totals .grand { padding-top: 6px; font-size: 16px; color: var(--text); }
.totals .grand strong { font-size: 18px; }
.paper-wrap { position: sticky; top: 84px; }
.paper { background: #fff; color: #1d1d20; border-radius: 4px; padding: 36px; font: 12.5px/1.5 var(--font); border: 1px solid var(--border); aspect-ratio: 1 / 1.414; overflow: hidden; }
.paper-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 2px solid #1d1d20; }
.paper-from { display: flex; gap: 14px; align-items: flex-start; }
.paper-from img { max-width: 64px; max-height: 64px; object-fit: contain; }
.paper-from p, .paper-meta p { white-space: pre-line; color: #4b4b52; }
.paper-title { text-align: right; }
.paper-title h2 { font-size: 22px; letter-spacing: .08em; font-weight: 600; color: #1d1d20; }
.paper-title p { color: #6b6b72; font-family: var(--mono); }
.paper-meta { display: flex; justify-content: space-between; gap: 20px; margin: 20px 0; }
.paper-meta small { display: block; font-size: 10.5px; font-weight: 600; color: #8a8a92; margin-top: 4px; }
.paper-meta .right { text-align: right; }
.paper-table { width: 100%; border-collapse: collapse; }
.paper-table th { text-align: left; font-size: 10.5px; font-weight: 600; color: #6b6b72; padding: 7px 8px; border-bottom: 1px solid #1d1d20; }
.paper-table td { padding: 7px 8px; border-bottom: 1px solid #e4e4e7; color: #1d1d20; }
.paper-table th:not(:first-child), .paper-table td:not(:first-child) { text-align: right; white-space: nowrap; font-family: var(--mono); }
.paper-table .we { color: #a3470f; font-size: 10px; font-weight: 600; margin-left: 6px; }
.paper-totals { margin: 16px 0 0 auto; width: 240px; display: flex; flex-direction: column; gap: 3px; font-family: var(--mono); }
.paper-totals div { display: flex; justify-content: space-between; }
.paper-totals .grand { margin-top: 6px; padding-top: 6px; border-top: 2px solid #1d1d20; font-weight: 600; font-size: 14px; }
.paper-notes { margin-top: 24px; color: #6b6b72; white-space: pre-line; }
.saved-list { list-style: none; margin: 0; padding: 0; }
.saved-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.saved-list li:last-child { border-bottom: 0; }
.saved-list time { color: var(--text-3); font-size: 13px; }
.saved-open { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-open:hover strong { text-decoration: underline; }

/* ---------------------------------------------------------------- profile */

.profile { padding: 0; overflow: hidden; }
.profile-banner { height: 140px; background: var(--surface-3); border-bottom: 1px solid var(--border); }
.profile-head { display: flex; align-items: flex-end; gap: 18px; padding: 0 24px; margin-top: -44px; position: relative; flex-wrap: wrap; }
.profile-avatar { position: relative; }
.presence { position: absolute; right: 6px; bottom: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--green); border: 3px solid var(--surface); }
.profile-id { flex: 1; padding-bottom: 4px; min-width: 200px; }
.profile-id h2 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.profile-head > .btn { margin-bottom: 6px; }
.profile-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; padding: 24px; }
.bio-text { font-size: 16px; line-height: 1.65; overflow-wrap: anywhere; max-width: 68ch; }
.link-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; align-items: center; }
.link-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.link-chip a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; padding-right: 4px; }
.link-chip img { width: 16px; height: 16px; border-radius: 3px; }
.chip-x { width: 22px; height: 22px; border-radius: 4px; border: 0; background: transparent; color: var(--text-3); cursor: pointer; display: grid; place-items: center; }
.chip-x:hover { background: var(--red-soft); color: var(--red); }
.chip-x .icon { width: 13px; height: 13px; }
.link-add { display: inline-flex; align-items: center; gap: 6px; padding: 2px 3px 2px 10px; border-radius: var(--radius-sm); border: 1px dashed var(--border-strong); }
.link-add input { border: 0; background: transparent; padding: 3px; min-height: 0; width: 200px; box-shadow: none !important; }
.link-add .icon { width: 15px; height: 15px; color: var(--text-3); }
.facts { margin: 0 0 14px; display: flex; flex-direction: column; }
.facts div { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; font-weight: 500; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.mini-stats div { display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border-left: 1px solid var(--border); }
.mini-stats div:first-child { border-left: 0; }
.mini-stats strong { font: 500 18px var(--mono); }
.mini-stats span { font-size: 12.5px; color: var(--text-3); }
.style-editor { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.style-editor summary { cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 8px; list-style: none; }
.style-editor summary::-webkit-details-marker { display: none; }
.style-editor summary .icon { color: var(--text-3); }
.style-editor[open] summary { margin-bottom: 14px; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 4px; border: 1px solid var(--border-strong); cursor: pointer; }
.avatar-editor { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.avatar-editor .avatar-xl { border-color: var(--border); }
.avatar-editor .form { flex: 1; min-width: 220px; }
.public-bio { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.public-bio.on { border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.public-bio-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.public-bio-head strong { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.public-bio-head .icon { color: var(--text-3); }
.public-url { display: block; font-size: 12.5px; padding: 6px 8px; word-break: break-all; }

/* ------------------------------------------------------------------ admin */

.reveal { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; border-color: color-mix(in srgb, var(--green) 45%, var(--border)); }
.reveal > div { flex: 1; }
.big-code { font-size: 20px; font-weight: 500; letter-spacing: .1em; padding: 6px 12px; }
.role-select { font-weight: 500; }
.help { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.help summary { cursor: pointer; font-weight: 500; }
.help[open] summary { margin-bottom: 8px; }
.code-block { font: 13px/1.6 var(--mono); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; margin: 8px 0; white-space: pre; }
.sudo-card { max-width: 420px; margin: 32px auto; }

/* ------------------------------------------------------------------- auth */

.auth-body { background: var(--bg); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }
.auth-panel { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 22px; }
.auth-panel > .brand { align-self: flex-start; }
.auth-card { display: flex; flex-direction: column; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-card > .muted { margin-bottom: 24px; }
.auth-switch { margin-top: 20px; color: var(--text-2); font-size: 14px; }
.auth-back { font-size: 14px; color: var(--text-2); }

/* ---------------------------------------------------------------- landing */

.landing-body { background: var(--bg); }
.lp-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 880px; margin: 0 auto; padding: 22px 24px; }
.lp-actions { display: flex; align-items: center; gap: 8px; }
.lp { max-width: 880px; margin: 0 auto; padding: 0 24px; }
.lp-intro { padding: 56px 0 40px; border-bottom: 1px solid var(--border); }
.lp-intro h1 { font-size: clamp(30px, 4.5vw, 40px); letter-spacing: -.02em; margin-bottom: 12px; }
.lp-lead { font-size: 17px; color: var(--text-2); max-width: 62ch; line-height: 1.6; }
.lp-section { padding: 40px 0 8px; }
.lp-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.lp-section-head h2 { font-size: 20px; }
.lp-table { width: 100%; border-collapse: collapse; }
.lp-table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--text-2); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--border-strong); }
.lp-table td { padding: 13px 12px 13px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lp-table td strong { font-weight: 500; margin-right: 10px; }
.lp-table td .muted { font-size: 14px; }
.lp-table .num { text-align: right; padding-right: 0; }
.lp-address { font: 14px var(--mono); color: var(--text); background: none; border: 0; border-bottom: 1px dashed var(--border-strong); padding: 0; cursor: copy; }
.lp-address:hover { color: var(--accent-text); border-color: var(--accent-text); }
.lp-foot-brand { display: inline-flex; align-items: center; gap: 8px; }
.lp-foot-brand .brand-mono { color: var(--text-2); }
.join-link { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; color: var(--text); border-bottom: 1px solid var(--border-strong); }
.join-link .icon { width: 13px; height: 13px; color: var(--text-3); }
.join-link:hover { color: var(--accent-text); border-color: var(--accent-text); text-decoration: none; }
.join-link:hover .icon { color: var(--accent-text); }
.lp-list { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
.lp-list div { padding: 12px 0; border-bottom: 1px solid var(--border); }
.lp-list dt { font-weight: 600; margin-bottom: 2px; }
.lp-list dd { margin: 0; color: var(--text-2); font-size: 15px; }
.lp-prose { max-width: 62ch; color: var(--text-2); font-size: 16px; }
.lp-prose a { text-decoration: underline; text-underline-offset: 3px; }
.lp-footer { max-width: 880px; margin: 56px auto 0; padding: 20px 24px 36px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }

/* -------------------------------------------------------------- public bio */
/* The bio page uses the member's own background; cards stay readable on top of it. */

.landing-body.bio-body { min-height: 100vh; color: #fff; background: #4b5563 fixed; }
.bio-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 48px 16px; text-align: center; }
.bio-avatar { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; border: 3px solid rgba(255, 255, 255, .85); background: rgba(255, 255, 255, .15); }
.bio-name { font-size: 24px; font-weight: 600; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.bio-card { width: 100%; max-width: 420px; text-align: left; padding: 16px 18px; border-radius: var(--radius); color: #f4f4f5; font-size: 15px; line-height: 1.6; background: rgba(20, 22, 26, .62); border: 1px solid rgba(255, 255, 255, .16); overflow-wrap: anywhere; }
.bio-info { font-size: 14px; }
.bio-info strong { display: block; margin-bottom: 4px; }
.bio-info b { font-weight: 600; }
.bio-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.bio-links a { display: inline-flex; align-items: center; gap: 8px; color: #fff; padding: 7px; border-radius: var(--radius-sm); background: rgba(20, 22, 26, .5); border: 1px solid rgba(255, 255, 255, .18); }
.bio-links.with-text a { padding: 7px 12px 7px 9px; font-weight: 500; font-size: 14px; }
.bio-links a:hover { background: rgba(20, 22, 26, .7); color: #fff; text-decoration: none; }
.bio-links img { width: 20px; height: 20px; border-radius: 4px; }
.bio-foot { margin-top: 10px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.bio-foot a { color: #fff; display: inline-flex; align-items: center; gap: 4px; opacity: .85; }
.bio-foot .icon { width: 14px; height: 14px; }
.bio-notice { display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: var(--radius-sm); font-size: 14px; background: rgba(0, 0, 0, .45); }
.bio-notice a { color: #fff; text-decoration: underline; }
.bio-notice .icon { width: 15px; height: 15px; }
.bio-missing { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bio-missing > .icon { width: 28px; height: 28px; opacity: .8; }
.bio-missing h1 { font-size: 19px; }

/* --------------------------------------------------------------- security */

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.otp-input { font: 500 22px var(--mono); letter-spacing: .25em; text-align: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.qr-secret { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.qr-secret code { font-size: 15px; letter-spacing: .06em; word-break: break-all; padding: 6px 8px; }
.recovery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: var(--mono); margin: 10px 0; }
.recovery-grid span { padding: 5px 10px; border-radius: 4px; border: 1px solid var(--border); text-align: center; }
.sec-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sec-list li { display: flex; align-items: center; gap: 10px; }
.sec-list .icon { color: var(--text-3); }

/* ----------------------------------------------------------------- toasts */

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(400px, calc(100vw - 40px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--pop-shadow); animation: toast-in .18s ease-out; }
.toast .icon { flex: none; }
.toast-success .icon { color: var(--green); }
.toast-error { border-color: color-mix(in srgb, var(--red) 50%, var(--border-strong)); }
.toast-error .icon { color: var(--red); }
.toast.out { animation: toast-out .18s ease-in forwards; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes toast-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ games */

/* Casino hub */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.game-tile { display: flex; flex-direction: column; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); transition: border-color .15s, background .15s; }
.game-tile:hover { border-color: var(--accent); background: var(--surface-2); text-decoration: none; color: var(--text); }
.game-art { width: 40px; height: 40px; color: var(--accent-text); }
.game-art svg { width: 100%; height: 100%; }
.game-info { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.game-info strong { font-size: 16px; font-weight: 600; }
.game-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--amber); }

/* Game page: controls left, table right */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.game-panel { display: grid; grid-template-columns: 280px minmax(0, 1fr); padding: 0; overflow: hidden; }
.game-controls { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-right: 1px solid var(--border); background: var(--surface); }
.game-controls .field select { width: 100%; }
.game-actions { display: flex; flex-direction: column; gap: 8px; }
.game-actions .btn { width: 100%; justify-content: center; flex-direction: column; gap: 0; }
.game-actions .btn small { font: 12px var(--mono); opacity: .8; }
.segmented-full { display: flex; }
.segmented-full > * { flex: 1; justify-content: center; }
.game-facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.game-facts dt { font-size: 12.5px; color: var(--text-2); }
.game-facts dd { margin: 0; font: 500 15px var(--mono); }
.game-stage { position: relative; min-height: 440px; padding: 28px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; background: var(--bg); }
.verdict { min-height: 24px; font-weight: 600; text-align: center; }
.verdict.win { color: var(--green); }
.verdict.lose { color: var(--red); }
.verdict.push { color: var(--text-2); }
.big-number { font-size: 56px; font-weight: 600; letter-spacing: -.02em; line-height: 1; transition: color .2s; }
.big-number.huge { font-size: 72px; }
.big-number.win { color: var(--green); }
.big-number.lose { color: var(--red); }
.round-list { list-style: none; margin: 0; padding: 0; }
.round-list li { display: grid; grid-template-columns: 76px 1fr auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.round-list li:last-child { border-bottom: 0; }
.round-list li.win strong { color: var(--green); }
.round-list li.lose strong { color: var(--red); }
.round-list li.push strong { color: var(--text-2); }
.paytable td { padding: 5px 8px; }
.paytable tr.hl td { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.game-rules p { color: var(--text-2); font-size: 14px; line-height: 1.55; }

/* Dice */
.dice-track { position: relative; width: 100%; max-width: 520px; height: 14px; border-radius: 7px; background: var(--red); opacity: .9; }
.dice-win { position: absolute; top: 0; bottom: 0; background: var(--green); border-radius: 7px; transition: left .2s, width .2s; }
.dice-marker { position: absolute; top: -9px; width: 4px; height: 32px; margin-left: -2px; border-radius: 2px; background: var(--text); opacity: 0; transition: left .45s ease-out; }
.dice-marker.show { opacity: 1; }
.dice-scale { display: flex; justify-content: space-between; width: 100%; max-width: 520px; }

/* Crash */
.crash-canvas { width: 100%; height: 300px; }
.crash-readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; pointer-events: none; }
.big-number.running { color: var(--text); }

/* Mines */
.mines-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; max-width: 400px; }
.tile { aspect-ratio: 1; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; transition: transform .1s, background .15s; position: relative; }
.tile:not(:disabled):hover { background: var(--surface-3); transform: translateY(-2px); }
.tile:disabled { cursor: default; }
.tile.gem { background: color-mix(in srgb, var(--green) 22%, var(--surface)); border-color: var(--green); }
.tile.gem::after { content: ''; position: absolute; inset: 30%; background: var(--green); transform: rotate(45deg); border-radius: 3px; }
.tile.mine { background: color-mix(in srgb, var(--red) 18%, var(--surface)); border-color: var(--red); }
.tile.mine::after { content: ''; position: absolute; inset: 28%; background: var(--red); border-radius: 50%; }
.tile.hit { background: var(--red); }
.tile.hit::after { background: var(--bg); }
.tile.dim { opacity: .45; }

/* Plinko */
.plinko { position: relative; width: 100%; max-width: 520px; aspect-ratio: 1.15; }
.peg { position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--text-3); }
.ball { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--accent); transition: left .11s linear, top .11s ease-in; z-index: 2; }
.plinko-slots { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; width: 100%; max-width: 520px; }
.slot { padding: 6px 0; text-align: center; font: 600 11px var(--mono); border-radius: 4px; color: #121315; }
.slot.heat-0 { background: #e0ae48; } .slot.heat-1 { background: #e69a42; } .slot.heat-2 { background: #ea853c; } .slot.heat-3 { background: #ee6f36; } .slot.heat-4 { background: #f05a30; }
.slot.hit { animation: slot-hit .5s ease-out; }
@keyframes slot-hit { 40% { transform: translateY(5px); filter: brightness(1.3); } }

/* Wheel */
.spin-wheel-wrap { position: relative; width: min(340px, 100%); aspect-ratio: 1; }
.spin-wheel { width: 100%; height: 100%; border-radius: 50%; border: 6px solid var(--surface-3); transition: transform 3s cubic-bezier(.12, .7, .16, 1); display: flex; align-items: center; justify-content: center; }
.spin-wheel-hub { position: absolute; top: 33%; left: 33%; width: 34%; aspect-ratio: 1; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px; }
.spin-wheel-pointer { position: absolute; top: -8px; left: 50%; margin-left: -10px; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 18px solid var(--text); z-index: 2; }
.spin-wheel-legend { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.spin-wheel-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

/* Slots */
.reels { display: flex; gap: 12px; }
.reel { width: 110px; height: 130px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 56px; font-weight: 700; overflow: hidden; }
.reel span { display: block; }
.reel.spinning span { filter: blur(1.5px); transform: translateY(4px); }

/* Keno */
.keno-board { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; width: 100%; max-width: 520px; }
.kn { aspect-ratio: 1; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: 600 15px var(--mono); cursor: pointer; }
.kn:hover { background: var(--surface-3); }
.kn.picked { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.kn.drawn { background: var(--text-3); border-color: var(--text-2); color: var(--bg); }
.kn.hit { background: var(--green); border-color: var(--green); color: #0f1a12; }

/* Cards (blackjack, baccarat, hi-lo, video poker) */
.card-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; min-height: 92px; }
.pcard { width: 62px; height: 88px; border-radius: 7px; background: #f4f4f2; color: #16171a; border: 1px solid #d0d0cc; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.pcard b { font-size: 22px; font-weight: 700; }
.pcard i { font-style: normal; font-size: 20px; }
.pcard.red { color: #c0322b; }
.pcard.back { background: repeating-linear-gradient(45deg, var(--accent) 0 6px, #d5651f 6px 12px); border-color: var(--accent); }
.pcard.pc-lg { width: 76px; height: 108px; }
.pcard.pc-lg b { font-size: 26px; }
.pcard.pc-xl { width: 120px; height: 170px; border-radius: 10px; }
.pcard.pc-xl b { font-size: 44px; }
.pcard.pc-xl i { font-size: 36px; }
.pcard.pc-sm { width: 38px; height: 54px; border-radius: 5px; }
.pcard.pc-sm b { font-size: 14px; }
.pcard.pc-sm i { font-size: 12px; }
.pcard.lose { outline: 3px solid var(--red); }
.pcard.pc-deal { animation: deal-in .25s ease-out; }
@keyframes deal-in { from { opacity: 0; transform: translateY(-12px); } }
.bj { display: flex; flex-direction: column; gap: 28px; width: 100%; }
.hand { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hand-label { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.hand-label span { margin-left: 6px; color: var(--text); font-size: 15px; }
.trail-guess { color: var(--text-3); font-size: 12px; }
.small-cards { min-height: 56px; }
.poker-hand { gap: 8px; flex-wrap: nowrap; width: 100%; }
.hold-btn { position: relative; flex: 1 1 0; max-width: 84px; padding: 0 0 22px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.hold-btn .pcard.pc-lg { width: 100%; height: auto; aspect-ratio: 62 / 88; }
.hold-label { position: absolute; bottom: 0; left: 0; right: 0; font: 600 11px var(--mono); color: transparent; }
.hold-btn.held .hold-label { color: var(--accent-text); }
.hold-btn.held .pcard { transform: translateY(-8px); box-shadow: 0 0 0 2px var(--accent); }
.hold-btn:disabled { cursor: default; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1200px) {
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid .stat:nth-child(3) { border-left: 0; }
  .stats-grid .stat:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .stats-grid-3 .stat:nth-child(3) { border-left: 1px solid var(--border); border-top: 0; }
  .stats-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-layout, .grid-main, .grid-side-right { grid-template-columns: minmax(0, 1fr); }
  .paper-wrap { position: static; }
  .field-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--pop-shadow); }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); }
  .main { margin-left: 0; }
  .topbar .menu-btn { display: inline-grid; }
  .grid-side, .grid-side-right, .grid-2, .chat-layout, .profile-body { grid-template-columns: minmax(0, 1fr); }
  .chat-layout { height: auto; }
  .chat-card { height: 70vh; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .content { padding: 4px 16px 32px; gap: 20px; }
  .topbar { padding: 14px 16px; }
  .topbar-title p { display: none; }
  .topbar-avatar { display: none; }
  .stats-grid, .stats-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid-3 .stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--border); }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 22px; }
  .grid-3, .form-grid, .field-row, .field-row-4, .lp-list { grid-template-columns: minmax(0, 1fr); }
  .template-bar { grid-template-columns: 1fr 1fr; }
  .paper { padding: 20px; aspect-ratio: auto; }
  .roulette-top { flex-wrap: wrap; }
  .round-timer { order: 3; flex-basis: 100%; }
  .wheel-cell { width: 62px; height: 62px; font-size: 22px; }
  .wheel { height: 78px; }
  .profile-head { padding: 0 16px; }
  .profile-body { padding: 16px; }
  .file-row { grid-template-columns: 40px minmax(0, 1fr); }
  .file-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .lp-nav, .lp, .lp-footer { padding-left: 16px; padding-right: 16px; }
  .lp-signin { display: none; }
  .lp-intro { padding: 32px 0 28px; }
  .lp-table thead { display: none; }
  .lp-table tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .lp-table td { border: 0; padding: 2px 0; }
  .lp-table td:nth-child(2) { grid-row: 2; grid-column: 1 / -1; }
  .lp-table td:nth-child(3) { grid-row: 1; grid-column: 2; }
  .metric { grid-template-columns: 60px minmax(0, 1fr) 48px; column-gap: 10px; }
}

/* ------------------------------------------------------------------ print */

@media print {
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .invoice-layout { display: block; }
  .paper { border: 0; aspect-ratio: auto; padding: 0; }
  .paper-wrap { position: static; }
  @page { margin: 16mm; }
}

/* Games on small screens (after the game styles so these win) */
@media (max-width: 980px) {
  .game-panel { grid-template-columns: minmax(0, 1fr); }
  .game-controls { border-right: 0; border-top: 1px solid var(--border); order: 2; }
  .game-stage { order: 1; min-height: 340px; }
}
@media (max-width: 640px) {
  .big-number { font-size: 42px; }
  .big-number.huge { font-size: 52px; }
  .reel { width: 84px; height: 100px; font-size: 42px; }
  .pcard.pc-lg { width: 56px; height: 80px; }
  .pcard.pc-lg b { font-size: 20px; }
  .keno-board { grid-template-columns: repeat(5, 1fr); }
  .slot { font-size: 9px; }
  .game-stage { padding: 20px 12px; }
}
/* ---- Software downloads (software.php) ---- */
.software-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.software-head { display: flex; align-items: center; gap: 16px; }
.software-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.software-head p { margin: 2px 0 0; }
.software-tile { width: 56px; height: 56px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex-shrink: 0; }
.software-tile svg { width: 26px; height: 26px; }
.software-desc { margin: 0; max-width: 70ch; color: var(--text-2); }
.software-hash { word-break: break-all; font-size: 12px; }
.software-notes { display: flex; gap: 10px; align-items: flex-start; background: var(--amber-soft); color: var(--text); border-radius: var(--radius-sm); padding: 10px 14px; max-width: 70ch; }
.software-notes svg { color: var(--amber); flex-shrink: 0; margin-top: 2px; }
.software-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.software-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; transition: border-color .15s; }
.software-card:hover { border-color: var(--accent); }
.software-card strong { display: flex; align-items: center; gap: 6px; }
.software-delete { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }