/* ============================================================
   EVL CMS — Master Console skin
   Same shell, same tokens, deliberately different register:
   violet accent instead of brand cyan, denser type, tables and
   flat panels instead of the soft cards the user CMS uses.
   ============================================================ */

:root {
    --ac-accent: #8b5cf6;          /* violet — operator surfaces */
    --ac-accent-strong: #7c3aed;
    --ac-accent-soft: rgba(139, 92, 246, 0.12);
    --ac-accent-line: rgba(139, 92, 246, 0.34);
    --ac-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
    --ac-accent: #a78bfa;
    --ac-accent-strong: #8b5cf6;
    --ac-accent-soft: rgba(167, 139, 250, 0.16);
    --ac-accent-line: rgba(167, 139, 250, 0.36);
}

/* ---------- sidebar group ---------- */

.ac-nav-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.ac-nav-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    color: var(--ac-accent) !important;
}

.tab-button--admin:hover { background: var(--ac-accent-soft); color: var(--ac-accent-strong); }
[data-theme="dark"] .tab-button--admin:hover { color: var(--ac-accent); }

.tab-button--admin.active {
    background: var(--ac-accent-soft);
    color: var(--ac-accent-strong);
}

[data-theme="dark"] .tab-button--admin.active { color: var(--ac-accent); }
.tab-button--admin.active::before { background: var(--ac-accent); }

.ac-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: var(--ac-accent-soft);
    border: 1px solid var(--ac-accent-line);
    color: var(--ac-accent-strong);
    font: 700 9.5px/1.6 var(--evl-sans);
    letter-spacing: .1em;
    text-transform: uppercase;
    white-space: nowrap;
}

[data-theme="dark"] .ac-chip { color: var(--ac-accent); }

.ac-chip--lg { font-size: 10.5px; padding: 3px 10px; vertical-align: middle; }
.ac-sidebar-chip { margin-left: 8px; }

/* ---------- admin page chrome ---------- */

.evl-admin .ac-header {
    background: linear-gradient(var(--topbar-bg), var(--topbar-bg));
    border-bottom: 1px solid var(--ac-accent-line);
    position: relative;
}

/* the console signature: a hatched rule under the topbar */
.evl-admin .ac-header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background-image: repeating-linear-gradient(
        135deg,
        var(--ac-accent) 0 6px,
        transparent 6px 12px
    );
    opacity: .55;
}

.evl-admin .section-header h2 { display: flex; align-items: center; gap: 12px; }

.evl-admin .ac-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1500px;
}

.ac-banner {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    background: var(--ac-accent-soft);
    border: 1px solid var(--ac-accent-line);
    border-left: 3px solid var(--ac-accent);
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.5;
}

.ac-banner strong { color: var(--ink); }

.ac-warning {
    padding: 12px 16px;
    border-radius: var(--r-md);
    background: rgba(245, 158, 11, .1);
    border: 1px solid rgba(245, 158, 11, .3);
    font-size: 13px;
    color: var(--ink-2);
}

.ac-warning p { margin: 0 0 6px; }
.ac-warning p:last-child { margin: 0; }

.ac-note { margin: 0 0 14px; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.ac-note code, .ac-id { font-family: var(--ac-mono); font-size: .92em; }

/* ---------- tiles ---------- */

.ac-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.ac-tile {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--ac-accent);
    border-radius: var(--r-md);
}

.ac-tile.is-good { border-left-color: #22c55e; }
.ac-tile.is-bad { border-left-color: #ef4444; }

.ac-tile-label {
    font: 700 10.5px/1 var(--evl-sans);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-4);
}

.ac-tile-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--evl-sans);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -.02em;
    overflow-wrap: anywhere;
}

.ac-tile-sub { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }

/* text values (names, ids) read better a size down from the big numbers */
.ac-tile-text { font-size: 1.05rem; font-weight: 700; line-height: 1.3; }
.ac-tile-sub code { font-family: var(--ac-mono); }

.ac-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--ink-4);
}

.ac-dot.is-up { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.ac-dot.is-down { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }

/* ---------- panels ---------- */

.ac-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    overflow: hidden;
    min-width: 0;
}

.ac-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 18px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}

.ac-panel-head h3 {
    margin: 0;
    font: 700 12px/1.2 var(--evl-sans);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.ac-panel-body { padding: 18px; }

.ac-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.ac-panel-body > .ac-actions:first-child { margin-top: 0; }

/* ---------- tier bars ---------- */

.ac-bars { display: flex; flex-direction: column; gap: 12px; }

.ac-bar-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) 92px;
    align-items: center;
    gap: 14px;
}

.ac-bar-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.ac-bar-track {
    height: 8px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.ac-bar-fill { display: block; height: 100%; border-radius: var(--r-pill); background: var(--ac-accent); }
.ac-bar-fill.tier-free { background: var(--ink-4); }
.ac-bar-fill.tier-supporter { background: var(--evl-cyan); }
.ac-bar-fill.tier-growth_insider { background: var(--ac-accent); }

.ac-bar-value {
    text-align: right;
    font-family: var(--ac-mono);
    font-size: 12.5px;
    color: var(--ink-2);
}

.ac-bar-value span { color: var(--ink-4); }

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

.ac-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ac-toolbar .form-control { height: 40px; }
.ac-search { flex: 1 1 260px; min-width: 0; }
.ac-toolbar select.form-control { flex: 0 0 auto; width: auto; min-width: 150px; }

.ac-count {
    margin-left: auto;
    font-family: var(--ac-mono);
    font-size: 12px;
    color: var(--ink-4);
    white-space: nowrap;
}

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

.ac-table-wrap { border-radius: var(--r-md); }
.ac-table { width: 100%; border-collapse: collapse; min-width: 780px; }

.ac-table th {
    padding: 11px 16px;
    font: 700 10.5px/1 var(--evl-sans);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-4);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.ac-table td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--ink-2);
    border-bottom: 1px solid var(--line-2);
    vertical-align: middle;
}

.ac-table tbody tr:last-child td { border-bottom: none; }
.ac-table tbody tr:hover { background: var(--surface-2); }

.ac-right { text-align: right; }
.ac-num { font-family: var(--ac-mono); font-size: 12.5px; }

.ac-server-name { font-weight: 700; color: var(--ink); margin-bottom: 2px; }

.ac-id {
    font-family: var(--ac-mono);
    font-size: 11.5px;
    color: var(--ink-4);
    background: var(--surface-2);
    padding: 1px 6px;
    border-radius: 5px;
}

.ac-features { display: flex; flex-wrap: wrap; gap: 5px; max-width: 220px; }

.ac-off, .ac-all-on {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line);
    white-space: nowrap;
}

.ac-off { color: #b45309; background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .28); }
[data-theme="dark"] .ac-off { color: #fbbf24; }
.ac-all-on { color: var(--ink-4); }

.ac-state {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: var(--r-pill);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    border: 1px solid var(--line);
    white-space: nowrap;
}

.ac-state.is-live { color: #16a34a; background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .3); }
.ac-state.is-stale { color: var(--ink-3); background: var(--surface-2); }
.ac-state.is-warn { color: #b45309; background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .3); }
.ac-state.is-fail { color: #dc2626; background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .28); }
[data-theme="dark"] .ac-state.is-live { color: #4ade80; }
[data-theme="dark"] .ac-state.is-warn { color: #fbbf24; }
[data-theme="dark"] .ac-state.is-fail { color: #f87171; }

.ac-row-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ac-row-actions .btn-small { padding: 5px 11px; font-size: 12px; }

.ac-empty { text-align: center; color: var(--ink-4); padding: 34px 16px !important; }

/* ---------- fields ---------- */

.ac-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.ac-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.ac-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font: 700 11px/1.3 var(--evl-sans);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.ac-counter { font-size: 10.5px; font-weight: 600; letter-spacing: 0; color: var(--ink-4); font-family: var(--ac-mono); }

.ac-preview {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 13px;
    color: var(--ink-2);
    flex-wrap: wrap;
}

.ac-preview strong { color: var(--ink); }
.ac-preview-text { color: var(--ink-3); }

.ac-defs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 0; }
.ac-defs > div { min-width: 0; }
.ac-defs dt { font: 700 10.5px/1 var(--evl-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4); margin-bottom: 5px; }
.ac-defs dd { margin: 0; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- ad clients ---------- */

.ac-client-list { display: flex; flex-direction: column; gap: 14px; }

.ac-client {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    min-width: 0;
}

.ac-client-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ac-client-head strong { color: var(--ink); font-size: 14px; }

/* ---------- audit feed ---------- */

.ac-feed { display: flex; flex-direction: column; gap: 6px; }

.ac-event {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--line);
    border-radius: var(--r-sm);
    min-width: 0;
}

.ac-event.is-fail { border-left-color: #ef4444; }
.ac-event:hover { border-color: var(--ac-accent-line); }

.ac-event-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.ac-event-action {
    font-family: var(--ac-mono);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.ac-event-meta { font-size: 11.5px; color: var(--ink-4); overflow-wrap: anywhere; }
.ac-event-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ac-event-time { font-size: 11.5px; color: var(--ink-4); white-space: nowrap; }

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

@media (max-width: 900px) {
    .ac-bar-row { grid-template-columns: 96px minmax(0, 1fr) 78px; gap: 10px; }
    .ac-count { margin-left: 0; }
    .evl-admin .ac-content { gap: 16px; }
}

/* ---------- consistent tier pills inside the console ---------- */

.evl-admin .tier-badge {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
    text-transform: none;
}

.evl-admin .tier-badge.tier-free { background: var(--surface-2); color: var(--ink-3); }

.evl-admin .tier-badge.tier-supporter {
    background: var(--evl-grad-soft);
    border-color: rgba(51, 189, 239, .35);
    color: var(--evl-cyan-strong);
}

[data-theme="dark"] .evl-admin .tier-badge.tier-supporter { color: var(--evl-cyan); }

.evl-admin .tier-badge.tier-growth_insider {
    background: var(--ac-accent-soft);
    border-color: var(--ac-accent-line);
    color: var(--ac-accent-strong);
}

[data-theme="dark"] .evl-admin .tier-badge.tier-growth_insider { color: var(--ac-accent); }

/* keep the row actions on one line; the table scrolls if it must */
.ac-table { min-width: 940px; }
.ac-table th:last-child, .ac-table td:last-child { min-width: 268px; }
.ac-row-actions { flex-wrap: nowrap; }

/* With the console mounted the sidebar carries 13 rows - tighten them so the
   whole menu fits without scrolling on a laptop screen. */
.sidebar.has-admin .nav-menu { padding: 12px 14px; gap: 2px; }
.sidebar.has-admin .tab-button { min-height: 38px; font-size: 13.5px; }
.sidebar.has-admin .nav-section-label { padding: 6px 12px 4px; }
.sidebar.has-admin .ac-nav-group { margin-top: 10px; padding-top: 8px; }

/* Scroll shadows so it is obvious the table continues past the edge */
.ac-table-wrap {
    background:
        linear-gradient(to right, var(--surface), rgba(255, 255, 255, 0)) left center / 32px 100% no-repeat local,
        linear-gradient(to left, var(--surface), rgba(255, 255, 255, 0)) right center / 32px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .16), transparent) left center / 12px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .16), transparent) right center / 12px 100% no-repeat scroll;
}
