/* ── Settings: tool pricing and cost settings (revamp F1, F2, F5) ───────────
   Tools are rows of the shared table; Edit opens the side form
   (dialog.css .dialog-side). Fields use the forms.css anatomy: label
   above, help and the error under the field. A save confirms with a quiet
   "Saved" mark, not a toast; a failure stays on screen and says what failed. */

.settings-layout { max-width: 1280px; }
.tool-key { margin-left: 4px; font-size: var(--fs-12); color: var(--text-3); }
#adminToolsError[hidden] { display: none; }

.settings-card { max-width: 640px; padding: 16px 20px; }
.settings-card-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.settings-card-head .section-title { margin: 0; }
.settings-form { display: grid; gap: var(--sp-4); }
.settings-form .control { max-width: 240px; }
.settings-actions { display: flex; gap: var(--sp-2); }
.mono-upper { font-family: var(--mono); text-transform: uppercase; }

/* F5: the saved mark. */
.save-mark { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-12); font-weight: 500; color: var(--success); }
.save-mark[hidden] { display: none; }
td .save-mark { margin-right: var(--sp-2); }

.unpriced-list { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.unpriced-list[hidden] { display: none; }

/* ── Settings > Operations and Audit (revamp finish) ─────────────────────────
   Cards for the controls and status (forms.css field anatomy, shared
   buttons), the hygiene counts as the shared strip, sessions, deliveries
   and the audit log as shared tables (table.css) with shared error states. */
.ops-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); align-items: start; }
.ops-card { display: grid; gap: var(--sp-3); padding: 16px 20px; min-width: 0; }
.ops-card .section-title { margin: 0; }
.ops-card .settings-form { gap: var(--sp-3); }
.ops-card .control.ops-num { max-width: 160px; }
.ops-card .field-checks .field-help { margin-left: 24px; }
.ops-card .settings-actions { flex-wrap: wrap; }
.ops-card .chart-canvas { width: 100%; }
#opsTimingsError[hidden], #opsSessionsError[hidden], #opsWebhooksError[hidden], #auditError[hidden] { display: none; }

/* System status: label, then value, on one line each. */
.ops-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--sp-4); margin: 0; font-size: var(--fs-13); }
.ops-facts dt { color: var(--text-3); }
.ops-facts dd { margin: 0; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Status lines with a shared mark (status.css .mk), never colour alone. */
.ops-status-body { display: grid; gap: 4px; font-size: var(--fs-13); color: var(--text-2); }
.ops-status-row { display: flex; align-items: baseline; gap: 8px; }
.ops-status-row .mk { transform: translateY(-1px); }
.ops-status-row .mk-warn { transform: translateY(-1px) rotate(45deg); }
.ops-status-row b { color: var(--text); font-weight: 600; }

.ops-muted { color: var(--text-3); }
.ops-this-session { font-size: var(--fs-12); color: var(--text-3); }

/* My sessions, in the account menu: a small table, no sorting. */
.my-sessions-list .dt td { height: 32px; max-width: 120px; font-size: var(--fs-12); }
.my-sessions-list .dt thead th { height: 28px; }
.my-sessions-list .field-help, .my-sessions-list .field-error { margin: 0; }

/* API tokens (Settings > Help and developers; static/lib/api-tokens.js):
   the create row, the access level (a preset or Custom, owner decision
   D13a), one scope choice per /api/v2 resource for Custom (W3), the expiry
   hint and the remaining lifetime in the list. Moved from app.css. */
.api-token-create-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: 8px; }
.api-token-create-row input:not([type="checkbox"]):not([type="radio"]) {
    flex: 1 1 100%; background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    min-height: var(--control-h); padding: 6px 10px; color: var(--text); font-size: var(--fs-13);
}
.api-token-levels { flex: 1 1 100%; display: grid; gap: 6px; min-width: 0; margin: 2px 0 0; padding: 0; border: 0; }
.api-token-legend { padding: 0; margin-bottom: 2px; font-size: var(--fs-12); font-weight: 600; color: var(--text-2); }
.api-token-level-choice { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-12); color: var(--text); cursor: pointer; }
.api-token-level-choice input { flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.api-token-level-choice > span { display: grid; gap: 1px; min-width: 0; }
.api-token-level-name { font-weight: 600; }
.api-token-level-choice .field-help { font-size: var(--fs-11); }
/* The "include cost data" tick under the presets (owner decision K9). */
.api-token-cost { display: flex; align-items: center; gap: var(--sp-2); margin-top: 2px; font-size: var(--fs-12); color: var(--text); cursor: pointer; }
.api-token-cost[hidden] { display: none; }
.api-token-cost input { flex: none; margin: 0; accent-color: var(--accent); }
.api-token-cost .field-help { font-size: var(--fs-11); }
.api-token-scopes { display: flex; flex-wrap: wrap; gap: var(--sp-2); flex: 1 1 auto; }
/* display: flex above beats the browser's [hidden] rule (Custom only). */
.api-token-scopes[hidden] { display: none; }
/* The key list: each key's level, then what it reaches in short words. */
.api-token-level { color: var(--text-2); font-weight: 600; }
.api-token-scope { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-2); }
.api-token-scope select {
    background: var(--surface); color: var(--text); font-size: var(--fs-12);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); min-height: var(--control-h); padding: 2px 6px;
}
/* This file loads after forms.css, so the shared focus border is restated
   (it used to win by coming later). */
.api-token-scope select:focus-visible { border-color: var(--focus); }
.api-token-hint { font-size: var(--fs-11); color: var(--text-3); margin-top: 6px; }
/* Remaining lifetime in the token list: amber inside the last 30 days. */
.token-expiry.is-expiring { color: var(--warn); font-weight: 600; }
.token-expiry.is-expired { color: var(--error); }
.token-reveal-expiry { font-size: var(--fs-11); color: var(--text-2); }

/* Settings > Armory: a saved value that no longer passes validation
   (static/lib/settings.js invalidStoredHtml). */
.set-warning { margin-top: 4px; font-size: var(--fs-12); font-weight: 500; color: var(--warn); }

@media (max-width: 1000px) { .ops-grid { grid-template-columns: minmax(0, 1fr); } }
