﻿:root {
    --color-primary: #4A90B8;
    --color-secondary: #6B7280;
    --color-accent: #F97316;
    --color-white: #FFFFFF;
    --color-sidebar-bg: #1F2937;
    --color-sidebar-text: #D1D5DB;
    --color-sidebar-hover: #374151;
    --color-header-bg: #1F2937;
    --color-body-bg: #F3F4F6;
    --sidebar-width: 260px;
    --header-height: 60px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--color-body-bg);
    color: #111827;
}

/* ── LAYOUT SHELL ──────────────────────────────────────── */
.layout-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── HEADER ────────────────────────────────────────────── */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    background-color: var(--color-header-bg);
    padding: 0 1.25rem;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.header-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--color-white);
    font-weight: 600;
}

.header-user svg { fill: var(--color-primary); }

.header-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
    position: relative;
}

.header-nav .nav-btn {
    background: transparent;
    border: none;
    color: var(--color-sidebar-text);
    font-size: .9rem;
    cursor: pointer;
    padding: .4rem .75rem;
    border-radius: 6px;
    transition: background .2s, color .2s;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.header-nav .nav-btn:hover,
.header-nav .nav-btn.active {
    background: var(--color-accent);
    color: var(--color-white);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--color-white);
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 200;
    overflow: hidden;
}

.dropdown-menu a,
.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .65rem 1rem;
    font-size: .875rem;
    color: #374151;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background .15s;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: #F3F4F6;
    color: var(--color-accent);
}

.dropdown-logout-btn {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .65rem 1rem;
    font-size: .875rem;
    color: #374151;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background .15s;
}

.dropdown-logout-btn:hover {
    background: #F3F4F6;
    color: var(--color-accent);
}

.dropdown-divider { height: 1px; background: #E5E7EB; }

/* ── BODY AREA ─────────────────────────────────────────── */
.body-area {
    display: flex;
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* ── SIDEBAR ───────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%; /* fill the body-area height exactly */
    overflow: hidden; /* outer shell does NOT scroll */
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 1rem;
    border-bottom: 1px solid #374151;
    background-color: whitesmoke;
    overflow: hidden;
    flex-shrink: 0;
    max-height: 80px; /* ← caps the logo area to a fixed band */
}

.sidebar-logo img {
    max-width: 100%;
    max-height: 56px; /* ← image never taller than this */
    width: auto;
    height: auto;
    object-fit: contain;
}

/* ── NEW: scrollable nav wrapper ─────────────────────────── */
.sidebar-nav-scroll {
    flex: 1 1 0; /* takes all remaining height */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #374151 transparent;
}

.sidebar-nav-scroll::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav-scroll::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}

.nav-sections {
    padding: .75rem .5rem .25rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.nav-section-tab {
    background: linear-gradient(135deg, #2D3748, #374151);
    border: 1px solid #4B5563;
    border-radius: 7px;
    overflow: hidden;
}

.nav-section-tab .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .7rem .9rem;
    cursor: pointer;
    color: var(--color-white);
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    transition: background .2s;
    user-select: none;
}

.nav-section-tab .section-header:hover        { background: var(--color-primary); }
.nav-section-tab .section-header.expanded     { background: var(--color-primary); border-bottom: 1px solid #3B82F6; }

.section-chevron       { transition: transform .25s; font-size: .7rem; color: var(--color-sidebar-text); }
.section-chevron.open  { transform: rotate(180deg); }

.section-sub-menu { display: flex; flex-direction: column; background: #111827; }

.section-sub-menu a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .9rem .5rem 1.2rem;
    font-size: .825rem;
    color: var(--color-sidebar-text);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .15s, border-color .15s, color .15s;
}

.section-sub-menu a:hover,
.section-sub-menu a.active {
    background: #1F2937;
    border-left-color: var(--color-accent);
    color: var(--color-white);
}

.nav-standalone {
    padding: .5rem .5rem;
    display: flex;
    flex-direction: column;
    gap: .15rem;
    border-top: 1px solid #374151;
    margin-top: .25rem;
}

.nav-standalone a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .9rem;
    font-size: .875rem;
    color: var(--color-sidebar-text);
    text-decoration: none;
    border-radius: 7px;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
}

.nav-standalone a:hover,
.nav-standalone a.active {
    background: var(--color-sidebar-hover);
    color: var(--color-white);
    border-left-color: var(--color-accent);
}

.nav-item-icon { font-size: 1rem; width: 20px; text-align: center; color: var(--color-secondary); }
.nav-standalone a:hover .nav-item-icon,
.nav-standalone a.active .nav-item-icon { color: var(--color-accent); }

.nav-standalone-section {
    border-radius: 7px;
    overflow: hidden;
}

.nav-standalone-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem .9rem;
    cursor: pointer;
    color: var(--color-sidebar-text);
    font-size: .875rem;
    font-weight: 400;
    border-radius: 7px;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    user-select: none;
}

.nav-standalone-section .section-header:hover,
.nav-standalone-section .section-header.expanded {
    background: var(--color-sidebar-hover);
    color: var(--color-white);
    border-left-color: var(--color-accent);
}

.nav-standalone-section .section-header.expanded {
    border-radius: 7px 7px 0 0;
}

.nav-standalone-section .section-sub-menu {
    display: flex;
    flex-direction: column;
    background: transparent;
}

.nav-standalone-section .section-sub-menu a {
    padding-left: 2rem;
    border-radius: 0 0 7px 7px;
}

/* ── MAIN CONTENT ──────────────────────────────────────── */
.main-content { flex: 1; overflow-y: auto; padding: 1.5rem 2rem; background: var(--color-body-bg); }

/* ── PAGE CARD ─────────────────────────────────────────── */
.page-card {
    background: var(--color-white);
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    padding: 1.5rem;
}

.page-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 1rem;
    padding-bottom: .6rem;
    border-bottom: 2px solid var(--color-primary);
}

/* ── PAGE HEADER ROW ───────────────────────────────────── */
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.toolbar-label { font-size: .875rem; font-weight: 600; color: #374151; }
.status-text   { color: #9CA3AF; font-size: .875rem; }
.record-count  { margin-top: .75rem; font-size: .8rem; color: #6B7280; }

/* ── STAT REPORT DATE ─────────────────────────────────── */
.stat-report-date {
    font-size: .875rem;
    color: #6B7280;
    white-space: nowrap;
}

/* ── STAT TILE GRID ───────────────────────────────────── */
.stat-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-tile {
    background: #fff;
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    border: 1px solid #E5E7EB;
    transition: transform .15s, box-shadow .15s;
}

.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.stat-tile-label {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6B7280;
    margin-bottom: .35rem;
}

.stat-tile-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

/* Tile color variants */
.stat-tile-primary  { border-left: 4px solid var(--color-primary); }
.stat-tile-primary  .stat-tile-value { color: var(--color-primary); }

.stat-tile-success  { border-left: 4px solid #22C55E; }
.stat-tile-success  .stat-tile-value { color: #16A34A; }

.stat-tile-info     { border-left: 4px solid #3B82F6; }
.stat-tile-info     .stat-tile-value { color: #2563EB; }

.stat-tile-warning  { border-left: 4px solid #F59E0B; }
.stat-tile-warning  .stat-tile-value { color: #D97706; }

.stat-tile-danger   { border-left: 4px solid #EF4444; }
.stat-tile-danger   .stat-tile-value { color: #DC2626; }

/* ── STAT SUBSYSTEM SECTION ───────────────────────────── */
.stat-subsystem-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #E5E7EB;
}

/* ── BUTTONS ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    transition: opacity .2s, transform .1s;
}

.btn:hover  { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--color-primary);   color: var(--color-white); }
.btn-accent  { background: var(--color-accent);    color: var(--color-white); }
.btn-grey    { background: var(--color-secondary); color: var(--color-white); }
.btn-outline { background: transparent; border: 1px solid var(--color-primary); color: var(--color-primary); }
.btn-primary { background: var(--color-primary); color: var(--color-white); }
.btn-accent  { background: var(--color-accent); color: var(--color-white);}
.btn-grey    { background: var(--color-secondary); color: var(--color-white); }
.btn-warning { background: #D97706; color: var(--color-white); }
.btn-danger  { background: #DC2626; color: var(--color-white); }
.btn-sm      { padding: .3rem .65rem; font-size: .78rem; }

/* ── BUTTON SPINNER ──────────────────────────────────────── */
.btn-spinner {
    display: inline-block;
    width: .85rem;
    height: .85rem;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin-right: .3rem;
    vertical-align: middle;
}

/* ── TABLE ─────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

    .data-table th {
        background: var(--color-primary);
        color: var(--color-white);
        padding: .65rem 1rem;
        text-align: left;
        font-weight: 600;
        white-space: nowrap;
    }

        .data-table th:first-child {
            border-radius: 7px 0 0 0;
        }

        .data-table th:last-child {
            border-radius: 0 7px 0 0;
        }

    .data-table td {
        padding: .6rem 1rem;
        border-bottom: 1px solid #E5E7EB;
        color: #374151;
        background: #ffffff; /* ← explicit white, prevents header colour bleeding */
        vertical-align: middle; /* ← keeps the new Test icon cell aligned */
    }

    .data-table tr:hover td {
        background: #F9FAFB;
    }

    .data-table tr:last-child td {
        border-bottom: none;
    }

/* ── TABLE-WRAPPER (generic styled tables) ────────────── */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    background: #fff;
}

.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.table-wrapper thead th {
    background: var(--color-primary);
    color: #fff;
    padding: .65rem .85rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    font-size: .8rem;
    letter-spacing: .02em;
}

.table-wrapper thead th:first-child { border-radius: 9px 0 0 0; }
.table-wrapper thead th:last-child  { border-radius: 0 9px 0 0; }

.table-wrapper tbody td {
    padding: .55rem .85rem;
    border-bottom: 1px solid #F3F4F6;
    color: #374151;
    vertical-align: middle;
}

.table-wrapper tbody tr:hover td { background: #F0F9FF; }
.table-wrapper tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-flex; align-items: center; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-phone { background: #DBEAFE; color: #1D4ED8; }
.badge-email { background: #D1FAE5; color: #065F46; }
.badge-ip    { background: #FEE2E2; color: #991B1B; }

/* ── OMNISUBSYSTEM BADGES ───────────────────────────────── */
.badge-db    { background: #EFF6FF; color: #1D4ED8; }
.badge-queue { background: #F0FDF4; color: #15803D; }

/* ── ALERTS ────────────────────────────────────────────── */
.alert-success {
    background: #F0FDF4;
    border: 1px solid #86EFAC;
    border-radius: 8px;
    padding: .65rem 1rem;
    font-size: .85rem;
    font-weight: 600;
    color: #15803D;
}

.alert-error {
    background: #FFF1F2;
    border: 1px solid #FECDD3;
    border-radius: 8px;
    padding: .65rem 1rem;
    font-size: .85rem;
    font-weight: 600;
    color: #BE123C;
}

/* ── MODAL ─────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 300;
    animation: fadeIn .15s ease;
}

.modal-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 301;
    background: var(--color-white);
    border-radius: 12px;
    width: min(540px, 94vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    animation: slideUp .2s ease;
}

.modal-dialog-wide { width: min(780px, 96vw); }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
    from { transform: translate(-50%, -46%); opacity: 0; }
    to   { transform: translate(-50%, -50%); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #E5E7EB;
    font-size: 1rem;
    font-weight: 700;
    color: #1F2937;
    background: linear-gradient(135deg, #F8FAFC, #EFF6FF);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1rem;
    color: #9CA3AF;
    cursor: pointer;
    padding: .25rem .5rem;
    border-radius: 4px;
    transition: background .15s, color .15s;
}

.modal-close:hover { background: #FEE2E2; color: #DC2626; }

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .6rem;
    padding: .9rem 1.25rem;
    border-top: 1px solid #E5E7EB;
    background: #F9FAFB;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

/* ── FORM FIELDS ───────────────────────────────────────── */
.field-group {
    display: flex;
    flex-direction: column;   /* ← this is what was missing */
    gap: .4rem;
    width: 100%;
}

.field-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: #374151;
    line-height: 1.4;
}

.field-hint {
    font-weight: 400;
    color: #9CA3AF;
    font-size: .75rem;
    margin-left: .3rem;
}

.required { color: #EF4444; }

.form-select,
.form-input {
    width: 100%;
    padding: .45rem .75rem;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: .875rem;
    color: #374151;
    background: var(--color-white);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.form-select:focus,
.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74,144,184,0.15);
}

.form-textarea {
    width: 100%;
    padding: .5rem .75rem;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: .825rem;
    font-family: 'Consolas', monospace;
    color: #374151;
    background: var(--color-white);
    resize: vertical;
    min-height: 130px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    line-height: 1.6;
    display: block;      /* ← ensures it sits below the label */
}

.form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74,144,184,0.15);
}

/* ── PARSE SUMMARY BAR ──────────────────────────────────── */
.parse-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8FAFC;
    border: 1px solid #E5E7EB;
    border-radius: 7px;
    padding: .55rem .9rem;
    font-size: .82rem;
    color: #374151;
}

.summary-type { display: flex; align-items: center; gap: .4rem; }

/* ── PARSE RESULTS GRID ─────────────────────────────────── */
.parse-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.parse-col {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.parse-col-valid   { border-color: #BBF7D0; }
.parse-col-invalid { border-color: #FECDD3; }

.parse-col-header {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .75rem;
    font-size: .78rem;
    font-weight: 700;
    color: #374151;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.parse-col-valid   .parse-col-header { background: #F0FDF4; border-color: #BBF7D0; }
.parse-col-invalid .parse-col-header { background: #FFF1F2; border-color: #FECDD3; }

.parse-dot       { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.parse-dot-green { background: #22C55E; }
.parse-dot-red   { background: #EF4444; }

.parse-count     { margin-left: auto; font-weight: 700; color: #15803D; }
.parse-count-red { color: #DC2626; }

.parse-col-scroll {
    overflow-y: auto;
    max-height: 220px;
    padding: .4rem .5rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    background: var(--color-white);
}

.parse-empty { font-size: .8rem; color: #9CA3AF; padding: .4rem; text-align: center; }

.parse-item {
    font-size: .78rem;
    font-family: 'Consolas', monospace;
    padding: .25rem .45rem;
    border-radius: 4px;
    word-break: break-all;
}

.parse-item-valid   { background: #DCFCE7; color: #166534; }
.parse-item-invalid { background: #FEF2F2; color: #991B1B; display: flex; flex-direction: column; gap: .1rem; }
.parse-item-value   { font-weight: 600; }
.parse-item-reason  { font-size: .72rem; color: #B91C1C; font-style: italic; }

.parse-warn {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: 7px;
    padding: .55rem .9rem;
    font-size: .8rem;
    color: #92400E;
} 

/* ── SEARCH BOX ────────────────────────────────────────── */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 320px;
}

.search-icon {
    position: absolute;
    left: .6rem;
    font-size: .85rem;
    pointer-events: none;
    line-height: 1;
}

.search-input {
    width: 100%;
    padding: .45rem .75rem .45rem 2rem;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: .875rem;
    color: #374151;
    background: var(--color-white);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74,144,184,0.15);
}

.search-clear {
    position: absolute;
    right: .4rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #9CA3AF;
    font-size: .8rem;
    padding: .2rem .35rem;
    border-radius: 4px;
    line-height: 1;
    transition: color .15s, background .15s;
}

.search-clear:hover { color: #DC2626; background: #FEE2E2; }

/* ── SEARCH RESULTS ────────────────────────────────────── */
.search-highlight {
    background: #FEF08A;
    color: #713F12;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 600;
}

.search-hint { color: #9CA3AF; font-style: italic; }

.search-no-results {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: #F9FAFB;
    border: 1px dashed #D1D5DB;
    border-radius: 8px;
    font-size: .875rem;
    color: #6B7280;
}

/* ── CONTENT KEYWORD BADGES ────────────────────────────── */
.badge-warning  { background: #FEF3C7; color: #92400E; }
.badge-critical { background: #FEE2E2; color: #991B1B; }
.badge-active   { background: #D1FAE5; color: #065F46; }
.badge-inactive { background: #F3F4F6; color: #6B7280; }  /* kept for any static use */

/* Light-red variant used on the inactive toggle pill */
.badge-inactive-red { background: #FEE2E2; color: #991B1B; }

/* ── ACTIVE/INACTIVE TOGGLE BUTTON ─────────────────────── */
.badge-toggle {
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: filter .15s, transform .1s, opacity .15s;
    white-space: nowrap;
    font-family: inherit;
}

.badge-toggle:hover  { filter: brightness(.92); transform: translateY(-1px); }
.badge-toggle:active { transform: translateY(0); }

.badge-toggle:disabled {
    opacity: .6;
    cursor: wait;
    transform: none;
}

/* ── SORTABLE TABLE HEADERS ─────────────────────────────── */
.sort-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sort-th:hover { background: #3a7fa8; }

.sort-th .sort-icons {
    display: inline-flex;
    flex-direction: column;
    margin-left: .35rem;
    gap: 1px;
    vertical-align: middle;
    line-height: 1;
    opacity: .45;
    font-size: .6rem;
}

.sort-th.sorted .sort-icons { opacity: 1; }

.sort-th .sort-asc  { line-height: 1; }
.sort-th .sort-desc { line-height: 1; }

.sort-th.asc  .sort-desc,
.sort-th.desc .sort-asc  { opacity: .25; }
/* ── MARKETING SOURCE BADGES ────────────────────────────── */
.badge-spark  { background: #EDE9FE; color: #5B21B6; }
.badge-market { background: #FEF3C7; color: #92400E; }

/* ── LOGIN PAGE ────────────────────────────────────────── */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-sidebar-bg);
}

.login-card {
    background: var(--color-white);
    border-radius: 14px;
    padding: 2.5rem 2rem;
    width: min(420px, 96vw);
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    gap: .6rem;
    overflow: hidden; /* ← prevents any child from bleeding outside the rounded card */
}

.login-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    text-align: center;
    letter-spacing: 1px;
}

.login-logo img {
    max-width: 100%; /* ← constrain to the card's content width */
    height: auto; /* ← preserve aspect ratio */
    display: block;
    margin: 0 auto; /* ← center it since it's now block-level */
}

.login-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1F2937;
    text-align: center;
    margin: 0;
}

.login-subtitle {
    font-size: .875rem;
    color: #6B7280;
    text-align: center;
    margin-bottom: .5rem;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: #374151;
    margin-top: .75rem;
}

.login-btn {
    width: 100%;
    justify-content: center;
    padding: .65rem;
    font-size: .95rem;
    margin-top: 1rem;
}

/* ── APPROVAL PAGE ──────────────────────────────────────── */
.approval-th {
    text-align: center;
    padding: .5rem .6rem;
    white-space: nowrap;
}

.approval-cell {
    text-align: center;
    padding: .5rem .6rem;
    white-space: nowrap;
}

.approval-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .22rem .65rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.approval-yes {
    background: #D1FAE5;
    color: #065F46;
}

.approval-no {
    background: #FEE2E2;
    color: #991B1B;
}

.approval-missing {
    background: #F3F4F6;
    color: #9CA3AF;
}

/* ── APPROVAL EDIT CHECKLIST ────────────────────────────── */
.approval-check-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.approval-check-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .55rem .85rem;
    border-radius: 8px;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    font-size: .875rem;
}

.approval-check-item.check-approved {
    background: #F0FDF4;
    border-color: #86EFAC;
}

.approval-check-item.check-unapproved {
    background: #FFF1F2;
    border-color: #FECDD3;
}

.approval-check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

.check-label {
    flex: 1;
}

.check-saving {
    font-size: .75rem;
    color: #9CA3AF;
    font-style: italic;
}

/* ── LEADS PAGE ─────────────────────────────────────────── */
.leads-date-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    background: #F8FAFC;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
}

.leads-quick-dates {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
}

.leads-date-range {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-left: auto;
}

/* ── FILTER CHIPS ────────────────────────────────────────── */
.leads-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .75rem;
}

.leads-chip {
    display: inline-flex;
    align-items: center;
    padding: .2rem .6rem;
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}

.leads-chip-clear {
    background: #FEE2E2;
    color: #991B1B;
    border-color: #FECACA;
    cursor: pointer;
    border: 1px solid #FECACA;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    padding: .2rem .6rem;
}

.leads-chip-clear:hover { background: #FCA5A5; }

/* ── LEADS TABLE ─────────────────────────────────────────── */
.leads-table tbody tr.lead-row {
    cursor: pointer;
    transition: background .12s;
}

.leads-table tbody tr.lead-row:hover td { background: #EFF6FF; }

.leads-chip-x {
    background: transparent;
    border: none;
    color: #1D4ED8;
    cursor: pointer;
    font-size: .7rem;
    line-height: 1;
    margin-left: .35rem;
    padding: 0 0 0 .1rem;
    opacity: .6;
}

.leads-chip-x:hover { opacity: 1; color: #991B1B; }

/* ── HOVER POPUP (legacy — still used by the per-client leads grid) ──────── */
.lead-popup {
    background: #1E293B;
    color: #F1F5F9;
    border-radius: 8px;
    padding: .9rem 1.1rem;
    font-size: .78rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    animation: fadeIn .1s ease;
}

.lead-popup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .3rem .75rem;
}

.lead-popup-grid div {
    display: flex;
    flex-direction: column;
    gap: .05rem;
}

.lp-label {
    font-size: .68rem;
    font-weight: 700;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.lp-val  { color: #F1F5F9; }
.lp-mono { font-family: 'Consolas', monospace; font-size: .73rem; }

.lead-popup-hint {
    margin-top: .6rem;
    font-size: .7rem;
    color: #64748B;
    text-align: right;
}

/* ── PAGINATION ──────────────────────────────────────────── */
.leads-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .9rem;
    gap: .5rem;
}

/* ── SEARCH MODAL GRID ───────────────────────────────────── */
.leads-search-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
}

/* ── BUTTON SPINNER ──────────────────────────────────────── */
.btn-spinner {
    display: inline-block;
    width: .85rem;
    height: .85rem;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin-right: .3rem;
    vertical-align: middle;
}

/* ── Lead Detail ─────────────────────────────────────────── */
.lead-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 1rem;
}

.lead-detail-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.lead-detail-heading {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    margin-bottom: .6rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid #e2e8f0;
}

.lead-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .5rem;
    padding: .3rem 0;
    font-size: .85rem;
    border-bottom: 1px solid #f1f5f9;
}

.lead-detail-row:last-child {
    border-bottom: none;
}

.lead-detail-row span:first-child {
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

.lead-detail-row span:last-child {
    text-align: right;
    word-break: break-all;
}

/* ── DASHBOARD TILES ──────────────────────────────────────── */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dash-tile {
    background: var(--color-white);
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    transition: box-shadow .2s, border-color .2s;
}

.dash-tile:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    border-color: var(--color-primary);
}

.dash-tile-icon {
    font-size: 1.5rem;
    margin-bottom: .15rem;
}

.dash-tile-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1F2937;
    line-height: 1.1;
}

.dash-tile-label {
    font-size: .78rem;
    color: #6B7280;
    font-weight: 500;
}

.dash-tile-sub {
    font-size: .7rem;
    color: #9CA3AF;
    font-family: 'Consolas', 'Courier New', monospace;
}

/* Tile variants */
.dash-tile-healthy { border-left: 4px solid #22C55E; }
.dash-tile-warning { border-left: 4px solid #F59E0B; }
.dash-tile-error   { border-left: 4px solid #EF4444; }
.dash-tile-info    { border-left: 4px solid var(--color-primary); }
.dash-tile-muted   { border-left: 4px solid #D1D5DB; }

/* ── DASHBOARD SECTION HEADER ────────────────────────────── */
.dash-section-header {
    font-size: 1rem;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: .75rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.dash-section-header span {
    font-size: 1.15rem;
}

/* ── QUEUE CARD GRID ─────────────────────────────────────── */
.queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .85rem;
    margin-bottom: 1.5rem;
}

.queue-card {
    background: var(--color-white);
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: box-shadow .2s, border-color .2s;
}

.queue-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    border-color: var(--color-primary);
}

.queue-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.queue-card-name {
    font-size: .85rem;
    font-weight: 700;
    color: #1F2937;
    font-family: 'Consolas', 'Courier New', monospace;
}

.queue-card-count {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-primary);
}

.queue-card-count.has-messages { color: #F59E0B; }
.queue-card-count.has-error    { color: #EF4444; }

.queue-card-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .5rem;
    border-radius: 999px;
}

.queue-status-active { background: #D1FAE5; color: #065F46; }
.queue-status-error  { background: #FEE2E2; color: #991B1B; }
.queue-status-empty  { background: #F3F4F6; color: #6B7280; }

/* ── SERVICE / TABLE LIST ────────────────────────────────── */
.dash-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: .65rem;
    margin-bottom: 1.5rem;
}

.dash-list-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--color-white);
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: .7rem 1rem;
    font-size: .82rem;
    transition: background .15s;
}

.dash-list-item:hover { background: #F9FAFB; }

.dash-list-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 1.8rem;
    height: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #EFF6FF;
}

.dash-list-icon.fn-icon  { background: #EFF6FF; }
.dash-list-icon.tbl-icon { background: #F0FDF4; }
.dash-list-icon.sp-icon  { background: #FEF3C7; }

.dash-list-text {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-width: 0;
}

.dash-list-name {
    font-weight: 600;
    color: #1F2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-list-desc {
    font-size: .72rem;
    color: #9CA3AF;
}

/* ── STATUS DOT ──────────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-green  { background: #22C55E; box-shadow: 0 0 4px rgba(34,197,94,.4); }
.dot-yellow { background: #F59E0B; box-shadow: 0 0 4px rgba(245,158,11,.4); }
.dot-red    { background: #EF4444; box-shadow: 0 0 4px rgba(239,68,68,.4); }
.dot-grey   { background: #D1D5DB; }

/* ── MESSAGE STATUS BADGES ──────────────────────────────── */
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }
.badge-green  { background: #D1FAE5; color: #065F46; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-gray   { background: #F3F4F6; color: #6B7280; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }
.badge-orange { background: #FFEDD5; color: #9A3412; }

/* ── HEADER BREADCRUMB ──────────────────────────────────── */
.header-breadcrumb {
    flex: 1;
    text-align: center;
    font-size: .85rem;
    font-weight: 600;
    color: #CBD5E1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 1rem;
}

/* ── SUBSYSTEM SWITCHER (sidebar) ───────────────────────── */
.subsystem-switcher-row {
    cursor: default !important;
    gap: .5rem;
}

.switcher-select {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, .08);
    color: var(--color-white);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 6px;
    padding: .3rem .4rem;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
}

.switcher-select:focus { outline: 2px solid var(--color-accent); }
.switcher-select option { color: #1F2937; background: #FFFFFF; }

.switcher-badge {
    background: #F59E0B;
    color: #78350F;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    padding: .12rem .45rem;
    min-width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.switcher-badge-zero {
    background: rgba(255, 255, 255, .15);
    color: #D1D5DB;
}

/* ── PAGINATION BAR ─────────────────────────────────────── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid #E5E7EB;
}

/* ── CLICKABLE DASHBOARD TABLE TILES ────────────────────── */
.dash-list-item-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    border-radius: 8px;
    transition: background .15s, transform .1s;
    cursor: pointer;
}

.dash-list-item-link:hover {
    background: #F0F9FF;
    transform: translateX(2px);
}

.dash-list-item-link .dash-list-count {
    margin-left: auto;
    font-size: .82rem;
    font-weight: 600;
    color: var(--color-primary);
    background: #EFF6FF;
    padding: .15rem .5rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* ── Shared table and validation styles ── */
.page-header {
    margin-bottom: 1.25rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
}

.search-bar-container {
    margin-bottom: 1.25rem;
}

.search-group {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    min-width: 260px;
}

.results-summary {
    font-size: .85rem;
    color: var(--color-muted);
    margin-bottom: .6rem;
}

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--color-muted);
}

.table-container {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--color-border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

    .data-table thead th {
        background: var(--color-primary);
        padding: .65rem .85rem;
        text-align: left;
        font-weight: 600;
        border-bottom: 2px solid var(--color-border);
        white-space: nowrap;
    }

    .data-table tbody tr:nth-child(even) {
        background: var(--color-surface-alt, #f9fafb);
    }

    .data-table tbody tr:hover {
        background: var(--color-hover, #f1f5f9);
    }

    .data-table tbody td {
        padding: .6rem .85rem;
        border-bottom: 1px solid var(--color-border);
        vertical-align: top;
    }

.phone-cell {
    white-space: nowrap;
    font-family: monospace;
}

.api-response-cell {
    max-width: 340px;
    word-break: break-word;
    font-size: .8rem;
    color: var(--color-muted);
}

.badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-neutral {
    background: #f3f4f6;
    color: #6b7280;
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── JSON VIEWER ──────────────────────────────────────── */
.json-viewer {
    background: #1E293B;
    color: #E2E8F0;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: .8rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* ── ICON BUTTONS (table row actions) ───────────────────── */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    border: 1px solid #D1D5DB;
    background: #ffffff;
    color: #374151;
    font-size: .95rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
    padding: 0;
    flex-shrink: 0;
    margin-right: .25rem;
}

    .btn-icon:hover {
        background: #EFF6FF;
        border-color: var(--color-primary);
        transform: translateY(-1px);
    }

    .btn-icon:active {
        transform: translateY(0);
    }

    .btn-icon:disabled {
        opacity: .45;
        cursor: not-allowed;
        transform: none;
    }

.btn-icon-accent:hover {
    background: #FFF7ED;
    border-color: var(--color-accent);
}
/* ════════════════════════════════════════════════════════════════════════════
   LEAD REQUESTS REPORT (/lead-requests) + shared lead-request detail panel
   ════════════════════════════════════════════════════════════════════════════ */

/* .btn-link was used across several pages without ever being defined, so those
   cells rendered as raw browser buttons. */
.btn-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--color-primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-link:hover { text-decoration: underline; color: #2F6E92; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.lr-scope {
    margin-top: .2rem;
    font-size: .8rem;
    color: #6B7280;
}

.lr-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}

.lr-search {
    position: relative;
    display: flex;
    align-items: center;
}

.lr-search .form-input {
    width: 268px;
    padding-left: 2rem;
    padding-right: 1.9rem;
}

.lr-search-icon {
    position: absolute;
    left: .6rem;
    font-size: .78rem;
    opacity: .55;
    pointer-events: none;
}

.lr-search-clear {
    position: absolute;
    right: .45rem;
    background: none;
    border: none;
    color: #9CA3AF;
    font-size: .75rem;
    cursor: pointer;
    padding: .15rem .25rem;
    border-radius: 4px;
}

.lr-search-clear:hover { background: #FEE2E2; color: #DC2626; }

.lr-notice {
    margin: .25rem 0 .75rem;
    padding: .55rem .85rem;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: 8px;
    font-size: .8rem;
    color: #92400E;
}

.lr-notice code {
    font-family: 'Consolas', monospace;
    font-size: .76rem;
    background: #FEF3C7;
    padding: .05rem .3rem;
    border-radius: 4px;
}

/* ── Outcome breakdown strip ─────────────────────────────────────────────── */
.lr-stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: .6rem;
    margin: .25rem 0 1rem;
}

.lr-stat {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    align-items: flex-start;
    padding: .6rem .8rem;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-left: 3px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, box-shadow .15s, transform .1s;
}

.lr-stat:hover { box-shadow: 0 4px 12px rgba(0,0,0,.07); transform: translateY(-1px); }

.lr-stat.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(74,144,184,.18);
}

.lr-stat-static { cursor: default; }
.lr-stat-static:hover { box-shadow: none; transform: none; }

.lr-stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
}

.lr-stat-label {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6B7280;
}

.lr-stat.tile-all   { border-left-color: var(--color-primary); }
.lr-stat.tile-good  { border-left-color: #22C55E; }
.lr-stat.tile-warn  { border-left-color: #F59E0B; }
.lr-stat.tile-bad   { border-left-color: #EF4444; }
.lr-stat.tile-muted { border-left-color: #D1D5DB; }

/* ── Grid ────────────────────────────────────────────────────────────────── */
.lr-table-wrap {
    max-height: calc(100vh - 430px);
    min-height: 220px;
    overflow: auto;
}

.lr-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.lr-table tbody tr.lr-row { cursor: pointer; }
.lr-table tbody tr.lr-row:hover td { background: #F0F9FF; }
.lr-table tbody tr.lr-row.is-open td { background: #E0F2FE; }

.lr-table td { font-size: .82rem; }
.lr-nowrap   { white-space: nowrap; }
.lr-num      { text-align: right; }
.lr-dim      { color: #9CA3AF; }

.lr-ellipsis {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lr-row-chevron {
    color: #CBD5E1;
    font-size: 1.1rem;
    text-align: right;
    width: 1.5rem;
}

.lr-row:hover .lr-row-chevron { color: var(--color-primary); }

.lr-check-ok {
    display: inline-block;
    color: #16A34A;
    font-weight: 700;
}

.lr-check-fail {
    display: inline-block;
    margin-right: .25rem;
    padding: .1rem .4rem;
    border-radius: 999px;
    background: #FEE2E2;
    color: #991B1B;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .03em;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.lr-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .9rem;
    flex-wrap: wrap;
}

.lr-page-size { display: flex; align-items: center; gap: .45rem; }
.lr-page-nav  { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }

.lr-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    padding: 2.5rem 1rem;
    color: #6B7280;
}

.lr-empty-title { font-size: .95rem; font-weight: 600; color: #374151; }

/* ── Detail dialog ───────────────────────────────────────────────────────── */
.modal-dialog-xl { width: min(1240px, 96vw); max-height: 92vh; }

/* A validation-result modal opened from inside the detail dialog. */
.modal-backdrop-stacked { z-index: 320; }
.modal-dialog-stacked   { z-index: 321; }

.lr-dialog-title {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
}

.lr-dialog-title .lr-dim { font-weight: 400; font-size: .8rem; }

.lr-dialog-nav-hint { margin-right: auto; }

/* ── Shared detail panel ─────────────────────────────────────────────────── */
.lr-detail {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.lr-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.lr-section {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
}

.lr-section-title {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .95rem;
    font-weight: 700;
    color: #1F2937;
}

.lr-section-sub  { font-weight: 400; font-size: .85rem; color: #6B7280; }
.lr-section-action { margin-left: auto; font-size: .8rem; }

.lr-raw-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.lr-raw-grid > div { min-width: 0; display: flex; flex-direction: column; gap: .5rem; }

.lr-subsystems { display: flex; flex-direction: column; gap: .5rem; }

.lr-copy-cell,
.lr-check-cell {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    justify-content: flex-end;
}

.lr-copy {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    font-size: .8rem;
    line-height: 1;
    padding: .1rem .2rem;
    border-radius: 4px;
}

.lr-copy:hover { background: #EFF6FF; color: var(--color-primary); }

.lr-inline-btn {
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 5px;
    color: #374151;
    cursor: pointer;
    font-size: .72rem;
    font-weight: 600;
    padding: .15rem .45rem;
}

.lr-inline-btn:hover { background: #EFF6FF; border-color: var(--color-primary); color: var(--color-primary); }

@media (max-width: 1100px) {
    .lr-raw-grid { grid-template-columns: 1fr; }
    .lr-search .form-input { width: 200px; }
}

/* ── Campaign "Follow" navigation (OmniCore campaign → subsystem run panel) ── */

.follow-pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: #EEF2FF;
    border: 1px solid #C7D2FE;
    border-radius: 999px;
    color: #3730A3;
    font-size: .72rem;
    font-weight: 600;
    padding: .2rem .55rem;
    text-decoration: none;
    white-space: nowrap;
}

.follow-pill:hover {
    background: #E0E7FF;
    border-color: #818CF8;
    color: #312E81;
}

.follow-arrow { transition: transform .12s ease-out; }
.follow-pill:hover .follow-arrow { transform: translateX(2px); }

/* Banner shown on a subsystem run list that was opened via Follow */
.run-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    background: #EEF2FF;
    border: 1px solid #C7D2FE;
    border-radius: 8px;
    color: #3730A3;
    font-size: .82rem;
    margin-bottom: 1rem;
    padding: .55rem .9rem;
}

/* The rows that matched the followed campaign */
.run-row-followed > td { background: #F5F3FF; }
.run-row-followed > td:first-child { box-shadow: inset 3px 0 0 #818CF8; }
