* {
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #f8f9fa;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.page-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 600;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--action-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--action-hover-color);
    text-decoration: underline;
}

/* Cards */

.card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.card.small {
    max-width: 400px;
    margin: 2rem auto;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

/* Alerts */

.alert {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 2000;
    max-width: min(92vw, 700px);
    width: max-content;
    margin: 0;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: alert-in-out 4.5s ease forwards;
}

@keyframes alert-in-out {
    0% {
        opacity: 0;
        transform: translate(-50%, 12px);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    80% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, 12px);
        visibility: hidden;
    }
}

.alert-error {
    background: #fdecea;
    color: #8a2f2f;
    border: 1px solid #8a2f2f;
}

.alert-success {
    background: #eaf7ee;
    color: #2f7a3e;
    border: 1px solid #2f7a3e;
}

.alert-info {
    background: #eaf2fb;
    color: #2f5f8a;
    border: 1px solid #2f5f8a;
}

.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning-border);
}

.alert-static {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    animation: none;
    width: auto;
    max-width: 100%;
    margin-top: 1rem;
}

.llm-feedback-panel {
    border-width: 1px;
    border-style: solid;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    box-shadow: none;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.llm-feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.llm-feedback-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 0.25rem;
    opacity: 0.8;
}

.llm-feedback-title {
    margin: 0;
    font-size: 1rem;
}

.llm-feedback-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid currentColor;
    white-space: nowrap;
}

.llm-feedback-message {
    margin: 0;
    font-weight: 600;
}

.llm-feedback-section {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.llm-feedback-section h5 {
    font-size: 0.9rem;
    margin: 0 0 0.45rem;
}

.llm-feedback-body {
    margin: 0;
    white-space: pre-line;
}

.llm-feedback-list {
    margin: 0;
    padding-left: 1.25rem;
}

.llm-feedback-list li+li {
    margin-top: 0.3rem;
}

.llm-mapping-toolbar-actions {
    min-height: 40px;
}

/* buttons */

.btn {
    height: var(--button-height);
    color: white;
    padding: 0 1rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;
}

.btn.w100 {
    width: 100%;
}

.btn:hover {
    box-shadow: var(--shadow);
    color: white;
    text-decoration: none;
}

.btn:hover a {
    box-shadow: var(--shadow);
    color: white;
    text-decoration: none;
}

.btn-commit {
    background-color: var(--commit-action-color);
}

.btn-commit:hover {
    background-color: var(--commit-action-hover-color);
}

.btn-danger {
    background-color: var(--danger-action-color)
}

.btn-danger:hover {
    background-color: var(--danger-action-hover-color);
}

.btn-neutral {
    background-color: #6b7280;
}

.btn-neutral:hover {
    background-color: #4b5563;
}

.btn-right {
    margin-left: auto;
}

.btn-sm {
    height: 32px;
    padding: 0 0.75rem;
    font-size: 0.85rem;
}

/* Page Header */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-header-title {
    align-items: center;
}

.page-header-title h2 {
    margin-bottom: 0.25rem;
}

.page-header-title p {
    margin-bottom: 0;
}

.page-header-actions {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.dashboard-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
    margin-bottom: 0;
    padding: 1.6rem;
    overflow: hidden;
    border: 1px solid rgba(44, 62, 80, 0.08);
    border-radius: 16px;
    box-shadow: 0 16px 36px rgba(44, 62, 80, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
}

.dashboard-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--dashboard-accent, var(--accent-color));
}

.dashboard-card-wide {
    grid-column: 1 / -1;
}

.dashboard-card-contributor {
    --dashboard-accent: #16a085;
}

.dashboard-card-analyst {
    --dashboard-accent: #3498db;
}

.dashboard-card-data-manager {
    --dashboard-accent: #2b6cb0;
}

.dashboard-card-content-manager {
    --dashboard-accent: #d97706;
}

.dashboard-card-admin {
    --dashboard-accent: #2c3e50;
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.dashboard-card-header> :first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.dashboard-card-header h3 {
    margin-bottom: 0.35rem;
}

.dashboard-card-kicker {
    display: inline-flex;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dashboard-accent, var(--accent-color));
}

.dashboard-card-header p {
    margin-bottom: 0;
    color: #5b6472;
}

.dashboard-card-actions {
    display: inline-flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0.5rem;
    margin-left: auto;
    white-space: nowrap;
}

.dashboard-card-actions .btn {
    flex: 0 0 auto;
}

.dashboard-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.dataset-overview-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-metric {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 1rem;
    min-height: 148px;
    border: 1px solid rgba(216, 222, 232, 0.95);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.dashboard-metric-shell {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.dashboard-metric-featured {
    grid-column: span 2;
}

.dashboard-metric-accent {
    background: linear-gradient(180deg, rgba(52, 152, 219, 0.12), #ffffff 88%);
}

.dashboard-metric-success {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.12), #ffffff 88%);
}

.dashboard-metric-warm {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.14), #ffffff 88%);
}

.dashboard-metric-danger {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.12), #ffffff 88%);
}

.dashboard-metric-neutral {
    background: linear-gradient(180deg, rgba(44, 62, 80, 0.08), #ffffff 88%);
}

.dashboard-metric-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.1;
    word-break: break-word;
}

.dashboard-metric-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    color: #465164;
    font-size: 0.95rem;
}

.dashboard-metric-label small {
    color: #6b7280;
    font-size: 0.8rem;
}

.dashboard-metric-progress {
    width: 100%;
    height: 7px;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(44, 62, 80, 0.08);
}

.dashboard-metric-progress::-webkit-progress-bar {
    background: rgba(44, 62, 80, 0.08);
    border-radius: 999px;
}

.dashboard-metric-progress::-webkit-progress-value {
    background: linear-gradient(90deg, var(--dashboard-accent, var(--accent-color)), rgba(52, 152, 219, 0.45));
    border-radius: 999px;
}

.dashboard-metric-progress::-moz-progress-bar {
    background: linear-gradient(90deg, var(--dashboard-accent, var(--accent-color)), rgba(52, 152, 219, 0.45));
    border-radius: 999px;
}

.dashboard-chart-panel {
    display: grid;
    gap: 1rem;
    padding: 1.2rem;
    border: 1px solid rgba(44, 62, 80, 0.08);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(44, 62, 80, 0.03), rgba(255, 255, 255, 0.98));
}

.dashboard-chart-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.dashboard-chart-header h4 {
    margin-bottom: 0.25rem;
}

.dashboard-chart-header p {
    margin-bottom: 0;
    color: #607086;
}

.dashboard-chart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(44, 62, 80, 0.08);
    color: var(--primary-color);
    font-weight: 700;
}

.dashboard-chart-canvas-wrap {
    position: relative;
    display: grid;
    gap: 0.85rem;
    min-height: 220px;
}

.dashboard-audit-chart {
    width: 100%;
    height: 240px;
    max-height: 280px;
}

.dashboard-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: #607086;
    font-size: 0.88rem;
}

.dashboard-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.dashboard-chart-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dashboard-chart-dot-success {
    background: #16a085;
}

.dashboard-chart-dot-error {
    background: #e74c3c;
}

/* Forms */

.form-flex-column {
    display: flex;
    flex-direction: column;
}

.row-right {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input:not([type="checkbox"]):not([type="radio"]) {
    width: 100%;
    padding: 0.75rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="file"],
.form-group input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
    background-color: white;
}

.form-group textarea {
    resize: vertical;
}

.form-group .label_not_bold {
    display: block;
    margin-bottom: 0.5rem;
    margin-left: 0.5rem;
    font-weight: 400;
    color: var(--primary-color);
}

.inline-form {
    display: inline-flex;
    align-items: flex-start;
}

/* Hero section */

.hero-section {
    text-align: center;
    padding: 40px 0;
}

.hero-section-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin: 10px 0 0 0;
}

/* cms */

.cms-menu {
    padding: 0;
}

.cms-menu-top {
    margin-top: 0;
}

.cms-menu-bottom {
    margin-top: 3.5rem;
    margin-bottom: 0;
}

.cms-footer-slot {
    margin-top: auto;
}

.cms-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;

}

.cms-menu-item {
    margin: 0;
}

.cms-menu-link {
    display: inline-block;
    padding: 0;
    color: var(--action-color);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cms-menu-bottom .cms-menu-link {
    font-weight: 400;
}

.cms-menu-link:hover {
    color: var(--action-hover-color);
    text-decoration: underline;
}

.cms-menu-link:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* public news */

.news-section {
    margin-top: 1.5rem;
}

.news-section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
}

.news-section-header h2 {
    margin-bottom: 0;
}

.news-section-archive-link {
    color: var(--action-color);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.news-section-archive-link:hover {
    color: var(--action-hover-color);
    text-decoration: underline;
}

.news-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 380px));
    gap: 20px;
    margin-top: 20px;
    justify-content: center;
}

.news-card-photo {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.news-card-photo-link {
    display: block;
}

.news-card-body h3 {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
}

.news-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #667085;
    font-size: 0.82rem;
    margin-bottom: 8px;
}

.news-read-link {
    display: inline-block;
    margin-top: 0.65rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
}

.news-read-link:hover {
    text-decoration: underline;
}

.news-card-body p {
    margin-bottom: 0;
    color: #4a4f55;
    white-space: pre-wrap;
}

.news-title-link {
    color: inherit;
    text-decoration: none;
}

.news-title-link:hover {
    color: var(--accent-color);
}


.page-date {
    color: #7f8c8d;
}

.page-summary {
    font-size: 1rem;
    color: #4a4f55;
}

.page-photo {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: 8px;
    margin: 0.75rem 0 1rem;
}

.page-content {
    white-space: pre-wrap;
    line-height: 1.7;
}


.news-archive-list {
    list-style: disc;
    margin: 0;
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.news-archive-item {
    display: list-item;
    margin-bottom: 0.5rem;
}

.news-archive-date {
    color: #6b7280;
    margin-right: 0.45rem;
    font-size: 0.9rem;
}

.news-archive-link-title {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
}

.news-archive-link-title:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Table */


.generic-table {
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.generic-table table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.users-table table {
    min-width: 0;
}

.generic-table th,
.generic-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.generic-table thead th {
    background: var(--secondary-color);
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.generic-table tbody tr:hover {
    background: var(--surface-hover);
}

.generic-table tbody tr:last-child td {
    border-bottom: none;
}

.generic-table td input[type="text"],
.generic-table td input[type="email"] {
    width: 150px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: inherit;
}

.generic-table td select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background-color: white;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}


.col-fill {
    width: 100%;
    white-space: normal;
}

.col-fit {
    width: 1%;
    /* shrinks to minimum needed by content */
    white-space: nowrap;
}

.users-table .col-fit {
    width: auto;
    white-space: normal;
}

.users-table .col-fill {
    width: auto;
}

.users-email-meta {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    color: var(--text-muted-dark);
    overflow-wrap: anywhere;
}

.users-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.users-actions-cell {
    min-width: 0;
    white-space: nowrap;
}

.users-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
}

.users-actions .inline-form {
    margin: 0;
    flex: 0 0 auto;
}

.users-actions .btn {
    width: auto;
}

.table-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 1rem;
}

.table-count {
    flex: 1;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-info {
    font-size: 0.95rem;
}

/* Badges */

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    background: #e2e3e5;
    color: #4a4f55;
    line-height: 1.4;
    vertical-align: middle;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-muted {
    background: #e2e3e5;
    color: #4a4f55;
}

.badge-info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
}

.badge-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
}

.badge-danger {
    background-color: var(--color-danger-bg);
    color: var(--color-danger-text);
}

/* IMG preview */

.image-preview {
    width: 140px;
    height: 100px;
    max-width: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: block;
    cursor: zoom-in;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.image-preview-link {
    display: inline-block;
    margin-top: 0.5rem;
    text-decoration: none;
}

.image-preview:hover .image-preview,
.image-preview:focus-visible .image-preview {
    transform: scale(1.02);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

/* User tools */



.user-tools-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
}

.user-tools-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

.user-tools-item:last-child {
    border-bottom: none;
}

.user-tools-item-main {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}

.user-tools-item-text {
    color: var(--primary-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-tools-item-text.completed {
    color: var(--text-muted-dark);
    text-decoration: line-through;
}


/* ── Filter card ─────────────────────────────────────────── */

.card-filter {
    padding: 0;
    overflow: hidden;
}

.card-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--surface-subtle);
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background 0.15s;
}

.card-filter-toggle::-webkit-details-marker {
    display: none;
}

.card-filter-toggle::after {
    content: '▾';
    font-size: 1rem;
    color: var(--text-muted-dark);
    transition: transform 0.2s;
    flex-shrink: 0;
}

details:not([open])>.card-filter-toggle::after {
    transform: rotate(-90deg);
}

details[open]>.card-filter-toggle {
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid var(--border-light);
}

.card-filter-toggle:hover {
    background: var(--border-light);
}

.card-filter div {
    padding: 1rem;
}

.filter-form {
    padding: 1.5rem 2rem;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.filter-field {
    display: flex;
    flex-direction: column;
    flex: 1 1 160px;
    min-width: 140px;
}

.filter-field label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--primary-color);
}

.filter-field select,
.filter-field input[type="text"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.7rem;
    font-family: inherit;
    background: white;
    color: var(--text-color);
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-shrink: 0;
    padding-bottom: 0.1rem;
}

/* Reusable modal component */

body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.42);
}

.modal-overlay[hidden] {
    display: none;
}

.modal-overlay>dialog.modal-panel,
.modal-overlay>.modal-panel {
    margin: 0;
}

.modal-panel {
    width: min(920px, 96vw);
    max-height: 90vh;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

dialog.modal-panel {
    position: relative;
    inset: auto;
    border: 1px solid var(--border-light);
    margin: 0;
    padding: 0;
}

.modal-panel-compact {
    width: min(680px, 92vw);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface-subtle);
}

.modal-title {
    margin: 0;
    font-size: 1rem;
    color: var(--primary-color);
}

.modal-close-btn {
    border: none;
    background: transparent;
    color: var(--text-muted-dark);
    width: 34px;
    height: 34px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
}

.modal-close-btn:hover {
    background: #e8edf2;
    color: var(--primary-color);
}

.modal-close-btn:focus-visible {
    outline: 2px solid var(--action-color);
    outline-offset: 1px;
}

.modal-body-scroll {
    max-height: calc(90vh - 70px);
    overflow: auto;
    padding: 1rem;
}

.modal-code-block {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    background: #f7f9fb;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 0.9rem;
    color: var(--text-dark);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Tabs */

.prep-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}


.prep-tab-btn {
    border: 1px solid var(--border-color);
    background: #f3f4f6;
    color: var(--primary-color);
    border-radius: 6px;
    padding: 0.5rem 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.prep-tab-btn[aria-selected='true'] {
    background: var(--action-color);
    border-color: var(--action-color);
    color: #fff;
}

.prep-tab-panel[hidden] {
    display: none;
}

/* panel */


.schema-confirm-panel {
    width: min(480px, 96vw);
}


.schema-infer-panel {
    max-width: 860px;
    padding: 0.8rem 0.95rem;
    margin: 0.5rem 0 1rem;
    border: 1px solid #d4dfec;
    border-radius: 10px;
    background: linear-gradient(180deg, #f8fbff 0%, #f2f7fd 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.schema-infer-inline {
    display: grid;
    grid-template-columns: 240px minmax(280px, 1fr) auto;
    gap: 0.9rem;
    align-items: center;
}

.schema-infer-title {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.schema-infer-title label {
    margin: 0;
    font-weight: 700;
    color: #15314e;
    letter-spacing: 0.01em;
}

.schema-infer-title .helper-text {
    margin: 0;
    font-size: 0.78rem;
    color: #526a84;
}

.schema-infer-file {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.schema-infer-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.schema-infer-file-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 0.8rem;
    border-radius: 7px;
    border: 1px solid #b8c9dc;
    background: linear-gradient(180deg, #ffffff 0%, #eaf1f8 100%);
    color: #17324d;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.schema-infer-file-btn:hover {
    border-color: #9db4cb;
    background: linear-gradient(180deg, #ffffff 0%, #e2ecf6 100%);
    box-shadow: 0 1px 3px rgba(44, 62, 80, 0.14);
}

.schema-infer-file-btn:focus-visible {
    outline: 2px solid var(--action-color);
    outline-offset: 1px;
}

.schema-infer-file-name {
    min-width: 0;
    flex: 1;
    height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 0.72rem;
    border: 1px dashed #c6d6e8;
    border-radius: 7px;
    background: #f7fbff;
    color: #607387;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schema-infer-file-name.has-file {
    border-color: #b8d2ea;
    background: #ffffff;
    color: #294861;
}

.schema-infer-btn {
    min-width: 152px;
    border: 1px solid #2c4f72;
    background: linear-gradient(180deg, #3f6690 0%, #2f567e 100%);
    color: #ffffff;
}

.schema-infer-btn:hover {
    background: linear-gradient(180deg, #355b84 0%, #284b71 100%);
}

.schema-infer-btn:disabled {
    border-color: #9bb2c9;
    background: #adc1d4;
    color: #2c475f;
    cursor: not-allowed;
    box-shadow: none;
}

.pos-relative {
    position: relative;
}


.mask-preview-icon-btn {
    flex-shrink: 0;
    min-width: 5.5rem;
    height: 2rem;
    padding: 0 0.65rem;
    border: 1px solid #c7d2e0;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    color: #0f172a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
    transition: box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
}

.mask-preview-icon-btn:hover {
    background: linear-gradient(180deg, #ffffff 0%, #e9eff7 100%);
    border-color: #93a6bf;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.22);
}

.mask-preview-icon-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.mask-preview-icon-btn:disabled {
    opacity: 0.65;
    cursor: wait;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.14);
}

.mask-preview-icon {
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mask-preview-label {
    display: inline-block;
}

.mask-template-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.mask-template-helper {
    display: block;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.25;
}


.modal-preview-content {
    max-height: 62vh;
}

.modal-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.modal-preview-table th,
.modal-preview-table td {
    text-align: left;
    padding: 0.4rem;
    border-bottom: 1px solid #e5e7eb;
}

.input-narrow {
    width: 50px;
}



.mask-preview-spinner {
    width: 0.82rem;
    height: 0.82rem;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 999px;
    animation: mask-spin 0.7s linear infinite;
}

@keyframes mask-spin {
    to {
        transform: rotate(360deg);
    }
}

/* DATASET */

.dataset-stats-header {
    margin-bottom: 0.75rem;
}

.dataset-stats-header h3 {
    margin: 0;
}

.dataset-stats-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.dataset-stats-export {
    white-space: nowrap;
    align-self: start;
}

.stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

.stats-kpi-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(24, 56, 99, 0.1);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
    box-shadow: 0 8px 18px rgba(24, 56, 99, 0.06);
}

.stats-kpi-label {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #36506f;
    line-height: 1.3;
}

.stats-kpi-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.15rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.stats-kpi-value.badge,
.stats-kpi-value.badge-info,
.stats-kpi-value.badge-success,
.stats-kpi-value.badge-warning {
    margin: 0;
}

.stats-kpi-item--info {
    background: linear-gradient(180deg, #ffffff 0%, #eef5ff 100%);
}

.stats-kpi-item--info .stats-kpi-value {
    background: #d8ecff;
    color: #205b86;
}

.stats-kpi-item--success {
    background: linear-gradient(180deg, #ffffff 0%, #eefbf1 100%);
}

.stats-kpi-item--success .stats-kpi-value {
    background: #d8f2dd;
    color: #276746;
}

.stats-kpi-item--warning {
    background: linear-gradient(180deg, #ffffff 0%, #fff8e8 100%);
}

.stats-kpi-item--warning .stats-kpi-value {
    background: #fce8b1;
    color: #6f4f00;
}

.stats-kpi-item--neutral {
    background: linear-gradient(180deg, #ffffff 0%, #f3f4f7 100%);
}

.stats-kpi-item--neutral .stats-kpi-value {
    background: #e3e6eb;
    color: #4b5563;
}

.data-preparation-inference-shell {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid rgba(24, 56, 99, 0.14);
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
    box-shadow: 0 10px 24px rgba(24, 56, 99, 0.06);
}

.data-preparation-inference-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1rem;
}

.data-preparation-inference-copy h4 {
    margin: 0 0 0.35rem;
}

.data-preparation-inference-copy p:last-child {
    margin-bottom: 0;
}

.data-preparation-inference-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: stretch;
    width: 100%;
}

.data-preparation-inference-controls .form-group {
    margin-bottom: 0;
}

.data-preparation-inference-controls .btn {
    justify-self: start;
}

.data-preparation-request-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.data-preparation-preview-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.data-preparation-commit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.data-preparation-commit-row .form-group {
    margin-bottom: 0;
}

.data-preparation-collapsible-card {
    margin-top: 1rem;
    padding: 0;
    overflow: hidden;
}

.data-preparation-collapsible-body {
    padding: 1rem;
}

.data-preparation-collapsible-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.data-preparation-collapsible-heading .badge {
    margin: 0;
}

@media (max-width: 768px) {
    .dataset-stats-layout {
        grid-template-columns: 1fr;
    }

    .dataset-stats-export {
        justify-self: start;
    }

    .stats-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .data-preparation-inference-controls .btn {
        width: 100%;
    }

    .data-preparation-request-actions .btn {
        width: 100%;
    }

    .data-preparation-preview-actions .btn {
        width: 100%;
    }

    .data-preparation-commit-row {
        grid-template-columns: 1fr;
    }

    .data-preparation-commit-row .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-kpi-grid {
        grid-template-columns: 1fr;
    }
}