/* ══════════════════════════════════════════════════════
   Vertica MCP Agent — FastAPI Theme
   기존 Streamlit 디자인 마이그레이션 (Geist + Pretendard)
   ══════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Geist Sans', 'Pretendard', -apple-system, BlinkMacSystemFont,
                 'Segoe UI', Roboto, sans-serif;
}

html, body {
    height: 100%;
    font-size: 15px;
    line-height: 1.65;
    color: #1E293B;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 50%, #E2E8F0 100%);
}

body {
    display: flex;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   Sidebar
   ══════════════════════════════════════════════════════ */

.sidebar {
    width: 280px;
    min-width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, #1E1B4B 0%, #312E81 50%, #3730A3 100%);
    overflow-y: auto;
    padding: 1.2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* Sidebar Logos */
.sidebar-logos {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.3rem;
    margin-bottom: 0.6rem;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    justify-content: center;
}

.logo-vertica {
    height: 24px;
}

.logo-divider {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.2);
}

.logo-softline {
    height: 36px;
    object-fit: contain;
}

.sidebar-header h2 {
    color: #F1F5F9;
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.sidebar hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin: 0.6rem 0;
}

.sidebar h5 {
    color: #CBD5E1;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.sidebar-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.sidebar-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    color: #E2E8F0;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.sidebar-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* DB Card */
.db-card {
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.db-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.db-label {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-weight: 500;
}

.db-value {
    font-size: 0.86rem;
    font-weight: 600;
    color: #F8FAFC;
}

/* Nav */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nav-btn {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: #CBD5E1;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.12);
}

.nav-btn.active {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
    color: #F1F5F9;
}

/* Shortcuts */
.sidebar-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.shortcut-btn {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.06);
    color: #A5B4FC;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.shortcut-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #E0E7FF;
}

/* MCP Section Header */
.mcp-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.3rem;
    margin-bottom: 0.3rem;
}

.mcp-badge {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.mcp-label {
    color: #E2E8F0;
    font-size: 0.78rem;
    font-weight: 600;
}

.mcp-count {
    margin-left: auto;
    color: rgba(255,255,255,0.35);
    font-size: 0.68rem;
    font-weight: 500;
}

/* Details */
.sidebar-details {
    color: #CBD5E1;
}

.sidebar-details summary {
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 0.6rem;
    color: #CBD5E1;
    border-radius: 8px;
    transition: all 0.15s ease;
    list-style: none;
}

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

.sidebar-details summary::after {
    content: '▸';
    float: right;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
    transition: transform 0.2s ease;
}

.sidebar-details[open] summary::after {
    transform: rotate(90deg);
}

.sidebar-details summary:hover {
    background: rgba(255,255,255,0.08);
}

.sidebar-details .shortcut-btn {
    margin-top: 0.3rem;
}

/* ══════════════════════════════════════════════════════
   Main Content
   ══════════════════════════════════════════════════════ */

.main-content {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.view.active {
    display: flex;
}

/* ══════════════════════════════════════════════════════
   Chat View
   ══════════════════════════════════════════════════════ */

.chat-header {
    padding: 1.2rem 2rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1E293B;
    letter-spacing: -0.4px;
}

.chat-header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748B;
}

.chat-header-controls select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
    color: #475569;
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    gap: 0.8rem;
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    font-weight: 500;
}

/* Chat Bubbles */
.msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
    color: #1E293B;
    border-radius: 18px 18px 4px 18px;
    padding: 0.9rem 1.2rem;
    font-size: 0.92rem;
    line-height: 1.6;
    max-width: 75%;
    border: 1px solid #C7D2FE;
    word-break: break-word;
}

.msg-assistant {
    align-self: flex-start;
    background: white;
    color: #334155;
    border: 1px solid #E2E8F0;
    border-radius: 18px 18px 18px 4px;
    padding: 0.9rem 1.2rem;
    font-size: 0.92rem;
    line-height: 1.7;
    max-width: 85%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    word-break: break-word;
}

.msg-assistant table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.85rem;
    border-radius: 8px;
    overflow: hidden;
}

.msg-assistant th {
    background: #F1F5F9;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.8rem;
}

.msg-assistant td {
    padding: 8px 12px;
    border-bottom: 1px solid #F1F5F9;
    color: #334155;
}

.msg-assistant tr:last-child td { border-bottom: none; }
.msg-assistant tr:hover { background-color: #F8FAFC; }

.msg-assistant strong { color: #1E293B; }
.msg-assistant code {
    background: #F1F5F9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #4F46E5;
}
.msg-assistant pre {
    background: #1E293B;
    color: #E2E8F0;
    padding: 1rem;
    border-radius: 10px;
    overflow-x: auto;
    margin: 0.5rem 0;
}
.msg-assistant pre code {
    background: none;
    color: inherit;
    padding: 0;
}
.msg-assistant h1, .msg-assistant h2, .msg-assistant h3, .msg-assistant h4 {
    margin: 0.8rem 0 0.4rem;
    color: #1E293B;
}
.msg-assistant h2 { font-size: 1.1rem; }
.msg-assistant h3 { font-size: 1rem; }
.msg-assistant ul, .msg-assistant ol {
    padding-left: 1.5rem;
    margin: 0.3rem 0;
}

/* Loading dots */
.msg-loading {
    align-self: flex-start;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 18px 18px 18px 4px;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.dot-pulse {
    display: flex;
    gap: 6px;
}

.dot-pulse span {
    width: 8px;
    height: 8px;
    background: #94A3B8;
    border-radius: 50%;
    animation: pulse 1.4s infinite ease-in-out;
}

.dot-pulse span:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Chat Input */
.chat-input-area {
    padding: 0.8rem 2rem 1.5rem;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    padding: 0.6rem 0.8rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
    transition: border-color 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: #A5B4FC;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
}

#chatInput {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.92rem;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    padding: 4px 0;
    background: transparent;
    color: #1E293B;
    font-family: inherit;
    display: block;
}

#chatInput::placeholder {
    color: #94A3B8;
}

.send-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #4F46E5;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #4338CA;
    transform: translateY(-1px);
}

/* 첨부 버튼 */
.attach-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #F1F5F9;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.attach-btn:hover {
    background: #E2E8F0;
    transform: translateY(-1px);
}

/* 첨부 미리보기 */
.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 4px;
    margin-bottom: 6px;
}
.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    background: #EEF2FF;
    border: 1px solid #C7D2FE;
    border-radius: 14px;
    font-size: 12px;
    color: #1E293B;
    max-width: 240px;
}
.attachment-chip .att-icon {
    font-size: 14px;
}
.attachment-chip .att-thumb {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #C7D2FE;
}
.attachment-chip .att-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
.attachment-chip .att-size {
    color: #64748B;
    font-size: 11px;
}
.attachment-chip .att-remove {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    color: #64748B;
}
.attachment-chip .att-remove:hover {
    color: #DC2626;
}

/* 드래그 오버레이 */
.view.drag-over,
#chatView.drag-over {
    outline: 2px dashed #4F46E5;
    outline-offset: -10px;
    background: rgba(79, 70, 229, 0.03);
}

.send-btn:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
    transform: none;
}

/* ══════════════════════════════════════════════════════
   Monitor View
   ══════════════════════════════════════════════════════ */

.monitor-header {
    padding: 1.2rem 2rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.monitor-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1E293B;
}

.monitor-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.monitor-controls select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.85rem;
    background: white;
    color: #475569;
    cursor: pointer;
}

.refresh-btn {
    padding: 0.4rem 1rem;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: white;
    color: #475569;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: #F8FAFC;
    border-color: #CBD5E1;
}

/* Tabs */
.monitor-tabs {
    display: flex;
    gap: 2px;
    background: #E2E8F0;
    border-radius: 14px;
    padding: 4px;
    margin: 0 2rem;
    width: fit-content;
}

.tab-btn {
    border: none;
    border-radius: 11px;
    font-size: 0.86rem;
    font-weight: 500;
    padding: 0.5rem 1.2rem;
    color: #64748B;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #475569;
}

.tab-btn.active {
    background: white;
    color: #1E293B;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Monitor Content */
.monitor-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.2rem 2rem;
}

.monitor-content::-webkit-scrollbar { width: 6px; }
.monitor-content::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

/* ══════════════════════════════════════════════════════
   MCP 도구 카탈로그
   ══════════════════════════════════════════════════════ */
.tools-header {
    padding: 1.2rem 2rem 0.6rem;
}

.tools-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1E293B;
}

.tools-header-sub {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: #64748B;
    line-height: 1.6;
}

.tools-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem 2rem 1.5rem;
}

.tools-content::-webkit-scrollbar { width: 6px; }
.tools-content::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }

.tool-category {
    margin-bottom: 1.6rem;
}

.tool-category-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #E2E8F0;
}

.tool-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.8rem;
}

.tool-card {
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tool-card-head {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.tool-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1E293B;
}

.tool-mcp-name {
    font-size: 0.7rem;
    color: #94A3B8;
    background: none;
}

.tool-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tool-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}

.tool-badge-quick {
    background: #D1FAE5;
    color: #047857;
}

.tool-badge-chat {
    background: #DBEAFE;
    color: #1D4ED8;
}

.tool-badge-mutating {
    background: #FEF3C7;
    color: #B45309;
}

.tool-desc {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.5;
    flex: 1;
}

.tool-template-box {
    font-size: 0.78rem;
    color: #334155;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
    word-break: break-all;
}

.tool-action-btn {
    align-self: flex-start;
    padding: 0.4rem 1rem;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    background: #F8FAFC;
    color: #4F46E5;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-action-btn:hover {
    background: #EEF2FF;
    border-color: #C7D2FE;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: #94A3B8;
    gap: 1rem;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #E2E8F0;
    border-top-color: #4F46E5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════
   Dashboard Components
   ══════════════════════════════════════════════════════ */

.metrics-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metrics-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.metrics-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.metrics-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.metrics-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }

.metric-card {
    background: white;
    border-radius: 16px;
    padding: 1.2rem 1.1rem;
    border: 1px solid #E2E8F0;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}

.metric-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.metric-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.5px;
}

.metric-sub {
    font-size: 0.72rem;
    color: #94A3B8;
    margin-top: 4px;
    font-weight: 500;
}

/* Progress Bar */
.progress-bar {
    background: #F1F5F9;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
    margin: 6px 0 2px 0;
}

.progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.4s ease;
}

.fill-green  { background: linear-gradient(90deg, #10B981, #34D399); }
.fill-yellow { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.fill-orange { background: linear-gradient(90deg, #F97316, #FB923C); }
.fill-red    { background: linear-gradient(90deg, #EF4444, #F87171); }

/* Badges */
.badge-up {
    display: inline-block;
    background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
    color: #065F46;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-down {
    display: inline-block;
    background: linear-gradient(135deg, #FEE2E2, #FECACA);
    color: #991B1B;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Section */
.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #334155;
    padding: 0.4rem 0;
    margin: 1.2rem 0 0.6rem 0;
    border-bottom: 2px solid #CBD5E1;
}

/* Charts */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-card {
    background: white;
    border-radius: 14px;
    border: 1px solid #E2E8F0;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.chart-card h4 {
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748B;
    text-align: center;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.chart-card canvas {
    height: 280px !important;   /* 고정 높이 — 데이터가 적어도 카드가 찌그러지지 않게 */
    max-height: 280px;
}
.chart-card .chart-empty {
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    font-size: 0.85rem;
}
.chart-card h4 .chart-hint {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: #94A3B8;
    text-transform: none;
    letter-spacing: 0;
    margin-top: 2px;
}

/* Data Tables */
.data-panel {
    background: white;
    border-radius: 14px;
    border: 1px solid #E2E8F0;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.data-panel-header {
    padding: 0.8rem 1rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: #334155;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-panel-header::after {
    content: '▼';
    font-size: 0.7rem;
    color: #94A3B8;
    transition: transform 0.2s;
}

.data-panel.collapsed .data-panel-header::after {
    transform: rotate(-90deg);
}

.data-panel-body {
    max-height: 350px;
    overflow: auto;
}

.data-panel.collapsed .data-panel-body {
    display: none;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.data-table th {
    background: #F1F5F9;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #F1F5F9;
    color: #334155;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background-color: #F8FAFC; }

.no-data {
    text-align: center;
    padding: 2rem;
    color: #94A3B8;
    font-size: 0.88rem;
}

/* ══════════════════════════════════════════════════════
   🩺 정기 점검 (Health Check) — 판정 배지 / 요약 / 섹션
   색 규칙: 정상=녹색, 권고=주황, 필수=적색, 정보=파랑, 조회실패=진적색
   ══════════════════════════════════════════════════════ */
.verdict-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
    vertical-align: middle;
}
.verdict-badge.v-ok    { background: #D1FAE5; color: #065F46; }
.verdict-badge.v-warn  { background: #FEF3C7; color: #92400E; }
.verdict-badge.v-fail  { background: #FEE2E2; color: #991B1B; }
.verdict-badge.v-info  { background: #DBEAFE; color: #1E40AF; }
.verdict-badge.v-error { background: #FCE7F3; color: #831843; }

/* 탭 상단 정기 점검 요약 스트립 (해당 탭에 병합된 항목들의 판정 집계) */
.hc-strip {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    background: white;
    border: 1px solid #E2E8F0;
    border-left: 6px solid #94A3B8;
    border-radius: 14px;
    padding: 0.7rem 1.1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.hc-strip.v-ok   { border-left-color: #10B981; }
.hc-strip.v-warn { border-left-color: #F59E0B; }
.hc-strip.v-fail { border-left-color: #EF4444; }
.hc-strip-title { font-size: 0.95rem; font-weight: 800; color: #1E293B; margin-right: 0.3rem; }
.hc-strip-sub { font-size: 0.76rem; color: #64748B; }
.hc-strip-counts { display: flex; gap: 0.35rem; margin-left: auto; flex-wrap: wrap; }
.hc-pill {
    font-size: 0.74rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: #F1F5F9;
    color: #475569;
    text-decoration: none;
    cursor: pointer;
}
.hc-pill.v-ok    { background: #D1FAE5; color: #065F46; }
.hc-pill.v-warn  { background: #FEF3C7; color: #92400E; }
.hc-pill.v-fail  { background: #FEE2E2; color: #991B1B; }
.hc-pill.v-info  { background: #DBEAFE; color: #1E40AF; }
.hc-pill.v-error { background: #FCE7F3; color: #831843; }
.hc-pill.dim { opacity: 0.45; }

.hc-section { margin-bottom: 1.4rem; }
.hc-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(90deg, #1E3A5F, #2E6DA4);
    padding: 0.55rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.7rem;
}
.hc-section-title .verdict-badge { background: rgba(255,255,255,0.92); }

.hc-item { border-left: 5px solid #CBD5E1; }
.hc-item.v-ok    { border-left-color: #10B981; }
.hc-item.v-warn  { border-left-color: #F59E0B; }
.hc-item.v-fail  { border-left-color: #EF4444; }
.hc-item.v-info  { border-left-color: #3B82F6; }
.hc-item.v-error { border-left-color: #BE185D; }
.hc-item-header { background: white; }
.hc-item-title { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: 0.9rem; }
.hc-no {
    font-family: 'Geist Mono', Consolas, monospace;
    font-size: 0.75rem;
    color: #64748B;
    background: #F1F5F9;
    padding: 1px 7px;
    border-radius: 6px;
}
.hc-msg { font-size: 0.8rem; font-weight: 500; color: #64748B; }
.hc-item.v-warn .hc-msg { color: #B45309; }
.hc-item.v-fail .hc-msg { color: #B91C1C; font-weight: 600; }
.hc-desc { padding: 0.6rem 1rem 0.2rem; font-size: 0.8rem; color: #64748B; }
.hc-criteria {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 1px 8px;
    border-radius: 6px;
    background: #EEF2FF;
    color: #3730A3;
    font-weight: 600;
    font-size: 0.74rem;
}
.hc-table-wrap { max-height: 420px; overflow: auto; padding: 0.4rem 0 0; }
.hc-table td { font-variant-numeric: tabular-nums; }
.hc-table td.hc-action { font-weight: 600; }
.hc-table td.v-warn { color: #B45309; }
.hc-table td.v-fail { color: #B91C1C; font-weight: 700; }
.hc-table td.v-info { color: #1D4ED8; }
.hc-pre {
    margin: 0.4rem 1rem 1rem;
    padding: 0.8rem 1rem;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    font-family: 'Geist Mono', Consolas, monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    color: #334155;
}
.hc-error {
    margin: 0.6rem 1rem 1rem;
    padding: 0.7rem 1rem;
    background: #FDF2F2;
    border-left: 4px solid #C0392B;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #7B241C;
}
.hc-errmsg { font-family: Consolas, monospace; font-size: 0.76rem; margin-top: 4px; word-break: break-all; }
.hc-footer { font-size: 0.75rem; color: #94A3B8; text-align: right; margin: 0.5rem 0 1.5rem; }

@media (max-width: 1024px) {
    .hc-summary { grid-template-columns: 1fr; }
    .hc-counts { flex-wrap: wrap; }
    .hc-actions { flex-direction: row; }
}

/* 대시보드 포함 시 버블 전체 너비 확장 */
.msg-assistant:has(.dash-container),
.msg-assistant:has(.dash-table),
.msg-assistant:has(.dash-info) {
    width: 85%;
}

/* Dashboard HTML Cards (에이전트 응답용) */
.dash-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.dash-card {
    background: white;
    border-radius: 16px;
    padding: 1.3rem;
    border: 1px solid #E2E8F0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    text-align: center;
}

.dash-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dash-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1E293B;
    margin: 4px 0;
}

.dash-sub {
    font-size: 0.75rem;
    color: #94A3B8;
}

/* Dashboard Section Title */
.dash-section {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1E293B;
    margin: 1.5rem 0 0.7rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #E2E8F0;
}

/* Dashboard HTML Table (에이전트 응답용) */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.8rem 0;
    font-size: 0.85rem;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.dash-table thead th {
    background: #F8FAFC;
    color: #64748B;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 2px solid #E2E8F0;
}

.dash-table tbody td {
    padding: 0.6rem 1rem;
    color: #334155;
    border-bottom: 1px solid #F1F5F9;
}

.dash-table tbody tr:last-child td {
    border-bottom: none;
}

.dash-table tbody tr:hover {
    background: #F8FAFC;
}

/* Dashboard Info Card (키-값 쌍 표시용) */
.dash-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.6rem;
    margin: 0.8rem 0;
}

.dash-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 0.7rem 1rem;
}

.dash-info-label {
    font-size: 0.82rem;
    color: #64748B;
    font-weight: 500;
}

.dash-info-value {
    font-size: 0.9rem;
    color: #1E293B;
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .chart-grid { grid-template-columns: 1fr; }
    .metrics-grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
    .metrics-grid.cols-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .metrics-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .metrics-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
    .msg-user, .msg-assistant { max-width: 95%; }
}

/* ══════════════════════════════════════════════════════
   사용자 로그인 배지 + 사용자 관리(관리자) 뷰
   ══════════════════════════════════════════════════════ */

.user-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.7rem;
    margin-bottom: 0.4rem;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #E2E8F0;
    font-size: 0.85rem;
}

.user-badge-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-badge-logout {
    flex-shrink: 0;
    padding: 0.25rem 0.6rem;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px;
    background: transparent;
    color: #C7D2FE;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}

.user-badge-logout:hover { background: rgba(255,255,255,0.12); }

.admin-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.admin-filter-btn {
    padding: 0.4rem 0.9rem;
    border: 1px solid #CBD5E1;
    border-radius: 999px;
    background: #FFFFFF;
    color: #475569;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}

.admin-filter-btn:hover { border-color: #4F46E5; color: #4F46E5; }

.admin-filter-btn.active {
    background: linear-gradient(135deg, #4F46E5, #3730A3);
    border-color: transparent;
    color: #fff;
    font-weight: 600;
}

.admin-table td { vertical-align: middle; }

.admin-status {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.admin-status-pending { background: #FEF3C7; color: #92400E; }
.admin-status-approved { background: #DCFCE7; color: #166534; }
.admin-status-rejected { background: #FEE2E2; color: #991B1B; }
.admin-status-disabled { background: #E2E8F0; color: #475569; }

.admin-role { white-space: nowrap; font-weight: 600; color: #3730A3; }
.admin-me { color: #94A3B8; font-size: 0.8rem; }

.admin-actions { white-space: nowrap; }

.admin-action-btn {
    padding: 0.3rem 0.65rem;
    margin-right: 0.35rem;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    background: #FFFFFF;
    color: #334155;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s;
}

.admin-action-btn:hover { border-color: #4F46E5; color: #4F46E5; }
.admin-action-btn.ok:hover { border-color: #16A34A; color: #16A34A; }
.admin-action-btn.danger:hover { border-color: #DC2626; color: #DC2626; }
