/* Compact settings, using the existing Brahmastra palette and type scale.
   Fixed field columns do not stretch a short choice across an entire card. */
:is(.panel, .global-settings, .rally-join-dialog) .form-grid {
    --settings-control-height: 36px;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 240px));
    align-items: start;
    justify-content: start;
    gap: 12px 20px;
    max-width: 760px;
    margin-block: 12px;
}
:is(.panel, .global-settings, .rally-join-dialog) .form-grid > label:not(.check):not(.switch) {
    display: grid;
    grid-template-rows: 2.75em var(--settings-control-height) auto;
    align-content: start;
    align-items: start;
    gap: 5px;
    min-width: 0;
    line-height: 1.35;
}
:is(.panel, .global-settings, .rally-join-dialog) .form-grid > label > :where(input:not([type=checkbox]):not([type=radio]), select) {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 240px;
    height: var(--settings-control-height);
    min-height: var(--settings-control-height);
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    line-height: 1.25;
}
:is(.panel, .global-settings, .rally-join-dialog) .form-grid > label > select {
    width: fit-content;
    min-width: min(140px, 100%);
    max-width: min(240px, 100%);
    justify-self: start;
    padding-right: 24px;
}
:is(.panel, .global-settings, .rally-join-dialog) .form-grid > label > .small { font-size: 12px; line-height: 1.4; font-weight: 400; }
.panel .check { align-items: start; gap: 8px; line-height: 1.45; }
.panel .check input[type=checkbox] { flex: none; margin-top: 3px; }
.settings-workspace { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.settings-workspace > .card-head { margin-bottom: 0; }
.settings-section-tabs { flex-flow: row wrap; gap: 4px; overflow: visible; margin: 0; }
.settings-section-tabs button { min-height: 36px; padding: 7px 11px; font-size: 13px; }
.settings-page { min-width: 0; }
.settings-page > .form-grid:first-child { margin-top: 0; }
.settings-save {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    position: sticky;
    bottom: -1px;
    padding: 12px 0 2px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    z-index: 1;
}
.settings-save .btn { min-height: 36px; }
.settings-page .rally-type-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
    gap: 6px 14px;
    max-width: 760px;
    min-inline-size: 0;
    margin-top: 12px;
}
.settings-page .rally-type-options legend { font-size: 13px; font-weight: 600; }
.settings-page .rally-type-options label { min-height: 30px; }
.training-order { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.training-order .order-actions { display: flex; gap: 10px; align-items: center; grid-column: 1 / -1; }
@media (max-width: 700px) {
    :is(.panel, .global-settings, .rally-join-dialog) .form-grid { grid-template-columns: minmax(0, 240px); gap: 12px; }
    :is(.panel, .global-settings, .rally-join-dialog) .form-grid > label:not(.check):not(.switch) { grid-template-rows: auto var(--settings-control-height) auto; }
    .settings-section-tabs button { min-height: 40px; }
    .settings-save { bottom: -1px; }
}

/* Protection: what protects the account now, a dot per section (green = on), and switched-off sections greyed. */
.protect-live { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.protect-live .pl { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; color: var(--muted); background: var(--surface-2); }
.protect-live .pl b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.protect-live .pl.on { border-color: var(--green); }
.protect-live .pl.on b { color: var(--green); }
.protection-tabs button { display: inline-flex; align-items: center; gap: 7px; }
.sec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: none; }
.sec-dot.is-on { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.panel .is-off .form-grid, .panel .form-grid.is-off, .panel .card.is-off .form-grid { opacity: .45; }
.panel .card.hunt-settings.is-off .settings-fields { opacity: .45; }

/* Three tab levels that look different at a glance.
   1. Section tabs (account window): bold, active one underlined in the accent colour, firm line under the bar.
   2. Sub-tabs (inside a section): a segmented control - a shaded tray, the active choice raised.
   3. Third level (Automation pages): light underline style, set apart by space under the sub-tabs. */
.modal.panel > .tab-bar { border-bottom: 2px solid var(--border); }
.panel .tab-bar .tabs button { font-weight: 700; font-size: 15px; color: var(--muted); border-radius: 8px 8px 0 0; padding-bottom: 11px; }
.panel .tab-bar .tabs button:hover { color: var(--text); }
.panel .tab-bar .tabs button.on { color: var(--text); background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 0 -3px 0 var(--accent); }

.modal .subtabs { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; gap: 2px; padding: 4px; margin: 2px 0 14px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.modal .subtabs button { font-weight: 650; font-size: 13.5px; color: var(--muted); border: 1px solid transparent; border-radius: 7px; padding: 7px 12px; min-height: 34px; }
.modal .subtabs button:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.modal .subtabs button.on { color: var(--text); background: var(--surface); border-color: var(--border); box-shadow: 0 1px 3px rgba(0, 0, 0, .28); }

/* Automation: categories are level 2 (the tray above); pages are level 3. */
.modal .subtabs.automation-pages { background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 0; gap: 4px; margin: 4px 0 14px; width: 100%; }
.modal .subtabs.automation-pages button { font-weight: 500; border: 0; border-radius: 0; background: none; box-shadow: none; padding: 8px 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.modal .subtabs.automation-pages button.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); background: none; box-shadow: none; }

/* Healing bank: labelled groups with a hairline between them */
.bank-group { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 14px; }
.bank-group h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 8px; }
.bank-group .prefix-input { max-width: 6ch; text-align: center; }
.bank-group .form-grid.bank-backup { grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; margin-bottom: 8px; }

/* Inventory: category buttons with counts, expandable pack sizes */
.bag-categories { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.bag-categories button { border: 1px solid var(--border); background: transparent; color: inherit; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.bag-categories button.on { background: var(--accent, #3b82f6); border-color: transparent; color: #fff; font-weight: 600; }
.bag-categories .count { opacity: .7; font-size: 12px; margin-left: 4px; }
.bag-parts summary { cursor: pointer; }
.bag-parts ul { list-style: none; margin: 6px 0 2px; padding: 0 0 0 14px; display: grid; gap: 2px; }
.bag-parts li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); max-width: 360px; }

/* Guild: player chips (chat-command senders) and the whitelist */
.player-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.player-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px; }
.player-chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 4px; }
.player-chip button:hover { color: var(--red, #ef4444); }
.player-add { display: flex; gap: 8px; align-items: center; max-width: 420px; }
.player-add input { flex: 1; min-width: 0; }
.whitelist-switches { display: grid; gap: 4px; margin: 8px 0 12px; }
.whitelist-table input, .whitelist-table select { width: 100%; min-width: 0; }
.apps-nudge { display: block; width: 100%; text-align: left; cursor: pointer; margin: 0 0 12px; font: inherit; }
