/* ================================================================
   TenderAI - SaaS Refresh Design System
   ================================================================ */

:root {
    --font-body: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-display: 'Space Grotesk', 'Manrope', system-ui, -apple-system, sans-serif;

    --bg: #f2f4f8;
    --bg-cloud-1: rgba(38, 103, 255, 0.18);
    --bg-cloud-2: rgba(255, 124, 92, 0.15);

    --surface: #ffffff;
    --surface-soft: #f6f8fc;
    --surface-strong: #edf1f8;

    --border: #d7e0ec;
    --border-soft: #e7edf5;
    --border-strong: #c6d3e3;

    --text: #0f1b2d;
    --text-soft: #334764;
    --text-muted: #6d809b;

    --primary: #2667ff;
    --primary-strong: #1748ca;
    --primary-soft: #eaf0ff;
    --accent: #ff7c5c;
    --accent-soft: #fff1eb;

    --success: #0c9b72;
    --success-soft: #e8fbf4;
    --warning: #b76e10;
    --warning-soft: #fff7e7;
    --danger: #d64545;
    --danger-soft: #fff1f1;
    --info: #2667ff;
    --info-soft: #eaf0ff;
    --sky-soft: #e9f2ff;
}

/* ---- Base ---- */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background:
        radial-gradient(920px circle at -8% -20%, var(--bg-cloud-1), transparent 60%),
        radial-gradient(880px circle at 110% -24%, var(--bg-cloud-2), transparent 54%),
        linear-gradient(180deg, #f7f8fc 0%, var(--bg) 44%, #eef3f9 100%);
    color: var(--text);
    font-size: 14px;
    line-height: 1.58;
    min-height: 100vh;
}

a {
    color: inherit;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 248px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(247, 250, 255, 0.94));
    backdrop-filter: blur(14px);
    border-right: 1px solid var(--border);
    box-shadow: 12px 0 28px rgba(15, 27, 45, 0.05);
    z-index: 40;
    transition: all 0.2s ease;
}

.sidebar-brand {
    padding: 20px 18px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-soft);
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #00a2ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(38, 103, 255, 0.3);
}

.sidebar-brand-text {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.05;
}

.sidebar-brand-subtext {
    margin-top: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 11px 12px;
    overflow-y: auto;
}

.sidebar-section,
.sidebar-section-label {
    padding: 14px 8px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--text-muted);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-soft);
    text-decoration: none;
    transition: all 0.15s ease;
}

.sidebar-link:hover {
    background: var(--surface-soft);
    border-color: var(--border-soft);
    color: var(--text);
}

.sidebar-link.active {
    background: linear-gradient(160deg, #edf2ff, #e9f1ff);
    color: var(--primary-strong);
    border-color: #c4d2f6;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.sidebar-link svg,
.sidebar-link .nav-icon {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    opacity: 0.72;
}

.sidebar-link.active svg,
.sidebar-link.active .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 14px 18px 16px;
    border-top: 1px solid var(--border-soft);
}

.sidebar-footer-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-footer-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-strong);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.sidebar-footer-subtitle {
    margin-top: 1px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Topbar ---- */
.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 248px;
    height: 64px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 249, 255, 0.88));
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.topbar-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.topbar-breadcrumb a:hover {
    color: var(--primary);
}

.topbar-breadcrumb .separator {
    color: #9db2cd;
    font-size: 12px;
}

.topbar-breadcrumb .current {
    color: var(--text);
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid #c5d3f7;
    background: linear-gradient(180deg, #ffffff, #edf2ff);
    color: var(--primary-strong);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    transition: all 0.15s ease;
}

.topbar-cta:hover {
    border-color: #9fb8ff;
    background: linear-gradient(180deg, #f7f9ff, #e8eeff);
    box-shadow: 0 8px 16px rgba(23, 72, 202, 0.14);
    transform: translateY(-1px);
}

.topbar-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
    transition: all 0.15s ease;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
}

.topbar-icon-btn:hover {
    background: var(--surface-soft);
    border-color: var(--border-soft);
    color: var(--text);
}

.topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(160deg, var(--primary), var(--primary-strong));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.03em;
    margin-left: 2px;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: 248px;
    margin-top: 64px;
    padding: 22px 24px 28px;
    min-height: calc(100vh - 64px);
}

.main-inner,
.main-content-inner {
    max-width: 1480px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.page-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 31px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1.1;
}

.page-subtitle {
    margin-top: 5px;
    font-size: 13.5px;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 10px 28px rgba(15, 27, 45, 0.06);
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 16px 34px rgba(15, 27, 45, 0.1);
}

.card-header {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.card-body {
    padding: 18px;
}

.stack-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---- Dashboard ---- */
.dashboard-shell {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.dashboard-panels-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

/* ---- Stat Cards ---- */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    transition: all 0.2s ease;
    cursor: default;
    min-height: 144px;
}

.stat-card:hover {
    border-color: #b8c8e7;
    box-shadow: 0 18px 30px rgba(15, 27, 45, 0.11);
    transform: translateY(-2px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border: 1px solid transparent;
}

.stat-icon.indigo {
    background: #e8efff;
    color: #1d4ed8;
    border-color: #ccd9ff;
}

.stat-icon.emerald {
    background: #e8fbf4;
    color: #0c9b72;
    border-color: #c9efdf;
}

.stat-icon.amber {
    background: #fff1e8;
    color: #c35d24;
    border-color: #ffd8c8;
}

.stat-icon.rose {
    background: #fff0f4;
    color: #cf3f72;
    border-color: #f7cddd;
}

.stat-icon.sky {
    background: #eaf4ff;
    color: #1f67d9;
    border-color: #ccdcf7;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.stat-label {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
}

.stat-trend.up {
    background: var(--success-soft);
    color: var(--success);
}

.stat-trend.down {
    background: var(--danger-soft);
    color: var(--danger);
}

/* ---- Tables ---- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    padding: 11px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 12px 16px;
    font-size: 13.5px;
    color: var(--text);
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.12s ease;
}

.data-table tbody tr:hover {
    background: #f7faff;
}

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

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.2;
    border: 1px solid transparent;
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: #c9efdf;
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: #f6d8b8;
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #f4c9c9;
}

.badge-info {
    background: var(--info-soft);
    color: var(--info);
    border-color: #c9d8ff;
}

.badge-gray {
    background: #f3f6fb;
    color: var(--text-soft);
    border-color: #d8e0ea;
}

.badge-sky {
    background: var(--sky-soft);
    color: #1f67d9;
    border-color: #c7daf6;
}

.badge-navy {
    background: #ebf0fa;
    color: #2b4e83;
    border-color: #d0d9ea;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.3;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.btn:focus {
    outline: none;
    /* box-shadow: 0 0 0 3px rgba(38, 103, 255, 0.24); */
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(160deg, var(--primary), var(--primary-strong));
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 10px 18px rgba(38, 103, 255, 0.32);
}

.btn-primary:hover {
    box-shadow: 0 12px 22px rgba(23, 72, 202, 0.38);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #f9fbff;
    color: var(--text-soft);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: #eff4ff;
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-teal {
    background: linear-gradient(160deg, #0f9c8d, #0d7d72);
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(12, 155, 114, 0.25);
}

.btn-teal:hover {
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-soft);
    padding: 6px 10px;
}

.btn-ghost:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.btn-danger {
    background: linear-gradient(160deg, #de4f4f, #bf3a3a);
    color: #ffffff;
    box-shadow: 0 8px 14px rgba(214, 69, 69, 0.28);
}

.btn-danger:hover {
    box-shadow: 0 10px 18px rgba(214, 69, 69, 0.38);
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0);
}

.btn-danger-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 10px;
}

.btn-danger-ghost:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 9px;
}

.btn-lg {
    padding: 11px 18px;
    font-size: 14px;
    border-radius: 12px;
}

.btn-block {
    width: 100%;
}

/* ---- Forms ---- */
.form-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #ffffff;
    color: var(--text);
    font-size: 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
    outline: none;
    border-color: #9cb5ff;
    box-shadow: 0 0 0 3px rgba(38, 103, 255, 0.16);
}

.form-error {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--danger);
}

/* ---- Checkboxes ---- */
.theme-checkbox-control {
    border-radius: 5px;
    border: 1px solid #c9d4e6;
    background: #ffffff;
    transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.theme-checkbox:hover .theme-checkbox-control {
    border-color: #9eb7ff;
}

.theme-checkbox-input:checked + .theme-checkbox-control {
    border-color: var(--primary);
    background: linear-gradient(160deg, var(--primary), var(--primary-strong));
}

.theme-checkbox-input:focus-visible + .theme-checkbox-control {
    box-shadow: 0 0 0 3px rgba(38, 103, 255, 0.18);
}

.theme-checkbox-icon {
    opacity: 0;
    transition: opacity 0.14s ease;
}

.theme-checkbox-input:checked ~ .theme-checkbox-icon {
    opacity: 1;
}

/* ---- Upload ---- */
.upload-split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
    gap: 16px;
    margin-bottom: 18px;
}

.upload-actions {
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Dropzone */
.dropzone {
    border: 1.5px dashed #c4d2ef;
    border-radius: 16px;
    min-height: 220px;
    background: linear-gradient(175deg, #fafcff 0%, #f3f6ff 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.22s ease;
    position: relative;
    overflow: hidden;
}

.dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse at 65% 10%, rgba(38,103,255,0.05) 0%, transparent 60%);
    pointer-events: none;
}

.dropzone:hover {
    border-color: #7fa8ff;
    background: linear-gradient(175deg, #f5f8ff 0%, #eaeeff 100%);
}

.dropzone:hover .dropzone-upload-icon {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(38,103,255,0.20);
}

.dropzone.dragging {
    border-color: var(--primary);
    background: var(--primary-soft);
    transform: scale(1.01);
    box-shadow: 0 0 0 4px rgba(38,103,255,0.10), 0 4px 24px rgba(38,103,255,0.12);
}

.dropzone.dragging .dropzone-upload-icon {
    background: var(--primary);
    color: #fff;
    transform: scale(1.08);
    border-color: var(--primary-strong);
}

.dropzone-inner {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 38px 28px;
    width: 100%;
    box-sizing: border-box;
}

.dropzone-upload-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: #e6eeff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border: 1px solid #ccd8ff;
    transition: all 0.22s ease;
    box-shadow: 0 2px 12px rgba(38,103,255,0.10);
    flex-shrink: 0;
}

.dropzone-main-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    font-family: var(--font-display);
    line-height: 1.3;
}

.dropzone-sub-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.dropzone-sub-text span {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}

.dropzone-formats {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.format-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    border: 1px solid;
}

.format-pill.pdf  { background: #fff0ee; color: #c0392b; border-color: #fac8c0; }
.format-pill.docx { background: #edf3ff; color: #2450b0; border-color: #c7d8ff; }
.format-pill.xlsx,
.format-pill.xls  { background: #edfaf3; color: #1a7a4c; border-color: #b8ecd4; }
.format-pill.csv  { background: #fef9ec; color: #9a6306; border-color: #fce5a3; }

.dropzone-limit {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

/* File preview card (selected state) */
.file-preview-wrap {
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
}

.file-preview-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1.5px solid #c8d8ff;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 3px 14px rgba(38,103,255,0.10);
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.file-preview-icon {
    width: 44px;
    height: 52px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.file-preview-icon.type-pdf   { background: #fff0ee; color: #c0392b; border: 1.5px solid #fac8c0; }
.file-preview-icon.type-docx  { background: #edf3ff; color: #2450b0; border: 1.5px solid #c7d8ff; }
.file-preview-icon.type-xlsx,
.file-preview-icon.type-xls   { background: #edfaf3; color: #1a7a4c; border: 1.5px solid #b8ecd4; }
.file-preview-icon.type-csv   { background: #fef9ec; color: #9a6306; border: 1.5px solid #fce5a3; }
.file-preview-icon.type-default { background: #f2f4f8; color: #6d809b; border: 1.5px solid #d7e0ec; }

.file-preview-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.file-preview-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
}

.file-preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--success);
    background: #edfaf3;
    border: 1px solid #b8ecd4;
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.file-preview-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 1.8s infinite;
    flex-shrink: 0;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.75); }
}

.file-preview-remove {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f2f4f8;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e6f0;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.file-preview-remove:hover {
    background: #ffeae8;
    color: var(--danger);
    border-color: #ffc8c4;
}

.file-preview-change {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.75;
    transition: opacity 0.15s;
}

.file-preview-change:hover { opacity: 1; }

/* ---- Upload info panel (right column) ---- */

/* Timeline steps */
.upload-timeline {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.timeline-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    position: relative;
}

.timeline-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 18px;
    top: 40px;
    bottom: 0;
    width: 1.5px;
    background: linear-gradient(to bottom, #cdd9ff 0%, #e8ecf6 100%);
}

.timeline-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.timeline-icon--upload  { background: #edf3ff; color: var(--primary);  border: 1px solid #c7d8ff; }
.timeline-icon--extract { background: #fff3ee; color: var(--accent);   border: 1px solid #ffd5c4; }
.timeline-icon--review  { background: #edfaf3; color: var(--success);  border: 1px solid #b8ecd4; }

.timeline-content {
    flex: 1;
    min-width: 0;
    padding-bottom: 22px;
}

.timeline-step:last-child .timeline-content {
    padding-bottom: 0;
}

.timeline-step-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
    font-family: var(--font-display);
    line-height: 1.3;
    margin-top: 9px;
}

.timeline-step-desc {
    font-size: 12.5px;
    color: var(--text-soft);
    margin-top: 3px;
    line-height: 1.55;
}

/* Upload spec list */
.upload-spec-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--border-soft);
    padding-top: 16px;
}

.upload-spec {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.upload-spec-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 1px;
}

.upload-spec-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.upload-spec-value {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 2px;
    line-height: 1.5;
}

/* ---- KB Snapshot panel ---- */
.kb-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.kb-stat-tile {
    border-radius: 13px;
    padding: 14px 12px;
    border: 1px solid;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.kb-stat-tile--primary { background: #f0f5ff; border-color: #cdd9ff; }
.kb-stat-tile--success { background: #edfaf3; border-color: #b8ecd4; }
.kb-stat-tile--warning { background: #fef9ec; border-color: #fce5a3; }
.kb-stat-tile--purple  { background: #f5f0ff; border-color: #d8c8ff; }

.kb-stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kb-stat-tile--primary .kb-stat-icon { background: #dce8ff; color: var(--primary); }
.kb-stat-tile--success .kb-stat-icon { background: #d5f5e5; color: var(--success); }
.kb-stat-tile--warning .kb-stat-icon { background: #fce7a3; color: #9a6306; }
.kb-stat-tile--purple  .kb-stat-icon { background: #e8d8ff; color: #7c3aed; }

.kb-stat-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.kb-stat-label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.4;
}

/* Guidance section */
.upload-guidance {
    border-top: 1px solid var(--border-soft);
    padding-top: 14px;
}

.upload-guidance-title {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 10px;
}

.guidance-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-soft);
}

.guidance-item:last-child { border-bottom: none; }

.guidance-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--surface-soft);
    border: 1px solid var(--border-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.guidance-text {
    font-size: 12.5px;
    color: var(--text-soft);
    line-height: 1.5;
    padding-top: 2px;
}

/* ---- Empty State ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 52px 20px;
    text-align: center;
}

.empty-state-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: var(--surface-strong);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.empty-state-desc {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 420px;
    margin-bottom: 16px;
    line-height: 1.6;
}

/* ---- Steps / Info ---- */
.info-panel {
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: #f8faff;
    padding: 14px;
}

.info-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 5px 0;
    color: var(--text-soft);
    font-size: 13px;
}

.info-step-num {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(160deg, var(--primary), var(--primary-strong));
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-step:nth-child(2) .info-step-num {
    background: #e8eeff;
    color: var(--primary-strong);
}

.info-step:nth-child(3) .info-step-num {
    background: #eef2f9;
    color: var(--text-muted);
}

.muted-list {
    margin: 10px 0 0;
    padding: 0 0 0 16px;
    display: grid;
    gap: 6px;
}

.muted-list li {
    color: var(--text-soft);
    font-size: 12.5px;
    line-height: 1.55;
}

/* ---- Progress Tracker ---- */
.step-tracker {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 18px;
}

.step-item {
    display: flex;
    align-items: center;
    flex: 1;
}

.step-item:last-child {
    flex: 0;
}

.step-circle {
    width: 31px;
    height: 31px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.step-circle.completed,
.step-circle.active {
    background: linear-gradient(160deg, var(--primary), var(--primary-strong));
    color: #ffffff;
}

.step-circle.active {
    box-shadow: 0 0 0 4px rgba(38, 103, 255, 0.16);
}

.step-circle.pending {
    background: #f2f5fb;
    color: var(--text-muted);
    border: 1px solid #d4ddef;
}

.step-label {
    font-size: 11px;
    font-weight: 700;
    margin-top: 8px;
    white-space: nowrap;
}

.step-line {
    flex: 1;
    height: 2px;
    margin: 0 8px 20px;
    border-radius: 2px;
}

.step-line.completed {
    background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

.step-line.pending {
    background: #d7def0;
}

/* ---- Confidence ---- */
.conf-high {
    color: var(--success);
    font-weight: 700;
}

.conf-med {
    color: var(--warning);
    font-weight: 700;
}

.conf-low {
    color: var(--danger);
    font-weight: 700;
}

/* ---- Activity List ---- */
.activity-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    transition: background 0.12s ease;
    text-decoration: none;
    border-bottom: 1px solid var(--border-soft);
}

.activity-item:hover {
    background: #f8faff;
}

.activity-item:last-child {
    border-bottom: none;
}

/* ---- Toasts ---- */
.toast-container {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 100;
}

.toast {
    min-width: 300px;
    max-width: 460px;
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 12px 26px rgba(18, 36, 56, 0.14);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 600;
    animation: slideIn 0.28s ease-out;
}

.toast-success {
    background: var(--success-soft);
    border-color: #c5ecdc;
    color: var(--success);
}

.toast-error {
    background: var(--danger-soft);
    border-color: #f0c3c3;
    color: var(--danger);
}

.toast-info {
    background: var(--info-soft);
    border-color: #c7d6ff;
    color: var(--info);
}

/* ---- File Type Icon ---- */
.file-icon {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.file-icon.pdf {
    background: #fff2f2;
    color: #cb4343;
    border-color: #f5cdcd;
}

.file-icon.docx {
    background: #eaf1ff;
    color: #1d4ed8;
    border-color: #ccd9ff;
}

.file-icon.xlsx {
    background: #e8fbf4;
    color: #0c9b72;
    border-color: #c9efdf;
}

.file-icon.xls {
    background: #ecfbf4;
    color: #117e5e;
    border-color: #cdeada;
}

.file-icon.csv {
    background: #eaf1ff;
    color: #205fb8;
    border-color: #cedaf4;
}

/* ---- Links ---- */
.link-primary {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
    font-size: 12px;
    transition: color 0.15s ease;
}

.link-primary:hover {
    color: var(--primary-strong);
    text-decoration: underline;
}

/* ---- Scrollbar ---- */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #cad6ea;
    border-radius: 4px;
}

/* ---- Animations ---- */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-up {
    animation: fadeUp 0.4s ease-out both;
}

.stagger > *:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger > *:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger > *:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger > *:nth-child(4) {
    animation-delay: 0.2s;
}

/* ---- Spinner ---- */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    animation: spin 0.7s linear infinite;
}

/* ---- SweetAlert2 Theme ---- */
.swal-tenderai-popup {
    font-family: var(--font-body) !important;
    border-radius: 14px !important;
    padding: 26px 22px 20px !important;
    box-shadow: 0 18px 32px rgba(18, 36, 56, 0.2), 0 0 0 1px rgba(18, 36, 56, 0.08) !important;
    max-width: 400px !important;
}

.swal-tenderai-title {
    font-size: 17px !important;
    font-weight: 700 !important;
    color: var(--text) !important;
    padding: 0 !important;
    margin-bottom: 6px !important;
}

.swal-tenderai-text {
    font-size: 13px !important;
    color: var(--text-soft) !important;
    line-height: 1.55 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.swal-tenderai-icon {
    width: 52px !important;
    height: 52px !important;
    margin: 0 auto 18px !important;
    border-width: 2px !important;
}

.swal-tenderai-actions {
    gap: 8px !important;
    margin-top: 20px !important;
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
}

/* ---- Item Review / HTMX Helpers ---- */
#items-tbody.filter-review-mode tr.ok-conf-row {
    display: none;
}

#items-review-table tbody tr:hover {
    background: #f6f9ff;
}

#items-review-table tbody tr.low-conf-row:hover {
    background: #fff4e9;
}

#items-review-table tbody tr[style*='border-top:2px solid #1748ca'] td {
    padding-top: 14px;
}

.low-conf-row {
    background: #fff9f3 !important;
}

.low-conf-row:hover {
    background: #fff3e7 !important;
}

.htmx-request {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.htmx-swapping {
    opacity: 0;
    transition: opacity 0.1s ease;
}

@keyframes savedFlash {
    0% {
        background-color: #e9f8f1;
    }

    100% {
        background-color: transparent;
    }
}

.saved-flash {
    animation: savedFlash 1s ease-out;
}

/* ---- Responsive ---- */
@media (max-width: 1300px) {
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .upload-split-grid {
        grid-template-columns: 1.25fr 0.95fr;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        position: relative;
        width: 100%;
        top: 0;
        bottom: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        box-shadow: none;
        backdrop-filter: none;
        background: linear-gradient(180deg, #ffffff, #f7faff);
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding-bottom: 14px;
    }

    .sidebar-section,
    .sidebar-section-label {
        grid-column: 1 / -1;
        padding-top: 10px;
    }

    .sidebar-link {
        margin-bottom: 0;
    }

    .sidebar-footer {
        display: none;
    }

    .topbar {
        position: relative;
        left: 0;
        height: 58px;
        padding: 0 14px;
    }

    .main-content {
        margin-left: 0;
        margin-top: 0;
        padding: 16px 14px 20px;
    }

    .main-inner,
    .main-content-inner {
        max-width: none;
    }

    .page-title {
        font-size: 28px;
    }

    .dashboard-panels-grid,
    .upload-split-grid {
        grid-template-columns: 1fr;
    }

    .header-actions {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .sidebar-brand {
        padding: 14px 12px 12px;
    }

    .sidebar-nav {
        grid-template-columns: 1fr;
        padding-left: 8px;
        padding-right: 8px;
    }

    .topbar {
        height: 56px;
        padding: 0 10px;
    }

    .topbar-breadcrumb {
        font-size: 12px;
    }

    .topbar-icon-btn {
        display: none;
    }

    .topbar-cta {
        height: 32px;
        padding: 0 10px;
        font-size: 11px;
    }

    .topbar-avatar {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }

    .main-content {
        padding: 12px 10px 16px;
    }

    .page-header {
        margin-bottom: 14px;
    }

    .page-title {
        font-size: 25px;
    }

    .page-subtitle {
        font-size: 12.5px;
    }

    .card-header,
    .card-body {
        padding: 13px;
    }

    .stat-card {
        min-height: 128px;
    }

    .data-table thead th,
    .data-table tbody td {
        padding-left: 10px;
        padding-right: 10px;
    }

    .dropzone {
        padding: 24px 12px;
    }

    .selected-file-name {
        max-width: 250px;
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }

    .upload-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .upload-actions .btn {
        width: 100%;
    }
}
