/* ================================================================
 * DS Data v7.1.0 — SQL 查询器 + 看板
 * ================================================================ */

/* SQL 编辑器 */
.ds-data-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 1024px) { .ds-data-layout { grid-template-columns: 1fr; } }

.ds-data-left { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; max-height: 700px; overflow-y: auto; }
.ds-data-left h3 { font-size: 13px; color: #64748b; margin: 8px 0 6px; }
.ds-data-right { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; }

.ds-table-list { font-size: 12px; }
.ds-table-item { padding: 4px 8px; border-radius: 4px; cursor: pointer; }
.ds-table-item:hover { background: #f1f5f9; }
.ds-table-item code { font-size: 11px; color: #0f172a; }

.ds-saved-item { padding: 6px 8px; border-bottom: 1px solid #f1f5f9; font-size: 12px; }
.ds-saved-item:hover { background: #f8fafc; }
.ds-saved-name { display: inline-block; min-width: 180px; color: #2563eb; text-decoration: none; }
.ds-saved-name:hover { text-decoration: underline; }

.ds-sql-editor {
    width: 100%;
    min-height: 200px;
    font-family: 'SF Mono', Consolas, monospace;
    font-size: 13px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
    line-height: 1.6;
    resize: vertical;
}
.ds-sql-editor:focus { outline: 2px solid #3b82f6; border-color: transparent; }

.ds-sql-result { margin-top: 12px; max-height: 500px; overflow: auto; }
.ds-sql-result table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ds-sql-result th { background: #f1f5f9; padding: 6px 10px; text-align: left; position: sticky; top: 0; }
.ds-sql-result td { padding: 4px 10px; border-bottom: 1px solid #f1f5f9; }
.ds-sql-result .ds-meta { color: #64748b; font-size: 12px; margin-bottom: 8px; }
.ds-sql-result .ds-error { background: #fee2e2; color: #991b1b; padding: 12px; border-radius: 8px; }

/* 看板 */
.ds-card-row { background: #f8fafc; padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.ds-card-row select, .ds-card-row input { padding: 4px 8px; }
.ds-card-remove { position: absolute; top: 8px; right: 8px; }

.ds-dashboard-preview { margin-top: 24px; padding-top: 24px; border-top: 2px solid #e2e8f0; }
.ds-dashboard-card { background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid #e2e8f0; }
.ds-dashboard-card-stat .ds-dashboard-num { font-size: 32px; font-weight: 800; color: #0f172a; }
.ds-dashboard-card-stat .ds-dashboard-label { color: #64748b; font-size: 12px; margin-top: 4px; }
.ds-dashboard-card-table table { width: 100%; font-size: 12px; }

/* 暗黑 */
@media (prefers-color-scheme: dark) {
    .ds-data-left, .ds-data-right, .ds-card-row, .ds-dashboard-card { background: #1e293b; border-color: #334155; }
    .ds-sql-editor { background: #0f172a; color: #f1f5f9; border-color: #334155; }
    .ds-dashboard-card-stat .ds-dashboard-num { color: #f1f5f9; }
    .ds-table-item:hover, .ds-saved-item:hover { background: #334155; }
}
