﻿/* ========================================================= 
   GLOBAL BASE
========================================================= */

body {
    margin: 0;
    font-family: Inter, system-ui, sans-serif;
    background: #f8fafc;
    color: #1e293b;
}

/* =========================================================
   AUTH PAGES
========================================================= */

.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f5f6f8;
}

.auth-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.auth-card {
    background: white;
    padding: 32px;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.auth-logo {
    display: block;
    margin: 0 auto 30px auto;
    max-height: 80px;
    max-width: 100%;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-card input {
    width: 100%;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 14px;
    box-sizing: border-box;
    transition: border 0.2s ease;
}

    .auth-card input:focus {
        outline: none;
        border-color: var(--primary);
    }

.auth-button-group {
    display: flex;
    gap: 14px;
    width: 100%;
}

    .auth-button-group .btn {
        flex: 1;
        width: 100%;
    }

.auth-button-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-error {
    color: #dc2626;
    font-size: 13px;
}

/* =========================================================
   BUTTONS
========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 6px;
    border: none;
    height: 40px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s ease;
    gap: 8px;
}

.btn,
.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-outline {
    background: white;
    border: 1px solid #cbd5e1;
    color: #1e293b;
}

.btn-full {
    width: 100%;
}

.btn-compact {
    height: 32px;
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1;
}

.btn:disabled,
.btn-outline:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn:hover:not(:disabled) {
    opacity: 0.92;
}

/* =========================================================
   SPINNER
========================================================= */

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.save-spinner {
    margin-right: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   ADMIN LAYOUT
========================================================= */

.admin-shell {
    min-height: 100vh;
    display: flex;
}

.admin-main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar {
    position: sticky;
    top: 0;
    width: 260px;
    height: 100vh;
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    box-sizing: border-box;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 8px 0 30px rgba(15, 23, 42, 0.04);
    z-index: 1000;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px 22px;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-brand img {
    width: 112px;
    height: auto;
    max-height: 48px;
    object-fit: contain;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 22px 0;
}

.nav a,
.sidebar-subnav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav a i {
    width: 18px;
    flex: 0 0 18px;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    text-align: center;
}

.nav a:hover i,
.nav a.active i {
    color: inherit;
}

.nav a:hover,
.sidebar-subnav a:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.nav a.active,
.sidebar-subnav a.active {
    background: color-mix(in srgb, var(--primary) 10%, white);
    color: color-mix(in srgb, var(--primary) 58%, #0f172a);
}

.sidebar-subnav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: -2px 0 8px;
    padding-left: 12px;
    border-left: 1px solid #e2e8f0;
}

.sidebar-subnav a {
    min-height: 34px;
    padding-left: 14px;
    font-size: 13px;
    font-weight: 500;
    gap: 0;
}

.sidebar-logout {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.sidebar-logout .btn-outline {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-subtitle {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 14px;
}

/* =========================================================
   TABLES
========================================================= */

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

    .table th,
    .table td {
        padding: 14px 16px;
        border-bottom: 1px solid #e2e8f0;
        vertical-align: middle;
    }

    .table th {
        background: #f8fafc;
        font-weight: 600;
        white-space: nowrap;
    }

.truncate {
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

/* =========================================================
   FORMS
========================================================= */

.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #475569;
    font-size: 13px;
}

select,
input,
textarea {
    padding: 10px 14px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 14px;
    box-sizing: border-box;
}

textarea {
    font-family: inherit;
}

/* =========================================================
   STATUS
========================================================= */

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.success {
    background: #22c55e;
}

.failed {
    background: #ef4444;
}

/* =========================================================
   MODAL
========================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 600px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.modal-wide {
    width: min(1180px, 94vw);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =========================================================
   CONTENT MODES
========================================================= */

.content-centered {
    max-width: 1200px;
    width: calc(100% - 60px);
    margin: 0 auto;
    padding: 40px 0;
}

.content-fluid {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

    .content-fluid iframe {
        width: 100%;
        height: 100%;
        border: none;
    }

.fluid-body {
    overflow: hidden;
    height: 100vh;
}

.fluid-body .admin-shell {
    height: 100vh;
    min-height: 0;
}

/* =========================================================
   DASHBOARD
========================================================= */

.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 0 36px;
}

.dashboard-shell-compact {
    padding-top: 12px;
}

.dashboard-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    padding: 28px 30px;
    border-radius: 24px;
    color: #eff6ff;
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--secondary) 34%, white), transparent 34%),
        radial-gradient(circle at bottom right, color-mix(in srgb, var(--primary) 28%, white), transparent 32%),
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--primary) 26%, #0f172a) 0%,
            color-mix(in srgb, var(--secondary) 32%, #102a43) 52%,
            color-mix(in srgb, var(--primary) 18%, #164e63) 100%
        );
    box-shadow: 0 20px 50px color-mix(in srgb, var(--primary) 18%, rgba(15, 23, 42, 0.82));
}

.dashboard-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 11px;
    font-weight: 700;
    color: rgba(226, 232, 240, 0.78);
    margin-bottom: 10px;
}

.dashboard-hero h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.05;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700;
}

.dashboard-hero-copy {
    margin: 14px 0 0;
    max-width: 640px;
    color: rgba(226, 232, 240, 0.9);
    font-size: 15px;
    line-height: 1.6;
}

.dashboard-hero-meta {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 13px;
    white-space: nowrap;
}

.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-kpi-card,
.dashboard-panel {
    background: white;
    border: 1px solid color-mix(in srgb, var(--secondary) 14%, #dbe4ee);
    border-radius: 22px;
    box-shadow: 0 12px 35px color-mix(in srgb, var(--primary) 6%, rgba(15, 23, 42, 0.12));
}

.dashboard-kpi-card {
    position: relative;
    padding: 20px;
    overflow: hidden;
}

.dashboard-kpi-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: var(--accent, var(--primary));
}

.dashboard-kpi-label {
    display: block;
    color: #64748b;
    font-size: 13px;
    margin-bottom: 14px;
}

.dashboard-kpi-card strong {
    display: block;
    font-size: 30px;
    line-height: 1;
    color: #0f172a;
    margin-bottom: 10px;
}

.dashboard-kpi-card span:last-child {
    color: #475569;
    font-size: 13px;
}

.accent-clients { --accent: var(--primary); }
.accent-workers { --accent: color-mix(in srgb, var(--secondary) 78%, #0f766e); }
.accent-jobs { --accent: color-mix(in srgb, var(--primary) 60%, var(--secondary)); }
.accent-bookings { --accent: color-mix(in srgb, var(--secondary) 68%, #1d4ed8); }
.accent-revenue { --accent: color-mix(in srgb, var(--primary) 56%, #ca8a04); }
.accent-ops { --accent: color-mix(in srgb, var(--secondary) 46%, #dc2626); }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-grid-lower {
    grid-template-columns: 1.1fr 1fr;
}

.dashboard-panel {
    padding: 22px;
}

.dashboard-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-panel h2 {
    margin: 0;
    font-size: 20px;
    color: #0f172a;
}

.dashboard-panel p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 14px;
}

.dashboard-panel-metric {
    font-size: 28px;
    line-height: 1;
    font-weight: 700;
    color: color-mix(in srgb, var(--primary) 34%, #0f172a);
}

.dashboard-panel-meta {
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
    text-align: right;
}

.dashboard-chart-panel {
    min-height: 320px;
}

.dashboard-bars {
    height: 220px;
    display: grid;
    grid-template-columns: repeat(30, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
}

.dashboard-bar-col {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: end;
    align-items: center;
    gap: 10px;
}

.dashboard-bar {
    width: 100%;
    min-height: 8px;
    border-radius: 999px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.dashboard-bar-col:hover .dashboard-bar {
    transform: translateY(-2px);
    opacity: 0.9;
}

.dashboard-bar.bookings {
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--secondary) 55%, white) 0%,
        color-mix(in srgb, var(--primary) 82%, #0f172a) 100%
    );
}

.dashboard-bar.revenue {
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 35%, white) 0%,
        color-mix(in srgb, var(--secondary) 70%, #7c2d12) 100%
    );
}

.dashboard-bar-col span {
    font-size: 11px;
    color: #94a3b8;
}

.dashboard-stat-list,
.dashboard-client-list,
.dashboard-activity-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dashboard-stat-row,
.dashboard-client-row,
.dashboard-activity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 4%, white),
        color-mix(in srgb, var(--secondary) 5%, white)
    );
    border: 1px solid color-mix(in srgb, var(--secondary) 10%, #e2e8f0);
}

.dashboard-stat-row span,
.dashboard-client-row span {
    color: #64748b;
    font-size: 13px;
    display: block;
    margin-top: 4px;
}

.dashboard-stat-row strong,
.dashboard-client-value,
.dashboard-activity-row strong {
    color: #0f172a;
}

.dashboard-client-value {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    color: color-mix(in srgb, var(--secondary) 34%, #0f172a);
}

.dashboard-empty {
    margin: 8px 0 0;
    color: #64748b;
}

.utility-hero {
    padding-top: 24px;
    padding-bottom: 24px;
}

.utility-hero-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.utility-page-header {
    margin-bottom: 20px;
}

.utility-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.utility-filter-bar {
    display: flex;
    align-items: end;
    flex-wrap: nowrap;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 4%, white),
        color-mix(in srgb, var(--secondary) 5%, white)
    );
    border: 1px solid color-mix(in srgb, var(--secondary) 10%, #e2e8f0);
}

.utility-modal-footer {
    padding: 20px 0 0;
}

.table-surface {
    border-color: color-mix(in srgb, var(--secondary) 14%, #dbe4ee);
    overflow: hidden;
}

.table-surface th {
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 4%, white),
        color-mix(in srgb, var(--secondary) 6%, white)
    );
}

.event-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 4%, white),
        color-mix(in srgb, var(--secondary) 5%, white)
    );
    border: 1px solid color-mix(in srgb, var(--secondary) 10%, #e2e8f0);
    color: #334155;
}

/* =========================================================
   KNOWLEDGEBASE
========================================================= */

.knowledgebase-shell,
.knowledgebase-detail-shell {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.knowledgebase-header,
.knowledgebase-detail-header {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 24px;
    border: 1px solid color-mix(in srgb, var(--secondary) 14%, #dbe4ee);
    border-radius: 8px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 3%, white),
        color-mix(in srgb, var(--secondary) 5%, white)
    );
}

.knowledgebase-header h1,
.knowledgebase-detail-header h1 {
    margin: 4px 0 0;
    color: #0f172a;
    font-size: 32px;
    line-height: 1.1;
}

.knowledgebase-header p,
.knowledgebase-detail-header p {
    margin: 10px 0 0;
    max-width: 820px;
    color: #64748b;
    line-height: 1.6;
}

.knowledgebase-eyebrow {
    color: color-mix(in srgb, var(--primary) 54%, #334155);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.knowledgebase-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
}

.knowledgebase-search i {
    color: #94a3b8;
}

.knowledgebase-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    padding-left: 0;
}

.knowledgebase-search input:focus {
    outline: none;
}

.knowledgebase-category-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.knowledgebase-category {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.knowledgebase-category:hover,
.knowledgebase-category.active {
    border-color: color-mix(in srgb, var(--primary) 22%, #cbd5e1);
    background: color-mix(in srgb, var(--primary) 7%, white);
    color: color-mix(in srgb, var(--primary) 44%, #0f172a);
}

.knowledgebase-topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.knowledgebase-topic-card {
    display: flex;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--secondary) 14%, #dbe4ee);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 10px 28px color-mix(in srgb, var(--primary) 5%, rgba(15, 23, 42, 0.1));
}

.knowledgebase-topic-card:hover {
    border-color: color-mix(in srgb, var(--primary) 28%, #cbd5e1);
    transform: translateY(-1px);
}

.knowledgebase-topic-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary) 9%, white);
    color: color-mix(in srgb, var(--primary) 58%, #0f172a);
    font-size: 20px;
}

.knowledgebase-topic-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.knowledgebase-topic-body strong {
    color: #0f172a;
    font-size: 16px;
    line-height: 1.3;
}

.knowledgebase-topic-body > span:last-child {
    color: #64748b;
    font-size: 13px;
    line-height: 1.55;
}

.knowledgebase-topic-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.knowledgebase-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.knowledgebase-status-starter {
    background: #ecfdf5;
    color: #047857;
}

.knowledgebase-status-reference {
    background: #eff6ff;
    color: #1d4ed8;
}

.knowledgebase-status-planned {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.knowledgebase-detail-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.knowledgebase-detail-nav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.knowledgebase-article {
    padding: 26px;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    line-height: 1.7;
}

.knowledgebase-article h1 {
    margin: 0 0 18px;
    color: #0f172a;
    font-size: 30px;
    line-height: 1.15;
}

.knowledgebase-article h2 {
    margin: 28px 0 10px;
    color: #0f172a;
    font-size: 21px;
}

.knowledgebase-article h3 {
    margin: 22px 0 8px;
    color: #0f172a;
    font-size: 17px;
}

.knowledgebase-article p {
    margin: 0 0 14px;
}

.knowledgebase-article ul,
.knowledgebase-article ol {
    margin: 0 0 18px;
    padding-left: 24px;
}

.knowledgebase-article li + li {
    margin-top: 7px;
}

.knowledgebase-article code {
    border-radius: 5px;
    background: #f1f5f9;
    color: #0f172a;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.92em;
    padding: 2px 5px;
}

.knowledgebase-article pre {
    margin: 16px 0;
    overflow-x: auto;
    border-radius: 8px;
    background: #0f172a;
}

.knowledgebase-article pre code {
    display: block;
    padding: 14px 16px;
    background: transparent;
    color: #e2e8f0;
    line-height: 1.55;
    white-space: pre;
}

.knowledgebase-related {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.knowledgebase-related h2 {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
}

.knowledgebase-related-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.knowledgebase-related-list a {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    text-decoration: none;
}

.knowledgebase-related-list span {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

/* =========================================================
   AGENT UI
========================================================= */

.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.agent-card {
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 2%, white),
        color-mix(in srgb, var(--secondary) 5%, white)
    );
    border: 1px solid color-mix(in srgb, var(--secondary) 14%, #e2e8f0);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 14px 36px color-mix(in srgb, var(--primary) 6%, rgba(15, 23, 42, 0.12));
}

.agent-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.agent-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-badge {
    background: color-mix(in srgb, var(--secondary) 10%, white);
    border: 1px solid color-mix(in srgb, var(--secondary) 16%, #dbe4ee);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    color: color-mix(in srgb, var(--primary) 26%, #334155);
}

.agent-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #64748b;
}

.agent-guid {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.agent-meta-label {
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.agent-guid code {
    color: #0f172a;
    font: 12px/1.45 Consolas, "Courier New", monospace;
    overflow-wrap: anywhere;
}

.agent-launch {
    display: flex;
    gap: 10px;
}

.launch-buttons {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.agent-launch .launch-buttons {
    display: none;
}

.agent-launch .agent-launch-btn {
    flex: 1;
    height: 32px;
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
    line-height: 1;
}

.agent-card-footer {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.agent-card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.agent-card-actions .agent-launch-btn {
    min-width: 96px;
}

.agent-card-footer .edit-btn {
    margin-left: auto;
}

.icon-btn {
    border: 1px solid color-mix(in srgb, var(--secondary) 14%, #cbd5e1);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 2%, white),
        color-mix(in srgb, var(--secondary) 6%, white)
    );
    border-radius: 10px;
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    cursor: pointer;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    vertical-align: middle;
}

.icon-btn:hover {
    border-color: color-mix(in srgb, var(--primary) 32%, #cbd5e1);
    color: color-mix(in srgb, var(--primary) 42%, #0f172a);
}

.inline-form {
    display: inline;
}

.delivery-actions-cell {
    white-space: nowrap;
    text-align: right;
}

.delivery-actions-cell .icon-btn {
    margin-left: 8px;
}

.delivery-subtext {
    display: inline-block;
    margin-left: 6px;
}

.delivery-details-row td {
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 4%, white),
        color-mix(in srgb, var(--secondary) 6%, white)
    );
    padding: 0;
}

.action-icon-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
    font-size: 16px;
}

.packet-code {
    margin: 0;
    padding: 20px 22px;
    color: #f8fafc;
    background:
        linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(2, 6, 23, 1)),
        repeating-linear-gradient(
            180deg,
            rgba(148, 163, 184, 0.028) 0,
            rgba(148, 163, 184, 0.028) 30px,
            rgba(15, 23, 42, 0) 30px,
            rgba(15, 23, 42, 0) 60px
        );
    border-top: 1px solid #0f172a;
    font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    border-radius: 0 0 10px 10px;
}

.packet-code code {
    color: inherit;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.pagination-summary {
    color: #475569;
    font-size: 14px;
}

.pagination-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-page-size {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    font-size: 13px;
}

.pagination-page-size select {
    min-width: 78px;
    padding: 8px 10px;
}

.pagination-page {
    color: #475569;
    font-size: 14px;
}

.pagination-current {
    pointer-events: none;
}

.pagination-ellipsis {
    color: #64748b;
    padding: 0 2px;
    min-width: 18px;
    text-align: center;
}

.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.empty-state-cell {
    text-align: center;
    color: #64748b;
    padding: 28px 16px;
}

.dashboard-tasks-panel {
    padding-bottom: 28px;
}

.delivery-search-field {
    min-width: 0;
    flex: 0 1 220px;
}

.delivery-search-field input {
    min-width: 0;
    width: 220px;
    max-width: 220px;
}

.deliveries-filter-bar > label:not(.delivery-search-field) {
    flex: 0 0 auto;
}

.deliveries-filter-bar > .btn {
    flex: 0 0 auto;
}

.payload-highlight {
    background: color-mix(in srgb, var(--secondary) 55%, #fde68a);
    color: #0f172a;
    padding: 0 1px;
    border-radius: 3px;
}

.hangfire-frame-shell {
    min-height: 72vh;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--secondary) 14%, #dbe4ee);
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 3%, white),
        color-mix(in srgb, var(--secondary) 6%, white)
    );
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.hangfire-frame-shell iframe {
    width: 100%;
    min-height: 72vh;
    border: none;
    display: block;
    background: white;
}

.settings-shell {
    gap: 20px;
}

.settings-panel {
    padding: 24px;
}

.settings-header {
    align-items: flex-start;
    gap: 16px;
}

.settings-callout {
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: 16px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 5%, white),
        color-mix(in srgb, var(--secondary) 7%, white)
    );
    border: 1px solid color-mix(in srgb, var(--secondary) 12%, #dbe4ee);
    color: #334155;
    line-height: 1.6;
}

.settings-groups {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-group {
    border: 1px solid color-mix(in srgb, var(--secondary) 12%, #dbe4ee);
    border-radius: 20px;
    padding: 20px;
    background: linear-gradient(
        180deg,
        color-mix(in srgb, var(--primary) 2%, white),
        color-mix(in srgb, var(--secondary) 5%, white)
    );
}

.settings-group-header h3 {
    margin: 0;
    font-size: 20px;
}

.settings-group-header p {
    margin: 8px 0 0;
    color: #64748b;
}

.usage-shell {
    gap: 22px;
}

.usage-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.usage-kpi {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 124px;
    padding: 18px;
    border: 1px solid #dbe4ee;
    border-radius: 8px;
    background: #ffffff;
}

.usage-kpi span {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.usage-kpi strong {
    color: #0f172a;
    font-size: 32px;
    line-height: 1;
}

.usage-kpi small {
    color: #64748b;
    line-height: 1.4;
}

.usage-chart-grid,
.usage-tables {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.usage-chart-panel canvas {
    display: block;
    width: 100%;
    min-height: 180px;
}

.usage-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.usage-breakdown-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e2e8f0;
}

.usage-breakdown-row:last-child {
    border-bottom: 0;
}

.usage-breakdown-row strong,
.usage-breakdown-row small {
    display: block;
}

.usage-breakdown-row strong {
    color: #0f172a;
}

.usage-breakdown-row small,
.usage-breakdown-row em {
    color: #64748b;
    font-style: normal;
}

.usage-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.usage-table {
    overflow-x: auto;
}

.usage-empty {
    margin: 0;
    color: #64748b;
}

.settings-variable-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 18px;
    border-top: 1px solid #e2e8f0;
}

.settings-variable-card {
    padding: 18px;
    border-radius: 18px;
    background: white;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-variable-row {
    display: grid;
    grid-template-columns: minmax(260px, 0.85fr) minmax(360px, 1.15fr);
    gap: 24px;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid #e2e8f0;
}

.settings-variable-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.settings-variable-key,
.settings-variable-meta {
    font-size: 12px;
    color: #64748b;
}

.settings-variable-copy {
    margin: 0;
    color: #334155;
    font-size: 14px;
    line-height: 1.6;
}

.settings-variable-copy strong {
    display: block;
    color: #0f172a;
    font-size: 15px;
    margin-bottom: 4px;
}

.settings-variable-copy p {
    margin: 0;
}

.settings-variable-control input {
    width: 100%;
}

.settings-source-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.settings-badge {
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    background: #eef2ff;
    color: #3730a3;
}

.settings-badge-warn {
    background: #fff7ed;
    color: #9a3412;
}

@media (max-width: 760px) {
    .settings-variable-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.settings-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.settings-search {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 280px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settings-form > div > label,
.settings-form label > span {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-size: 13px;
}

.settings-form-note {
    margin: 16px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

.client-checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
    padding: 4px 2px 2px;
}

.client-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.client-child-toggle {
    margin: 10px 0 12px;
}

.scope-badge-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 360px;
}

.scope-checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
}

.scope-checkbox-group {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    padding: 14px;
}

.scope-checkbox-group h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #0f172a;
}

.scope-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #e2e8f0;
}

.scope-checkbox-item:first-of-type {
    border-top: none;
}

.scope-checkbox-item strong,
.scope-checkbox-item small {
    display: block;
}

.scope-checkbox-item small {
    margin-top: 3px;
    color: #64748b;
    line-height: 1.4;
}

.generated-key-panel {
    padding: 14px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.generated-key-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: 8px;
}

.generated-key-row input {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (max-width: 900px) {
    .admin-shell {
        flex-direction: column;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        flex-basis: auto;
        padding: 14px 16px;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }

    .sidebar-brand {
        padding: 0 0 12px;
    }

    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 14px 0 0;
    }

    .nav a,
    .sidebar-subnav a {
        min-height: 36px;
        padding: 0 10px;
    }

    .sidebar-subnav {
        flex-direction: row;
        flex-wrap: wrap;
        margin: 0;
        padding-left: 0;
        border-left: none;
    }

    .sidebar-logout {
        margin-top: 14px;
    }

    .content-centered {
        width: calc(100% - 32px);
        padding: 28px 0;
    }

    .deliveries-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .deliveries-filter-bar {
        width: 100%;
    }

    .deliveries-filter-bar label,
    .deliveries-filter-bar input,
    .deliveries-filter-bar select {
        width: 100%;
    }

    .delivery-actions-cell {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
    }

    .delivery-actions-cell .icon-btn {
        margin-left: 0;
    }

    .settings-toolbar {
        justify-content: stretch;
    }

    .settings-search {
        min-width: 0;
        width: 100%;
    }

    .usage-kpis,
    .usage-chart-grid,
    .usage-tables {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   AGENT TEST PANEL
========================================================= */

.agent-viewer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 520px;
    height: 100%;
    background: white;
    box-shadow: -4px 0 10px rgba(0,0,0,0.15);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 2000;
}

    .agent-viewer.open {
        right: 0;
    }

.agent-viewer-header {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.agent-viewer iframe {
    flex: 1;
    border: none;
}

.video-container {
    height: 45%;
    min-height: 260px;
    background: #fafafa;
}

#toolLogs {
    height: 55%;
    overflow-y: auto;
    border-top: 1px solid #eee;
    padding: 10px;
    font-size: 13px;
    background: #fff;
}

.tool-log {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
}

.tool-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tool-log-title {
    font-weight: 600;
}

.tool-log-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tool-log-toggle {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    color: #555;
}

.tool-result {
    background: #fafafa;
    padding: 8px;
    margin-top: 8px;
    font-family: monospace;
    font-size: 12px;
    white-space: pre-wrap;
    display: none;
    border-radius: 6px;
    overflow-x: auto;
}

.tool-empty {
    color: #777;
    font-size: 13px;
    padding: 6px 2px;
}

.tool-status {
    font-size: 12px;
    color: #666;
}

/* =========================================================
   AGENT FORM
========================================================= */

.prompt-editor {
    width: 100%;
    min-height: 160px;
    font-family: ui-monospace, Menlo, monospace;
    resize: vertical;
    white-space: pre-wrap;
    overflow-x: hidden;
}

.agent-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.agent-modal-subtitle {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}

    .form-row > div {
        flex: 1;
    }

.form-row-single > div {
    max-width: 320px;
}

.agent-form-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.agent-form-section-sticky {
    position: sticky;
    top: 0;
}

.agent-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.agent-section-header h3 {
    margin: 0;
    font-size: 16px;
}

.agent-section-header p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.agent-form-section label {
    display: block;
    margin-bottom: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
}

.agent-form-section input:not([type="checkbox"]),
.agent-form-section select,
.agent-form-section textarea {
    width: 100%;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    background: #f8fafc;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.agent-knowledge-panel {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.agent-knowledge-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.agent-knowledge-header small {
    color: #64748b;
    font-size: 12px;
    line-height: 1.5;
    max-width: 280px;
    text-align: right;
}

.knowledge-files-list {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    min-height: 52px;
    max-height: 180px;
    overflow-y: auto;
    padding: 10px;
}

.knowledge-file-empty {
    color: #64748b;
    font-size: 13px;
}

.knowledge-file-item {
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.knowledge-file-item + .knowledge-file-item {
    margin-top: 8px;
}

.knowledge-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.knowledge-upload-row input[type="file"] {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    background: #fff;
}

.tool-list {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    background: #f8fafc;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.tool-item {
    padding: 10px 8px;
    border-radius: 10px;
}

    .tool-item + .tool-item {
        margin-top: 6px;
    }

    .tool-item:hover {
        background: #fff;
}

    .tool-item label {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        font-weight: 600;
    }

    .tool-item small {
        display: block;
        margin-left: 22px;
        font-size: 12px;
        color: #64748b;
        white-space: normal;
        word-break: break-word;
    }

.agent-edit-modal .modal-body {
    overflow-x: hidden;
}

.agent-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
    gap: 24px;
    align-items: flex-start;
}

.agent-form-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.agent-form-side {
    min-width: 280px;
}

.personality-preview {
    display: none;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    padding: 12px;
    margin-top: 0;
    margin-bottom: 14px;
    background: linear-gradient(180deg, #f8fbff 0%, #f8fafc 100%);
}

/* =========================================================
   MCP WORKBENCH
========================================================= */

.mcp-workbench-shell {
    gap: 20px;
}

.mcp-instructions {
    border-radius: 8px;
}

.mcp-status {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
}

.mcp-status-connected {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.mcp-status-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.mcp-setup-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.mcp-setup-step {
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
}

.mcp-setup-step strong,
.mcp-setup-step code {
    display: block;
}

.mcp-setup-step strong {
    margin-bottom: 8px;
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
}

.mcp-setup-step code {
    color: #0f172a;
    font-size: 13px;
    word-break: break-word;
}

.mcp-code-panel {
    margin-top: 16px;
}

.mcp-code-panel summary {
    cursor: pointer;
    color: #334155;
    font-weight: 700;
}

.mcp-example-stack {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}

.mcp-example-stack strong {
    display: block;
    margin-bottom: 8px;
    color: #334155;
    font-size: 13px;
}

.mcp-workbench {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.mcp-tool-browser,
.mcp-detail-panel,
.mcp-result-panel {
    border-radius: 8px;
}

.mcp-tool-browser {
    position: sticky;
    top: 22px;
    background: #fff;
    border: 1px solid #dbe4ee;
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.08);
    min-height: 520px;
    max-height: calc(100vh - 120px);
    overflow: hidden;
}

.mcp-tool-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.mcp-tool-search i {
    color: #64748b;
}

.mcp-tool-search input {
    width: 100%;
    min-width: 0;
    background: #fff;
}

.mcp-tool-list {
    height: calc(100% - 65px);
    max-height: calc(100vh - 185px);
    overflow-y: auto;
    padding: 8px;
}

.mcp-tool-row {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #1e293b;
    text-align: left;
    cursor: pointer;
}

.mcp-tool-row + .mcp-tool-row {
    margin-top: 4px;
}

.mcp-tool-row:hover,
.mcp-tool-row.selected {
    background: color-mix(in srgb, var(--primary) 5%, #fff);
    border-color: color-mix(in srgb, var(--primary) 18%, #dbe4ee);
}

.mcp-tool-row strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.3;
    word-break: break-word;
}

.mcp-tool-row span {
    display: -webkit-box;
    margin-top: 5px;
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.mcp-tool-empty {
    padding: 18px 12px;
    color: #64748b;
    font-size: 13px;
}

.mcp-tool-detail {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.mcp-detail-header {
    align-items: start;
}

.mcp-detail-header h2 {
    word-break: break-word;
}

.mcp-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
    gap: 16px;
}

.mcp-editor-panel,
.mcp-schema-panel {
    min-width: 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    overflow: hidden;
}

.mcp-panel-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

#mcpArguments,
#mcpSchema,
#mcpResult {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #0f172a;
    color: #e2e8f0;
    font: 13px/1.55 Consolas, "Courier New", monospace;
    tab-size: 2;
    white-space: pre;
    overflow: auto;
}

#mcpArguments {
    display: block;
    height: 390px;
    resize: vertical;
}

#mcpSchema {
    height: 390px;
    padding: 12px;
    box-sizing: border-box;
}

.mcp-run-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.mcp-run-row span {
    color: #64748b;
    font-size: 12px;
    line-height: 1.4;
}

#mcpResult {
    min-height: 260px;
    padding: 14px;
    box-sizing: border-box;
}

#mcpResult.mcp-result-empty {
    color: #94a3b8;
}

#mcpResult.mcp-result-error {
    color: #fecaca;
}

    .personality-preview.active {
        display: block;
    }

.personality-preview-video {
    width: 100%;
    max-height: 240px;
    border-radius: 6px;
    background: #000;
    display: block;
}

.personality-preview-name {
    margin-top: 8px;
    font-weight: 600;
}

.personality-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0;
    max-height: 460px;
    overflow-y: auto;
    padding-right: 4px;
}

.personality-card {
    border: 1px solid #dbe4f0;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    border-radius: 12px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

    .personality-card:hover {
        border-color: #94a3b8;
        box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
        transform: translateY(-1px);
    }

    .personality-card video {
        width: 100%;
        border-radius: 8px;
        display: block;
        background: #f3f3f3;
    }

    .personality-card.selected {
        border-color: #0f172a;
        box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.1);
    }

    .personality-card .personality-name {
        margin-top: 6px;
        font-size: 12px;
        line-height: 1.3;
        word-break: break-word;
    }

@media (max-width: 980px) {
    .dashboard-kpis,
    .dashboard-grid,
    .dashboard-grid-lower {
        grid-template-columns: 1fr;
    }

    .dashboard-hero {
        flex-direction: column;
    }

    .dashboard-bars {
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 8px;
    }

    .dashboard-bar-col {
        min-width: 16px;
    }

    .agent-form-layout {
        grid-template-columns: 1fr;
    }

    .agent-form-main,
    .agent-form-side {
        width: 100%;
        min-width: 0;
    }

    .agent-form-section-sticky {
        position: static;
    }

    .agent-knowledge-header,
    .knowledge-upload-row {
        flex-direction: column;
        align-items: stretch;
    }

    .agent-knowledge-header small {
        max-width: none;
        text-align: left;
    }

    .personality-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        max-height: 320px;
    }

    .mcp-workbench,
    .mcp-setup-grid,
    .mcp-detail-grid {
        grid-template-columns: 1fr;
    }

    .mcp-tool-browser {
        position: static;
        min-height: 260px;
        max-height: 380px;
    }

    .mcp-tool-list {
        max-height: 315px;
    }
}
