/* ══════════════════════════════════════════════════════════
   MOKO Dashboard — Design Tokens & Global Styles
   Converted from React prototype to Blazor Server
   ══════════════════════════════════════════════════════════ */

:root {
    /* Brand */
    --brand: #440099;
    --brand-glow: rgba(68,0,153,0.35);
    --brand-light: #7B3FBF;
    --accent: #FF3366;
    --accent-warm: #FF6633;

    /* Surfaces */
    --surface: #0C0A14;
    --surface-raised: #13101E;
    --surface-hover: #1A1628;
    --sidebar: #0D0B14;
    --sidebar-border: #1E1A2E;
    --content-bg: #F7F6F3;
    --content-card: #FFFFFF;
    --content-border: #E8E6E1;
    --content-muted-bg: #FAFAF8;

    /* Text */
    --text-dark: #1A1A2E;
    --text-body: #3D3D56;
    --text-muted: #8888A0;
    --text-light: #C0C0D0;
    --text-sidebar: #9994B0;
    --text-sidebar-active: #FFFFFF;

    /* Status */
    --green: #10B981;
    --green-bg: #ECFDF5;
    --amber: #F59E0B;
    --amber-bg: #FFFBEB;
    --red: #EF4444;
    --red-bg: #FEF2F2;
    --blue: #3B82F6;
    --blue-bg: #EFF6FF;

    /* Scores */
    --hot-red: #EF4444;
    --warm-amber: #F59E0B;
    --cold-grey: #94A3B8;

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    font-family: var(--font-body);
    background: var(--content-bg);
    color: var(--text-body);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

/* ── Focus ── */
textarea:focus, input:focus, select:focus {
    outline: 2px solid rgba(68,0,153,0.25);
    outline-offset: -1px;
}

/* ── Animations ── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Blazor Error UI ── */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ══════════════════════════════════════════════════════════
   Layout
   ══════════════════════════════════════════════════════════ */

.moko-app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ── */
.moko-sidebar {
    width: 250px;
    background: var(--sidebar);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease;
    flex-shrink: 0;
    overflow: hidden;
}

.moko-sidebar.collapsed {
    width: 68px;
}

.moko-sidebar-logo {
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--sidebar-border);
    cursor: pointer;
    min-height: 65px;
}

.collapsed .moko-sidebar-logo {
    padding: 20px 0;
    justify-content: center;
}

.moko-logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    font-family: var(--font-heading);
    box-shadow: 0 0 20px var(--brand-glow);
    flex-shrink: 0;
}

.moko-logo-icon-img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    box-shadow: 0 0 20px var(--brand-glow);
    flex-shrink: 0;
    object-fit: cover;
}

.moko-logo-text {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    font-family: var(--font-heading);
    letter-spacing: 0.05em;
}

.moko-logo-sub {
    font-size: 10px;
    color: var(--text-sidebar);
    letter-spacing: 0.1em;
}

/* ── Nav ── */
.moko-nav {
    flex: 1;
    padding: 12px 10px;
    overflow: auto;
}

.collapsed .moko-nav {
    padding: 12px 8px;
}

.moko-nav-group-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-sidebar);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 4px 10px;
    margin-bottom: 4px;
    opacity: 0.6;
}

.moko-nav-group {
    margin-bottom: 16px;
}

.moko-nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-sidebar);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    font-family: var(--font-heading);
    position: relative;
}

.collapsed .moko-nav-btn {
    padding: 10px 0;
    justify-content: center;
}

.moko-nav-btn:hover {
    background: var(--surface-hover);
}

.moko-nav-btn.active {
    background: rgba(68,0,153,0.15);
    color: var(--text-sidebar-active);
    font-weight: 700;
}

.moko-nav-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 3px;
    border-radius: 2px;
    background: var(--brand);
}

.moko-nav-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.moko-nav-label {
    flex: 1;
}

.moko-nav-badge {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border-radius: 100px;
    padding: 1px 7px;
    min-width: 18px;
    text-align: center;
}

.moko-nav-dot {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

/* ── Sidebar Footer ── */
.moko-sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.moko-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.moko-user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-sidebar-active);
}

.moko-user-role {
    font-size: 10px;
    color: var(--text-sidebar);
}

/* ── Main Content Area ── */
.moko-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Top Bar ── */
.moko-topbar {
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.moko-topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    font-family: var(--font-heading);
}

.moko-topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.moko-env-badge {
    font-size: 11px;
    font-family: var(--font-mono);
    background: rgba(16,185,129,0.2);
    color: var(--green);
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
}

.moko-topbar-region {
    font-size: 12px;
    color: var(--text-light);
}

.moko-topbar-divider {
    width: 1px;
    height: 20px;
    background: var(--sidebar-border);
}

.moko-topbar-icon {
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}

.moko-topbar-icon:hover {
    color: #fff;
}

/* ── Content ── */
.moko-content {
    flex: 1;
    overflow: auto;
    padding: 24px;
}

/* ══════════════════════════════════════════════════════════
   Shared Components
   ══════════════════════════════════════════════════════════ */

/* ── Status Badge ── */
.status-badge {
    border-radius: 100px;
    font-family: var(--font-heading);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.02em;
}

.status-badge.sm {
    font-size: 11px;
    padding: 2px 10px;
}

.status-badge.md {
    font-size: 13px;
    padding: 4px 14px;
}

.status-badge .pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

/* Status colours */
.status-running { color: var(--blue); background: var(--blue-bg); }
.status-running .pulse-dot { background: var(--blue); }
.status-completed { color: var(--green); background: var(--green-bg); }
.status-awaitingapproval { color: var(--amber); background: var(--amber-bg); }
.status-failed { color: var(--red); background: var(--red-bg); }
.status-idle { color: var(--text-muted); background: #F3F4F6; }
.status-healthy { color: var(--green); background: var(--green-bg); }
.status-degraded { color: var(--amber); background: var(--amber-bg); }
.status-down { color: var(--red); background: var(--red-bg); }
.status-pending { color: var(--amber); background: var(--amber-bg); }
.status-unknown { color: var(--text-muted); background: #F3F4F6; }
.status-offline { color: var(--text-muted); background: #F3F4F6; }

/* ── KPI Card ── */
.kpi-card {
    background: var(--content-card);
    border-radius: 14px;
    padding: 18px 20px;
    border: 1px solid var(--content-border);
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 180px;
}

.kpi-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--text-dark);
    line-height: 1.1;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.kpi-trend {
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
}

.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }

/* ══════════════════════════════════════════════════════════
   Page-specific styles
   ══════════════════════════════════════════════════════════ */

/* ── Section Headers ── */
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 14px;
    font-family: var(--font-heading);
    letter-spacing: 0.02em;
}

.field-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

/* ── Cards ── */
.moko-card {
    background: var(--content-card);
    border-radius: 14px;
    border: 1px solid var(--content-border);
    overflow: hidden;
}

.moko-card-lg {
    background: var(--content-card);
    border-radius: 16px;
    border: 1px solid var(--content-border);
    padding: 24px;
}

/* ── Agent Card ── */
.agent-card {
    background: var(--content-card);
    border-radius: 14px;
    padding: 18px;
    border: 1px solid var(--content-border);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.agent-card:hover {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px rgba(68,0,153,0.12);
}

.agent-card-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0.7;
}

.agent-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.agent-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    font-family: var(--font-heading);
}

.agent-card-model {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.agent-card-stats {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.agent-card-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    font-family: var(--font-heading);
}

.agent-card-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.agent-card-footer {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
    border-top: 1px solid var(--content-border);
    padding-top: 8px;
}

/* ── Live Activity Feed ── */
.feed-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--content-border);
    border-left: 3px solid transparent;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feed-agent {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dark);
    font-family: var(--font-heading);
}

.feed-time {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.feed-detail {
    font-size: 12px;
    color: var(--text-body);
    line-height: 1.4;
}

.feed-type-badge {
    font-size: 10px;
    padding: 1px 8px;
    border-radius: 100px;
    font-weight: 600;
}

.feed-pipeline {
    font-size: 10px;
    color: var(--text-muted);
}

/* ── Connected indicator ── */
.connected-indicator {
    font-size: 11px;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.connected-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 1.5s infinite;
}

/* ── Tables ── */
.moko-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: var(--font-body);
}

.moko-table thead tr {
    background: var(--content-muted-bg);
}

.moko-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--content-border);
    font-family: var(--font-heading);
}

.moko-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--content-border);
}

.moko-table tbody tr {
    transition: background 0.1s;
}

.moko-table tbody tr:hover {
    background: var(--content-muted-bg);
}

.moko-table tbody tr:last-child td {
    border-bottom: none;
}

.moko-table .cell-id {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--brand);
    font-weight: 600;
}

.moko-table .cell-bold {
    font-weight: 700;
    color: var(--text-dark);
}

.moko-table .cell-muted {
    color: var(--text-muted);
}

.moko-table .cell-mono {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Error Rate Bar ── */
.error-rate-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-rate-track {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #F3F4F6;
    overflow: hidden;
    max-width: 60px;
}

.error-rate-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s;
}

/* ── Filter Pill ── */
.filter-pill {
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid var(--content-border);
    background: var(--content-card);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: all 0.15s;
}

.filter-pill:hover {
    border-color: var(--brand);
}

.filter-pill.active {
    border-color: var(--brand);
    background: rgba(68,0,153,0.06);
    color: var(--brand);
}

/* ── Selectable List Item ── */
.selectable-item {
    background: var(--content-card);
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    border: 1px solid var(--content-border);
    transition: all 0.15s;
}

.selectable-item:hover {
    border-color: var(--brand);
}

.selectable-item.selected {
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(68,0,153,0.12);
}

/* ── Muted Panel ── */
.muted-panel {
    background: var(--content-muted-bg);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--content-border);
}

.muted-panel-lg {
    background: var(--content-muted-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--content-border);
}

/* ── Buttons ── */
.btn-moko-primary {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font-heading);
    box-shadow: 0 4px 20px var(--brand-glow);
    transition: opacity 0.15s;
}

.btn-moko-primary:hover {
    opacity: 0.9;
}

.btn-moko-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-approve {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    background: var(--green);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font-heading);
}

.btn-approve:hover { opacity: 0.9; }

.btn-reject {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    background: var(--red-bg);
    color: var(--red);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font-heading);
}

.btn-reject:hover { background: #fde8e8; }

.btn-edit {
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--content-border);
    background: var(--content-card);
    color: var(--text-body);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font-heading);
}

.btn-edit:hover { border-color: var(--brand); }

.btn-edit-send {
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--amber);
    background: var(--amber-bg);
    color: var(--amber);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font-heading);
}

.btn-escalate {
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--red);
    background: var(--red-bg);
    color: var(--red);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font-heading);
}

.btn-outline {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--content-border);
    background: var(--content-card);
    color: var(--text-body);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-heading);
}

.btn-outline:hover { border-color: var(--brand); }

.btn-run-now {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--blue);
    background: var(--blue-bg);
    color: var(--blue);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-heading);
}

/* ── Form Controls ── */
.moko-input, .moko-textarea, .moko-select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--content-border);
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text-dark);
    background: var(--content-muted-bg);
}

.moko-input:focus, .moko-textarea:focus, .moko-select:focus {
    border-color: var(--brand);
}

.moko-textarea {
    resize: none;
    line-height: 1.7;
}

.moko-select {
    cursor: pointer;
}

/* ── Priority Buttons ── */
.priority-btn {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    border: 1px solid var(--content-border);
    background: var(--content-card);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-heading);
    transition: all 0.15s;
}

.priority-btn.active-critical {
    border-color: var(--red);
    background: rgba(239,68,68,0.06);
    color: var(--red);
}

.priority-btn.active-high {
    border-color: var(--amber);
    background: rgba(245,158,11,0.06);
    color: var(--amber);
}

.priority-btn.active-normal {
    border-color: var(--blue);
    background: rgba(59,130,246,0.06);
    color: var(--blue);
}

.priority-btn.active-low {
    border-color: var(--text-muted);
    background: rgba(136,136,160,0.06);
    color: var(--text-muted);
}

/* ── Quick Action Card ── */
.quick-action {
    background: var(--content-card);
    border: 1px solid var(--content-border);
    border-radius: 12px;
    padding: 14px 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    font-family: var(--font-heading);
}

.quick-action:hover {
    border-color: var(--brand);
}

.quick-action-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.quick-action-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
}

.quick-action-agent {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── Toggle Switch ── */
.toggle-switch {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    border: none;
    padding: 0;
}

.toggle-switch.on {
    background: var(--green);
}

.toggle-switch.off {
    background: #D1D5DB;
}

.toggle-switch-knob {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 2px;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.on .toggle-switch-knob {
    left: 22px;
}

.toggle-switch.off .toggle-switch-knob {
    left: 2px;
}

/* ── Schedule Row ── */
.schedule-row {
    background: var(--content-card);
    border-radius: 14px;
    border: 1px solid var(--content-border);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: opacity 0.2s;
}

.schedule-row.inactive {
    opacity: 0.6;
}

.schedule-cron-badge {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--brand);
    background: rgba(68,0,153,0.03);
    padding: 4px 12px;
    border-radius: 6px;
}

/* ── Score Badges ── */
.score-hot {
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    padding: 2px 10px;
    border-radius: 100px;
    background: var(--hot-red);
    font-family: var(--font-heading);
}

.score-warm {
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    padding: 2px 10px;
    border-radius: 100px;
    background: var(--warm-amber);
    font-family: var(--font-heading);
}

.score-cold {
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    padding: 2px 10px;
    border-radius: 100px;
    background: var(--cold-grey);
    font-family: var(--font-heading);
}

.score-hot-lg {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    padding: 4px 16px;
    border-radius: 100px;
    background: var(--hot-red);
    font-family: var(--font-heading);
}

.score-warm-lg {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    padding: 4px 16px;
    border-radius: 100px;
    background: var(--warm-amber);
    font-family: var(--font-heading);
}

.score-cold-lg {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    padding: 4px 16px;
    border-radius: 100px;
    background: var(--cold-grey);
    font-family: var(--font-heading);
}

/* ── Matched Event Tag ── */
.matched-event-tag {
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 100px;
    background: rgba(68,0,153,0.06);
    color: var(--brand);
    font-weight: 600;
}

/* ── Platform colours ── */
.platform-instagram { color: #E1306C; }
.platform-tiktok { color: #000000; }
.platform-facebook { color: #1877F2; }

/* ── ID Badge ── */
.id-badge {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: #F3F4F6;
    padding: 4px 10px;
    border-radius: 6px;
}

/* ── Pending count badge (amber) ── */
.pending-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--amber);
    background: var(--amber-bg);
    padding: 2px 10px;
    border-radius: 100px;
}

/* ── Grid Layouts ── */
.grid-kpi {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.grid-home {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

.grid-agents {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.grid-content {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    height: calc(100vh - 140px);
}

.grid-lead {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    height: calc(100vh - 140px);
}

.grid-lead-detail {
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 16px;
    height: 100%;
}

.grid-dispatch {
    max-width: 800px;
    margin: 0 auto;
}

.grid-quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.grid-form-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── Filter Row ── */
.filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.filter-row .moko-input {
    flex: 1;
}

/* ── Action message ── */
.action-message {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 12px;
}

.action-message.success {
    background: var(--green-bg);
    color: var(--green);
}

.action-message.error {
    background: var(--red-bg);
    color: var(--red);
}

/* ── Sparkline Label ── */
.sparkline-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    text-align: right;
}

/* ── Schedules ── */
.schedules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.schedules-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Schedule Agent Groups ── */
.schedule-agent-group {
    margin-bottom: 24px;
}

.schedule-agent-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding-left: 4px;
}

.schedule-agent-badge {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    padding: 4px 12px;
    border-radius: 100px;
    font-family: var(--font-heading);
    letter-spacing: 0.03em;
}

/* ── Priority Badges ── */
.priority-badge {
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    padding: 2px 8px;
    border-radius: 100px;
    font-family: var(--font-heading);
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.priority-1 { background: #DC2626; }
.priority-2 { background: #F59E0B; }
.priority-3 { background: #3B82F6; }
.priority-4 { background: #9CA3AF; }

/* ── Job Code Badge ── */
.job-code-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--brand);
    background: rgba(68,0,153,0.06);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ── Approval Badge ── */
.approval-badge {
    font-size: 10px;
    font-weight: 700;
    color: #D97706;
    background: rgba(217,119,6,0.08);
    padding: 2px 8px;
    border-radius: 100px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Flex helpers ── */
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.shrink-0 { flex-shrink: 0; }
.overflow-auto { overflow: auto; }
.text-right { text-align: right; }

@media (max-width: 768px) {
    .grid-home { grid-template-columns: 1fr; }
    .grid-content { grid-template-columns: 1fr; height: auto; }
    .grid-lead { grid-template-columns: 1fr; height: auto; }
    .grid-quick-actions { grid-template-columns: repeat(2, 1fr); }
    .moko-sidebar { display: none; }
}

/* ══════════════════════════════════════════════════════════
   MOKO Loading Screen — Global Loading Component
   ══════════════════════════════════════════════════════════ */

@keyframes moko-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes moko-pulse-glow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(68, 0, 153, 0.3)); }
    50%      { filter: drop-shadow(0 0 20px rgba(68, 0, 153, 0.6)); }
}

@keyframes moko-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.moko-loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background: var(--sidebar, #0D0B14);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    transition: opacity 0.35s ease;
}

.moko-loading-fade-out {
    opacity: 0;
    pointer-events: none;
}

.moko-loading-logo-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: moko-pulse-glow 2s ease-in-out infinite;
}

.moko-loading-logo-wrap img {
    width: 64px;
    height: 64px;
    border-radius: 14px;
}

.moko-loading-spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 120px;
    height: 120px;
    animation: moko-spin 1.4s linear infinite;
}

.moko-loading-spinner circle {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 280;
    stroke-dashoffset: 80;
}

.moko-loading-text {
    margin-top: 24px;
    font-family: var(--font-heading, 'Outfit', sans-serif);
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    animation: moko-fade-in 0.6s ease 0.3s both;
}

.moko-loading-brand {
    margin-top: 8px;
    font-family: var(--font-heading, 'Outfit', sans-serif);
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.08em;
    animation: moko-fade-in 0.6s ease 0.15s both;
}

/* ── Inline loading spinner (for page transitions) ── */

.moko-loading-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    gap: 16px;
}

.moko-loading-inline .moko-loading-logo-wrap {
    width: 80px;
    height: 80px;
}

.moko-loading-inline .moko-loading-logo-wrap img {
    width: 44px;
    height: 44px;
}

.moko-loading-inline .moko-loading-spinner {
    width: 80px;
    height: 80px;
}

.moko-loading-inline .moko-loading-text {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted, #8888A0);
}
