/* Brahmastra — one stylesheet, tokens first. No inline scripts; inline styles allowed by CSP for MudBlazor only. */
:root {
    /* Dark, like the previous Brahmastra site. */
    --bg: #0b0e14; --surface: #121722; --surface-2: #182030; --border: #232c3d;
    --text: #e6e9f0; --muted: #8b93a5; --accent: #3b82f6; --accent-text: #ffffff;
    --green: #34d399; --green-bg: #0f2a20; --amber: #f5b544; --amber-bg: #2d230d;
    --red: #f87171; --red-bg: #321515; --grey-bg: #1e2635;
    --row-shielded: #0f1f19; --row-unshielded: #1f1a0e;
    --radius: 12px; --shadow: 0 1px 2px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; line-height: 1.2; }
h2 { font-size: 17px; margin: 0 0 4px; line-height: 1.2; }
h3 { font-size: 14px; margin: 0; line-height: 1.2; }
h1:focus { outline: none; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* Shell */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; object-fit: contain; }
.brand-word { font-family: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif; font-stretch: 85%; font-weight: 600; font-size: 17px; letter-spacing: .02em; }
/* The logo is black ink; on the dark themes it is shown as light ink. */
:root:not([data-theme=light]):not([data-theme=warm_light]) .ink { filter: invert(.93); }
.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topnav a, .linklike { padding: 6px 12px; border-radius: 8px; color: var(--muted); background: none; border: 0; font: inherit; cursor: pointer; }
.topnav a:hover, .linklike:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topnav a.active { color: var(--text); background: var(--surface-2); }
.topnav a.cta, .cta { background: var(--accent); color: var(--accent-text); padding: 7px 14px; border-radius: 8px; font-weight: 600; }
.topnav a.cta:hover, .cta:hover { filter: brightness(1.08); text-decoration: none; color: var(--accent-text); }
form.inline { display: inline; margin: 0; }
.page-body { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 24px; }

/* Landing */
.hero { max-width: 640px; margin: 10vh auto; text-align: center; }
.hero h1 { font-size: 34px; line-height: 1.2; margin-bottom: 12px; }
.hero p { color: var(--muted); font-size: 16px; margin: 0 0 24px; }
.big { display: inline-block; padding: 11px 20px; font-size: 15px; margin: 4px; }
.ghost { border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: var(--surface); }

/* Fleet */
.fleet-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 16px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: 1px; }
.live-dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
table.fleet th, table.fleet td { padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; line-height: 1.2; vertical-align: middle; }
table.fleet th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; background: var(--surface-2); position: sticky; top: 0; }
table.fleet tbody tr { cursor: pointer; }
table.fleet tbody tr:hover { filter: brightness(.97); }
table.fleet tbody tr:last-child td { border-bottom: 0; }
table.fleet tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
tr.shielded, section.detail.shielded { background: var(--row-shielded); }
tr.unshielded, section.detail.unshielded { background: var(--row-unshielded); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.acct { display: flex; align-items: center; gap: 10px; }
.acct-name { font-weight: 600; }
.acct-sub { font-size: 12px; color: var(--muted); }
.tag { color: var(--muted); font-weight: 500; margin-right: 4px; }
.state-dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.state-dot.online { background: var(--green); }
.state-dot.pending { background: var(--amber); }
.state-dot.bad { background: var(--red); }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.2; background: var(--grey-bg); color: var(--muted); vertical-align: middle; }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.violet { background: rgba(167, 139, 250, .16); color: #c4b5fd; }
.chip.red { background: var(--red-bg); color: var(--red); }
.empty { text-align: center; padding: 64px 16px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.notice.ok { background: var(--green-bg); color: var(--green); }
.notice.bad { background: var(--red-bg); color: var(--red); }

/* Detail */
section.detail { margin-top: 20px; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.strip { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: start; }
.strip p { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 16px 0; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; }
.stats span { font-size: 12px; color: var(--muted); }
.stats b { font-size: 15px; font-variant-numeric: tabular-nums; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card.wide { grid-column: span 2; }
@media (max-width: 760px) { .card.wide { grid-column: auto; } .page-body { padding: 16px; } .topbar { padding: 10px 16px; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.card p { margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
table.mini { font-size: 13px; }
table.mini th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 4px 6px; border-bottom: 1px solid var(--border); }
table.mini td { padding: 6px; border-bottom: 1px solid var(--border); }
table.mini tr:last-child td { border-bottom: 0; }
ul.kv, ul.activity { list-style: none; margin: 0; padding: 0; }
ul.kv li { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--border); }
ul.kv li:last-child { border-bottom: 0; }
ul.activity li { display: grid; grid-template-columns: auto auto 1fr auto; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); }
ul.activity li:last-child { border-bottom: 0; }
ul.activity .what { font-weight: 600; }
ul.activity .when { font-size: 12px; color: var(--muted); }

/* Controls */
.btn { font: inherit; line-height: 1.2; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn.small { padding: 2px 8px; font-size: 12px; }
.btn.icon { padding: 4px 10px; font-size: 16px; line-height: 1; }
select, input[type=text], input[type=search], input[type=email], input[type=password] { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Identity pages (template markup, Bootstrap removed) */
.row > .col-lg-6, .row > .col-lg-4, .row > .col-md-6 { flex: 1 1 340px; max-width: 460px; }
.form-floating { display: flex; flex-direction: column-reverse; gap: 4px; margin-bottom: 14px; }
.form-control { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; }
.form-label { font-size: 13px; color: var(--muted); }
.form-floating > .form-control::placeholder { color: transparent; }
.btn-primary { font: inherit; width: 100%; padding: 10px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer; }
.btn-link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; }
.text-danger { color: var(--red); font-size: 13px; }
.mb-3 { margin-bottom: 14px; }
.checkbox label { display: flex; gap: 8px; align-items: center; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.d-flex { display: flex; } .flex-column { flex-direction: column; } .mx-auto { margin-left: auto; margin-right: auto; } .mt-2 { margin-top: 8px; }
.text-secondary { color: var(--muted); }
.turnstile-slot { margin: 6px 0 14px; min-height: 65px; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 16px; background: var(--red-bg); color: var(--red); z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 8px; }
.blazor-error-boundary { background: var(--red-bg); color: var(--red); padding: 1rem; border-radius: 8px; }
.blazor-error-boundary::after { content: "An error has occurred."; }

/* ── Popups ─────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(3, 6, 12, .72); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.overlay.inner { position: absolute; border-radius: var(--radius); z-index: 60; }
.modal { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.5); padding: 20px; width: 100%; max-height: calc(100vh - 32px); overflow: auto; }
.modal.small { max-width: 520px; }
.modal.wide { max-width: 1060px; }
.modal.panel { max-width: 1440px; min-height: min(820px, calc(100vh - 32px)); padding: 0; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 14px; }
.modal-head p { margin: 2px 0 0; }

/* Add account */
.methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.method { display: flex; gap: 12px; align-items: center; text-align: left; padding: 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.method:hover:not(:disabled) { border-color: var(--accent); }
.method b { display: block; font-size: 15px; }
.method small { color: var(--muted); }
.method-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; font-weight: 800; font-size: 18px; color: #fff; flex: none; }
.method-icon.fb { background: #1877f2; }
.method-icon.igg { background: #e0412b; }
@media (max-width: 560px) { .methods { grid-template-columns: 1fr; } }
.frame-bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2); font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.frame-wrap { width: 100%; max-width: 1000px; overflow: auto; border: 1px solid var(--border); border-radius: 0 0 10px 10px; background: #fff; outline: none; }
.frame-wrap:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.frame-wrap img { display: block; width: 100%; height: auto; margin: 0 auto; cursor: pointer; user-select: none; touch-action: manipulation; }
.relay { display: grid; gap: 4px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.relay input { font-size: 16px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--control-border); background: var(--input-bg); color: var(--text); }   /* 16px: phones do not zoom in */
@media (max-width: 700px) {
    .overlay .modal.wide { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; overflow-y: auto; padding: 12px; }
    .frame-bar .muted.grow { display: none; }
    .frame-wrap { overflow: hidden; }
    .row.paste input { min-width: 0; }
}
.frame-placeholder { display: flex; gap: 10px; align-items: center; justify-content: center; min-height: 220px; color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.row.paste { margin-top: 10px; }
.row.paste input { flex: 1; min-width: 200px; }
.row.end { justify-content: flex-end; margin-top: 14px; }
.result { padding: 14px; border-radius: 10px; }
.result.ok { background: var(--green-bg); color: var(--green); }
.result.bad { background: var(--red-bg); color: var(--red); }
.result p { margin: 4px 0 0; color: var(--text); }

/* Account panel */
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.panel-head p { margin: 2px 0 0; font-size: 12px; }
.who { display: flex; gap: 12px; align-items: center; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--accent); color: var(--accent); font-weight: 700; }
.pager { display: flex; align-items: center; gap: 6px; margin-right: 6px; font-size: 12px; }
.tab-bar { display: flex; align-items: center; min-width: 0; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; padding: 8px 14px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab-bar > .tabs { flex: 1; min-width: 0; border-bottom: 0; padding-right: 8px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab-bar > .tabs::-webkit-scrollbar { display: none; height: 0; }
.tab-nudge { display: flex; flex: none; align-items: center; gap: 4px; padding: 8px 12px 8px 0; }
.tabs button { font: inherit; line-height: 1; background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button.on { color: var(--accent); background: rgba(59, 130, 246, .12); }
.modal.panel > .notice { margin: 14px 20px 0; }
.panel-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.strip5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.strip5 > div { padding: 12px 14px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.strip5 > div:last-child { border-right: 0; }
.strip5 > div > span { display: flex; align-items: center; gap: 6px; height: 16px; font-size: 12px; line-height: 1; letter-spacing: .025em; text-transform: uppercase; color: var(--muted); }
.strip5 b { font-size: 18px; font-weight: 600; line-height: 1.15; }
.strip5 b span { display: inline; height: auto; font: inherit; letter-spacing: normal; text-transform: none; color: inherit; }
.strip5 small { color: var(--muted); font-size: 12px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip5 .shielded { background: var(--row-shielded); }
.strip5 .shielded b { color: var(--green); }
.strip5 .unshielded { background: var(--row-unshielded); }
.strip5 .unshielded b { color: var(--amber); }
.state-online { color: var(--green); }
.state-pending { color: var(--amber); }
.state-bad { color: var(--red); }
@media (max-width: 900px) { .strip5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .strip5 > div { border-bottom: 1px solid var(--border); } }
.res-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.res-strip div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; display: flex; gap: 8px; align-items: baseline; }
.res-strip span { font-size: 12px; line-height: 1; color: var(--muted); }
.res-strip b { line-height: 1; font-variant-numeric: tabular-nums; }
.cards3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1000px) { .cards3 { grid-template-columns: 1fr; } }
.empty-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: 130px; padding: 16px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); font-size: 13px; }
.empty-card b { color: var(--text); }
.empty-card.big { min-height: 320px; }
ul.marches { list-style: none; margin: 0; padding: 0; }
ul.marches li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
ul.marches li:last-child { border-bottom: 0; }
ul.marches small { display: block; }
.slot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--surface-2); font-size: 12px; color: var(--muted); flex: none; }
.shield-grid, .action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.tile:hover:not(:disabled) { border-color: var(--accent); }
.tile:disabled { opacity: .45; cursor: not-allowed; }
.tile small { color: var(--muted); font-size: 12px; }
@media (max-width: 560px) { .shield-grid, .action-grid { grid-template-columns: 1fr 1fr; } }
table.fleet tbody tr:hover { filter: brightness(1.15); }

/* ── Old-site layout: full width, section tabs, toolbar, dense list ─────── */
.page-body { max-width: none; padding: 18px 24px 32px; }
.sections { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.sections a { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; line-height: 1; white-space: nowrap; transition: background-color .12s ease, color .12s ease; }
.sections a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.sections a.active { color: var(--accent); background: rgba(59, 130, 246, .12); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.tb { display: inline-flex; align-items: center; gap: 6px; font: inherit; line-height: 1; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; white-space: nowrap; transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
.tb:hover:not(:disabled) { border-color: var(--accent); text-decoration: none; }
.tb:disabled { opacity: .45; cursor: not-allowed; }
.tb.start { background: var(--accent); border-color: transparent; color: #fff; }
.tb.stop, .tb.danger { color: var(--red); border-color: rgba(248, 113, 113, .45); }
.tb.accent { color: var(--accent); border-color: rgba(59, 130, 246, .55); }
.tb-sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 4px; }
.columns-menu { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 14px; margin: -6px 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.columns-menu label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.list-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.list-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; }
.list-head p { margin: 2px 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 280px; padding: 9px 12px; }
.filters select { padding: 9px 10px; }
.small { font-size: 12px; }
.list-card .table-wrap { box-shadow: none; max-height: calc(100vh - 330px); overflow: auto; }
table.fleet th { text-transform: uppercase; letter-spacing: .05em; font-size: 11px; line-height: 1; }
table.fleet td, table.fleet th { padding: 9px 10px; }
table.fleet th.num, table.fleet td.num { text-align: right; }
table.fleet th.col-account { padding-left: 29px; }
table.fleet td.col-igg { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
table.fleet th.cb, table.fleet td.cb { width: 34px; padding-right: 0; }
table.fleet tr.picked td { box-shadow: inset 0 0 0 9999px rgba(59, 130, 246, .08); }
table.fleet tr.opening td { box-shadow: inset 0 0 0 9999px rgba(59, 130, 246, .16); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.btn.danger { background: var(--red-bg); color: var(--red); border-color: rgba(248, 113, 113, .45); }
.field-label { display: block; font-size: 12px; color: var(--muted); margin: 6px 0; }
.field-label code { color: var(--text); }
.proxy-text { width: 100%; font: 13px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; resize: vertical; }
.list-card > .notice { margin-bottom: 10px; }
.notice .linklike { color: inherit; text-decoration: underline; padding: 0 0 0 8px; }
@media (max-width: 700px) { .page-body { padding: 12px 12px 24px; } .sections { padding: 8px 12px; } }

/* Selected accounts: combined resources (resources are not row columns) */
.selected-card { margin-top: 14px; }
.res-totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.res-totals div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.res-totals span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.res-totals b { font-size: 18px; font-variant-numeric: tabular-nums; }
.res-totals small { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.list-card .table-wrap { max-height: calc(100vh - 470px); min-height: 160px; }
/* Administration lists the whole customer table and the house proxies. Scroll the page, not a short inner box. */
.list-card:has(.operator-table) .table-wrap,
.list-card.house-proxies .table-wrap { max-height: none; min-height: 0; }

.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--muted); cursor: pointer; }

/* Settings tab */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form-grid select { padding: 8px 10px; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { width: 18px; height: 18px; accent-color: var(--green); }
.card.soon { opacity: .75; }
.card .notice { margin-top: 10px; }
.ok-text { color: var(--green); align-self: center; font-size: 13px; }
.bad-text { color: var(--red); align-self: center; font-size: 13px; }

/* Account tools stay in reach; only the selected section scrolls. */
[hidden] { display: none !important; }
.modal.panel { height: min(860px, calc(100dvh - 32px)); min-height: 0; overflow: hidden; }
.panel-head, .modal.panel > .tab-bar, .modal.panel > .notice { flex-shrink: 0; }
.panel-body { flex: 1; min-height: 0; overflow: auto; }
.settings-grid { grid-template-columns: minmax(0, 1fr); }
.tabs button, .subtabs button, .btn { min-height: 36px; transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
@media (prefers-reduced-motion: reduce) {
    .sections a, .tb, .tabs button, .subtabs button, .btn { transition: none; }
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.subtabs { display: flex; gap: 4px; overflow-x: auto; min-width: 0; }
.subtabs button { flex: none; padding: 7px 11px; background: none; color: var(--muted); border: 1px solid transparent; border-radius: 8px; font: inherit; cursor: pointer; white-space: nowrap; }
.subtabs button.on { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.folder-count { font-size: 11px; color: var(--muted); margin-left: 4px; }
.account-message-host { flex: 1; min-height: 0; display: flex; }
.messaging { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 0; min-height: 0; }
.messaging .card-head { margin: 0; }
.chat-log { flex: 1; overflow-y: auto; min-height: 140px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.chat-line { padding: 9px 12px; border-bottom: 1px solid var(--border); }
.chat-line:last-child { border-bottom: 0; }
.chat-line header, .mail-summary-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.chat-line time, .mail-summary time { flex: none; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-line p { margin: 3px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-compose { display: flex; align-items: end; gap: 8px; }
.chat-compose textarea { flex: 1; min-width: 0; resize: vertical; max-height: 140px; }
.messaging textarea, .messaging input:not([type=checkbox]):not([type=radio]) { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--bg); color: var(--text); }
.messaging .check input, .messaging .switch input { flex: none; }
.mail-toolbar { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.mail-toolbar > .btn { flex: none; }
.mail-split { display: grid; grid-template-columns: minmax(200px, 30%) minmax(0, 1fr); gap: 12px; flex: 1; min-height: 0; }
.mail-list { overflow-y: auto; min-height: 120px; border: 1px solid var(--border); border-radius: 10px; }
.mail-summary { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; width: 100%; background: var(--surface); border: 0; border-bottom: 1px solid var(--border); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.mail-summary.on { background: var(--surface-2); box-shadow: inset 3px 0 var(--accent); }
.mail-summary-head { width: 100%; }
.mail-summary b, .mail-subject { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mail-summary b { font-size: 12px; }
.mail-subject { max-width: 100%; align-self: flex-start; text-align: left; }
.mail-reader { padding: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: auto; }
.mail-reader h3 { margin-top: 12px; }
.mail-meta, .mail-progress, .message-feedback { color: var(--muted); font-size: 12px; }
.mail-meta { margin: 4px 0 16px; }
.mail-content { white-space: pre-wrap; overflow-wrap: anywhere; }
.mail-composer { overflow-y: auto; }
.mail-composer .message-label { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.mail-review { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 14px 0; }
.mail-review dt { color: var(--muted); }
.mail-review dd { margin: 0; overflow-wrap: anywhere; }
.message-feedback { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.care-workspace { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.care-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.care-workspace .card-head { margin-bottom: 0; }
.care-workspace > .card-head { margin: 0; }
.care-workspace input[type=number] { width: 100%; min-width: 0; padding: 8px 10px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.care-batch { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 18px; padding: 14px 0; }
.care-batch b { font-size: 18px; }
.care-batch span, .care-next span, .care-spending { color: var(--muted); font-size: 12px; }
.care-next { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.care-spending { margin-top: 12px; }
.care-troops { max-height: 280px; overflow-y: auto; margin-top: 12px; }
.care-review { border-color: var(--accent); }
.global-settings { width: min(780px, 100%); display: flex; flex-direction: column; gap: 14px; max-height: calc(100dvh - 48px); }
.global-settings .modal-head { flex: none; margin: 0; }
.global-settings h2 { margin: 0 0 4px; }
.global-body { overflow-y: auto; min-height: 0; }
.global-include { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 0 14px; border-bottom: 1px solid var(--border); }
.global-include .chip { margin-left: auto; }
.global-fields { border: 0; padding: 16px 0 0; margin: 0; min-width: 0; }
.global-fields:disabled { opacity: .55; }
.global-fields .switch { margin-bottom: 14px; }
.global-fields input[type=number] { width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); padding: 8px 10px; font: inherit; }
.global-footer { flex: none; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 12px; }
.global-accounts { margin-top: 14px; }
.global-accounts summary { cursor: pointer; padding: 8px 0; }
.global-accounts ul { max-height: 170px; overflow-y: auto; }
@media (max-width: 700px) {
    .overlay { padding: 8px; }
    .modal.panel { height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
    .panel-head { padding: 12px; gap: 8px; }
    .panel-head .actions { gap: 5px; }
    .panel-body { padding: 12px; }
    .mail-toolbar { align-items: stretch; flex-direction: column; }
    .mail-toolbar > .btn { align-self: flex-end; }
    .mail-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(100px, 32%) minmax(140px, 1fr); }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .care-cards { grid-template-columns: minmax(0, 1fr); }
    .tabs button, .subtabs button, .btn { min-height: 44px; }
}

/* Rally center */
.rally-list { display: flex; flex-direction: column; gap: 10px; }
.rally { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: 12px 14px; content-visibility: auto; contain-intrinsic-size: auto 220px; }
.rally.defence { border-color: rgba(248, 113, 113, .35); }
.rally.npc { border-color: rgba(167, 139, 250, .35); }
.rally header { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.rally header .chip { margin-right: 8px; }
.rally-meta { display: flex; gap: 14px; align-items: center; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.rally-meta b { color: var(--text); font-variant-numeric: tabular-nums; }
.bar { width: 140px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
ul.joiners { list-style: none; margin: 10px 0 0; padding: 0; }
ul.joiners li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
input.troops { width: 130px; padding: 5px 8px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }

/* Army & map tab */
.army-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.troop-table th { text-align: left; font-weight: 500; color: var(--muted); }
.troop-table td.muted { color: var(--muted); }

/* Guild management tab */
.guild-head { margin-bottom: 4px; }
.guild-head p { margin: 2px 0 0; }
.member-wrap { max-height: 420px; overflow: auto; box-shadow: none; }
.actions-cell { display: flex; gap: 6px; justify-content: flex-end; }
.card-head input[type=search] { max-width: 220px; padding: 5px 9px; }

.join-all { margin-top: 8px; }
.rally-join-dialog { width: min(780px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; gap: 14px; }
.rally-join-dialog .modal-head { margin: 0; flex: none; }
.rally-join-dialog h2 { margin: 0 0 4px; }
.rally-join-dialog .subtabs { flex-shrink: 0; overflow-y: hidden; scrollbar-width: thin; }
.rally-join-dialog .kv li { gap: 16px; }
.rally-join-dialog .kv li > span { flex: 0 0 38%; }
.rally-join-dialog .kv li > b { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.rally-dialog-body { overflow: auto; min-height: 0; }
.rally-dialog-body input[type=number] { width: 100%; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; }
.rally-type-options { display: flex; gap: 16px; flex-wrap: wrap; border: 0; margin: 16px 0 0; padding: 0; }
.rally-type-options legend { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.rally-type-options label { display: inline-flex; align-items: center; gap: 6px; }
.rally-custom-mix { min-width: 0; border: 0; padding: 0; margin: 14px 0 0; }
.rally-custom-mix legend { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.rally-mix-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.rally-mix-grid label { min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.rally-mix-grid input { width: 100%; min-width: 0; }
.rally-rule-toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rally-rule-toggle:last-of-type { margin-bottom: 16px; }
.rally-join-dialog .field-label { display: flex; flex-direction: column; gap: 6px; }
.rally-join-dialog > .field-label { width: min(280px, 100%); align-self: flex-start; }
.rally-join-dialog textarea { width: 100%; min-height: 90px; padding: 8px 10px; font: inherit; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.rally-account-tools { display: flex; gap: 8px; align-items: center; }
.rally-account-tools input { flex: 1; min-width: 80px; }
.rally-account-list { list-style: none; margin: 12px 0 0; padding: 0; max-height: 340px; overflow-y: auto; }
.rally-account-list li { padding: 9px 0; border-top: 1px solid var(--border); }
.rally-account-list label { display: flex; align-items: center; gap: 10px; }
.rally-account-list label span { margin-left: auto; }
@media (max-width: 700px) {
    ul.joiners li { gap: 8px; flex-wrap: wrap; }
    ul.joiners .grow { display: none; }
    ul.joiners li > .btn { margin-left: auto; }
    .rally-account-tools { flex-wrap: wrap; }
    .rally-account-tools input { flex-basis: 100%; }
    .rally-join-dialog { max-height: calc(100dvh - 16px); }
}

/* Monster hunting */
.big-number { font-size: 1.6rem; font-weight: 700; margin: .25rem 0 .5rem; }
.big-number .muted { font-size: .95rem; font-weight: 500; }
.hunt-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .25rem .75rem; }
.hunt-status { margin-bottom: .75rem; }
.hunt-settings { grid-column: 1 / -1; }
.fest-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .35rem 1rem; }
.fest-types label { display: flex; gap: .4rem; align-items: baseline; }

/* Copy settings: section checkboxes in two columns, one on phones. */
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; margin: 8px 0; }
@media (max-width: 520px) { .check-grid { grid-template-columns: 1fr; } }
/* Number, date and long-text fields in the bulk dialogs, the leaderboard and bank totals, styled like the other inputs. */
.bulk-actions-body input[type=number], .bulk-actions-body textarea, .list-card input[type=number], .bank-workspace input[type=date] { width: 100%; min-width: 0; max-width: 220px; padding: 8px 10px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.bulk-actions-body textarea { max-width: none; display: block; }
/* Global settings: Automation feature groups keep the expand arrow beside the group tick. */
.global-feature-group > summary { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.global-feature-group > summary label.check { display: inline-flex; margin: 0; }
.global-feature-group .check-grid { padding-left: 22px; }
.global-sections { margin-bottom: 8px; }
.method-icon.google { background: #fff; color: #4285f4; border: 1px solid var(--border); }
.cards3.overview-more { margin-top: 12px; }

/* Toolbar dropdown menus (ToolMenu.razor; owner 11-29 Prison Fill tools). */
.tb-menu { position: relative; display: inline-flex; }
.tb-caret { font-size: 10px; opacity: .7; margin-left: 2px; }
.tb-menu-backdrop { position: fixed; inset: 0; z-index: 40; }
.tb-menu-list { position: absolute; top: calc(100% + 4px); left: 0; z-index: 41; min-width: 230px; display: grid; padding: 4px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .35); }
.tb-menu-list button { display: grid; gap: 2px; text-align: left; font: inherit; padding: 8px 12px; border: 0; border-radius: 6px; background: none; color: var(--text); cursor: pointer; }
.tb-menu-list button:hover:not(:disabled), .tb-menu-list button:focus-visible { background: var(--surface-2); }
.tb-menu-list button:disabled { opacity: .5; cursor: not-allowed; }
.tb-menu-list button small { font-size: 11px; color: var(--muted); }
.tb-menu-list hr { border: 0; border-top: 1px solid var(--border); margin: 4px 6px; }

/* Prison Fill dashboard: filters, selection row, table. */
.prison-roster .prison-toolbar { margin: 10px 0 12px; }
.prison-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.prison-filters input[type=search] { flex: 1 1 200px; min-width: 160px; }
.prison-filters .prison-point { width: 170px; }
.prison-select-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.prison-select-row .chip { margin-left: auto; }
.prison-select-n { display: inline-flex; align-items: center; gap: 6px; }
.prison-select-n label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.prison-select-n input { width: 70px; }
.prison-table td, .prison-table th { white-space: nowrap; }
.prison-table th.num, .prison-table td.num { text-align: right; }
.prison-table tr.picked td { background: color-mix(in srgb, var(--accent) 8%, transparent); }
@media (max-width: 700px) {
    .tb-menu-list { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; }
    .prison-filters select, .prison-filters input { flex: 1 1 45%; }
    .prison-select-row .chip { margin-left: 0; }
}
.prison-select-n label { white-space: nowrap; }
.prison-filters .prison-point { flex: 0 0 190px; }
/* Prison Fill on phones: one card per account (labels from data-label), nothing wider than the screen. */
.prison-roster, .prison-roster .toolbar, .prison-filters { min-width: 0; max-width: 100%; }
@media (max-width: 700px) {
    .prison-roster .table-wrap { overflow: visible; }
    .prison-table, .prison-table tbody { display: block; width: 100%; }
    .prison-table thead { display: none; }
    .prison-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; padding: 10px; margin: 0 0 8px;
        border: 1px solid var(--border); border-radius: 10px; background: var(--surface); position: relative; }
    .prison-table td { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; min-width: 0; }
    .prison-table td::before { content: attr(data-label); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
    .prison-table td.num { text-align: left; }
    .prison-table td.roster-check { position: absolute; top: 6px; right: 6px; }
    .prison-table td.roster-check::before, .prison-table td[data-label="Account"]::before { content: none; }
    .prison-table td[data-label="Account"] { grid-column: 1 / -1; padding-right: 36px; font-size: 16px; }
    .prison-table td.roster-check input { width: 22px; height: 22px; }
    .prison-filters .prison-point { flex: 1 1 45%; }
}
.prison-setup.modal { max-height: calc(100vh - 40px); overflow-y: auto; }
.prison-setup .subtabs { margin-bottom: 10px; }
