.database-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.database-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 60%;
}

.database-path-label {
    font-size: 12px;
    color: #64748b;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.database-shell {
    --database-tree-width: 300px;
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.database-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.database-tree-wrap {
    width: var(--database-tree-width);
    padding: 10px 10px 12px;
    background: #f8fafc;
    overflow: auto;
}

.database-tree-resizer {
    width: 8px;
    cursor: col-resize;
    touch-action: none;
    background: linear-gradient(90deg, transparent 0, transparent 3px, #e2e8f0 3px, #e2e8f0 4px, transparent 4px, transparent 100%);
}

.database-shell.database-resizing,
.database-shell.database-resizing * {
    cursor: col-resize;
    user-select: none;
}

.database-tree-title {
    font-size: 12px;
    color: #64748b;
    font-weight: 700;
    margin: 6px 6px 8px;
}

.database-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.database-tree-item {
    list-style: none;
}

.database-tree-children {
    margin: 0;
    padding: 0 0 0 16px;
}

.database-tree-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 5px 8px;
    border-radius: 10px;
    color: #334155;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.database-tree-row:hover {
    background: #eff6ff;
}

.database-tree-row.active {
    background: #dbeafe;
    color: #1d4ed8;
}

.database-tree-arrow {
    width: 14px;
    flex-shrink: 0;
    color: #64748b;
    text-align: center;
}

.database-tree-folder {
    width: 18px;
    flex-shrink: 0;
    text-align: center;
}

.database-file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 10px;
    font-weight: 700;
}

.database-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.database-tree-row[data-type="folder"] .database-file-name {
    font-size: 13px;
}

.database-tree-row[data-type="file"] .database-file-name {
    font-size: 11px;
}

.database-name-tooltip {
    position: fixed;
    z-index: 200;
    max-width: 420px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid #dbe4f0;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
    font-size: 12px;
    line-height: 1.4;
    pointer-events: none;
    word-break: break-all;
}

.database-file-empty {
    font-size: 12px;
    color: #94a3b8;
    padding: 8px;
}

.database-file-empty-tip {
    text-align: center;
    font-size: 14px;
    padding: 18px 8px;
}

.database-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.database-current-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    max-width: 100%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.database-context-menu {
    position: fixed;
    min-width: 168px;
    background: #ffffff;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.2);
    padding: 6px;
    z-index: 120;
}

.database-context-item {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: #1e293b;
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 13px;
}

.database-context-item:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.database-dialog-mask {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.36);
    z-index: 160;
}

.database-dialog-card {
    width: min(420px, calc(100% - 24px));
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.25);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.database-dialog-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.database-dialog-message {
    font-size: 13px;
    color: #475569;
}

.database-dialog-input {
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
    color: #0f172a;
    background: #ffffff;
}

.database-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.database-preview-pane {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 18px;
    background: #ffffff;
}

.database-empty-state {
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    color: #94a3b8;
    font-size: 13px;
    text-align: center;
}

.database-empty-icon {
    font-size: 28px;
}

.database-markdown {
    font-size: 14px;
    color: #1e293b;
    line-height: 1.8;
}

.database-markdown h1,
.database-markdown h2,
.database-markdown h3 {
    color: #0f172a;
    margin: 0 0 10px;
}

.database-markdown ul {
    padding-left: 20px;
}

.database-pre {
    border-radius: 12px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    white-space: pre-wrap;
    color: #1e293b;
}

.database-image-wrap {
    text-align: center;
}

.database-image {
    max-width: 100%;
    max-height: 66vh;
    border-radius: 12px;
    border: 1px solid #dbe4f0;
}

.database-iframe {
    width: 100%;
    flex: 1;
    min-height: 0;
    height: 100%;
    border: 1px solid #dbe4f0;
    border-radius: 12px;
    background: #ffffff;
}
