/* A2A Directo Import - Directo-Style UI Theme */

:root {
    /* Directo-inspired color palette */
    --sidebar-bg: #2c3567;
    --sidebar-hover: #3a4580;
    --sidebar-active: #1e2750;
    --sidebar-header: #3d4a82;
    --sidebar-text: #c5cce6;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 220px;

    /* Content area */
    --toolbar-bg: #eef1f7;
    --toolbar-border: #c8cfdf;
    --content-bg: #ffffff;
    --page-bg: #f0f2f6;

    /* Primary colors */
    --primary: #1a3c8a;
    --primary-dark: #122a63;
    --primary-light: #3b5eb5;
    --link-color: #1a3c8a;
    --link-hover: #0f2460;

    /* Accent */
    --accent: #4a6eb5;
    --success: #28854b;
    --warning: #c08b1a;
    --danger: #b83232;
    --info: #2a6496;

    /* Table */
    --th-bg: #dce2ef;
    --th-color: #1a2a52;
    --td-border: #dce2ef;
    --tr-hover: #f2f5fb;
    --tr-alt: #f7f9fc;

    /* Form */
    --input-border: #b0b8cc;
    --input-focus: #4a6eb5;
    --input-bg: #ffffff;

    /* Text */
    --text-primary: #1a2340;
    --text-secondary: #4a5568;
    --text-muted: #8892a6;

    /* Misc */
    --border: #d0d7e5;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 3px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    background: var(--page-bg);
    color: var(--text-primary);
    line-height: 1.4;
    display: flex;
    min-height: 100vh;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* ===== LEFT SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 14px 16px;
    background: var(--sidebar-active);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

.sidebar-brand-icon {
    width: 28px;
    height: 28px;
    background: #4a6eb5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-section {
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--sidebar-header);
    user-select: none;
    transition: background 0.15s;
}

.sidebar-section-header:hover {
    background: var(--sidebar-hover);
}

.sidebar-section-header .arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.sidebar-section-header.collapsed .arrow {
    transform: rotate(-90deg);
}

.sidebar-nav {
    list-style: none;
    padding: 4px 0;
}

.sidebar-nav.collapsed {
    display: none;
}

.sidebar-nav li a {
    display: block;
    padding: 7px 16px 7px 28px;
    color: var(--sidebar-text);
    font-size: 13px;
    text-decoration: none;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.sidebar-nav li a.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    border-left-color: #6b8dd6;
    font-weight: 600;
}

.sidebar-user {
    margin-top: auto;
    padding: 12px 16px;
    background: var(--sidebar-active);
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
}

.sidebar-user-name {
    color: #fff;
    font-weight: 600;
    margin-bottom: 2px;
}

.sidebar-user-role {
    color: var(--sidebar-text);
    font-size: 11px;
}

.sidebar-user-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.sidebar-user-actions a {
    color: #8ea4d4;
    font-size: 11px;
    text-decoration: none;
}

.sidebar-user-actions a:hover {
    color: #fff;
    text-decoration: underline;
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== BREADCRUMB BAR ===== */
.breadcrumb-bar {
    background: var(--content-bg);
    padding: 8px 20px;
    font-size: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.breadcrumb-bar a {
    color: var(--link-color);
}

.breadcrumb-bar .sep {
    margin: 0 6px;
    color: var(--text-muted);
}

/* ===== TOOLBAR ===== */
.toolbar {
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--toolbar-border);
    padding: 6px 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: #d8dfe9;
    border-color: var(--toolbar-border);
    text-decoration: none;
    color: var(--text-primary);
}

.toolbar-btn:active {
    background: #c8cfdf;
}

.toolbar-btn .icon {
    font-size: 14px;
    opacity: 0.8;
}

.toolbar-sep {
    width: 1px;
    height: 22px;
    background: var(--toolbar-border);
    margin: 0 4px;
}

.toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 16px 20px;
    flex: 1;
}

/* ===== SECTION PANELS ===== */
.panel {
    background: var(--content-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.panel-header {
    padding: 10px 16px;
    background: var(--th-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 13px;
    color: var(--th-color);
}

.panel-body {
    padding: 16px;
}

.panel-body-compact {
    padding: 12px 16px;
}

/* ===== TABLES (Directo-style) ===== */
.d-table-container {
    overflow-x: auto;
}

table.d-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

table.d-table th {
    background: var(--th-bg);
    padding: 8px 10px;
    text-align: left;
    font-weight: 700;
    color: var(--th-color);
    border: 1px solid var(--td-border);
    font-size: 12px;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    position: relative;
}

table.d-table th.sortable:hover {
    background: #cdd5e8;
}

table.d-table th .sort-arrow {
    font-size: 9px;
    margin-left: 3px;
    opacity: 0.5;
}

table.d-table th .sort-arrow.active {
    opacity: 1;
    color: var(--primary);
}

table.d-table td {
    padding: 6px 10px;
    border: 1px solid var(--td-border);
    vertical-align: middle;
}

table.d-table tr:nth-child(even) {
    background: var(--tr-alt);
}

table.d-table tr:hover {
    background: var(--tr-hover);
}

table.d-table tr.selected {
    background: #d0ddf5;
}

/* Column filter row */
table.d-table tr.filter-row td {
    padding: 4px 6px;
    background: var(--content-bg);
}

table.d-table tr.filter-row input {
    width: 100%;
    padding: 3px 6px;
    border: 1px solid var(--input-border);
    border-radius: 2px;
    font-size: 12px;
    background: var(--input-bg);
}

table.d-table tr.filter-row input:focus {
    border-color: var(--input-focus);
    outline: none;
    box-shadow: 0 0 0 1px var(--input-focus);
}

/* Table action links */
table.d-table .action-link {
    color: var(--link-color);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    text-decoration: none;
    margin-right: 8px;
}

table.d-table .action-link:hover {
    text-decoration: underline;
}

/* ===== SEARCH/OPEN BAR (like "AVA NR" in Directo) ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--content-bg);
    border-bottom: 1px solid var(--border);
}

.search-bar input,
.search-bar select {
    padding: 5px 10px;
    border: 1px solid var(--input-border);
    border-radius: 2px;
    font-size: 12px;
    background: var(--input-bg);
}

.search-bar input:focus,
.search-bar select:focus {
    border-color: var(--input-focus);
    outline: none;
}

.search-bar label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ===== PAGINATION ===== */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 16px;
    background: var(--content-bg);
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}

.pagination-bar .page-info {
    margin-right: auto;
}

.pagination-bar input {
    width: 50px;
    padding: 3px 6px;
    border: 1px solid var(--input-border);
    border-radius: 2px;
    text-align: center;
    font-size: 12px;
}

.pagination-bar button {
    padding: 3px 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.pagination-bar .page-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.pagination-bar .page-nav a,
.pagination-bar .page-nav span {
    padding: 2px 6px;
    cursor: pointer;
    color: var(--link-color);
}

.pagination-bar .page-nav span.disabled {
    color: var(--text-muted);
    cursor: default;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border: 1px solid;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.5;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary-dark);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-success {
    background: var(--success);
    border-color: #1d6b3a;
    color: #fff;
}
.btn-success:hover {
    background: #1d6b3a;
    color: #fff;
}

.btn-warning {
    background: var(--warning);
    border-color: #a07515;
    color: #fff;
}
.btn-warning:hover {
    background: #a07515;
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    border-color: #9a2626;
    color: #fff;
}
.btn-danger:hover {
    background: #9a2626;
    color: #fff;
}

.btn-secondary {
    background: #6c7a96;
    border-color: #576481;
    color: #fff;
}
.btn-secondary:hover {
    background: #576481;
    color: #fff;
}

.btn-outline {
    background: #fff;
    border-color: var(--border);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: var(--toolbar-bg);
}

.btn-sm {
    padding: 3px 10px;
    font-size: 11px;
}

.btn-lg {
    padding: 8px 20px;
    font-size: 14px;
}

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #b0b8cc;
    border-radius: 20px;
    transition: 0.2s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d6ecf5;
    color: #0c5460;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-neutral {
    background: #e8ecf2;
    color: #4a5568;
}

/* ===== ALERTS ===== */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 12px;
    border: 1px solid;
}

.alert-info {
    background: #d6ecf5;
    color: #0c5460;
    border-color: #b8daff;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--input-border);
    border-radius: 2px;
    font-size: 12px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text-primary);
}

.form-control:focus {
    border-color: var(--input-focus);
    outline: none;
    box-shadow: 0 0 0 1px var(--input-focus);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    cursor: pointer;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-inline label {
    margin-bottom: 0;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.form-check input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--primary);
}

/* ===== GRID LAYOUTS ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ===== STAT CARDS (Directo-style) ===== */
.stat-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.stat-card {
    background: var(--content-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    flex: 1;
    min-width: 140px;
}

.stat-card-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.stat-card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.stat-card.warning .stat-card-value { color: var(--warning); }
.stat-card.danger .stat-card-value { color: var(--danger); }
.stat-card.success .stat-card-value { color: var(--success); }
.stat-card.info .stat-card-value { color: var(--info); }

/* ===== CODE / PRE ===== */
code {
    background: #eef1f7;
    padding: 1px 5px;
    border-radius: 2px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #3a4f8a;
}

pre {
    background: #1e2a42;
    color: #d0d8e8;
    padding: 14px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid #162036;
}

/* ===== TABS ===== */
.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--border);
    background: var(--toolbar-bg);
    padding: 0 16px;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(26, 60, 138, 0.05);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== DETAILS/SUMMARY (Directo collapsible) ===== */
details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

details summary {
    padding: 8px 12px;
    cursor: pointer;
    background: var(--th-bg);
    font-weight: 600;
    font-size: 12px;
    color: var(--th-color);
    user-select: none;
    list-style: none;
}

details summary::before {
    content: ">";
    display: inline-block;
    margin-right: 8px;
    font-weight: 700;
    transition: transform 0.15s;
    font-size: 11px;
}

details[open] summary::before {
    transform: rotate(90deg);
}

details summary::-webkit-details-marker {
    display: none;
}

details > div,
details > pre {
    padding: 10px 12px;
}

/* ===== EXECUTION TRACE ===== */
.trace-step {
    position: relative;
    margin: 0 0 0 20px;
    padding: 12px 16px;
    border-left: 3px solid var(--primary);
    background: var(--content-bg);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 8px;
}

.trace-step.warning {
    border-left-color: var(--warning);
}

.trace-step.error {
    border-left-color: var(--danger);
}

.trace-step:hover {
    background: var(--tr-hover);
}

.trace-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.trace-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    margin-right: 10px;
}

.trace-step-title {
    font-weight: 600;
    font-size: 13px;
}

.trace-step-time {
    font-size: 11px;
    color: var(--text-muted);
}

.trace-data-flow {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: center;
    margin: 10px 0;
}

.trace-data-box {
    background: var(--page-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
}

.trace-data-box h5 {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.trace-arrow {
    font-size: 18px;
    color: var(--primary);
    font-weight: 700;
}

/* ===== REVIEW QUEUE ===== */
.review-item {
    background: var(--content-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.review-item.approved {
    border-left-color: var(--success);
    background: #f7fdf9;
}

.review-item.corrected {
    border-left-color: var(--info);
    background: #f5f9ff;
}

.review-item.blocked {
    border-left-color: var(--danger);
    background: #fdf7f7;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.item-code {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.warning-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 2px;
    background: #fff3cd;
    color: #856404;
    font-weight: 600;
    font-size: 12px;
}

.warning-list {
    background: #fffbee;
    border: 1px solid #ffeeba;
    padding: 10px 14px;
    margin: 10px 0;
    border-radius: var(--radius);
    font-size: 12px;
}

.warning-list h4 {
    color: #856404;
    margin: 0 0 8px 0;
    font-size: 12px;
}

.warning-item {
    padding: 5px 0;
    border-bottom: 1px solid #ffeeba;
}

.warning-item:last-child {
    border-bottom: none;
}

.data-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 12px 0;
}

.data-column {
    background: var(--page-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
}

.data-column h5 {
    margin: 0 0 8px 0;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.data-row {
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.data-row:last-child {
    border-bottom: none;
}

.data-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.data-value {
    color: var(--text-primary);
}

.correction-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--input-focus);
    border-radius: 2px;
    font-size: 12px;
    background: #fff;
}

.correction-input:focus {
    outline: none;
    box-shadow: 0 0 0 1px var(--input-focus);
}

.review-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.note-textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    border: 1px solid var(--input-border);
    border-radius: 2px;
    font-family: inherit;
    font-size: 12px;
    resize: vertical;
}

/* ===== RULES GRAPH ===== */
.rules-tree-item {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.rules-tree-item:last-child {
    border-bottom: none;
}

.rule-override {
    background: #fff8e5;
    border-left: 3px solid var(--warning);
    padding: 4px 10px;
    margin: 4px 0;
    font-size: 12px;
}

.rule-inherited {
    border-left: 3px solid var(--success);
    padding: 4px 10px;
    margin: 4px 0;
    font-size: 12px;
}

/* ===== CHAT ASSISTANT WIDGET ===== */
.chat-widget {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1000;
}

.chat-toggle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.chat-toggle:hover {
    transform: scale(1.08);
    background: var(--primary-dark);
}

.chat-window {
    position: fixed;
    bottom: 76px;
    right: 16px;
    width: 380px;
    height: 520px;
    background: var(--content-bg);
    border-radius: 6px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
}

.chat-window.open {
    display: flex;
}

.chat-header {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 13px;
    font-weight: 600;
}

.chat-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.chat-close:hover {
    background: rgba(255,255,255,0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-message.assistant .chat-avatar {
    background: var(--primary);
    color: white;
}

.chat-message.user .chat-avatar {
    background: #6c7a96;
    color: white;
}

.chat-bubble {
    padding: 8px 12px;
    border-radius: 6px;
    line-height: 1.4;
    font-size: 12px;
}

.chat-message.assistant .chat-bubble {
    background: var(--page-bg);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}

.chat-message.user .chat-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-input-container {
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: var(--page-bg);
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 12px;
    outline: none;
}

.chat-input:focus {
    border-color: var(--input-focus);
}

.chat-send {
    padding: 7px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

.chat-send:hover {
    background: var(--primary-dark);
}

.chat-send:disabled {
    background: #b0b8cc;
    cursor: not-allowed;
}

/* ===== SPINNER ===== */
.spinner {
    border: 2px solid var(--border);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 11px;
    border-top: 1px solid var(--border);
    background: var(--page-bg);
}

/* ===== INFO TOOLTIPS ===== */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
    flex-shrink: 0;
}

.info-icon:hover {
    background: var(--primary);
    color: #fff;
}

.info-icon .info-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--sidebar-bg);
    color: #fff;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.5;
    width: 280px;
    z-index: 300;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    white-space: normal;
    text-align: left;
}

.info-icon .info-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--sidebar-bg);
}

.info-icon:hover .info-tooltip {
    display: block;
}

/* ===== UTILITY ===== */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar {
        width: 180px;
    }
    :root {
        --sidebar-width: 180px;
    }
    .data-comparison {
        grid-template-columns: 1fr;
    }
    .trace-data-flow {
        grid-template-columns: 1fr;
    }
    .trace-arrow {
        transform: rotate(90deg);
        text-align: center;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    .main-content {
        margin-left: 0;
    }
    .chat-window {
        width: calc(100vw - 32px);
        right: 16px;
    }
    .grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        flex-direction: column;
    }
}

/* ===== LOGIN PAGE ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #1e2750 100%);
}

.login-card {
    background: white;
    border-radius: 6px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    padding: 36px;
    max-width: 420px;
    width: 100%;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo h1 {
    color: var(--primary);
    font-size: 20px;
    font-weight: 700;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 12px;
}

/* ===== MODAL OVERLAY ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    background: var(--content-bg);
    border-radius: 6px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-box-header {
    padding: 12px 16px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    border-radius: 6px 6px 0 0;
}

.modal-box-body {
    padding: 16px;
}
