/* ===== Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===== Base ===== */
* {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #1f2937;
}
::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* ===== Search input clear button ===== */
.search-input-wrap {
    position: relative;
}
.search-input--clearable {
    padding-right: 2.5rem !important;
}
.search-clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.375rem;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
    z-index: 2;
}
.search-clear-btn:hover {
    color: #d1d5db;
    background: rgba(55, 65, 81, 0.6);
}
.search-clear-btn.hidden {
    display: none;
}

/* ===== Styled Select (chevron inset like custom combos) ===== */
.select-field {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.25rem;
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem 1rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%236b7280' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    cursor: pointer;
}
.select-field.select-field--wide {
    background-position: right 1rem center;
}

/* ===== Number stepper ===== */
.number-stepper {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.number-stepper-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.75rem;
    background: #1f2937;
    border: 1px solid #374151;
    color: #9ca3af;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.number-stepper-btn:first-child {
    border-radius: 0.5rem 0 0 0.5rem;
    border-right: none;
}
.number-stepper-btn:last-child {
    border-radius: 0 0.5rem 0.5rem 0;
    border-left: none;
}
.number-stepper-btn:hover:not(:disabled) {
    background: #374151;
    color: #e5e7eb;
}
.number-stepper-btn:active:not(:disabled) {
    background: #4b5563;
}
.number-stepper-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.number-stepper-input {
    flex: 1;
    min-width: 0;
    border-radius: 0;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}
.number-stepper-input::-webkit-outer-spin-button,
.number-stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ===== Shell top bars (sidebar brand + main header) ===== */
.shell-top-bar {
    height: 3.5rem;
    min-height: 3.5rem;
    max-height: 3.5rem;
    flex-shrink: 0;
    box-sizing: border-box;
}

/* ===== Sidebar ===== */
.sidebar-link.active {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border-right: 3px solid #6366f1;
}
.sidebar-link:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

/* ===== Cards ===== */
.stat-card {
    transition: all 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* ===== Tabs ===== */
.tab-btn.active {
    border-color: #6366f1;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.1);
}

/* ===== Animations ===== */
.fade-in {
    animation: fadeIn 0.25s ease-in-out;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pulse-dot {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== Modals ===== */
.modal-overlay {
    transition: opacity 0.2s ease;
}
.modal-content {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ===== Flatpickr Dark Theme Override ===== */
.flatpickr-calendar.dark {
    background: #1f2937;
    border-color: #374151;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.flatpickr-calendar.dark .flatpickr-month,
.flatpickr-calendar.dark .flatpickr-weekdays,
.flatpickr-calendar.dark .flatpickr-weekday {
    background: #1f2937;
    color: #9ca3af;
}
.flatpickr-calendar.dark .flatpickr-day {
    color: #e5e7eb;
    border-radius: 6px;
}
.flatpickr-calendar.dark .flatpickr-day:hover {
    background: #374151;
    border-color: #374151;
}
.flatpickr-calendar.dark .flatpickr-day.selected,
.flatpickr-calendar.dark .flatpickr-day.selected:hover {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
}
.flatpickr-calendar.dark .flatpickr-day.today {
    border-color: #6366f1;
}
.flatpickr-calendar.dark .flatpickr-day.disabled,
.flatpickr-calendar.dark .flatpickr-day.disabled:hover,
.flatpickr-calendar.dark .flatpickr-day.flatpickr-disabled,
.flatpickr-calendar.dark .flatpickr-day.flatpickr-disabled:hover,
.flatpickr-calendar.dark .flatpickr-day.prevMonthDay,
.flatpickr-calendar.dark .flatpickr-day.nextMonthDay {
    color: #4b5563;
    background: transparent;
}
.flatpickr-calendar.dark .flatpickr-prev-month,
.flatpickr-calendar.dark .flatpickr-next-month {
    fill: #9ca3af;
}
.flatpickr-calendar.dark .flatpickr-prev-month:hover,
.flatpickr-calendar.dark .flatpickr-next-month:hover {
    fill: #e5e7eb;
}
.flatpickr-calendar.dark .flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-calendar.dark .flatpickr-current-month input.cur-year {
    color: #e5e7eb;
    background: #1f2937;
}
/* Time section */
.flatpickr-calendar.dark .flatpickr-time {
    border-top: 1px solid #374151;
}
.flatpickr-calendar.dark .flatpickr-time input {
    color: #e5e7eb;
}
.flatpickr-calendar.dark .flatpickr-time input:hover,
.flatpickr-calendar.dark .flatpickr-time input:focus {
    background: #374151;
}
.flatpickr-calendar.dark .flatpickr-time .flatpickr-time-separator {
    color: #6b7280;
}
.flatpickr-calendar.dark .numInputWrapper span {
    border-color: #374151;
}
.flatpickr-calendar.dark .numInputWrapper span:hover {
    background: #374151;
}
/* Alt input styling (the visible input) */
.flatpickr-input.flatpickr-mobile,
input.flatpickr-input[readonly] {
    cursor: pointer;
}
input.flatpickr-alt-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af' stroke-width='1.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 38px !important;
}

/* ===== Circular Flag Icons ===== */
.flag-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #1f2937;
    border: 2px solid #374151;
}
.flag-circle-img {
    width: 130%;
    height: 130%;
    object-fit: cover;
    display: block;
}

/* ===== Flag Picker Dropdown ===== */
.flag-picker {
    position: relative;
    width: 100%;
}
.flag-picker-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 42px;
    padding: 6px 12px;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.flag-picker-selected:hover {
    border-color: #4b5563;
}
.flag-picker-selected:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.flag-picker-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.flag-picker-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}
.flag-picker-dropdown:not(.hidden) ~ .flag-picker-selected .flag-picker-chevron,
.flag-picker:has(.flag-picker-dropdown:not(.hidden)) .flag-picker-chevron {
    transform: rotate(180deg);
}
.flag-picker-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 60;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: flagPickerIn 0.15s ease;
}
@keyframes flagPickerIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.flag-picker-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #1f2937;
}
.flag-picker-search {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e5e7eb;
    font-size: 13px;
}
.flag-picker-search::placeholder {
    color: #6b7280;
}
.flag-picker-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px;
}
.flag-picker-list::-webkit-scrollbar {
    width: 5px;
}
.flag-picker-list::-webkit-scrollbar-track {
    background: transparent;
}
.flag-picker-list::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}
.flag-picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s ease;
}
.flag-picker-option:hover {
    background: rgba(99, 102, 241, 0.1);
}
.flag-picker-option.active {
    background: rgba(99, 102, 241, 0.15);
}
.flag-picker-option-name {
    flex: 1;
    font-size: 13px;
    color: #d1d5db;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.flag-picker-option-code {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.flag-picker-empty {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
}

/* ===== Kebab Dropdown Menu ===== */
.kebab-menu {
    position: relative;
}
.kebab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s ease;
    color: #6b7280;
}
.kebab-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #9ca3af;
}
.kebab-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 50;
    min-width: 160px;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    padding: 4px;
    animation: kebabIn 0.12s ease;
}
@keyframes kebabIn {
    from { opacity: 0; transform: translateY(-4px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.kebab-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s ease;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.kebab-dropdown-item.edit-item {
    color: #d1d5db;
}
.kebab-dropdown-item.edit-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
}
.kebab-dropdown-item.delete-item {
    color: #f87171;
}
.kebab-dropdown-item.delete-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

/* ===== Server Load Bars ===== */
.server-bar {
    transition: width 0.6s ease;
}

/* ===== Page Loading ===== */
.page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}
.page-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #374151;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Agent sidebar button (orange accent, matches logo #F39719) ===== */
#agentSidebarBtn {
    color: #F39719;
}
#agentSidebarBtn svg {
    color: #F39719;
}
#agentSidebarBtn:hover {
    background: rgba(243, 151, 25, 0.10);
    color: #f7ad47;
}
#agentSidebarBtn.active {
    background: rgba(243, 151, 25, 0.15);
    color: #f7ad47;
    border-right: 3px solid #F39719;
}
#agentSidebarBtn .agent-sidebar-avatar {
    background: linear-gradient(135deg, #F39719, #d97706);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(243, 151, 25, 0.35);
}
#agentSidebarBtn .agent-sidebar-avatar svg {
    color: #ffffff;
}
#agentSidebarBtn:hover .agent-sidebar-avatar,
#agentSidebarBtn.active .agent-sidebar-avatar {
    box-shadow: 0 2px 12px rgba(243, 151, 25, 0.55);
}

/* ===== Agent chat: styled confirm dialog ===== */
.agent-chat-confirm {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(3, 7, 18, 0.6);
    backdrop-filter: blur(3px);
    animation: agentConfirmIn 0.15s ease;
}
.agent-chat-confirm.closing {
    animation: agentConfirmOut 0.15s ease forwards;
}
@keyframes agentConfirmIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes agentConfirmOut { from { opacity: 1; } to { opacity: 0; } }

.agent-chat-confirm-card {
    width: 100%;
    max-width: 300px;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
    animation: agentConfirmCardIn 0.18s ease;
}
@keyframes agentConfirmCardIn {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.agent-chat-confirm-icon {
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
}
.agent-chat-confirm-icon.danger {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
}
.agent-chat-confirm-icon svg { width: 22px; height: 22px; }
.agent-chat-confirm-title {
    font-size: 15px;
    font-weight: 600;
    color: #f3f4f6;
    margin: 0 0 6px;
}
.agent-chat-confirm-text {
    font-size: 12.5px;
    line-height: 1.5;
    color: #9ca3af;
    margin: 0 0 18px;
}
.agent-chat-confirm-actions {
    display: flex;
    gap: 8px;
}
.agent-chat-confirm-btn {
    flex: 1;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.agent-chat-confirm-btn:hover { transform: translateY(-1px); }
.agent-chat-confirm-btn.cancel {
    background: transparent;
    border-color: #374151;
    color: #9ca3af;
}
.agent-chat-confirm-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e5e7eb;
}
.agent-chat-confirm-btn.primary {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: #fff;
}
.agent-chat-confirm-btn.danger {
    background: #dc2626;
    color: #fff;
}
.agent-chat-confirm-btn.danger:hover { background: #ef4444; }

/* ===== Agent Chat Widget ===== */
.agent-chat {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(99, 102, 241, 0.08);
    overflow: hidden;
    animation: agentChatIn 0.2s ease;
}
.agent-chat.hidden {
    display: none;
}
.agent-chat--no-animate {
    animation: none !important;
}
.agent-chat--dragging {
    user-select: none;
    cursor: grabbing;
}
.agent-chat--resizing {
    user-select: none;
}
@keyframes agentChatIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.agent-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(124, 58, 237, 0.08) 100%);
    border-bottom: 1px solid #1f2937;
    cursor: grab;
    flex-shrink: 0;
}
.agent-chat-header:active {
    cursor: grabbing;
}
.agent-chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.agent-chat-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
    flex-shrink: 0;
}
.agent-chat-avatar svg {
    width: 18px;
    height: 18px;
}
.agent-chat-title-text {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #f3f4f6;
    line-height: 1.2;
}
.agent-chat-subtitle {
    display: block;
    font-size: 11px;
    color: #6b7280;
    line-height: 1.2;
}
.agent-chat-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}
.agent-chat-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #d1d5db;
}
.agent-chat-close svg {
    width: 16px;
    height: 16px;
}

.agent-chat-messages {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}
.agent-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}
.agent-chat-msg--agent {
    align-self: flex-start;
}
.agent-chat-msg--user {
    align-self: flex-end;
}
.agent-chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}
.agent-chat-msg--agent .agent-chat-msg-bubble {
    background: #1f2937;
    color: #e5e7eb;
    border-bottom-left-radius: 4px;
}
.agent-chat-msg--user .agent-chat-msg-bubble {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
    border-bottom-right-radius: 4px;
}
.agent-chat-msg-time {
    font-size: 10px;
    color: #4b5563;
    margin-top: 4px;
    padding: 0 4px;
}
.agent-chat-msg--user .agent-chat-msg-time {
    text-align: right;
}

.agent-chat-footer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #1f2937;
    background: #0d1117;
    flex-shrink: 0;
}
.agent-chat-input {
    flex: 1;
    resize: none;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    color: #e5e7eb;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: hidden;
    overscroll-behavior: contain;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.agent-chat-input::placeholder {
    color: #6b7280;
}
.agent-chat-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.agent-chat-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.agent-chat-send:hover {
    opacity: 0.9;
    transform: scale(1.05);
}
.agent-chat-send svg {
    width: 18px;
    height: 18px;
}

.agent-chat-resize {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 18px;
    height: 18px;
    cursor: nesw-resize;
    z-index: 1;
}
.agent-chat-resize::before {
    content: '';
    position: absolute;
    left: 4px;
    bottom: 4px;
    width: 8px;
    height: 8px;
    border-left: 2px solid #4b5563;
    border-bottom: 2px solid #4b5563;
    border-radius: 0 0 0 2px;
    transition: border-color 0.15s ease;
}
.agent-chat-resize:hover::before {
    border-color: #818cf8;
}

/* ===== Deep-link highlight ===== */
.agent-deeplink-flash {
    animation: agentDeeplinkFlash 2.6s ease;
    border-radius: 8px;
}
@keyframes agentDeeplinkFlash {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); background-color: transparent; }
    15% { box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.7); background-color: rgba(99, 102, 241, 0.16); }
    60% { box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4); background-color: rgba(99, 102, 241, 0.10); }
}

/* ===== Agent chat: reasoning, nav buttons, header actions, streaming ===== */
.agent-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.agent-chat-iconbtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.agent-chat-iconbtn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #d1d5db;
}
.agent-chat-iconbtn.danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
}
.agent-chat-iconbtn svg {
    width: 16px;
    height: 16px;
}

.agent-chat-reason {
    margin-bottom: 6px;
    border: 1px solid #1f2937;
    border-radius: 10px;
    background: rgba(31, 41, 55, 0.4);
    overflow: hidden;
}
.agent-chat-reason-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 7px 10px;
    border: none;
    background: transparent;
    color: #8b93a7;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.agent-chat-reason-toggle:hover { color: #a5b4fc; }
.agent-chat-reason-toggle svg {
    width: 13px;
    height: 13px;
    transition: transform 0.2s ease;
}
.agent-chat-reason.collapsed .agent-chat-reason-toggle svg { transform: rotate(-90deg); }
.agent-chat-reason-spinner {
    width: 11px;
    height: 11px;
    border: 1.5px solid #374151;
    border-top-color: #818cf8;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: auto;
}
.agent-chat-reason-body {
    padding: 0 10px 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #7c849a;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 180px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.agent-chat-reason.collapsed .agent-chat-reason-body { display: none; }

.agent-chat-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.agent-chat-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.agent-chat-nav-btn:hover {
    background: rgba(99, 102, 241, 0.22);
    transform: translateY(-1px);
}
.agent-chat-nav-btn svg { width: 14px; height: 14px; }

.agent-chat-msg-bubble code {
    background: rgba(0, 0, 0, 0.35);
    padding: 1px 5px;
    border-radius: 5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}
.agent-chat-typing {
    display: inline-flex;
    gap: 3px;
    padding: 2px 0;
}
.agent-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6b7280;
    animation: agentTyping 1.2s infinite ease-in-out;
}
.agent-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.agent-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes agentTyping {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}
