:root {
    --font-body: "IRANSansX", system-ui, sans-serif;
    --font-heading: "IRANYekanX", "IRANSansX", system-ui, sans-serif;
    --font-family: var(--font-body);
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-raised: #ffffff;
    --border: #e5eaf1;
    --text: #162033;
    --text-muted: #6d788b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --success: #0f9f6e;
    --success-soft: #ecfdf5;
    --danger: #e5484d;
    --danger-soft: #fff1f2;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --info: #0284c7;
    --info-soft: #f0f9ff;
    --violet: #7c3aed;
    --sidebar: #111827;
    --sidebar-text: #aeb8c8;
    --sidebar-active: rgba(99, 102, 241, .2);
    --shadow-sm: 0 4px 18px rgba(15, 23, 42, .05);
    --shadow-lg: 0 22px 60px rgba(15, 23, 42, .16);
    --radius: 16px;
    --chart-grid: rgba(100, 116, 139, .13);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #121a2a;
    --surface-soft: #172033;
    --surface-raised: #182235;
    --border: #263248;
    --text: #e8edf7;
    --text-muted: #96a3b8;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-soft: rgba(99, 102, 241, .16);
    --success-soft: rgba(16, 185, 129, .12);
    --danger-soft: rgba(239, 68, 68, .12);
    --warning-soft: rgba(245, 158, 11, .12);
    --info-soft: rgba(14, 165, 233, .12);
    --sidebar: #070b14;
    --sidebar-text: #98a5ba;
    --shadow-sm: 0 4px 18px rgba(0, 0, 0, .16);
    --shadow-lg: 0 22px 60px rgba(0, 0, 0, .36);
    --chart-grid: rgba(148, 163, 184, .12);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; font-family: var(--font-family); background: var(--bg); color: var(--text); font-size: .9rem; }
button, input, optgroup, select, textarea { font-family: var(--font-body); }
h1, h2, h3, h4, h5, h6, .brand, .login-brand, .kpi-metric strong, .health-value, .score-ring-label strong { font-family: var(--font-heading); }
a { color: var(--primary); text-decoration: none; }
.text-muted { color: var(--text-muted) !important; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 1040; inset: 0 0 0 auto; width: 268px; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); color: #fff; }
.brand { height: 76px; display: flex; align-items: center; gap: 12px; padding: 0 22px; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 8px 20px rgba(99,102,241,.3); font-size: 1.2rem; }
.brand-mark-lg { width: 54px; height: 54px; font-size: 1.55rem; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; letter-spacing: .04em; }
.brand small { margin-top: 1px; color: #94a3b8; font-size: .69rem; }
.btn-close-sidebar { margin-right: auto; border: 0; background: none; color: #fff; font-size: 1.1rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 15px 13px 24px; scrollbar-width: thin; }
.nav-group-label { padding: 22px 13px 7px; color: #64748b; font-size: .66rem; font-weight: 700; letter-spacing: .02em; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 42px; margin: 2px 0; padding: 8px 13px; border-radius: 10px; color: var(--sidebar-text); transition: .18s ease; }
.nav-item i { width: 21px; font-size: 1.04rem; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: var(--sidebar-active); box-shadow: inset -3px 0 #818cf8; }
.sidebar-footer { height: 55px; display: flex; align-items: center; gap: 8px; padding: 0 22px; border-top: 1px solid rgba(255,255,255,.07); color: #7f8ba0; font-size: .72rem; }
.system-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px rgba(16,185,129,.12); }
.app-main { min-height: 100vh; margin-right: 268px; display: flex; flex-direction: column; }
.topbar { position: sticky; z-index: 1020; top: 0; min-height: 76px; display: flex; align-items: center; gap: 18px; padding: 12px 28px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); }
.topbar-title { min-width: 0; }
.eyebrow { display: block; color: var(--primary); font-size: .67rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.topbar h1 { margin: 2px 0 0; font-size: 1.18rem; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-right: auto; display: flex; align-items: center; gap: 12px; }
.icon-button { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: var(--surface); transition: .18s; }
.icon-button:hover { border-color: var(--primary); color: var(--primary); }
.theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-light { display: inline-block; }
[data-theme="dark"] .theme-icon-dark { display: none; }
.user-trigger { display: flex; align-items: center; gap: 10px; border: 0; padding: 0; color: var(--text); background: none; }
.avatar { width: 39px; height: 39px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.user-copy { max-width: 155px; text-align: right; }
.user-copy strong, .user-copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-copy strong { font-size: .78rem; }
.user-copy small { color: var(--text-muted); font-size: .64rem; }
.dropdown-menu { border-color: var(--border); background: var(--surface-raised); color: var(--text); }
.dropdown-item { color: var(--text); }
.dropdown-item:hover { background: var(--surface-soft); color: var(--text); }
.content-area { width: 100%; max-width: 1700px; margin: 0 auto; flex: 1; padding: 26px 28px 36px; }
.app-footer { display: flex; justify-content: space-between; gap: 20px; padding: 16px 28px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .72rem; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.section-heading h2 { margin: 0 0 5px; font-size: 1.08rem; font-weight: 750; }
.section-heading p { margin: 0; color: var(--text-muted); }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 60px; padding: 15px 19px; border-bottom: 1px solid var(--border); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: .91rem; font-weight: 750; }
.panel-body { padding: 19px; }
.panel-flush .panel-body { padding: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi-card { position: relative; min-height: 92px; display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.kpi-icon { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 11px; background: var(--primary-soft); color: var(--primary); font-size: 1rem; }
.kpi-card.tone-success .kpi-icon { color: var(--success); background: var(--success-soft); }
.kpi-card.tone-danger .kpi-icon { color: var(--danger); background: var(--danger-soft); }
.kpi-card.tone-warning .kpi-icon { color: var(--warning); background: var(--warning-soft); }
.kpi-card.tone-info .kpi-icon { color: var(--info); background: var(--info-soft); }
.kpi-card.tone-violet .kpi-icon { color: var(--violet); background: color-mix(in srgb, var(--violet) 12%, transparent); }
.kpi-copy { min-width: 0; flex: 1; }
.kpi-copy h3 { margin: 0 0 8px; color: var(--text-muted); font-size: .68rem; font-weight: 700; }
.kpi-metrics { display: flex; align-items: flex-end; gap: 14px; }
.kpi-metric { min-width: 0; }
.kpi-metric span, .kpi-metric strong { display: block; }
.kpi-metric span { margin-bottom: 3px; color: var(--text-muted); font-size: .61rem; white-space: nowrap; }
.kpi-metric strong { font-size: 1.15rem; line-height: 1; }
.kpi-metric.tone-danger strong { color: var(--danger); }
.chart-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; margin-bottom: 20px; }
.chart-card { grid-column: span 6; min-height: 360px; }
.chart-card.chart-sm { grid-column: span 4; }
.chart-card.chart-lg { grid-column: span 8; }
.chart-wrap { position: relative; height: 275px; padding: 15px; }
.chart-wrap.chart-compact { height: 235px; }
.score-ring-label { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.score-ring-label strong { display: block; font-size: 1.65rem; }
.score-ring-label span { color: var(--text-muted); font-size: .66rem; }
.dashboard-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); margin: 0; vertical-align: middle; }
.table > :not(caption) > * > * { padding: .82rem .95rem; }
.table thead th { color: var(--text-muted); background: var(--surface-soft); font-size: .68rem; font-weight: 700; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary) 3%, transparent); }
.table-link { color: var(--text); font-weight: 700; }
.table-link:hover { color: var(--primary); }
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--text-muted); font-size: .65rem; font-weight: 700; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-success, .status-ready, .status-healthy, .status-active, .status-succeeded { color: var(--success); background: var(--success-soft); }
.status-danger, .status-failed, .status-unhealthy, .status-rejected, .status-inactive { color: var(--danger); background: var(--danger-soft); }
.status-warning, .status-running, .status-processing, .status-validating, .status-cancellation_requested { color: var(--warning); background: var(--warning-soft); }
.status-info, .status-queued, .status-created, .status-pending, .status-unknown { color: var(--info); background: var(--info-soft); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 160px; }
.filter-search { position: relative; flex: 1; min-width: 220px; }
.filter-search i { position: absolute; top: 50%; right: 13px; transform: translateY(-50%); color: var(--text-muted); }
.filter-search .form-control { width: 100%; padding-right: 36px; }
.form-control, .form-select { min-height: 42px; border-color: var(--border); border-radius: 10px; background-color: var(--surface); color: var(--text); font-size: .82rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); background-color: var(--surface); color: var(--text); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--primary) 15%, transparent); }
.form-control::placeholder { color: color-mix(in srgb, var(--text-muted) 75%, transparent); }
textarea.form-control { min-height: 90px; }
.form-label { margin-bottom: 6px; color: var(--text); font-size: .75rem; font-weight: 650; }
.form-text { color: var(--text-muted); font-size: .65rem; }
.config-examples { margin-top: 10px; overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.config-examples summary { padding: 10px 12px; color: var(--text); cursor: pointer; font-size: .69rem; font-weight: 700; }
.config-examples summary::marker { color: var(--primary); }
.config-examples-body { display: grid; gap: 8px; padding: 0 10px 10px; }
.config-example-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.config-example-item[hidden], .config-example-empty[hidden] { display: none !important; }
.config-example-copy { min-width: 0; }
.config-example-copy strong, .config-example-copy small { display: block; }
.config-example-copy strong { margin-bottom: 3px; font-size: .68rem; }
.config-example-copy small, .config-example-empty { color: var(--text-muted); font-size: .61rem; }
.config-example-empty { margin: 0; padding: 8px; text-align: center; }
.config-example-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 3px; }
.config-example-actions .btn { white-space: nowrap; font-size: .63rem; }
.required-mark { margin-right: 3px; color: var(--danger); }
.btn { border-radius: 10px; font-size: .78rem; font-weight: 650; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); }
.btn-outline-secondary { --bs-btn-color: var(--text-muted); --bs-btn-border-color: var(--border); --bs-btn-hover-bg: var(--surface-soft); --bs-btn-hover-color: var(--text); --bs-btn-hover-border-color: var(--border); }
.action-menu { display: flex; align-items: center; gap: 7px; }
.pagination-wrap { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 18px; border-top: 1px solid var(--border); }
.pagination-meta { color: var(--text-muted); font-size: .68rem; }
.page-link { border-color: var(--border); background: var(--surface); color: var(--text-muted); }
.active > .page-link { border-color: var(--primary); background: var(--primary); }
.empty-state { padding: 50px 24px; text-align: center; }
.empty-icon { width: 60px; height: 60px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 15px; border-radius: 18px; color: var(--primary); background: var(--primary-soft); font-size: 1.45rem; }
.empty-state h3 { margin: 0 0 6px; font-size: .9rem; }
.empty-state p { max-width: 420px; margin: 0 auto; color: var(--text-muted); font-size: .75rem; }
.detail-hero { display: flex; align-items: center; gap: 18px; padding: 20px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(115deg, var(--surface), var(--primary-soft)); }
.detail-icon { width: 58px; height: 58px; display: inline-flex; align-items: center; justify-content: center; border-radius: 17px; color: var(--primary); background: var(--surface); box-shadow: var(--shadow-sm); font-size: 1.45rem; }
.detail-copy h2 { margin: 0 0 5px; font-size: 1.14rem; }
.detail-copy p { margin: 0; color: var(--text-muted); }
.detail-actions { margin-right: auto; display: flex; gap: 8px; }
.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 18px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--border); }
.metric-item { padding: 17px; background: var(--surface); }
.metric-item span, .metric-item strong { display: block; }
.metric-item span { margin-bottom: 5px; color: var(--text-muted); font-size: .68rem; }
.metric-item strong { font-size: .92rem; }
.nav-tabs { gap: 5px; padding: 0 8px; border-bottom-color: var(--border); }
.nav-tabs .nav-link { padding: 11px 14px; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: .73rem; }
.nav-tabs .nav-link:hover { color: var(--text); }
.nav-tabs .nav-link.active { border-bottom-color: var(--primary); background: transparent; color: var(--primary); font-weight: 700; }
.tab-content-panel { padding: 20px; }
.definition-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 30px; margin: 0; }
.definition-list div { display: grid; grid-template-columns: 125px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.definition-list dt { color: var(--text-muted); font-size: .69rem; font-weight: 500; }
.definition-list dd { margin: 0; overflow-wrap: anywhere; font-size: .76rem; font-weight: 600; }
.tag { display: inline-flex; padding: 4px 8px; margin: 2px; border-radius: 8px; color: var(--primary); background: var(--primary-soft); font-size: .64rem; }
.timeline { position: relative; margin: 0; padding: 5px 20px 5px 0; list-style: none; }
.timeline::before { content: ""; position: absolute; top: 8px; bottom: 8px; right: 5px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding: 0 18px 20px 0; }
.timeline-item::before { content: ""; position: absolute; top: 5px; right: -19px; width: 10px; height: 10px; border: 2px solid var(--surface); border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item strong { display: block; margin-bottom: 3px; font-size: .75rem; }
.timeline-item p { margin: 0 0 3px; color: var(--text-muted); font-size: .69rem; }
.timeline-item time { color: var(--text-muted); font-size: .62rem; }
.code-block { max-height: 440px; overflow: auto; padding: 15px; border: 1px solid var(--border); border-radius: 12px; direction: ltr; background: #0f172a; color: #cbd5e1; font: .72rem/1.8 ui-monospace, monospace; text-align: left; white-space: pre-wrap; }
.preview-state { min-height: 230px; display: flex; align-items: center; justify-content: center; }
.health-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.health-card { padding: 19px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.health-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.health-card h3 { margin: 0; font-size: .82rem; }
.health-value { font-size: 1.35rem; font-weight: 800; }
.health-meta { color: var(--text-muted); font-size: .67rem; }
.loading-overlay { position: fixed; z-index: 2000; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(15,23,42,.28); backdrop-filter: blur(2px); }
.loading-overlay.visible { display: flex; }
.loading-card { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow-lg); }
.alert { border: 0; border-radius: 12px; font-size: .76rem; }
.modal-content { border-color: var(--border); border-radius: 18px; background: var(--surface); color: var(--text); }
.modal-dialog-scrollable .modal-content > form { display: flex; min-height: 0; max-height: calc(100vh - var(--bs-modal-margin) - var(--bs-modal-margin)); max-height: calc(100dvh - var(--bs-modal-margin) - var(--bs-modal-margin)); flex-direction: column; }
.modal-dialog-scrollable .modal-content > form > .modal-header, .modal-dialog-scrollable .modal-content > form > .modal-footer { flex: 0 0 auto; }
.modal-dialog-scrollable .modal-content > form > .modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.modal-header, .modal-footer { border-color: var(--border); }
.modal-title { font-size: .95rem; }
.dataset-create-dialog { width: calc(100% - 30px); max-width: 800px; }
.dataset-create-dialog .modal-content { overflow: hidden; }
.dataset-modal-header { align-items: flex-start; padding: 18px 22px 16px; }
.dataset-modal-header > div { min-width: 0; padding-left: 24px; }
.dataset-modal-header .modal-title { margin-bottom: 5px; font-size: 1.05rem; }
.dataset-modal-header p { max-width: 620px; margin: 0; color: var(--text-muted); font-size: .69rem; line-height: 1.8; }
.dataset-modal-body { padding: 17px 22px 18px; }
.dataset-form-alert { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 16px; padding: 10px 12px; }
.dataset-form-alert .errorlist { margin: 0; padding: 0; list-style: none; }
.dataset-form-section > h3 { margin: 0 0 13px; color: var(--text-muted); font-size: .7rem; font-weight: 750; }
.dataset-management-section { padding-top: 16px; margin-top: 18px; border-top: 1px solid var(--border); }
.dataset-fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.dataset-field { min-width: 0; }
.dataset-field-wide { grid-column: 1 / -1; }
.dataset-field .form-label { display: block; }
.dataset-field textarea.form-control { min-height: 78px; resize: vertical; }
.dataset-slug-field { max-width: 430px; }
.dataset-slug-field .form-label { color: var(--text-muted); }
.dataset-slug-field .form-control { background: var(--surface-soft); direction: ltr; text-align: left; }
.dataset-advanced-settings { margin-top: 18px; }
.advanced-box { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.advanced-box > summary { color: var(--text-muted); font-size: .7rem; font-weight: 700; cursor: pointer; }
.technical-value { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.copy-button { padding: 3px 8px; border: 1px solid var(--border); border-radius: 7px; color: var(--primary); background: var(--surface); font-size: .61rem; }
.technical-popover summary { color: var(--primary); font-size: .65rem; cursor: pointer; white-space: nowrap; }
.technical-popover > div { min-width: 260px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 7px; padding-top: 8px; }
.technical-popover span { color: var(--text-muted); font-size: .61rem; }
.technical-popover code { overflow-wrap: anywhere; font-size: .59rem; }
.job-form-section { padding: 4px 2px 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.job-form-section:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.job-form-section > header { margin-bottom: 15px; }
.job-form-section > header h3 { margin: 0 0 4px; font-size: .82rem; }
.job-form-section > header p { margin: 0; color: var(--text-muted); font-size: .67rem; }
.relation-picker { min-width: 0; }
.relation-search { position: relative; margin-bottom: 7px; }
.relation-search > i { position: absolute; z-index: 1; top: 50%; right: 12px; transform: translateY(-50%); color: var(--text-muted); font-size: .72rem; }
.relation-search .form-control { padding-right: 34px; font-size: .7rem; }
.relation-picker .form-select { min-height: 46px; font-size: .7rem; }
.schedule-summary { display: flex; align-items: center; padding: 11px 13px; border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: .7rem; font-weight: 650; }
.pagination-builder { padding: 13px; border: 1px dashed var(--border); border-radius: 11px; background: var(--surface-soft); }
.key-value-editor { padding: 11px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-soft); }
.key-value-editor .key-value-row:first-child { margin-top: 0; }
.dataset-field.has-error .form-control, .dataset-field.has-error .form-select, .dataset-field.has-error .chip-input { border-color: var(--danger); }
.dataset-field.has-error .form-control:focus, .dataset-field.has-error .form-select:focus, .dataset-field.has-error .chip-input:focus-within { box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--danger) 15%, transparent); }
.dataset-field .chip-input { margin-top: 0; }
.dataset-field .input-chip { direction: rtl; }
.dataset-modal-footer { min-height: 64px; padding: 11px 22px; }
.dataset-modal-footer .btn { min-width: 104px; }
.wizard-form { display: flex; min-height: min(760px, calc(100dvh - 40px)); max-height: calc(100dvh - 30px); flex-direction: column; }
.wizard-header { min-height: 92px; display: grid; grid-template-columns: minmax(165px, .7fr) minmax(430px, 1.8fr) auto; align-items: center; gap: 20px; padding: 17px 22px; }
.wizard-heading .eyebrow { display: block; margin-bottom: 4px; color: var(--primary); font-size: .59rem; font-weight: 750; }
.wizard-heading .modal-title { font-size: 1.05rem; }
.wizard-stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; direction: rtl; }
.wizard-stepper li { position: relative; display: flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: .65rem; }
.wizard-stepper li:not(:last-child)::after { content: ""; position: absolute; z-index: 0; top: 50%; right: 29px; left: 7px; height: 2px; transform: translateY(-50%); background: var(--border); }
.wizard-stepper li span { z-index: 1; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); font-size: .62rem; }
.wizard-stepper li strong { z-index: 1; padding: 2px 0 2px 7px; background: var(--surface); white-space: nowrap; }
.wizard-stepper li.active { color: var(--primary); }
.wizard-stepper li.active span { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.wizard-stepper li.done { color: var(--success); }
.wizard-stepper li.done span { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.wizard-stepper li.done::after { background: color-mix(in srgb, var(--success) 55%, var(--border)); }
.wizard-body { min-height: 0; padding: 24px; overflow-y: auto; overscroll-behavior: contain; }
.wizard-panel { width: 100%; max-width: 1080px; margin: 0 auto; }
.wizard-alert { max-width: 1080px; margin: 0 auto 16px; }
.wizard-intro { margin: 5px auto 24px; text-align: center; }
.wizard-intro h3 { margin: 0 0 7px; font-size: 1rem; }
.wizard-intro p { margin: 0; color: var(--text-muted); font-size: .72rem; line-height: 1.8; }
.source-choice-grid { max-width: 850px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 40px auto; }
.source-choice-card { min-height: 210px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 28px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); text-align: right; box-shadow: var(--shadow-sm); transition: .18s ease; }
.source-choice-card:hover:not(:disabled), .source-choice-card:focus-visible { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); box-shadow: var(--shadow-lg); }
.source-choice-card:disabled { opacity: .55; cursor: not-allowed; }
.source-choice-card > i { color: var(--text-muted); font-size: 1rem; }
.source-choice-card strong, .source-choice-card small, .source-choice-card em { display: block; }
.source-choice-card strong { margin-bottom: 5px; font-size: 1rem; }
.source-choice-card small { margin-bottom: 14px; color: var(--primary); font-size: .67rem; font-weight: 750; }
.source-choice-card em { color: var(--text-muted); font-size: .69rem; font-style: normal; line-height: 1.9; }
.source-choice-icon { width: 55px; height: 55px; display: inline-flex; align-items: center; justify-content: center; border-radius: 16px; color: var(--primary); background: var(--primary-soft); font-size: 1.35rem; }
.source-choice-icon.tone-violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 12%, transparent); }
.dropzone { min-height: 360px; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 42px; border: 2px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); border-radius: 20px; background: color-mix(in srgb, var(--primary-soft) 40%, var(--surface)); text-align: center; cursor: pointer; transition: .18s ease; }
.dropzone:hover, .dropzone.dragging, .dropzone:focus-visible { border-color: var(--primary); background: var(--primary-soft); outline: none; }
.dropzone-icon { width: 72px; height: 72px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 18px; border-radius: 22px; color: var(--primary); background: var(--surface); box-shadow: var(--shadow-sm); font-size: 1.8rem; }
.dropzone h3 { margin: 0 0 7px; font-size: 1.05rem; }
.dropzone p { margin: 0 0 15px; color: var(--text-muted); font-size: .74rem; }
.dropzone strong { margin-bottom: 10px; color: var(--primary); font-size: .7rem; letter-spacing: .08em; direction: ltr; }
.dropzone small { color: var(--text-muted); font-size: .65rem; }
.upload-card { position: relative; min-height: 165px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 28px; margin: 70px auto; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.upload-card .file-format-icon { width: 54px; height: 54px; display: inline-flex; align-items: center; justify-content: center; border-radius: 15px; color: var(--success); background: var(--success-soft); font-size: 1.25rem; }
.upload-card > div > strong, .upload-card > div > small, .upload-card > div > span { display: block; }
.upload-card > div > strong { margin-bottom: 5px; font-size: .87rem; }
.upload-card > div > small { margin-bottom: 9px; color: var(--text-muted); font-size: .68rem; }
.upload-card > div > span { font-size: .67rem; }
.upload-card .progress { position: absolute; right: 28px; bottom: 20px; left: 28px; height: 5px; background: var(--surface-soft); }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.preview-toolbar h3 { margin: 0 0 5px; font-size: .93rem; }
.preview-toolbar p { margin: 0; color: var(--text-muted); font-size: .65rem; }
.sheet-control { min-width: 190px; display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: .67rem; }
.sheet-control .form-select { min-width: 135px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.summary-card { min-height: 68px; display: flex; align-items: center; gap: 11px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.summary-card > i { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; color: var(--primary); background: var(--primary-soft); }
.summary-card strong, .summary-card small { display: block; }
.summary-card strong { margin-bottom: 2px; font-size: .84rem; }
.summary-card small { color: var(--text-muted); font-size: .6rem; }
.advanced-panel { margin: 12px 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); }
.advanced-panel summary { padding: 12px 14px; color: var(--text-muted); font-size: .68rem; font-weight: 700; cursor: pointer; }
.advanced-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 12px; padding: 0 14px 14px; }
.advanced-grid label { color: var(--text-muted); font-size: .64rem; }
.advanced-grid .form-control, .advanced-grid .form-select { margin-top: 6px; }
.preview-tabs { display: flex; gap: 4px; margin-top: 14px; padding: 4px; border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--surface-soft); }
.preview-tabs button { min-width: 75px; padding: 7px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-muted); font-size: .66rem; }
.preview-tabs button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); font-weight: 700; }
.preview-stage, .preview-json { position: relative; min-height: 205px; max-height: 265px; margin: 0; overflow: auto; border: 1px solid var(--border); border-radius: 0 0 12px 12px; }
.preview-table { min-width: 700px; font-size: .68rem; direction: ltr; text-align: left; }
.preview-table > :not(caption) > * > * { max-width: 250px; padding: .58rem .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-loading, .empty-preview, .standalone-loading { min-height: 203px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 9px; background: color-mix(in srgb, var(--surface) 92%, transparent); text-align: center; }
.preview-loading { position: absolute; z-index: 3; inset: 0; }
.preview-loading strong, .empty-preview strong, .standalone-loading strong { font-size: .73rem; }
.empty-preview i { color: var(--text-muted); font-size: 1.7rem; }
.empty-preview small, .standalone-loading small { color: var(--text-muted); font-size: .63rem; }
.schema-panel { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.schema-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.schema-panel-head h4 { margin: 0; font-size: .73rem; }
.schema-panel-head span { color: var(--success); font-size: .6rem; }
.schema-grid { max-height: 145px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 15px; overflow: auto; padding: 5px 14px; }
.schema-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.schema-grid strong { overflow: hidden; font-family: ui-monospace, monospace; font-size: .63rem; text-overflow: ellipsis; direction: ltr; }
.schema-grid span { padding: 3px 7px; border-radius: 6px; color: var(--violet); background: color-mix(in srgb, var(--violet) 10%, transparent); font-size: .56rem; }
.metadata-shell { max-width: 760px; margin: 0 auto; }
.metadata-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.metadata-grid > label, .metadata-grid > div > label { color: var(--text-muted); font-size: .67rem; font-weight: 650; }
.metadata-grid .form-control, .metadata-grid .form-select { margin-top: 7px; }
.metadata-grid .field-wide { grid-column: 1 / -1; }
.optional-label { margin-right: 6px; color: var(--text-muted); font-size: .56rem; font-weight: 400; }
.ltr-input { direction: ltr; text-align: left; }
.chip-input { min-height: 46px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 9px; margin-top: 7px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.chip-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--primary) 15%, transparent); }
.chip-list { display: contents; }
.chip-input > input { min-width: 155px; height: 30px; flex: 1 1 180px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .73rem; }
.input-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; color: var(--primary); background: var(--primary-soft); font-size: .64rem; }
.input-chip button { padding: 0; border: 0; background: transparent; color: inherit; font-size: .9rem; line-height: 1; }
.ready-card { max-width: 760px; display: grid; grid-template-columns: auto 1fr; gap: 15px 18px; padding: 28px; margin: 10px auto; border: 1px solid var(--border); border-radius: 18px; background: linear-gradient(120deg, var(--surface), var(--success-soft)); }
.ready-icon { width: 52px; height: 52px; display: inline-flex; align-items: center; justify-content: center; grid-row: span 2; border-radius: 16px; background: var(--success); color: white; font-size: 1.25rem; }
.ready-card h3 { margin: 4px 0 0; font-size: .95rem; }
.summary-list { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; margin: 7px 0 0; }
.summary-list > div { display: grid; grid-template-columns: 115px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.summary-list dt { color: var(--text-muted); font-size: .64rem; font-weight: 500; }
.summary-list dd { margin: 0; overflow-wrap: anywhere; font-size: .7rem; font-weight: 700; }
.wizard-footer { min-height: 68px; padding: 12px 22px; }
.wizard-footer-spacer { flex: 1; }
.wizard-footer .btn { min-width: 105px; }
.ingestion-setup-shell { overflow: hidden; }
.ingestion-setup-shell > form { min-height: 650px; display: flex; flex-direction: column; }
.ingestion-setup-header { padding: 20px 24px; border-bottom: 1px solid var(--border); background: var(--surface-soft); }
.ingestion-stepper { max-width: 980px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0 auto; padding: 0; list-style: none; }
.ingestion-stepper li { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--text-muted); font-size: .65rem; }
.ingestion-stepper li:not(:last-child)::after { content: ""; position: absolute; z-index: 0; top: 50%; right: calc(50% + 17px); left: calc(-50% + 17px); height: 2px; transform: translateY(-50%); background: var(--border); }
.ingestion-stepper li span, .ingestion-stepper li strong { position: relative; z-index: 1; background: var(--surface-soft); }
.ingestion-stepper li span { width: 29px; height: 29px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 50%; }
.ingestion-stepper li strong { padding-left: 7px; white-space: nowrap; }
.ingestion-stepper li.active { color: var(--primary); }
.ingestion-stepper li.active span { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 0 0 4px var(--primary-soft); }
.ingestion-stepper li.done { color: var(--success); }
.ingestion-stepper li.done span { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.ingestion-stepper li.done:not(:last-child)::after { background: color-mix(in srgb, var(--success) 55%, var(--border)); }
.ingestion-setup-body { flex: 1 1 auto; padding: 28px; }
.ingestion-step { max-width: 980px; margin: 0 auto; }
.ingestion-step .wizard-intro .source-choice-icon { margin-bottom: 14px; }
.setup-field-card { max-width: 760px; padding: 22px; margin: 0 auto; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-soft); }
.setup-secondary-action { max-width: 760px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 18px; margin: 12px auto 0; border: 1px dashed var(--border); border-radius: 12px; color: var(--text-muted); font-size: .67rem; }
.setup-preview { max-width: 900px; margin: 0 auto; }
.setup-source-context { padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); color: var(--text-muted); font-size: .69rem; }
.setup-preview .schema-chip { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.setup-preview .schema-chip strong { overflow: hidden; font-family: ui-monospace, monospace; font-size: .63rem; text-overflow: ellipsis; direction: ltr; }
.setup-preview .schema-chip small { padding: 3px 7px; border-radius: 6px; color: var(--violet); background: color-mix(in srgb, var(--violet) 10%, transparent); font-size: .56rem; }
.setup-preview .empty-preview { min-height: 145px; }
.setup-confirmation { max-width: 760px; padding: 14px 18px; margin: 14px auto 0; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border)); border-radius: 12px; background: var(--primary-soft); }
.ingestion-step[data-setup-step="4"] { max-width: 880px; }
.ingestion-ready-card { max-width: 850px; }
.ingestion-setup-footer { min-height: 72px; display: flex; align-items: center; gap: 10px; padding: 13px 24px; border-top: 1px solid var(--border); background: var(--surface-soft); }
.ingestion-setup-footer .btn { min-width: 125px; }
.api-fields { max-width: 800px; margin: 0 auto 20px; }
.key-value-section { max-width: 800px; padding: 15px; margin: 0 auto 12px; border: 1px solid var(--border); border-radius: 12px; }
.key-value-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.key-value-head h4 { margin: 0 0 3px; font-size: .73rem; }
.key-value-head p { margin: 0; color: var(--text-muted); font-size: .61rem; }
.key-value-row { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(200px, 1.5fr) auto; gap: 8px; margin-top: 8px; }
.key-value-row .btn { width: 42px; padding: 0; }
.connection-test-state { min-height: 390px; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.connection-test-state h3 { margin: 17px 0 7px; font-size: .93rem; }
.connection-test-state p { max-width: 500px; margin: 0; color: var(--text-muted); font-size: .68rem; }
.connection-success { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid color-mix(in srgb, var(--success) 30%, var(--border)); border-radius: 11px; background: var(--success-soft); }
.connection-success span { color: var(--success); font-size: .7rem; font-weight: 750; }
.connection-success strong { margin-right: auto; font-size: .7rem; direction: ltr; }
.connection-success small { color: var(--text-muted); font-size: .62rem; }
.standalone-loading { min-height: 390px; }
.definition-list .ltr-value { direction: ltr; text-align: right; font-family: ui-monospace, monospace; }
.login-body { min-height: 100vh; overflow-x: hidden; background: var(--bg); }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-panel { width: 100%; display: flex; justify-content: center; }
.login-card { width: min(100%, 430px); padding: 36px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); }
.login-card h2 { margin: 7px 0 8px; font-size: 1.55rem; font-weight: 800; }
.login-card > p { margin-bottom: 28px; font-size: .78rem; }
.login-help { margin: 22px 0 0 !important; color: var(--text-muted); text-align: center; font-size: .66rem !important; }
.login-theme { position: fixed; z-index: 5; top: 20px; left: 20px; }
.login-brand { display: flex; align-items: center; flex-direction: column; gap: 12px; margin-bottom: 30px; text-align: center; }

.lineage-page-heading { align-items: center; padding: 3px 2px; }
.lineage-page-heading h2 { margin-top: 4px; font-size: 1.35rem; }
.lineage-heading-badges { display: flex; align-items: center; gap: 8px; }
.lineage-summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.lineage-summary-card { min-height: 92px; display: flex; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.lineage-summary-card > div { min-width: 0; }
.lineage-summary-card small, .lineage-summary-card strong { display: block; }
.lineage-summary-card small { margin-bottom: 5px; color: var(--text-muted); font-size: .67rem; white-space: nowrap; }
.lineage-summary-card strong { font-size: 1.38rem; line-height: 1; }
.lineage-summary-icon { width: 39px; height: 39px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border-radius: 12px; color: var(--primary); background: var(--primary-soft); font-size: 1rem; }
.lineage-summary-icon.tone-violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 12%, transparent); }
.lineage-summary-icon.tone-info { color: var(--info); background: var(--info-soft); }
.lineage-summary-icon.tone-warning { color: var(--warning); background: var(--warning-soft); }
.lineage-summary-icon.tone-success { color: var(--success); background: var(--success-soft); }
.lineage-filter-panel { margin-bottom: 16px; }
.lineage-filter-panel .panel-body { padding: 14px; }
.lineage-filter-primary, .lineage-filter-secondary { display: flex; align-items: end; gap: 10px; }
.lineage-filter-primary { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.lineage-field { min-width: 170px; display: flex; flex: 0 0 auto; flex-direction: column; gap: 6px; }
.lineage-field > span:first-child { color: var(--text-muted); font-size: .64rem; font-weight: 700; }
.lineage-search-field { min-width: 260px; flex: 1 1 320px; }
.lineage-input-icon { position: relative; }
.lineage-input-icon > i { position: absolute; z-index: 1; top: 50%; right: 13px; transform: translateY(-50%); color: var(--text-muted); }
.lineage-input-icon .form-control { width: 100%; padding-right: 36px; }
.lineage-static-value { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--border); border-radius: 10px; color: var(--primary); background: var(--primary-soft); font-size: .76rem; font-weight: 700; }
.lineage-filter-secondary .lineage-field { min-width: 150px; flex: 1 1 180px; }
.lineage-clear-filters { min-height: 42px; white-space: nowrap; }
.lineage-limit-alert { margin-bottom: 16px; }
.lineage-graph-panel { overflow: hidden; }
.lineage-graph-header p { margin: 4px 0 0; color: var(--text-muted); font-size: .68rem; }
.lineage-stage { min-height: 650px; display: grid; grid-template-columns: minmax(0, 1fr) 0; overflow: hidden; direction: ltr; transition: grid-template-columns .2s ease; }
.lineage-stage.detail-open { grid-template-columns: minmax(0, 1fr) 335px; }
.lineage-canvas-wrap { position: relative; min-width: 0; min-height: 650px; overflow: hidden; background-color: var(--surface-soft); background-image: radial-gradient(circle, color-mix(in srgb, var(--text-muted) 20%, transparent) 1px, transparent 1px); background-size: 22px 22px; }
.lineage-canvas { width: 100%; height: 650px; outline: none; direction: ltr; }
.lineage-canvas:focus-visible { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent); }
.lineage-toolbar { position: absolute; z-index: 5; top: 14px; left: 14px; display: flex; overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow-sm); backdrop-filter: blur(10px); direction: ltr; }
.lineage-toolbar button, .lineage-detail-panel header button { width: 39px; height: 39px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-right: 1px solid var(--border); color: var(--text-muted); background: transparent; transition: .15s; }
.lineage-toolbar button:last-child { border-right: 0; }
.lineage-toolbar button:hover, .lineage-detail-panel header button:hover { color: var(--primary); background: var(--primary-soft); }
.lineage-state { position: absolute; z-index: 4; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 9px; padding: 30px; color: var(--text); background: color-mix(in srgb, var(--surface-soft) 88%, transparent); text-align: center; direction: rtl; backdrop-filter: blur(3px); }
.lineage-state[hidden] { display: none; }
.lineage-state strong { font-size: .84rem; }
.lineage-state small { max-width: 420px; color: var(--text-muted); font-size: .68rem; line-height: 1.8; }
.lineage-error-state .empty-icon { margin: 0; color: var(--danger); background: var(--danger-soft); }
.lineage-detail-panel { min-width: 0; overflow: hidden auto; border-left: 1px solid var(--border); background: var(--surface); color: var(--text); direction: rtl; }
.lineage-detail-panel[hidden] { display: block; visibility: hidden; }
.lineage-detail-panel header { min-width: 334px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 19px; border-bottom: 1px solid var(--border); }
.lineage-detail-panel header h3 { margin: 4px 0 0; font-size: .96rem; overflow-wrap: anywhere; }
.lineage-detail-panel header button { flex: 0 0 auto; border: 0; border-radius: 10px; }
.lineage-detail-status { min-width: 334px; padding: 15px 19px 0; }
.lineage-detail-panel dl { min-width: 334px; margin: 5px 0 18px; padding: 0 19px; }
.lineage-detail-panel dl div { display: grid; grid-template-columns: 118px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.lineage-detail-panel dt { color: var(--text-muted); font-size: .65rem; font-weight: 500; }
.lineage-detail-panel dd { margin: 0; overflow-wrap: anywhere; font-size: .7rem; font-weight: 650; }
.lineage-detail-panel .ltr-value { direction: ltr; text-align: right; font-family: ui-monospace, monospace; font-size: .63rem; }
.lineage-detail-panel > a { width: calc(100% - 38px) !important; min-width: 296px; margin: 0 19px 19px; }
.lineage-legend { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 22px; padding: 14px 17px; margin-top: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.lineage-legend-title { display: flex; align-items: center; gap: 10px; }
.lineage-legend-title > i { color: var(--primary); font-size: 1.1rem; }
.lineage-legend-title strong, .lineage-legend-title small { display: block; white-space: nowrap; }
.lineage-legend-title strong { font-size: .7rem; }
.lineage-legend-title small { margin-top: 2px; color: var(--text-muted); font-size: .58rem; }
.lineage-legend-items, .lineage-status-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 15px; }
.lineage-legend-items span, .lineage-status-legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: .62rem; white-space: nowrap; }
.legend-shape { width: 12px; height: 12px; display: inline-block; border: 2px solid var(--primary); background: var(--primary-soft); }
.legend-shape.connector { border-radius: 50%; border-color: var(--info); background: var(--info-soft); }
.legend-shape.source { width: 15px; border-radius: 50%; border-color: #0891b2; background: #ecfeff; }
.legend-shape.dataset { border-radius: 3px 3px 6px 6px; border-color: var(--primary); }
.legend-shape.version { border-radius: 2px; border-color: var(--violet); background: color-mix(in srgb, var(--violet) 10%, transparent); }
.legend-shape.transformation { transform: rotate(45deg); border-color: var(--warning); background: var(--warning-soft); }
.legend-shape.quality { border-radius: 4px; border-color: var(--success); background: var(--success-soft); clip-path: polygon(25% 7%, 75% 7%, 100% 50%, 75% 93%, 25% 93%, 0 50%); }
.legend-shape.export { border-color: #db2777; background: #fdf2f8; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.status-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; }
.status-dot.healthy { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.status-dot.failed { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.lineage-tab-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 2px 1px 18px; }
.lineage-tab-intro h3 { margin: 4px 0 5px; font-size: 1rem; }
.lineage-tab-intro p { margin: 0; color: var(--text-muted); font-size: .7rem; }
.vis-tooltip { padding: 9px 11px !important; border: 1px solid var(--border) !important; border-radius: 9px !important; background: var(--surface-raised) !important; color: var(--text) !important; box-shadow: var(--shadow-lg) !important; font-family: var(--font-family) !important; font-size: .68rem !important; direction: rtl; }
.quality-rule-sentence { display: flex; align-items: flex-start; padding: 13px 15px; border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border)); border-radius: 11px; background: var(--primary-soft); color: var(--text); font-size: .72rem; line-height: 1.9; }
.quality-rule-sentence i { margin-top: 4px; color: var(--primary); }
.user-picker { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.user-picker-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border-bottom: 1px solid var(--border); }
.user-picker-search { position: relative; flex: 1; }
.user-picker-search i { position: absolute; top: 50%; right: 11px; z-index: 1; color: var(--text-muted); transform: translateY(-50%); }
.user-picker-search .form-control { padding-right: 34px; }
.user-picker-options { max-height: 320px; overflow-y: auto; }
.user-picker-option { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.user-picker-option:last-of-type { border-bottom: 0; }
.user-picker-option:hover { background: var(--surface-muted); }
.user-picker-option > input { width: 17px; height: 17px; accent-color: var(--primary); }
.user-picker-avatar { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); }
.user-picker-identity { min-width: 0; }
.user-picker-identity strong, .user-picker-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-picker-identity strong { font-size: .7rem; }
.user-picker-identity small { margin-top: 2px; color: var(--text-muted); font-size: .58rem; text-align: right; }
.entity-picker { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.entity-picker-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px; border-bottom: 1px solid var(--border); }
.entity-picker-search { position: relative; flex: 1; }
.entity-picker-search i { position: absolute; top: 50%; right: 11px; z-index: 1; color: var(--text-muted); transform: translateY(-50%); }
.entity-picker-search .form-control { padding-right: 34px; }
.entity-picker-options { max-height: 280px; overflow-y: auto; }
.entity-picker-option { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.entity-picker-option:last-of-type { border-bottom: 0; }
.entity-picker-option:hover { background: var(--surface-muted); }
.entity-picker-option > input { width: 17px; height: 17px; accent-color: var(--primary); }
.entity-picker-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary); }
.entity-picker-identity { min-width: 0; }
.entity-picker-identity strong, .entity-picker-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entity-picker-identity strong { font-size: .7rem; }
.entity-picker-identity small { margin-top: 2px; color: var(--text-muted); font-size: .59rem; }
.policy-stepper { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 24px; }
.policy-stepper button { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-muted); font-size: .64rem; }
.policy-stepper button span { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; background: var(--surface-muted); }
.policy-stepper button.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.policy-stepper button.active span { background: var(--primary); color: #fff; }
.policy-builder-ready .policy-step { display: none; }
.policy-builder-ready .policy-step.active { display: block; }
.policy-step-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.policy-step-heading h3 { margin: 0 0 4px; font-size: .9rem; }
.policy-step-heading p { margin: 0; color: var(--text-muted); font-size: .66rem; }
.policy-step-icon { display: grid; width: 40px; height: 40px; flex: 0 0 auto; place-items: center; border-radius: 11px; background: var(--primary-soft); color: var(--primary); font-size: 1rem; }
.policy-step .form-field + .form-field, .policy-step [data-policy-subject], .policy-step [data-policy-scope] { margin-top: 16px; }
.policy-step .form-field > div[id$="subject_kind"], .policy-step .form-field > div[id$="scope_mode"], .policy-step .form-field > div[id$="environment_mode"], .policy-step .form-field > div[id$="data_classifications"], .policy-step .form-field > div[id$="environments"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.policy-step .form-field > div[id$="subject_kind"] > div > label, .policy-step .form-field > div[id$="scope_mode"] > div > label, .policy-step .form-field > div[id$="environment_mode"] > div > label, .policy-step .form-field > div[id$="data_classifications"] > div > label, .policy-step .form-field > div[id$="environments"] > div > label { min-height: 43px; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; transition: .16s ease; }
.policy-step .form-field > div[id$="subject_kind"] input, .policy-step .form-field > div[id$="scope_mode"] input, .policy-step .form-field > div[id$="environment_mode"] input, .policy-step .form-field > div[id$="data_classifications"] input, .policy-step .form-field > div[id$="environments"] input { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; accent-color: var(--primary); }
.policy-step .form-field > div[id$="subject_kind"] > div > label:has(input:checked), .policy-step .form-field > div[id$="scope_mode"] > div > label:has(input:checked), .policy-step .form-field > div[id$="environment_mode"] > div > label:has(input:checked), .policy-step .form-field > div[id$="data_classifications"] > div > label:has(input:checked), .policy-step .form-field > div[id$="environments"] > div > label:has(input:checked) { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); background: var(--primary-soft); color: var(--primary); }
.policy-summary { display: flex; align-items: flex-start; gap: 12px; padding: 18px; border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border)); border-radius: 13px; background: var(--primary-soft); }
.policy-summary i { color: var(--primary); font-size: 1.25rem; }
.policy-summary p { margin: 0; line-height: 2; }
.policy-builder-actions { display: flex; align-items: center; gap: 10px; padding-top: 20px; margin-top: 22px; border-top: 1px solid var(--border); }
.audit-event-table td { vertical-align: top; }
.audit-technical-details { min-width: 145px; }
.audit-technical-details[open] { min-width: 390px; }
.audit-technical-details .definition-list div { grid-template-columns: 105px minmax(0, 1fr); }
.audit-metadata { max-width: 480px; max-height: 220px; padding: 10px; margin: 0; overflow: auto; border-radius: 8px; background: var(--surface-muted); color: var(--text); direction: ltr; text-align: left; font-size: .6rem; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 1199px) {
    .chart-card.chart-sm, .chart-card.chart-lg { grid-column: span 6; }
    .lineage-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lineage-filter-secondary { flex-wrap: wrap; }
    .lineage-filter-secondary .lineage-field { min-width: 220px; }
    .lineage-clear-filters { flex: 1 1 220px; }
    .lineage-legend { grid-template-columns: 1fr; }
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(105%); transition: transform .25s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-backdrop { position: fixed; z-index: 1035; inset: 0; visibility: hidden; opacity: 0; background: rgba(2,6,23,.5); transition: .2s; }
    body.sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }
    .app-main { margin-right: 0; }
    .lineage-filter-primary { flex-wrap: wrap; }
    .lineage-search-field { flex-basis: 100%; }
    .lineage-stage.detail-open { grid-template-columns: minmax(0, 1fr); }
    .lineage-detail-panel { position: absolute; z-index: 8; top: 0; bottom: 0; left: 0; width: min(88vw, 350px); box-shadow: var(--shadow-lg); }
    .lineage-stage { position: relative; }
    .wizard-header { grid-template-columns: 1fr auto; }
    .wizard-stepper { grid-column: 1 / -1; grid-row: 2; }
    .source-choice-grid { margin: 20px auto; }
    .source-choice-card { min-height: 170px; padding: 20px; }
}

@media (max-width: 767px) {
    .topbar { min-height: 66px; padding: 10px 15px; }
    .topbar .eyebrow, .user-copy { display: none; }
    .topbar h1 { font-size: 1rem; }
    .content-area { padding: 18px 14px 28px; }
    .app-footer { flex-direction: column; padding: 15px; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-lists, .health-grid { grid-template-columns: 1fr; }
    .chart-card, .chart-card.chart-sm, .chart-card.chart-lg { grid-column: span 12; }
    .definition-list { grid-template-columns: 1fr; }
    .metric-strip { grid-template-columns: repeat(2, 1fr); }
    .detail-hero { align-items: flex-start; flex-wrap: wrap; }
    .detail-actions { width: 100%; margin-right: 0; }
    .filter-bar .form-control, .filter-bar .form-select, .filter-bar .btn { width: 100%; }
    .config-example-item { align-items: stretch; flex-direction: column; }
    .config-example-actions { flex-wrap: wrap; }
    .login-shell { padding: 28px 20px; }
    .login-card { padding: 30px 24px; }
    .lineage-page-heading, .lineage-tab-intro { align-items: flex-start; flex-direction: column; }
    .lineage-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lineage-summary-card:last-child { grid-column: span 2; }
    .lineage-filter-primary, .lineage-filter-secondary { align-items: stretch; flex-direction: column; }
    .lineage-field, .lineage-filter-secondary .lineage-field, .lineage-clear-filters { width: 100%; min-width: 0; flex-basis: auto; }
    .lineage-canvas, .lineage-canvas-wrap, .lineage-stage { min-height: 540px; height: 540px; }
    .lineage-toolbar { top: 10px; left: 10px; }
    .wizard-form { min-height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
    .wizard-header { gap: 12px; padding: 14px 16px; }
    .wizard-stepper li { justify-content: center; }
    .wizard-stepper li strong { display: none; }
    .wizard-stepper li:not(:last-child)::after { right: calc(50% + 12px); left: calc(-50% + 12px); }
    .wizard-body { padding: 17px; }
    .source-choice-grid, .metadata-grid { grid-template-columns: 1fr; }
    .source-choice-card { min-height: 145px; }
    .metadata-grid .field-wide { grid-column: auto; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .advanced-grid, .schema-grid { grid-template-columns: 1fr 1fr; }
    .summary-list { grid-template-columns: 1fr; }
    .preview-toolbar { align-items: flex-start; flex-direction: column; }
    .sheet-control { width: 100%; }
    .upload-card { grid-template-columns: auto 1fr; margin: 25px auto; }
    .upload-card > .btn { grid-column: 1 / -1; }
    .connection-success { align-items: flex-start; flex-wrap: wrap; }
    .connection-success strong { margin-right: 0; }
    .dataset-create-dialog { width: auto; margin: 8px; }
    .dataset-modal-header { padding: 16px; }
    .dataset-modal-header > div { padding-left: 12px; }
    .dataset-modal-body { padding: 15px 16px 17px; }
    .dataset-fields-grid { grid-template-columns: 1fr; gap: 13px; }
    .dataset-field-wide { grid-column: auto; }
    .dataset-slug-field { max-width: none; }
    .dataset-modal-footer { padding: 10px 16px; }
    .ingestion-setup-hero { display: none; }
    .ingestion-setup-shell > form { min-height: calc(100dvh - 110px); }
    .ingestion-setup-header { padding: 15px 10px; overflow-x: auto; }
    .ingestion-stepper { min-width: 440px; }
    .ingestion-stepper li strong { display: none; }
    .ingestion-setup-body { padding: 20px 15px; }
    .setup-secondary-action { align-items: stretch; flex-direction: column; }
    .setup-secondary-action .btn { width: 100%; }
    .ingestion-setup-footer { padding: 10px 14px; }
}

@media (max-width: 479px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .source-choice-card { grid-template-columns: auto 1fr; }
    .source-choice-card > i { display: none; }
    .summary-grid, .advanced-grid, .schema-grid { grid-template-columns: 1fr; }
    .key-value-row { grid-template-columns: 1fr auto; }
    .key-value-row [data-header-name] { grid-column: 1 / -1; }
    .ready-card { padding: 20px; }
}
