/* ==========================================================================
   Appeal Portal — Admin Theme
   Inherits design tokens from the public theme. Adds sidebar layout, forms,
   tables, and buttons.
   ========================================================================== */

body.lx-admin {
    display: flex;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    max-width: none;
}

/* ---------------------------------------------------------------- sidebar */
.lx-side {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.lx-side-brand {
    padding: var(--space-5) var(--space-5) var(--space-4);
}
.lx-side-brand strong { display: block; font-size: 16px; font-weight: 700; }
.lx-side-brand small  { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.lx-side-brand .lx-side-logo {
    display: block;
    max-width: 160px;
    max-height: 32px;
    width: auto;
    height: auto;
    margin-bottom: 8px;
}

.lx-side nav { flex: 1; padding: 0 var(--space-3); }
.lx-side nav ul { list-style: none; margin: 0; padding: 0; }
.lx-side nav li { margin: 2px 0; }
.lx-side nav a {
    display: block;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
}
.lx-side nav a:hover { background: var(--surface-2); color: var(--text); }
.lx-side nav li.is-on a { background: var(--surface-2); color: var(--text); }

.lx-side-foot {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border);
}
.lx-side-user strong { display: block; font-size: 13px; }
.lx-side-user small  { color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.lx-side-logout {
    display: inline-block;
    margin-top: var(--space-2);
    font-size: 12px;
    color: var(--text-muted);
}
.lx-side-logout:hover { color: var(--text); }

/* ---------------------------------------------------------------- main */
.lx-main {
    flex: 1;
    min-width: 0;
    padding: var(--space-5) var(--space-6);
    max-width: 1000px;
}
.lx-main-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}
.lx-main-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.lx-main-public { color: var(--text-dim); font-size: 13px; }
.lx-main-public:hover { color: var(--text); }
.lx-main-foot {
    margin-top: var(--space-7);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

h2.lx-h2 {
    margin: var(--space-6) 0 var(--space-3);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* ---------------------------------------------------------------- notice */
.lx-notice {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    margin-bottom: var(--space-4);
}
.lx-notice-ok  { color: var(--status-up); }
.lx-notice-err { color: var(--status-outage); }

/* ---------------------------------------------------------------- toolbar */
.lx-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.lx-toolbar-meta { color: var(--text-dim); font-size: 12px; }

/* ---------------------------------------------------------------- cards (dashboard) */
.lx-grid          { display: grid; gap: var(--space-3); }
.lx-grid-3        { grid-template-columns: repeat(3, 1fr); }

.lx-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4) var(--space-5);
}
.lx-card-label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.lx-card-num   { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- tables */
.lx-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 13px;
}
.lx-table th,
.lx-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.lx-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--surface-2);
}
.lx-table tr:last-child td { border-bottom: none; }
.lx-table tr:hover td      { background: var(--surface-2); }

.lx-table-kv th { width: 40%; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 13px; }

.lx-truncate {
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.lx-row-actions a { color: var(--text-muted); font-size: 12px; }
.lx-row-actions a:hover { color: var(--text); }

.lx-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--text-muted); }

.lx-tag {
    display: inline-block;
    padding: 1px 8px;
    background: var(--surface-2);
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.lx-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}
.lx-status-pill .sd {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--status-unknown);
}
.lx-status-pill[data-key="operational"] .sd { background: var(--status-up); }
.lx-status-pill[data-key="degraded"]    .sd { background: var(--status-degraded); }
.lx-status-pill[data-key="outage"]      .sd { background: var(--status-outage); }

/* ---------------------------------------------------------------- forms */
.lx-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-5) var(--space-4);
}
.lx-form fieldset {
    border: none;
    border-top: 1px solid var(--border);
    padding: var(--space-4) 0;
    margin: 0;
}
.lx-form fieldset:first-of-type { border-top: none; padding-top: var(--space-3); }
.lx-form legend {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    padding: 0;
    margin-bottom: var(--space-3);
}
.lx-form label {
    display: block;
    margin-bottom: var(--space-3);
}
.lx-form label > span {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
}
.lx-form label > span small {
    color: var(--text-dim);
    font-weight: 400;
    margin-left: 4px;
}
.lx-form input[type="text"],
.lx-form input[type="number"],
.lx-form input[type="password"],
.lx-form input:not([type]),
.lx-form select,
.lx-form textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--text);
    font: inherit;
    font-size: 13px;
}
.lx-form input:focus,
.lx-form select:focus,
.lx-form textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.lx-form .help {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-dim);
}
.lx-form .help code {
    background: var(--surface-2);
    padding: 1px 4px;
    border-radius: 3px;
    color: var(--text-muted);
}
.lx-form .err {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--status-outage);
    font-style: normal;
}
.lx-form .lx-check {
    display: flex;
    align-items: center;
    gap: 8px;
}
.lx-form .lx-check input {
    width: auto;
}
.lx-form .lx-check span {
    margin: 0;
    font-weight: 400;
    font-size: 13px;
}

.lx-form-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------- buttons */
.lx-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}
.lx-btn:hover { background: var(--bg); }
.lx-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0a0b;
    font-weight: 600;
}
.lx-btn-primary:hover { background: #1fb98a; border-color: #1fb98a; }
.lx-btn-ghost { background: transparent; }
.lx-btn-danger {
    background: transparent;
    color: var(--status-outage);
    border-color: transparent;
    margin-right: auto;
}
.lx-btn-danger:hover { background: var(--surface-2); }

.lx-empty {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: var(--space-7);
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.lx-token {
    display: block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--accent);
    word-break: break-all;
    margin-bottom: var(--space-2);
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 768px) {
    body.lx-admin { flex-direction: column; }
    .lx-side {
        position: static;
        width: auto;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .lx-side nav ul { display: flex; flex-wrap: wrap; }
    .lx-side-foot { display: flex; justify-content: space-between; align-items: center; }
    .lx-main { padding: var(--space-4); max-width: none; }
    .lx-grid-3 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- tabs */
.lx-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* old Edge / IE */
}
.lx-tabs::-webkit-scrollbar {
    display: none;                /* Chrome / Safari */
}
.lx-tabs a {
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.lx-tabs a:hover { color: var(--text); }
.lx-tabs a.is-on {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------- branding upload */
.lx-brand-row {
    display: flex;
    gap: var(--space-5);
    align-items: flex-start;
}
.lx-brand-preview {
    width: 200px;
    flex-shrink: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lx-brand-preview img {
    max-width: 100%;
    max-height: 80px;
    display: block;
}
.lx-brand-preview-sm {
    width: 100px;
    min-height: 100px;
}
.lx-brand-preview-sm img {
    max-height: 64px;
    max-width: 64px;
}
.lx-brand-empty {
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.lx-brand-controls {
    flex: 1;
    min-width: 0;
}
.lx-form input[type="file"] {
    width: 100%;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.lx-form input[type="file"]::file-selector-button {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    margin-right: var(--space-3);
    cursor: pointer;
}
.lx-form input[type="file"]::file-selector-button:hover {
    background: var(--bg);
}

@media (max-width: 600px) {
    .lx-brand-row { flex-direction: column; }
    .lx-brand-preview { width: 100%; }
}

/* ---------------------------------------------------------------- radios */
.lx-radio-group {
    display: block;
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}
.lx-radio-group > span:first-child {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
}
.lx-radio-options {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}
.lx-radio {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 0 !important;
    cursor: pointer;
    font-size: 13px;
}
.lx-radio:has(input:checked) {
    border-color: var(--accent);
}
.lx-radio input {
    width: auto !important;
    margin: 0;
    accent-color: var(--accent);
}
.lx-radio span {
    margin: 0 !important;
    font-weight: 500;
}
.lx-radio span small {
    color: var(--text-dim);
    font-weight: 400;
    margin-left: 4px;
}

/* ---------------------------------------------------------------- multi-select for monitor picker */
.lx-multiselect {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 16px;
    max-height: 320px;
    overflow-y: auto;
    padding: var(--space-3);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.lx-multiselect .lx-check {
    margin: 0;
    padding: 4px 0;
}
.lx-multiselect .lx-check span {
    font-size: 13px;
    font-weight: 400;
}
.lx-multiselect .lx-check small {
    color: var(--text-dim);
    margin-left: 4px;
}

/* ---------------------------------------------------------------- status / impact tag accents (admin tables) */
.lx-tag.lx-status-investigating { color: #e44b4b; }
.lx-tag.lx-status-identified    { color: #f5a623; }
.lx-tag.lx-status-monitoring    { color: #5b8def; }
.lx-tag.lx-status-resolved      { color: #29cd96; }
.lx-tag.lx-impact-none     { color: var(--text-dim); }
.lx-tag.lx-impact-minor    { color: #f5a623; }
.lx-tag.lx-impact-major    { color: #e44b4b; }
.lx-tag.lx-impact-critical { color: #e44b4b; }

/* ---------------------------------------------------------------- admin timeline (shared structure with public) */
.lx-timeline {
    list-style: none;
    margin: var(--space-3) 0 0;
    padding: 0;
    border-left: 2px solid var(--border);
}
.lx-timeline li {
    position: relative;
    padding: 0 0 var(--space-3) var(--space-4);
}
.lx-timeline li::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
}
.lx-timeline-head {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.lx-timeline-ts { font-variant-numeric: tabular-nums; }
.lx-timeline-by { color: var(--text-dim); }
.lx-timeline-body {
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}

/* ---------------------------------------------------------------- inline link-button (for table actions) */
.lx-link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.lx-link-btn:hover {
    color: var(--text);
    text-decoration: underline;
}

/* ---------------------------------------------------------------- notification queue status tags */
.lx-tag.lx-status-pending { color: var(--text-muted); }
.lx-tag.lx-status-sent    { color: var(--status-up); }
.lx-tag.lx-status-failed  { color: var(--status-outage); }

/* ---------------------------------------------------------------- tier tags */
.lx-tag.lx-tier-admin  { color: var(--status-up); }
.lx-tag.lx-tier-staff  { color: var(--status-maintenance, #5b8def); }
.lx-tag.lx-tier-viewer { color: var(--text-dim); }

/* --------------------------------------------------------------------------
   Install wizard
   -------------------------------------------------------------------------- */
.lx-install-steps {
    display: flex;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
    margin: var(--space-4) 0 var(--space-5);
    counter-reset: step;
}
.lx-install-steps li {
    flex: 1;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    counter-increment: step;
}
.lx-install-steps li::before { content: counter(step) '. '; opacity: 0.6; }
.lx-install-steps li.is-active { color: var(--text); border-color: var(--accent); }
.lx-install-steps li.is-done   { color: var(--accent); border-color: var(--border); }
.lx-install-steps li.is-done::before { content: '\2713 '; }

/* --------------------------------------------------------------------------
   License banner (admin)
   -------------------------------------------------------------------------- */
.lx-license-banner {
    margin: 0 0 var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
}
.lx-license-banner[data-state="invalid"] {
    border-color: var(--status-outage);
    background: rgba(228, 75, 75, 0.06);
}
.lx-license-banner[data-state="offline"] {
    border-color: var(--status-degraded);
    background: rgba(245, 166, 35, 0.06);
}
.lx-license-banner strong { margin-right: var(--space-2); }
.lx-license-banner a { margin-left: var(--space-3); color: var(--accent); }


/* --------------------------------------------------------------------------
   License tab — status header + detail grid
   -------------------------------------------------------------------------- */
.lx-license-status {
    margin: 0 0 var(--space-4);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.lx-license-status[data-state="ok"]   { border-left-color: var(--status-up); }
.lx-license-status[data-state="warn"] { border-left-color: var(--status-degraded); }
.lx-license-status[data-state="bad"]  { border-left-color: var(--status-outage); }

.lx-license-status__head { display: flex; align-items: center; gap: var(--space-3); }
.lx-license-status__head .lab { margin: 0 0 2px; }
.lx-license-status__head h2 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.2; }

.lx-license-status__dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--status-unknown);
    box-shadow: 0 0 0 4px rgba(255,255,255,0.03);
}
.lx-license-status[data-state="ok"]   .lx-license-status__dot { background: var(--status-up); }
.lx-license-status[data-state="warn"] .lx-license-status__dot { background: var(--status-degraded); }
.lx-license-status[data-state="bad"]  .lx-license-status__dot { background: var(--status-outage); }

.lx-license-status__msg {
    margin: var(--space-3) 0 0;
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.55;
}
.lx-license-status__meta {
    margin-top: var(--space-3);
    font-size: 12px;
    color: var(--text-muted);
}
.lx-license-status__meta code {
    background: rgba(255,255,255,0.04);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text);
}

.lx-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-3) var(--space-5);
    margin: 0;
    padding: 0;
}
.lx-detail-grid > div { display: flex; flex-direction: column; gap: 4px; }
.lx-detail-grid .lab { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.lx-detail-grid strong { font-weight: 500; font-size: 14px; color: var(--text); word-break: break-word; }
.lx-detail-grid code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--text); }


/* License tab — info card wrapper. Gives the read-only sections a card
   surface distinct from the update form below. The existing .lx-form
   fieldset rules already handle the internal "border-top + uppercase
   legend" separator between License details and Install details. */
.lx-license-info {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 var(--space-5);
    margin: 0 0 var(--space-5);
    background: var(--surface-2);
}
.lx-license-info > fieldset:first-of-type { padding-top: var(--space-4) !important; }


/* --------------------------------------------------------------------------
   Admin -> Agents page
   -------------------------------------------------------------------------- */
.lx-page-intro {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.55;
    margin: 0 0 var(--space-5);
    max-width: 760px;
}

.lx-agents-grid {
    display: grid;
    gap: var(--space-4);
}

.lx-agent-card {
    --agent-accent: var(--accent);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
    padding-left: calc(var(--space-5) + 3px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 150ms ease, transform 150ms ease;
}

/* Thin accent strip on the left edge in the game brand color.
   Single-side -- matches the existing visual language elsewhere. */
.lx-agent-card::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--agent-accent);
}

.lx-agent-card:hover {
    border-color: var(--text-dim);
    transform: translateY(-1px);
}

/* Game icon -- top-right, large, low-contrast. Acts as decoration rather
   than competing with the title. */
.lx-agent-card__icon {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 28px;
    height: 28px;
    color: var(--agent-accent);
    opacity: 0.65;
    transition: opacity 150ms ease;
}
.lx-agent-card__icon svg { width: 100%; height: 100%; display: block; }
.lx-agent-card:hover .lx-agent-card__icon { opacity: 1; }

.lx-agent-card__head { display: flex; flex-direction: column; gap: 4px; padding-right: 40px; }

.lx-agent-card__game {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--agent-accent);
}

.lx-agent-card__title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.lx-agent-card__version {
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.lx-agent-card__desc {
    margin: 0;
    color: var(--text-dim);
    font-size: 13px;
    line-height: 1.6;
    flex: 1;
}

.lx-agent-card__foot {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    padding-top: var(--space-4);
    margin-top: var(--space-2);
    border-top: 1px solid var(--border);
}

.lx-agent-card__download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Per-game accent colors. Sourced from each platform's primary brand hue. */
.lx-agent-card--fivem     { --agent-accent: #f4001e; }
.lx-agent-card--minecraft { --agent-accent: #6ab04c; }
.lx-agent-card--rust      { --agent-accent: #ce422b; }
.lx-agent-card--discord-js { --agent-accent: #5865f2; }
.lx-agent-card--discord-py { --agent-accent: #5865f2; }
/* .lx-agent-card--generic falls through to var(--accent) by default */

/* --------------------------------------------------------------------------
   Wide-page override. Opt-in per page via $bodyClass = 'lx-page-wide'.
   Used by pages like Agents that benefit from a wider canvas (multi-col grids)
   while leaving the rest of admin at its comfortable 1000px reading width.
   -------------------------------------------------------------------------- */
body.lx-page-wide .lx-main { max-width: 1400px; }

/* Use auto-fit so the grid collapses to actual content when there are
   only a couple of items, instead of stretching each card to half the
   row. Pair with a max-width on each card so they keep a sensible size
   when there's lots of horizontal room. */
/* Agents page on wide layout: 3 columns by default (gives each card
   enough breathing room for the description), bumps to 4 on properly
   wide viewports, steps down on tablet and mobile. */
body.lx-page-wide .lx-agents-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (min-width: 1500px) {
    body.lx-page-wide .lx-agents-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
@media (max-width: 900px) {
    body.lx-page-wide .lx-agents-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 600px) {
    body.lx-page-wide .lx-agents-grid {
        grid-template-columns: 1fr;
    }
}

/* Image icon: bigger surface than the SVG fallback, no tinting -- the
   hosted image owns its colors. Slight border so transparent PNGs land
   on a contained surface even when the host bg matches. */
.lx-agent-card__icon--img {
    width: 44px;
    height: 44px;
    opacity: 1;
    color: inherit;
}
.lx-agent-card__icon--img img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    border-radius: var(--radius-sm);
}
.lx-agent-card:hover .lx-agent-card__icon--img { opacity: 1; }

/* Push the card content over a touch further when an image icon is in
   the corner -- it's bigger than the SVG fallback so the title needs
   more right-padding to clear it. */
.lx-agent-card:has(.lx-agent-card__icon--img) .lx-agent-card__head {
    padding-right: 60px;
}


/* --------------------------------------------------------------------------
   New / Edit monitor form -- type-card picker + sectioned layout
   -------------------------------------------------------------------------- */
.lx-step-label {
    display: block;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 var(--space-3);
    font-weight: 600;
}

.lx-type-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-2);
    margin: 0 0 var(--space-5);
}
@media (max-width: 1100px) { .lx-type-cards { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .lx-type-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 450px)  { .lx-type-cards { grid-template-columns: 1fr; } }

.lx-type-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: left;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    transition: border-color 120ms ease, transform 120ms ease;
}
.lx-type-card:hover  { border-color: var(--text-dim); transform: translateY(-1px); }
.lx-type-card.is-on  { border-color: var(--accent); }
.lx-type-card__ic {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
    transition: color 120ms ease;
}
.lx-type-card.is-on .lx-type-card__ic { color: var(--accent); }
.lx-type-card__nm   { display: block; font-size: 13px; font-weight: 600; }
.lx-type-card__desc { display: block; font-size: 11px; color: var(--text-muted); line-height: 1.4; }

/* Sectioned form layout. Each fieldset is a self-contained card so the
   user can see the conceptual grouping at a glance. */
.lx-monitor-form .lx-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-4) var(--space-5);
    margin: 0 0 var(--space-3);
}
.lx-monitor-form .lx-section legend {
    padding: 0;
    margin: 0 0 2px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.lx-monitor-form .lx-section-sub {
    margin: 0 0 var(--space-4);
    font-size: 12px;
    color: var(--text-muted);
}

/* Two-column field grid inside a section. */
.lx-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-4);
}
.lx-form-grid > .span-2 { grid-column: span 2; }
@media (max-width: 700px) {
    .lx-form-grid { grid-template-columns: 1fr; }
    .lx-form-grid > .span-2 { grid-column: span 1; }
}

/* Push-token field with inline copy button. */
.lx-pushtoken { display: flex; gap: var(--space-2); align-items: stretch; }
.lx-pushtoken input {
    flex: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    color: var(--accent);
}
.lx-copy-btn {
    padding: 0 var(--space-3);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: color 120ms ease, border-color 120ms ease;
}
.lx-copy-btn:hover { color: var(--text); border-color: var(--text-dim); }

/* Toggle row -- checkbox + label inline. */
.lx-monitor-form .lx-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    cursor: pointer;
    color: var(--text);
    font-size: 13px;
}
.lx-monitor-form .lx-toggle input[type="checkbox"] { width: auto; margin: 0; }
.lx-monitor-form .lx-toggle small { color: var(--text-muted); margin-left: var(--space-2); }

/* The label inside a grid cell -- consistent label / input spacing. */
.lx-form-grid label .lbl,
.lx-monitor-form label > .lbl {
    display: block;
    font-size: 12px;
    color: var(--text);
    margin-bottom: 6px;
    font-weight: 500;
}
.lx-form-grid label .lbl small,
.lx-monitor-form label > .lbl small {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: var(--space-2);
}

/* Restore the HTML 'hidden' attribute. The .lx-form .help rule above
   sets display:block, which overrides [hidden]'s default display:none.
   Force hidden elements to stay hidden across the admin form. */
.lx-form [hidden] { display: none !important; }

/* Help text inside the new monitor form is too small to read at the
   default 11px. Bump it up and lift the contrast a notch so it stops
   reading like an ignorable footnote. */
.lx-monitor-form .help,
.lx-monitor-form .lx-target-help {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-muted);
}

/* The Target-field help is the most important hint on the page --
   it teaches the user how to format the value for whichever type they
   just picked. Give it a touch more presence. */
.lx-monitor-form .lx-target-help {
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    color: var(--text);
}

/* Section sub-text -- the short explanation under each section legend --
   was also too small. Same treatment. */
.lx-monitor-form .lx-section-sub {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-muted);
}

/* Small-print inside label captions (e.g. 'optional', 'seconds') is
   ALSO a hint, just compact -- bump it too so it doesn't disappear. */
.lx-monitor-form .lbl small {
    font-size: 12px;
}

/* Wider layout: the monitor form gets 3 columns when there's room.
   span-2 and span-3 helpers let individual fields claim more horizontal
   space when they need it (Name, Description). */
@media (min-width: 1100px) {
    body.lx-page-wide .lx-monitor-form .lx-form-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    body.lx-page-wide .lx-monitor-form .lx-form-grid > .span-3 { grid-column: span 3; }
}

/* Advanced settings: fields tagged .lx-adv are hidden by default and
   revealed by JS adding .is-revealed when the user ticks the
   'Show advanced settings' toggle. Keeps the form dead simple for
   non-technical users while leaving the power-user controls one click
   away. */
.lx-monitor-form .lx-adv { display: none; }
.lx-monitor-form .lx-adv.is-revealed { display: block; }
.lx-monitor-form fieldset.lx-adv.is-revealed { display: block; }

/* The toggle itself sits between the form sections and the buttons,
   with a subtle separator above it. */
.lx-adv-toggle-row {
    padding: var(--space-3) 0;
    margin: var(--space-3) 0;
    border-top: 1px dashed var(--border);
}
.lx-adv-toggle {
    color: var(--text-muted);
}
.lx-adv-toggle small {
    display: block;
    margin-top: 2px;
    margin-left: 24px;
    font-size: 12px;
    color: var(--text-dim);
}

/* Destructive action button -- subdued at rest so it doesn't fight the
   primary action for attention; warms up on hover so the user gets a
   clear 'this is the dangerous one' cue right before they click. */
.lx-btn-danger {
    color: var(--status-outage);
    border-color: var(--border);
    background: transparent;
}
.lx-btn-danger:hover {
    color: #fff;
    background: var(--status-outage);
    border-color: var(--status-outage);
}

/* Push the cancel + primary actions to the right while keeping the
   destructive action on the left. */
.lx-form-actions-spacer { flex: 1; }

/* --------------------------------------------------------------------------
   Admin -> Cron jobs page
   -------------------------------------------------------------------------- */
.lx-cron-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: var(--space-4) 0;
}
.lx-cron-table th,
.lx-cron-table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    font-size: 13px;
}
.lx-cron-table tbody tr:last-child td { border-bottom: none; }
.lx-cron-table th {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface-2);
    font-weight: 600;
}
.lx-cron-name {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 4px;
}
.lx-cron-desc {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    max-width: 520px;
}
.lx-cron-sched {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: var(--text-muted);
}
.lx-cron-stamp {
    margin-top: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    color: var(--text-dim);
}

/* Status badge -- colored solid for healthy, muted for the rest so
   problem states draw the eye without being noisy. */
.lx-cron-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 600;
    border: 1px solid var(--border);
}
.lx-cron-badge--healthy { color: var(--status-up);       border-color: var(--status-up); }
.lx-cron-badge--lagging { color: var(--status-degraded); border-color: var(--status-degraded); }
.lx-cron-badge--pending { color: var(--status-degraded); border-color: var(--status-degraded); }
.lx-cron-badge--stale,
.lx-cron-badge--never   { color: var(--status-outage);   border-color: var(--status-outage); }

/* Collapsible help block at the bottom of the page. */
.lx-cron-help {
    margin-top: var(--space-5);
    padding: var(--space-4) var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.lx-cron-help summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
}
.lx-cron-help p {
    margin: var(--space-3) 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.55;
}
.lx-cron-crontab {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
    margin: var(--space-3) 0;
}

/* Inline action button on the cron page. Borderless, subdued, hover
   colour-shifts to the accent so it reads as a clickable utility action
   rather than a primary CTA. */
.lx-btn-link {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: color 0.12s ease, background 0.12s ease;
}
.lx-btn-link:hover {
    color: var(--accent);
    background: var(--surface-2);
}
.lx-cron-actions { text-align: right; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Drag-and-drop monitor reorder (admin monitors list)
   -------------------------------------------------------------------------- */
.lx-table-hint {
    color: var(--text-muted);
    font-size: 12px;
    margin: var(--space-3) 0 var(--space-2);
}
.lx-table-sortable .lx-drag-col { width: 32px; }
.lx-table-sortable tr[draggable="true"] { cursor: grab; }
.lx-table-sortable tr.is-dragging {
    opacity: 0.4;
    cursor: grabbing;
}
.lx-drag-handle {
    width: 32px;
    color: var(--text-dim);
    font-size: 14px;
    text-align: center;
    user-select: none;
    cursor: grab;
}
.lx-drag-handle:hover { color: var(--text); }
.lx-table-sortable tr:hover .lx-drag-handle { color: var(--text); }

/* --------------------------------------------------------------------------
   Per-group monitor list -- one table per group, header on top
   -------------------------------------------------------------------------- */
.lx-monitor-group {
    margin-top: var(--space-5);
}
.lx-monitor-group:first-of-type {
    margin-top: var(--space-4);
}
.lx-monitor-group-title {
    margin: 0 0 var(--space-3);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.lx-monitor-group-untitled {
    color: var(--text-dim);
    font-style: italic;
    text-transform: none;
    letter-spacing: 0;
}
.lx-monitor-group-count {
    display: inline-block;
    padding: 1px 8px;
    background: var(--surface-2);
    border-radius: 999px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0;
}
