/* RiskAss LLM Fallback — admin panel */
.rllm-container {
    max-width: none;
    width: 100%;
    margin: 20px 0;
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    color: #323130;
    box-sizing: border-box;
}
.rllm-container * { box-sizing: border-box; }

.rllm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    background: linear-gradient(135deg, #0078d4 0%, #106ebe 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
    flex-wrap: wrap;
    gap: 12px;
}
.rllm-header h1 {
    margin: 0; font-size: 19px; font-weight: 600; color: #fff;
    letter-spacing: -0.01em;
}
.rllm-status { display: flex; gap: 8px; flex-wrap: wrap; }
.rllm-pill {
    display: inline-block; padding: 4px 10px; font-size: 10.5px; font-weight: 600;
    border-radius: 10px; background: rgba(255,255,255,0.18); color: #fff;
    text-transform: uppercase; letter-spacing: .4px;
}
.rllm-pill.ok   { background: #107c10; }
.rllm-pill.ko   { background: #a4262c; }
.rllm-pill.warn { background: #c29500; }
.rllm-pill.gemini { background: #4285f4; color: #fff; }
.rllm-pill.claude { background: #d97706; color: #fff; }
.rllm-pill.grok   { background: #7c3aed; color: #fff; }

.rllm-tabs {
    display: flex; background: #fff;
    border-bottom: 1px solid #e6e8ec;
    padding: 0 16px;
    overflow-x: auto;
}
.rllm-tab {
    background: none; border: none;
    padding: 14px 18px; cursor: pointer;
    font-size: 13px; font-weight: 500; color: #6b7280;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
    font-family: inherit;
}
.rllm-tab:hover { color: #1d1f23; }
.rllm-tab.active {
    color: #0078d4; border-bottom-color: #0078d4;
    font-weight: 600;
}

.rllm-panel {
    display: none;
    padding: 28px clamp(16px, 2.5vw, 28px);
    background: #fff;
    border: 1px solid #e6e8ec;
    border-top: none;
    border-radius: 0 0 12px 12px;
}
.rllm-panel.active { display: block; }
.rllm-panel h2 {
    margin: 0 0 6px 0;
    font-size: 18px; font-weight: 600;
    color: #1d1f23;
    letter-spacing: -0.01em;
}
.rllm-panel > p.muted {
    margin-top: 0;
    font-size: 13px;
}
.rllm-panel h3 {
    margin: 28px 0 12px 0;
    font-size: 13px; font-weight: 600;
    color: #1d1f23;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .5px;
    color: #6b7280;
}
.muted { color: #6b7280; }
.small { font-size: 11px; }
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    background: #f1f3f6;
    color: #1d1f23;
    padding: 1px 6px;
    border-radius: 4px;
}

/* Form row moderna */
.rllm-form .rllm-row {
    display: flex; align-items: center; gap: 14px;
    margin: 10px 0;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}
.rllm-form .rllm-row:hover { border-color: #e0e3e8; }
.rllm-form .rllm-row label {
    min-width: 240px; font-weight: 500; font-size: 13px;
    color: #1d1f23;
}
.rllm-form .rllm-row input[type="text"],
.rllm-form .rllm-row input[type="password"],
.rllm-form .rllm-row input[type="number"],
.rllm-form .rllm-row select {
    min-width: 280px;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #e6e8ec;
    border-radius: 8px;
    background: #fff;
    color: #1d1f23;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.rllm-form .rllm-row input:focus,
.rllm-form .rllm-row select:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 3px rgba(0,120,212,.12);
}
.rllm-toggle { display: inline-flex !important; align-items: center; gap: 8px; min-width: 0 !important; cursor: pointer; }
.rllm-toggle input { width: 16px; height: 16px; accent-color: #0078d4; }

.rllm-btn {
    padding: 9px 18px;
    font-size: 13px; font-weight: 500;
    border: 1px solid #e6e8ec;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    color: #1d1f23;
    transition: all .15s;
    font-family: inherit;
}
.rllm-btn:hover { background: #f5f7fa; border-color: #d1d5db; }
.rllm-btn.primary {
    background: #0078d4; color: #fff; border-color: #0078d4;
    box-shadow: 0 1px 2px rgba(0,120,212,.15);
}
.rllm-btn.primary:hover { background: #106ebe; border-color: #106ebe; }
.rllm-btn-test {
    padding: 6px 14px; font-size: 12px;
    border: 1px solid #e6e8ec;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    color: #1d1f23;
    transition: all .15s;
    font-family: inherit;
}
.rllm-btn-test:hover { background: #f5f7fa; border-color: #0078d4; color: #0078d4; }
.rllm-btn-test:disabled { opacity: .6; cursor: default; }
.rllm-test-result { font-size: 12px; font-weight: 600; }
.rllm-test-result.ok   { color: #16a34a; }
.rllm-test-result.fail { color: #dc2626; }

/* Table base modernizzata (usata nei pannelli non-dashboard) */
.rllm-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12.5px;
    background: #fff;
    border: 1px solid #eef0f3;
    border-radius: 10px;
    overflow: hidden;
}
.rllm-table th,
.rllm-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eef0f3;
}
.rllm-table tr:last-child td { border-bottom: none; }
.rllm-table th {
    background: #fafbfc;
    font-weight: 600;
    color: #9aa0a6;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: .5px;
}
.rllm-table input[type="number"] {
    width: 90px; padding: 5px 8px; font-size: 12px;
    border: 1px solid #e6e8ec;
    border-radius: 6px;
    color: #1d1f23;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.rllm-table input[type="number"]:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 3px rgba(0,120,212,.12);
}
.rllm-table tr.is-error td { background: #fef2f2; }
.rllm-table tbody tr { transition: background .12s; }
.rllm-table tbody tr:hover td { background: #fafbfc; }

.rllm-log .rllm-pill { font-size: 9px; padding: 2px 6px; }

/* Test mode banner + pill selector */
.rllm-test-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    background: linear-gradient(90deg, #fef3c7 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
    border-radius: 10px;
    margin-bottom: 12px;
    color: #7f1d1d;
    flex-wrap: wrap;
}
.rllm-test-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 280px;
}
.rllm-test-banner-text strong {
    font-size: 14px;
    letter-spacing: .2px;
}
.rllm-test-banner-text span {
    font-size: 12.5px;
    color: #991b1b;
}
.rllm-test-ttl {
    font-size: 11px !important;
    color: #b91c1c !important;
    font-weight: 600;
    margin-top: 2px;
}

.rllm-testmode-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
@media (max-width: 900px) { .rllm-testmode-pills { grid-template-columns: 1fr; } }

.rllm-testmode-pill {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 16px;
    background: #fff;
    border: 2px solid #e6e8ec;
    border-radius: 12px;
    cursor: pointer;
    transition: all .15s;
}
.rllm-testmode-pill:hover { border-color: #d1d5db; }
.rllm-testmode-pill input[type="radio"] { margin-top: 2px; }
.rllm-testmode-pill div { display: flex; flex-direction: column; gap: 4px; }
.rllm-testmode-pill strong { font-size: 13.5px; color: #1d1f23; }
.rllm-testmode-pill.active { border-color: #16a34a; background: #f0fdf4; }
.rllm-testmode-pill.active.warn { border-color: #f59e0b; background: #fffbeb; }
.rllm-testmode-pill.active.err { border-color: #dc2626; background: #fef2f2; }
.rllm-testmode-pill.active strong { color: #065f46; }
.rllm-testmode-pill.active.warn strong { color: #78350f; }
.rllm-testmode-pill.active.err strong { color: #7f1d1d; }

/* Pricing table filter bar (tab Modelli) */
.rllm-pricing-filterbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin: 8px 0 12px 0;
    padding: 12px 14px;
    background: #faf9f8;
    border: 1px solid #eef0f3;
    border-radius: 10px;
}
.rllm-pricing-search {
    flex: 1;
    min-width: 220px;
    padding: 7px 12px;
    font-size: 13px;
    border: 1px solid #e6e8ec;
    border-radius: 8px;
    background: #fff;
    color: #1d1f23;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.rllm-pricing-search:focus {
    outline: none;
    border-color: #0078d4;
    box-shadow: 0 0 0 3px rgba(0,120,212,.12);
}
.rllm-pricing-provider-pills {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: #f1f3f6;
    border-radius: 10px;
}
.rllm-pricing-provider-pills .rllm-pill-btn {
    background: transparent;
    border: none;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.rllm-pricing-provider-pills .rllm-pill-btn:hover { color: #1d1f23; }
.rllm-pricing-provider-pills .rllm-pill-btn.active {
    background: #fff;
    color: #1d1f23;
    box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 0 0 1px rgba(15,23,42,.04);
}
.rllm-pricing-provider-pills .rllm-pill-count {
    font-size: 10px;
    font-weight: 600;
    color: #9aa0a6;
    background: rgba(15,23,42,.06);
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.rllm-pricing-provider-pills .rllm-pill-btn.active .rllm-pill-count {
    color: #0078d4;
    background: rgba(0,120,212,.12);
}

/* KPI legacy (non dashboard) — lasciati per retrocompat ma rimodernizzati */
.rllm-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 16px 0 24px; }
@media (max-width: 900px) { .rllm-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .rllm-kpis { grid-template-columns: repeat(2, 1fr); } }
.rllm-kpi {
    padding: 16px;
    border: 1px solid #e6e8ec;
    border-radius: 10px;
    background: #fff;
    text-align: center;
}
.rllm-kpi .val { font-size: 22px; font-weight: 700; color: #0078d4; letter-spacing: -0.02em; }
.rllm-kpi .lbl { font-size: 10.5px; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; font-weight: 600; }

.rllm-saved {
    padding: 12px 16px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-left: 3px solid #16a34a;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 13px;
    color: #065f46;
}
.rllm-notice {
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 3px solid #f59e0b;
    border-radius: 8px;
    font-size: 13px;
    color: #78350f;
}

.rllm-service-status { display: inline-flex; align-items: center; gap: 8px; }
.rllm-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.rllm-dot-green { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.18); animation: rllm-pulse-green 2s infinite; }
.rllm-dot-red   { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.18); }
.rllm-dot-amber { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
@keyframes rllm-pulse-green {
    0%, 100% { box-shadow: 0 0 0 3px rgba(22,163,74,0.18); }
    50%      { box-shadow: 0 0 0 6px rgba(22,163,74,0.08); }
}

/* Provider card grid (tab Chiavi API) */
.rllm-provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.rllm-provider-card {
    background: #fff;
    border: 1px solid #e6e8ec;
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
    transition: transform .18s ease, box-shadow .18s ease, border-color .15s;
}
.rllm-provider-card:hover {
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -4px rgba(15,23,42,.08);
}
.rllm-provider-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-bottom: 12px;
}
.rllm-provider-name {
    font-size: 15px; font-weight: 600; color: #1d1f23;
    display: inline-flex; align-items: center; gap: 8px;
    letter-spacing: -0.01em;
}
.rllm-chip {
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
    color: #1e40af; background: #dbeafe; padding: 3px 8px; border-radius: 10px;
}
.rllm-provider-state {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: #16a34a;
}
.rllm-provider-usage {
    display: flex; align-items: center; gap: 10px;
    padding-top: 12px; border-top: 1px dashed #eef0f3;
}
.rllm-usage-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: #9aa0a6; font-weight: 600; flex-shrink: 0; }
.rllm-usage-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.rllm-usage-tag {
    font-size: 11px; color: #6b7280; background: #f1f3f6;
    padding: 2px 8px; border-radius: 6px;
}

/* ================= Dashboard v2 — modern fullwidth ================= */
.rllm-panel-dashboard {
    padding: 0 !important;
    background: #f5f7fa !important;
    border: none !important;
    border-radius: 0 !important;
    width: 100%;
}
.rllm-panel-dashboard h3 { margin: 0; }
.rllm-dash-wrap {
    width: 100%;
    margin: 0;
    padding: 24px clamp(16px, 2.5vw, 28px) 48px;
    color: #1d1f23;
    box-sizing: border-box;
}

/* Toolbar */
.rllm-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e6e8ec;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.rllm-toolbar-left, .rllm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Range pills (segmented control style) */
.rllm-toolbar .rllm-range-pills {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    background: #f1f3f6;
    border-radius: 10px;
    border: none;
}
.rllm-toolbar .rllm-pill-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.rllm-toolbar .rllm-pill-btn:hover { color: #1d1f23; }
.rllm-toolbar .rllm-pill-btn.active {
    background: #fff;
    color: #1d1f23;
    box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 0 0 1px rgba(15,23,42,.04);
}

.rllm-toolbar .rllm-custom-range {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 3px 8px;
    background: #f1f3f6;
    border-radius: 8px;
    border: none;
}
.rllm-toolbar .rllm-custom-range input[type="date"] {
    padding: 4px 8px;
    border: 1px solid #e6e8ec; border-radius: 6px;
    font-size: 12px;
    background: #fff;
    color: #1d1f23;
    font-family: inherit;
}

.rllm-select-wrap {
    display: flex; align-items: center; gap: 8px;
}
.rllm-select-wrap label {
    font-size: 11px;
    color: #9aa0a6;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.rllm-select-wrap select {
    padding: 6px 28px 6px 10px;
    border: 1px solid #e6e8ec;
    border-radius: 8px;
    font-size: 12.5px;
    background: #fff;
    color: #1d1f23;
    cursor: pointer;
    min-width: 130px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color .15s, box-shadow .15s;
}
.rllm-select-wrap select:hover,
.rllm-select-wrap select:focus {
    border-color: #0078d4;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,120,212,.12);
}

.rllm-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid #e6e8ec; background: #fff;
    border-radius: 8px; color: #6b7280; cursor: pointer;
    transition: all .15s;
}
.rllm-icon-btn:hover {
    color: #0078d4; border-color: #0078d4;
    background: rgba(0,120,212,.04);
}
.rllm-last-refresh { font-size: 11px; color: #9aa0a6; }
.rllm-btn-sm { padding: 5px 10px !important; font-size: 11.5px !important; }

/* KPI grid */
.rllm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
@media (max-width: 1400px) { .rllm-kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .rllm-kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.rllm-kpi-card {
    background: #fff;
    border: 1px solid #e6e8ec;
    border-radius: 10px;
    padding: 11px 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
    transition: transform .18s ease, box-shadow .18s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 12px;
}
.rllm-kpi-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -3px rgba(15,23,42,.08);
}
.rllm-kpi-card::before {
    content: ''; position: absolute;
    top: 0; left: 0; width: 3px; height: 100%;
    background: var(--rllm-accent, #0078d4);
    opacity: .85;
}
.rllm-accent-blue   { --rllm-accent: #4f7df6; }
.rllm-accent-green  { --rllm-accent: #16a34a; }
.rllm-accent-purple { --rllm-accent: #8b5cf6; }
.rllm-accent-orange { --rllm-accent: #f59e0b; }
.rllm-accent-red    { --rllm-accent: #dc2626; }
.rllm-accent-teal   { --rllm-accent: #0ea5e9; }

.rllm-kpi-body { flex: 1; min-width: 0; }
.rllm-kpi-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 6px;
    margin-bottom: 2px;
}
.rllm-kpi-icon {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--rllm-accent);
    background: color-mix(in srgb, var(--rllm-accent) 12%, transparent);
    border-radius: 8px;
    flex-shrink: 0;
}
/* Fallback per browser senza color-mix */
@supports not (background: color-mix(in srgb, red, blue)) {
    .rllm-accent-blue   .rllm-kpi-icon { background: rgba(79,125,246,.12); }
    .rllm-accent-green  .rllm-kpi-icon { background: rgba(22,163,74,.12); }
    .rllm-accent-purple .rllm-kpi-icon { background: rgba(139,92,246,.12); }
    .rllm-accent-orange .rllm-kpi-icon { background: rgba(245,158,11,.12); }
    .rllm-accent-red    .rllm-kpi-icon { background: rgba(220,38,38,.12); }
    .rllm-accent-teal   .rllm-kpi-icon { background: rgba(14,165,233,.12); }
}

.rllm-kpi-delta {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 10px; font-weight: 600;
    padding: 1px 6px;
    border-radius: 5px;
    line-height: 1.4;
    flex-shrink: 0;
    white-space: nowrap;
}
.rllm-kpi-delta:empty { display: none; }
.rllm-kpi-delta.up    { color: #0f766e; background: #ccfbf1; }
.rllm-kpi-delta.down  { color: #b91c1c; background: #fee2e2; }
.rllm-kpi-delta.flat  { color: #6b7280; background: #f3f4f6; }
/* Per fallback% e error% l'up è peggio (rosso) e down è meglio (verde) */
.rllm-kpi-card[data-kpi-card="fallback_rate"] .rllm-kpi-delta.up,
.rllm-kpi-card[data-kpi-card="error_rate"] .rllm-kpi-delta.up,
.rllm-kpi-card[data-kpi-card="avg_latency"] .rllm-kpi-delta.up { color: #b91c1c; background: #fee2e2; }
.rllm-kpi-card[data-kpi-card="fallback_rate"] .rllm-kpi-delta.down,
.rllm-kpi-card[data-kpi-card="error_rate"] .rllm-kpi-delta.down,
.rllm-kpi-card[data-kpi-card="avg_latency"] .rllm-kpi-delta.down { color: #0f766e; background: #ccfbf1; }

.rllm-kpi-val {
    font-size: 17px;
    font-weight: 700;
    color: #1d1f23;
    letter-spacing: -0.02em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rllm-kpi-lbl {
    font-size: 10px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Grid 12 colonne */
.rllm-grid-12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}
.rllm-span-3  { grid-column: span 3; min-width: 0; }
.rllm-span-4  { grid-column: span 4; min-width: 0; }
.rllm-span-6  { grid-column: span 6; min-width: 0; }
.rllm-span-8  { grid-column: span 8; min-width: 0; }
.rllm-span-12 { grid-column: span 12; min-width: 0; }
@media (max-width: 1400px) {
    .rllm-span-3 { grid-column: span 6; }
}
@media (max-width: 1100px) {
    .rllm-span-3, .rllm-span-4, .rllm-span-8, .rllm-span-6 { grid-column: span 12; }
}

/* Card */
.rllm-card {
    background: #fff;
    border: 1px solid #e6e8ec;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.rllm-card-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; margin-bottom: 16px;
}
.rllm-card-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d1f23;
    letter-spacing: -0.01em;
}
.rllm-card-sub {
    margin: 3px 0 0 0;
    font-size: 11.5px;
    color: #6b7280;
    font-weight: 400;
    line-height: 1.3;
}
.rllm-legend {
    display: inline-flex; gap: 14px;
    font-size: 11.5px; color: #6b7280;
}
.rllm-dot-sm {
    display: inline-block; width: 8px; height: 8px;
    border-radius: 3px; margin-right: 5px;
    vertical-align: middle;
}

.rllm-chart-box { position: relative; height: 260px; }
.rllm-chart-tall { height: 320px; }
.rllm-chart-mid  { height: 340px; }
.rllm-chart-sm   { height: 240px; }

.rllm-table-scroll { max-height: 380px; overflow: auto; }
.rllm-table-scroll-sm { max-height: 240px; overflow: auto; }
.rllm-table-compact th,
.rllm-table-compact td {
    padding: 7px 8px;
    font-size: 11.5px;
}
.rllm-table-compact code { font-size: 11px; padding: 1px 4px; }
.rllm-table-clean {
    width: 100%;
    font-size: 12.5px;
    border-collapse: collapse;
    margin: 0;
}
.rllm-table-clean th {
    background: #fff;
    font-size: 10.5px;
    color: #9aa0a6;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eef0f3;
    position: sticky; top: 0;
    z-index: 1;
}
.rllm-table-clean td {
    padding: 10px 12px;
    border-bottom: 1px solid #eef0f3;
    color: #1d1f23;
    vertical-align: middle;
}
.rllm-table-clean tr:last-child td { border-bottom: none; }
.rllm-table-clean tbody tr { transition: background .12s; }
.rllm-table-clean tbody tr:hover td { background: #f5f7fa; }
.rllm-table-clean tr.is-error td { background: #fef2f2; }
.rllm-table-clean tr.is-error:hover td { background: #fee2e2; }

.rllm-badge-soft {
    font-size: 10.5px;
    font-weight: 600;
    color: #6b7280;
    background: #f1f3f6;
    padding: 4px 10px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

/* Pill provider nelle righe log più moderne */
.rllm-table-clean .rllm-pill {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .3px;
    background: #f3f4f6;
    color: #1d1f23;
}
.rllm-table-clean .rllm-pill.gemini { background: #e1efff; color: #1e40af; }
.rllm-table-clean .rllm-pill.claude { background: #ffedd5; color: #92400e; }
.rllm-table-clean .rllm-pill.grok   { background: #ede9fe; color: #6d28d9; }

/* Loading */
.rllm-panel-dashboard.is-loading .rllm-dash-wrap {
    opacity: .55;
    transition: opacity .15s;
    pointer-events: none;
}
.rllm-panel-dashboard.is-loading::after {
    content: '';
    position: fixed;
    top: 90px; right: 40px;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2.5px solid rgba(0,120,212,.2);
    border-top-color: #0078d4;
    animation: rllm-spin .8s linear infinite;
    z-index: 999;
}
@keyframes rllm-spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 900px) {
    .rllm-toolbar { padding: 10px 12px; gap: 10px; }
    .rllm-toolbar-left, .rllm-toolbar-right { gap: 10px; }
    .rllm-toolbar .rllm-range-pills { flex-wrap: wrap; border-radius: 10px; }
    .rllm-kpi-val { font-size: 22px; }
    .rllm-card { padding: 14px 16px; }
}
