@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Pacifico&family=Quicksand:wght@400;500;600;700&display=swap');

/* Kinza light theme (default) */
html {
    --bg: #FAFAFA;
    --card: #FFFFFF;
    --text: #171717;
    --text-muted: #525252;
    --border: #E5E5E5;
    --border-strong: #D4D4D4;
    --primary: #005CA9;
    --primary-hover: #004A8C;
    --success: #72B8E4;
    --success-bg: #EEF7FD;
    --danger: #C97B83;
    --danger-bg: #FFF6F7;
    --warning: #F59E0B;
    --sidebar-bg: #FFFFFF;
    --sidebar-hover-bg: #F5F5F5;
    --sidebar-active-bg: #E8F4FC;
    --sidebar-active-text: #005CA9;
    --input-bg: #FFFFFF;
    --overlay: rgba(17, 24, 39, 0.35);
    --loader-bg: rgba(250, 250, 250, 0.95);
}

/* Kinza dark theme */
html.theme-kinza-dark {
    --bg: #1C1C1F;
    --card: #232328;
    --text: #ECECEF;
    --text-muted: #9B9BA4;
    --border: #3B3B42;
    --border-strong: #50505A;
    --primary: #4A9EE5;
    --primary-hover: #5DADE8;
    --success: #73B3DC;
    --success-bg: #1B2934;
    --danger: #C69299;
    --danger-bg: #322226;
    --warning: #FBBF24;
    --sidebar-bg: #1C1C1F;
    --sidebar-hover-bg: #2D2D33;
    --sidebar-active-bg: #1A2A3D;
    --sidebar-active-text: #4A9EE5;
    --input-bg: #232328;
    --overlay: rgba(4, 4, 6, 0.65);
    --loader-bg: rgba(28, 28, 31, 0.95);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    margin: 0;
    line-height: 1.5;
    min-height: 100vh;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.card-body {
    padding: 1.25rem;
    position: relative;
    z-index: 1;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 1rem 0.5rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.main {
    margin-left: 240px;
    padding: 1.5rem;
    background: var(--bg);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.logo {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    letter-spacing: 0.02em;
}

.logo-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-collapse-btn {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--card);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-collapse-btn:hover {
    background: var(--sidebar-hover-bg);
    color: var(--text);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    border: none;
    border-radius: 5px;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.88rem;
    transition: all 0.2s;
    background: transparent;
}

.nav-item:hover {
    background: var(--sidebar-hover-bg);
    color: var(--text);
    box-shadow: none;
    transform: none;
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.nav-item i {
    margin-right: 0;
}


h2 {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    color: var(--text);
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: stretch;
}

.stat-card {
    padding: 1.25rem;
    border-left: 4px solid var(--border);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100px;
    background: #ffffff;
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.primary {
    border-left-color: var(--primary);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.text-primary {
    color: var(--primary);
}

.text-warning {
    color: #F9A825;
}

.text-muted {
    color: var(--text-muted);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text);
    background: #f5f5f5;
    cursor: pointer;
    user-select: none;
}

.table th:hover {
    background: #eee;
}

.table th .sort-icon {
    margin-left: 0.25rem;
    opacity: 0.3;
}

.table th.sorted .sort-icon {
    opacity: 1;
    color: var(--primary);
}

.table tbody tr {
    cursor: pointer;
    transition: all 0.2s;
}

.table tbody tr:hover {
    background: #f9f9f9;
}

.table tbody tr.row-loading:hover {
    background: none;
    background-image: linear-gradient(90deg, transparent, var(--primary), transparent);
    background-size: 40% 2px;
    background-repeat: no-repeat;
}

.text-end {
    text-align: right;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    background: #1a1a1a;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn:hover {
    background: #333;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: #3d5d8a;
    border-color: #3d5d8a;
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #b04848;
    border-color: #b04848;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
}

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

.form-control,
.form-select {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    outline: none;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.2);
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: -0.4rem;
}

.col-6 {
    width: 50%;
    padding: 0.4rem;
}

.col-4 {
    width: 33.333%;
    padding: 0.4rem;
}

.col-3 {
    width: 25%;
    padding: 0.4rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 4px;
}

.badge-unsigned {
    background: #fce4e4;
    color: var(--danger);
}

.badge-signed {
    background: #EEF7FD;
    color: var(--success);
}

.upload-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .upload-columns {
        grid-template-columns: 1fr;
    }
}

.upload-zone {
    border: 2px dashed #ccc;
    border-radius: 4px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.upload-zone:hover,
.upload-zone.dragover {
    background: #f0f0f0;
    border-color: var(--primary);
}

.upload-zone i {
    font-size: 3rem;
    color: var(--text-muted);
}

.chart-container {
    height: 220px;
}

.contractor-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.contractor-card {
    cursor: pointer;
    transition: all 0.2s;
}

.contractor-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Table row loading: sliding bar along the bottom */
.table tbody tr.row-loading {
    background-image: linear-gradient(90deg, transparent, var(--primary), transparent);
    background-size: 40% 2px;
    background-repeat: no-repeat;
    background-position: -40% 100%;
    animation: row-slide 1s ease-in-out infinite;
}

@keyframes row-slide {
    0% {
        background-position: -40% 100%;
    }

    100% {
        background-position: 140% 100%;
    }
}

/* Debtor item loading: same sliding bar */
.debtor-item.row-loading {
    background-image: linear-gradient(90deg, transparent, var(--primary), transparent);
    background-size: 40% 2px;
    background-repeat: no-repeat;
    background-position: -40% 100%;
    animation: row-slide 1s ease-in-out infinite;
}

/* Nav button loading: spinning icon */
.modal-nav .btn.nav-loading i {
    display: inline-block;
    animation: nav-spin 0.6s linear infinite;
}

@keyframes nav-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Contractor card loading: pulsing accent border */
.contractor-card.card-loading {
    animation: card-pulse 0.7s ease-in-out infinite alternate;
}

@keyframes card-pulse {
    from {
        box-shadow: 0 0 0 0px var(--primary);
    }

    to {
        box-shadow: 0 0 0 2px var(--primary);
    }
}

.contractors-table {
    width: 100%;
}

.contractors-table .table tbody tr {
    cursor: pointer;
}

.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
    margin-left: -1px;
    box-shadow: none;
}

.btn-group .btn:first-child {
    border-radius: 4px 0 0 4px;
    margin-left: 0;
}

.btn-group .btn:last-child {
    border-radius: 0 4px 4px 0;
}

.btn-group .btn.active {
    background: #333;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3rem;
    overflow-y: auto;
}

.modal-overlay.show {
    display: flex;
}

#contractorModal {
    z-index: 1100;
}

#botOutgoingModal {
    z-index: 1050;
}


.modal-content {
    background: #ffffff;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 95%;
    max-width: 1000px;
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 6rem);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    background: #f5f5f5;
    border-radius: 3px 3px 0 0;
    z-index: 10;
    gap: 0.75rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.modal-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
}

.modal-title-row h4 {
    margin: 0;
    font-size: 1.1rem;
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.contractor-stats {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
    background: #fafafa;
}

.contractor-comment {
    width: 100%;
    min-height: 5rem;
    padding: 0.75rem;
    font-size: 0.85rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.contractor-comment:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(74, 111, 165, 0.2);
}

.comment-saved {
    color: var(--success);
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.comment-saved.show {
    opacity: 1;
}

.modal-close {
    background: #1a1a1a;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #333;
}

.modal-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.modal-nav .btn {
    padding: 0.4rem 0.8rem;
}

.modal-manager {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 600;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}

.loading-overlay.show {
    display: flex;
}

@keyframes bounce {
    to {
        transform: translateY(-10px);
    }
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #ddd;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.alert {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.alert-success {
    background: #EEF7FD;
    border-color: var(--success);
}

.alert-danger {
    background: #fce4e4;
    border-color: var(--danger);
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
    gap: 0.3rem;
}

.pagination a {
    display: block;
    padding: 0.4rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.pagination a:hover {
    background: #f5f5f5;
}

.pagination .active a {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
}

.progress {
    height: 10px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    transition: width 0.3s;
    background: var(--primary);
    border-radius: 4px;
}

/* Upload log area */
.upload-log {
    font-family: monospace;
    font-size: 0.8rem;
    height: 200px;
    overflow-y: auto;
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
}

.upload-log-line {
    display: block;
}

.upload-log-line.error {
    color: #f48771;
}

html.theme-kinza-dark .upload-log {
    background: #111113;
    color: #ececef;
}

.filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.filters .form-control,
.filters .form-select {
    width: auto;
}

.org-group {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.org-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.org-group-header:hover {
    background: #eee;
}

.org-group-content {
    display: none;
}

.org-group-content.show {
    display: block;
}

.debtor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.debtor-item:hover {
    background: #f9f9f9;
}

.debtor-item.row-loading:hover {
    background: none;
    background-image: linear-gradient(90deg, transparent, var(--primary), transparent);
    background-size: 40% 2px;
    background-repeat: no-repeat;
}

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

.info-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.info-card {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #ffffff;
    min-height: 75px;
    transition: all 0.2s;
}

.info-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-card.danger {
    border-left: 4px solid var(--danger);
}

.info-card.success {
    border-left: 4px solid var(--success);
}

.discipline-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.discipline-bar .progress {
    flex: 1;
    height: 10px;
    min-width: 40px;
}

.discipline-bar .disc-value {
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 32px;
    text-align: right;
    color: var(--text);
}

.table-wrapper {
    max-height: 280px;
    overflow-y: auto;
    border-radius: 4px;
}

.table-wrapper .table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.managers-scroll {
    overflow-y: auto;
    border-radius: 4px;
}

.managers-scroll .table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.debt-table-scroll {
    max-height: 280px;
    overflow-y: auto;
    border-radius: 4px;
}

.debt-table-scroll .table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--card-bg);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.75rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 0.75rem;
}

.d-none {
    display: none;
}

.d-flex {
    display: flex;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 0.75rem;
}

::selection {
    background: var(--primary);
    color: white;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.auth-panel {
    margin-top: auto;
    margin-bottom: 0.75rem;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    font-size: 0.78rem;
}

.auth-status {
    margin-bottom: 0.3rem;
}

.auth-email {
    margin-bottom: 0.45rem;
    color: var(--text);
    word-break: break-all;
}

.auth-btn {
    width: 100%;
    justify-content: center;
    margin-bottom: 0.35rem;
}

.auth-btn:last-child {
    margin-bottom: 0;
}

/* Theme toggle button */
.theme-toggle {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    margin-left: auto;
    margin-right: auto;
}

.theme-toggle:hover {
    transform: none;
    background: var(--sidebar-hover-bg);
}

/* Kinza theme overrides */
html.theme-kinza-light body,
html.theme-kinza-dark body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

html.theme-kinza-light .sidebar,
html.theme-kinza-dark .sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 1rem 0.5rem;
}

html.theme-kinza-light .main,
html.theme-kinza-dark .main {
    margin-left: 240px;
    background: var(--bg);
    min-height: 100vh;
    padding: 1.5rem;
}

html.theme-kinza-light .logo,
html.theme-kinza-dark .logo {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem 0.9rem;
    letter-spacing: 0.02em;
}

html.theme-kinza-light .logo::before,
html.theme-kinza-light .logo::after,
html.theme-kinza-dark .logo::before,
html.theme-kinza-dark .logo::after {
    content: none;
}

html.theme-kinza-light .nav-item,
html.theme-kinza-dark .nav-item {
    color: var(--text-muted);
    border-radius: 5px;
    font-weight: 500;
    margin-bottom: 0.25rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
}

html.theme-kinza-light .nav-item:hover,
html.theme-kinza-dark .nav-item:hover {
    background: var(--sidebar-hover-bg);
    color: var(--text);
    box-shadow: none;
    transform: none;
}

html.theme-kinza-light .nav-item.active,
html.theme-kinza-dark .nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    box-shadow: none;
}

html.theme-kinza-light h2,
html.theme-kinza-dark h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text);
}

html.theme-kinza-light h2::after,
html.theme-kinza-dark h2::after {
    content: none;
}

html.theme-kinza-light .section-title,
html.theme-kinza-dark .section-title {
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

html.theme-kinza-light .card,
html.theme-kinza-dark .card {
    border-color: var(--border);
    border-radius: 5px;
    background: var(--card);
    box-shadow: none;
}

html.theme-kinza-light .card:hover,
html.theme-kinza-dark .card:hover {
    box-shadow: 0 10px 22px rgba(17, 24, 39, 0.06);
    transform: none;
}

html.theme-kinza-light .stat-card,
html.theme-kinza-dark .stat-card {
    border: 1px solid var(--border);
    border-left-width: 1px;
    border-radius: 5px;
    background: var(--card);
}

html.theme-kinza-light .stat-card.danger,
html.theme-kinza-dark .stat-card.danger {
    border-left: 1px solid var(--border);
}

html.theme-kinza-light .stat-card.success,
html.theme-kinza-dark .stat-card.success {
    border-left: 1px solid var(--border);
}

html.theme-kinza-light .stat-card.primary,
html.theme-kinza-dark .stat-card.primary {
    border-left: 1px solid var(--border);
}

html.theme-kinza-light .stat-card.warning,
html.theme-kinza-dark .stat-card.warning {
    border-left: 1px solid var(--border);
}

html.theme-kinza-light .stat-card.danger {
    background: #FFF7F8;
}

html.theme-kinza-light .stat-card.success {
    background: #F3F9FE;
}

html.theme-kinza-light .stat-card.primary {
    background: #F4F9FD;
}

html.theme-kinza-light .stat-card.warning {
    background: #FFFDF7;
}

html.theme-kinza-dark .stat-card.danger {
    background: #2E2427;
}

html.theme-kinza-dark .stat-card.success {
    background: #1B2934;
}

html.theme-kinza-dark .stat-card.primary {
    background: #1C2731;
}

html.theme-kinza-dark .stat-card.warning {
    background: #2D2A1E;
}

html.theme-kinza-light .stat-label,
html.theme-kinza-dark .stat-label {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.82rem;
    font-weight: 500;
}

html.theme-kinza-light .stat-value,
html.theme-kinza-dark .stat-value {
    font-size: 1.95rem;
}

html.theme-kinza-light .text-warning,
html.theme-kinza-dark .text-warning {
    color: var(--warning);
}

html.theme-kinza-light .badge-unsigned {
    background: #FFF2F4;
    color: var(--danger);
    border: 1px solid #EAC9CF;
}

html.theme-kinza-light .badge-signed {
    background: #EEF7FD;
    color: var(--success);
    border: 1px solid #CFE3F2;
}

html.theme-kinza-dark .badge-unsigned {
    background: #332528;
    color: #D5A1A8;
    border: 1px solid #4A3237;
}

html.theme-kinza-dark .badge-signed {
    background: #1E2B37;
    color: #93C6E6;
    border: 1px solid #324556;
}

html.theme-kinza-light .table,
html.theme-kinza-dark .table {
    font-size: 0.84rem;
}

html.theme-kinza-light .table th,
html.theme-kinza-light .table td,
html.theme-kinza-dark .table th,
html.theme-kinza-dark .table td {
    border-bottom: 1px solid var(--border);
    padding: 0.72rem 0.85rem;
}

html.theme-kinza-light .table th,
html.theme-kinza-dark .table th {
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

html.theme-kinza-light .table th:hover,
html.theme-kinza-dark .table th:hover {
    background: var(--sidebar-hover-bg);
}

html.theme-kinza-light .table tbody tr:hover,
html.theme-kinza-dark .table tbody tr:hover {
    background: var(--sidebar-hover-bg);
    transform: none;
}

html.theme-kinza-light .table tbody tr.row-loading:hover,
html.theme-kinza-dark .table tbody tr.row-loading:hover {
    background: none;
    background-image: linear-gradient(90deg, transparent, var(--primary), transparent);
    background-size: 40% 2px;
    background-repeat: no-repeat;
}

html.theme-kinza-light .btn,
html.theme-kinza-dark .btn {
    text-transform: none;
    letter-spacing: 0;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: var(--card);
    color: var(--text);
    font-weight: 500;
}

html.theme-kinza-light .btn:hover,
html.theme-kinza-dark .btn:hover {
    background: var(--sidebar-hover-bg);
    transform: none;
    box-shadow: none;
}

html.theme-kinza-light .btn-primary,
html.theme-kinza-dark .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

html.theme-kinza-light .btn-primary:hover,
html.theme-kinza-dark .btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

html.theme-kinza-light .btn-danger,
html.theme-kinza-dark .btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

html.theme-kinza-light .btn-danger:hover,
html.theme-kinza-dark .btn-danger:hover {
    filter: brightness(0.95);
}

html.theme-kinza-light .form-control,
html.theme-kinza-light .form-select,
html.theme-kinza-dark .form-control,
html.theme-kinza-dark .form-select {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text);
}

html.theme-kinza-dark .form-control,
html.theme-kinza-dark .form-select {
    color-scheme: dark;
}

html.theme-kinza-light .form-control:focus,
html.theme-kinza-light .form-select:focus,
html.theme-kinza-dark .form-control:focus,
html.theme-kinza-dark .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 92, 169, 0.16);
}

html.theme-kinza-light .form-control::placeholder,
html.theme-kinza-dark .form-control::placeholder {
    color: var(--text-muted);
}

html.theme-kinza-light .filters,
html.theme-kinza-dark .filters {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 5px;
}

html.theme-kinza-light .upload-zone,
html.theme-kinza-dark .upload-zone {
    border: 2px dashed var(--border-strong);
    border-radius: 5px;
    background: var(--bg);
}

html.theme-kinza-light .upload-zone:hover,
html.theme-kinza-light .upload-zone.dragover,
html.theme-kinza-dark .upload-zone:hover,
html.theme-kinza-dark .upload-zone.dragover {
    background: var(--sidebar-hover-bg);
    border-color: var(--primary);
    box-shadow: none;
    transform: none;
}

html.theme-kinza-light .upload-zone i,
html.theme-kinza-dark .upload-zone i {
    color: var(--text-muted);
}

html.theme-kinza-light .upload-title,
html.theme-kinza-dark .upload-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text);
}

html.theme-kinza-light .modal-overlay,
html.theme-kinza-dark .modal-overlay {
    background: var(--overlay);
    backdrop-filter: blur(4px);
}

html.theme-kinza-light .modal-content,
html.theme-kinza-dark .modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.2);
}

html.theme-kinza-light .modal-header,
html.theme-kinza-dark .modal-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    padding: 0.85rem 1rem;
}

html.theme-kinza-light .contractor-stats,
html.theme-kinza-dark .contractor-stats {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1rem;
}

html.theme-kinza-light .modal-title-row h4,
html.theme-kinza-dark .modal-title-row h4 {
    font-family: 'Inter', sans-serif;
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
}

html.theme-kinza-light .modal-body,
html.theme-kinza-dark .modal-body {
    padding: 1rem;
    background: var(--card);
}

html.theme-kinza-light .modal-nav,
html.theme-kinza-dark .modal-nav {
    gap: 0.4rem;
}

html.theme-kinza-light .modal-nav .btn,
html.theme-kinza-dark .modal-nav .btn {
    height: 30px;
    min-width: 30px;
    padding: 0 0.65rem;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 500;
    border-color: var(--border);
    background: var(--bg);
}

html.theme-kinza-light .modal-nav .btn.active,
html.theme-kinza-dark .modal-nav .btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

html.theme-kinza-light .modal-manager,
html.theme-kinza-dark .modal-manager {
    font-size: 0.78rem;
    color: var(--text-muted);
}

html.theme-kinza-light .contractor-comment,
html.theme-kinza-dark .contractor-comment {
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--text);
}

html.theme-kinza-light .contractor-comment:focus,
html.theme-kinza-dark .contractor-comment:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 92, 169, 0.16);
}

html.theme-kinza-light .modal-close,
html.theme-kinza-dark .modal-close {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 5px;
}

html.theme-kinza-light .modal-close:hover,
html.theme-kinza-dark .modal-close:hover {
    background: var(--sidebar-hover-bg);
    transform: none;
}

html.theme-kinza-light .modal-section,
html.theme-kinza-dark .modal-section {
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.75rem;
    background: var(--bg);
    margin-bottom: 0.85rem;
}

html.theme-kinza-light .modal-section-title,
html.theme-kinza-dark .modal-section-title {
    margin: 0.2rem 0 0.6rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

html.theme-kinza-light .modal-section-header,
html.theme-kinza-dark .modal-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

html.theme-kinza-light .modal-table-wrap,
html.theme-kinza-dark .modal-table-wrap {
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
    background: var(--card);
}

html.theme-kinza-light .modal-empty,
html.theme-kinza-dark .modal-empty {
    padding: 0.85rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

html.theme-kinza-light .modal-kpi-row,
html.theme-kinza-dark .modal-kpi-row {
    margin-bottom: 0;
}

html.theme-kinza-light #contractorModal .info-card,
html.theme-kinza-light #managerModal .info-card,
html.theme-kinza-dark #contractorModal .info-card,
html.theme-kinza-dark #managerModal .info-card {
    min-height: 68px;
    padding: 0.7rem 0.85rem;
    border-color: var(--border);
    border-left-width: 1px;
    box-shadow: none;
    transform: none;
}

html.theme-kinza-light #contractorModal .info-card:hover,
html.theme-kinza-light #managerModal .info-card:hover,
html.theme-kinza-dark #contractorModal .info-card:hover,
html.theme-kinza-dark #managerModal .info-card:hover {
    box-shadow: none;
    transform: none;
}

html.theme-kinza-light #contractorModal .modal-section .contractor-comment,
html.theme-kinza-dark #contractorModal .modal-section .contractor-comment {
    margin-bottom: 0;
}

html.theme-kinza-light #contractorModal .org-group,
html.theme-kinza-dark #contractorModal .org-group {
    border-color: var(--border);
    border-radius: 5px;
    background: var(--card);
    margin-bottom: 0.6rem;
}

html.theme-kinza-light #contractorModal .org-group-header,
html.theme-kinza-dark #contractorModal .org-group-header {
    background: var(--bg);
    color: var(--text);
    border-bottom: 1px solid transparent;
    font-weight: 600;
}

html.theme-kinza-light #contractorModal .org-group-header:hover,
html.theme-kinza-dark #contractorModal .org-group-header:hover {
    background: var(--sidebar-hover-bg);
}

html.theme-kinza-light #contractorModal .org-group-content.show,
html.theme-kinza-dark #contractorModal .org-group-content.show {
    border-top: 1px solid var(--border);
}

html.theme-kinza-light #managerModal .debtor-item,
html.theme-kinza-dark #managerModal .debtor-item {
    border-bottom-color: var(--border);
    padding: 0.7rem 0.85rem;
}

html.theme-kinza-light #managerModal .debtor-item:hover,
html.theme-kinza-dark #managerModal .debtor-item:hover {
    background: var(--sidebar-hover-bg);
    transform: none;
}

html.theme-kinza-light #managerModal .debtor-item.row-loading:hover,
html.theme-kinza-dark #managerModal .debtor-item.row-loading:hover {
    background: none;
    background-image: linear-gradient(90deg, transparent, var(--primary), transparent);
    background-size: 40% 2px;
    background-repeat: no-repeat;
}

html.theme-kinza-light .loading-overlay,
html.theme-kinza-dark .loading-overlay {
    background: var(--loader-bg);
}

html.theme-kinza-light .spinner,
html.theme-kinza-dark .spinner {
    border-color: var(--border);
    border-top-color: var(--primary);
}

html.theme-kinza-light .alert,
html.theme-kinza-dark .alert {
    border-radius: 5px;
    border: 1px solid var(--border);
}

html.theme-kinza-light .alert-success,
html.theme-kinza-dark .alert-success {
    background: var(--success-bg);
    border-color: var(--success);
}

html.theme-kinza-light .alert-danger,
html.theme-kinza-dark .alert-danger {
    background: var(--danger-bg);
    border-color: var(--danger);
}

html.theme-kinza-light .pagination a,
html.theme-kinza-dark .pagination a {
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--card);
    color: var(--text);
}

html.theme-kinza-light .pagination a:hover,
html.theme-kinza-dark .pagination a:hover {
    background: var(--sidebar-hover-bg);
    transform: none;
}

html.theme-kinza-light .pagination .active a,
html.theme-kinza-dark .pagination .active a {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: none;
}

html.theme-kinza-light .progress,
html.theme-kinza-dark .progress {
    background: var(--sidebar-hover-bg);
    border-radius: 5px;
    box-shadow: none;
}

html.theme-kinza-light .progress-bar,
html.theme-kinza-dark .progress-bar {
    background: var(--primary);
    border-radius: 5px;
}

html.theme-kinza-light .theme-toggle,
html.theme-kinza-dark .theme-toggle {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    transform: none;
    margin-top: auto;
    margin-left: auto;
    margin-right: auto;
}

html.theme-kinza-light .theme-toggle:hover,
html.theme-kinza-dark .theme-toggle:hover {
    transform: none;
    background: var(--sidebar-hover-bg);
}

html.theme-kinza-light ::-webkit-scrollbar-track,
html.theme-kinza-dark ::-webkit-scrollbar-track {
    background: var(--bg);
}

html.theme-kinza-light ::-webkit-scrollbar-thumb,
html.theme-kinza-dark ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 8px;
}

html.theme-kinza-light ::-webkit-scrollbar-thumb:hover,
html.theme-kinza-dark ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Sidebar collapse state */
body.sidebar-collapsed .sidebar {
    width: 62px;
    padding: 1rem 0.35rem;
}

body.sidebar-collapsed .main {
    margin-left: 62px;
}

body.sidebar-collapsed .logo {
    justify-content: center;
    padding: 0 0 0.8rem;
}

body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .nav-label {
    display: none;
}

body.sidebar-collapsed .auth-panel {
    display: none;
}

body.sidebar-collapsed .sidebar-collapse-btn {
    margin-left: 0;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 0.65rem 0;
}

body.sidebar-collapsed .nav-item i {
    margin-right: 0;
    font-size: 1.1rem;
}

/* ─── Debt Status Badge ─────────────────────────────────────────────────── */

.debt-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    line-height: 1.5;
    vertical-align: middle;
}

/* ─── Status Cell (inline status picker in tables) ───────────────────── */

.status-cell {
    cursor: pointer;
    white-space: nowrap;
}

.status-cell .status-empty {
    color: var(--text-muted);
    text-decoration: underline dotted;
    font-size: 0.82rem;
}

.status-cell:hover .debt-status-badge {
    opacity: 0.8;
}

/* ─── Status Picker Popover ──────────────────────────────────────────── */

.status-picker-popover {
    position: fixed;
    z-index: 9999;
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    padding: 6px 0;
    min-width: 160px;
    max-width: 240px;
    max-height: 70vh;
    overflow-y: auto;
}

.status-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    transition: background 0.12s;
}

.status-picker-item:hover {
    background: var(--sidebar-hover-bg);
}

.status-picker-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-picker-clear {
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 8px;
}

/* ─── INN Copy Button ────────────────────────────────────────────────── */

.inn-copy-btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    padding: 1px 3px;
    margin-left: 4px;
    cursor: pointer;
    opacity: 0.5;
    color: var(--text-muted);
    border-radius: 3px;
    font-size: 0.78rem;
    line-height: 1;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    vertical-align: middle;
}

.inn-copy-btn:hover {
    opacity: 1;
    color: var(--primary);
    background: var(--sidebar-hover-bg);
}

.inn-copy-btn.copy-success {
    opacity: 1;
    color: var(--success);
}

/* ─── Hide-Signed Wrapper ────────────────────────────────────────────── */

.hide-signed-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.hide-signed-wrap input[type="checkbox"] {
    accent-color: var(--danger);
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ─── Modal Status Button ────────────────────────────────────────────── */

.modal-status-btn {
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-radius: 10px;
    cursor: pointer;
    padding: 2px 6px;
    transition: opacity 0.15s;
    font-family: inherit;
}

.modal-status-btn:hover {
    opacity: 0.8;
}

.modal-status-btn .modal-status-add {
    font-size: 0.75rem;
    text-decoration: underline dotted;
}

/* ─── Status Settings Toggle ─────────────────────────────────────────── */

.debt-status-settings-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #525252;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
}

.debt-status-settings-toggle:hover {
    background: #f5f5f5;
    border-color: #aaa;
}

.debt-status-settings-toggle .bi {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
}

.debt-status-settings-toggle.open .bi {
    transform: rotate(180deg);
}

/* ─── Status Settings Panel ──────────────────────────────────────────── */

.debt-status-settings {
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    padding: 0.85rem;
    background: #fafafa;
}

.debt-status-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.75rem;
}

.debt-status-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #e5e5e5;
    background: #fff;
}

.debt-status-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.debt-status-preview {
    flex: 1;
    padding: 0.18rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.debt-status-row-actions {
    display: flex;
    gap: 0.15rem;
    flex-shrink: 0;
    align-items: center;
}

.debt-status-sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    font-size: 0.72rem;
    padding: 0.2rem 0.3rem;
    border-radius: 3px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
    display: inline-flex;
    align-items: center;
}

.debt-status-sort-btn:hover:not(:disabled) {
    color: #333;
    background: #ebebeb;
}

.debt-status-sort-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.debt-status-delete-btn:hover:not(:disabled) {
    color: #c97b83;
    background: #fff6f7;
}

/* ─── Status Add Row ─────────────────────────────────────────────────── */

.debt-status-add-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding-top: 0.65rem;
    border-top: 1px solid #e5e5e5;
}

input[type="color"].debt-status-color-input {
    width: 32px;
    height: 32px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    background: #fff;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
}

input[type="color"].debt-status-color-input::-webkit-color-swatch-wrapper {
    padding: 2px;
    border-radius: 3px;
}

input[type="color"].debt-status-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.debt-status-name-input {
    flex: 1;
    min-width: 0;
}

/* ─── Copy INN Button ────────────────────────────────────────────────── */

.copy-inn-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    padding: 0.1rem 0.25rem;
    border-radius: 3px;
    font-size: 0.78rem;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    vertical-align: middle;
}

.copy-inn-btn:hover {
    color: #005CA9;
    background: #EEF7FD;
}

.copy-feedback {
    font-size: 0.7rem;
    color: #72B8E4;
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    pointer-events: none;
    margin-left: 0.2rem;
    vertical-align: middle;
}

.copy-feedback.show {
    opacity: 1;
}

/* ─── Hide-Signed Checkbox ───────────────────────────────────────────── */

.hide-signed-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s, background 0.15s;
    flex-shrink: 0;
    vertical-align: middle;
    display: inline-block;
}

.hide-signed-checkbox:hover {
    border-color: #C97B83;
}

.hide-signed-checkbox:checked {
    border-color: #C97B83;
    background: #FFF6F7;
}

.hide-signed-checkbox:checked::after {
    content: "✓";
    position: absolute;
    top: -3px;
    left: 1px;
    font-size: 0.72rem;
    color: #C97B83;
    font-weight: 700;
    line-height: 1.5;
}

/* ─── Status Dropdown / Popover ──────────────────────────────────────── */

.status-dropdown {
    position: absolute;
    z-index: 200;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 5px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    min-width: 160px;
    padding: 0.3rem 0;
}

.status-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.65rem;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.12s;
    white-space: nowrap;
}

.status-dropdown-item:hover {
    background: #f5f5f5;
}

.status-dropdown-item .debt-status-color-swatch {
    width: 10px;
    height: 10px;
}

/* ─── Kinza Theme Overrides ──────────────────────────────────────────── */

html.theme-kinza-light .debt-status-settings-toggle,
html.theme-kinza-dark .debt-status-settings-toggle {
    border-color: var(--border);
    color: var(--text-muted);
    border-radius: 5px;
}

html.theme-kinza-light .debt-status-settings-toggle:hover,
html.theme-kinza-dark .debt-status-settings-toggle:hover {
    background: var(--sidebar-hover-bg);
    border-color: var(--border-strong);
}

html.theme-kinza-light .debt-status-settings,
html.theme-kinza-dark .debt-status-settings {
    background: var(--bg);
    border-color: var(--border);
    border-radius: 0 0 5px 5px;
}

html.theme-kinza-light .debt-status-row,
html.theme-kinza-dark .debt-status-row {
    border-color: var(--border);
    background: var(--card);
    border-radius: 5px;
}

html.theme-kinza-light .debt-status-sort-btn,
html.theme-kinza-dark .debt-status-sort-btn {
    color: var(--text-muted);
    border-radius: 4px;
}

html.theme-kinza-light .debt-status-sort-btn:hover:not(:disabled),
html.theme-kinza-dark .debt-status-sort-btn:hover:not(:disabled) {
    color: var(--text);
    background: var(--sidebar-hover-bg);
}

html.theme-kinza-light .debt-status-delete-btn:hover:not(:disabled),
html.theme-kinza-dark .debt-status-delete-btn:hover:not(:disabled) {
    color: var(--danger);
    background: var(--danger-bg);
}

html.theme-kinza-light .debt-status-add-row,
html.theme-kinza-dark .debt-status-add-row {
    border-top-color: var(--border);
}

html.theme-kinza-light input[type="color"].debt-status-color-input,
html.theme-kinza-dark input[type="color"].debt-status-color-input {
    border-color: var(--border);
    background: var(--input-bg);
}

html.theme-kinza-dark input[type="color"].debt-status-color-input {
    color-scheme: dark;
}

html.theme-kinza-light .copy-inn-btn,
html.theme-kinza-dark .copy-inn-btn {
    color: var(--text-muted);
}

html.theme-kinza-light .copy-inn-btn:hover,
html.theme-kinza-dark .copy-inn-btn:hover {
    color: var(--primary);
    background: var(--sidebar-hover-bg);
}

html.theme-kinza-light .copy-feedback,
html.theme-kinza-dark .copy-feedback {
    color: var(--success);
}

html.theme-kinza-light .hide-signed-checkbox,
html.theme-kinza-dark .hide-signed-checkbox {
    border-color: var(--border-strong);
}

html.theme-kinza-light .hide-signed-checkbox:hover,
html.theme-kinza-dark .hide-signed-checkbox:hover {
    border-color: var(--danger);
}

html.theme-kinza-light .hide-signed-checkbox:checked,
html.theme-kinza-dark .hide-signed-checkbox:checked {
    border-color: var(--danger);
    background: var(--danger-bg);
}

html.theme-kinza-light .hide-signed-checkbox:checked::after,
html.theme-kinza-dark .hide-signed-checkbox:checked::after {
    color: var(--danger);
}

html.theme-kinza-light .status-dropdown,
html.theme-kinza-dark .status-dropdown {
    background: var(--card);
    border-color: var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    border-radius: 5px;
}

html.theme-kinza-light .status-dropdown-item,
html.theme-kinza-dark .status-dropdown-item {
    color: var(--text);
}

html.theme-kinza-light .status-dropdown-item:hover,
html.theme-kinza-dark .status-dropdown-item:hover {
    background: var(--sidebar-hover-bg);
}

html.theme-kinza-light .debt-status-list,
html.theme-kinza-dark .debt-status-list {
    gap: 0.3rem;
}

html.theme-kinza-light .status-picker-popover,
html.theme-kinza-dark .status-picker-popover {
    background: var(--card);
    border-color: var(--border-strong);
    border-radius: 8px;
}

html.theme-kinza-light .status-picker-item,
html.theme-kinza-dark .status-picker-item {
    color: var(--text);
}

html.theme-kinza-light .status-picker-item:hover,
html.theme-kinza-dark .status-picker-item:hover {
    background: var(--sidebar-hover-bg);
}

html.theme-kinza-light .status-picker-clear,
html.theme-kinza-dark .status-picker-clear {
    color: var(--text-muted);
    border-top-color: var(--border);
}

html.theme-kinza-light .hide-signed-wrap,
html.theme-kinza-dark .hide-signed-wrap {
    color: var(--text-muted);
}

html.theme-kinza-light .modal-status-btn,
html.theme-kinza-dark .modal-status-btn {
    color: var(--text-muted);
}

html.theme-kinza-dark .badge-bot-assigned,
html.theme-kinza-dark .badge-bot-approved {
    background: #1a2744;
    color: #6db3f8;
    border-color: #2d4a7a;
}

html.theme-kinza-dark .badge-bot-partially_paid {
    background: #332d1a;
    color: #f0c040;
    border-color: #5a4a22;
}

html.theme-kinza-dark .badge-bot-overpaid {
    background: #331f0a;
    color: #ff9e40;
    border-color: #5a3a1a;
}

html.theme-kinza-dark .badge-bot-confirmed {
    background: #1a2e1a;
    color: #66bb6a;
    border-color: #2d5a2d;
}

/* ─── Bot Tabs ──────────────────────────────────────────────────────────── */

.bot-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.bot-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: 'Quicksand', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.bot-tab:hover {
    color: var(--text);
}

.bot-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Bot status badges */
.badge-bot-pending {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge-bot-assigned {
    background: #e8f0fe;
    color: var(--primary);
    border: 1px solid #b6d4f8;
}

.badge-bot-partially_paid {
    background: #fff8e1;
    color: #b8860b;
    border: 1px solid #ffe082;
}

.badge-bot-paid {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid currentColor;
}

.badge-bot-overpaid {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
}

.badge-bot-confirmed {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.badge-bot-approved {
    background: #e8f0fe;
    color: var(--primary);
    border: 1px solid #b6d4f8;
}

.badge-bot-cancelled {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid currentColor;
}

.badge-bot-loading {
    position: relative;
    border-color: transparent !important;
    pointer-events: none;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-radius: 4px;
}
.btn-icon:hover {
    color: var(--primary);
    background: var(--bg-hover, rgba(0,0,0,0.05));
}

.bot-tab-content .table tbody tr {
    cursor: pointer;
}

.bot-tab-content .table tbody tr:hover {
    background: var(--sidebar-hover-bg);
}

/* ─── View Toggle ──────────────────────────────────────────────────────── */

.bot-view-toggle { display: flex; gap: 0.25rem; }
.bot-view-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.15s;
    font-family: inherit;
}
.bot-view-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

/* ─── Dynamic KPI Row ──────────────────────────────────────────────────── */

.bot-kpi-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.bot-kpi-card {
    background: var(--card);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    flex: 1;
    min-width: 130px;
}
.bot-kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.bot-kpi-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }
.bot-kpi-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.0625rem; }

/* ─── Card Grid & Data Card ────────────────────────────────────────────── */

.bot-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.bot-data-card {
    background: var(--card);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0.75rem;
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.bot-data-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* ─── Lifecycle Bar ────────────────────────────────────────────────────── */

.bot-lifecycle { display: flex; align-items: center; gap: 4px; font-size: 0.7rem; flex-wrap: wrap; }
.bot-lifecycle-step {
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: 500;
    display: inline-block;
    font-size: 0.65rem;
    letter-spacing: 0.02em;
}
.bot-lifecycle-step.active { font-weight: 700; transform: scale(1.08); }
.bot-lifecycle-step.past { opacity: 0.45; }
.bot-lifecycle-step.future { opacity: 0.3; }
.bot-lifecycle-arrow { color: var(--text-muted); font-size: 0.6rem; }

/* ─── Progress Bar ─────────────────────────────────────────────────────── */

.bot-progress { display: flex; align-items: center; gap: 6px; }
.bot-progress-track { flex: 1; height: 4px; background: var(--border); border-radius: 2px; min-width: 50px; }
.bot-progress-fill { height: 4px; border-radius: 2px; transition: width 0.3s; background: var(--border); }
.bot-progress-fill.green { background: #16a34a; }
.bot-progress-fill.blue { background: var(--primary); }
.bot-progress-fill.amber { background: #f59e0b; }
.bot-progress-label { font-size: 0.7rem; color: var(--text-muted); min-width: 32px; text-align: right; }

/* ─── Field Grid (modals) ──────────────────────────────────────────────── */

.bot-field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.bot-field {
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.bot-field:nth-child(2n) { border-right: none; }
.bot-field.full { grid-column: 1 / -1; border-right: none; }
.bot-field.last { border-bottom: none; }
.bot-field-label { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.125rem; }
.bot-field-value { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.bot-field-value.mono { font-family: 'SF Mono', 'Consolas', monospace; }

/* ─── Finance Trio (receipt modal) ─────────────────────────────────────── */

.bot-finance-trio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; margin-bottom: 0.875rem; }
.bot-finance-item { border-radius: 6px; padding: 0.5rem 0.625rem; text-align: center; }
.bot-finance-item .bot-finance-label { font-size: 0.7rem; }
.bot-finance-item .bot-finance-value { font-size: 1rem; font-weight: 700; }
.bot-finance-item.amount { background: var(--danger-bg); }
.bot-finance-item.amount .bot-finance-label { color: var(--danger); }
.bot-finance-item.amount .bot-finance-value { color: var(--danger); }
.bot-finance-item.commission { background: #fffbeb; }
.bot-finance-item.commission .bot-finance-label { color: #92400e; }
.bot-finance-item.commission .bot-finance-value { color: #b45309; }
.bot-finance-item.deposited { background: var(--success-bg); }
.bot-finance-item.deposited .bot-finance-label { color: var(--success); }
.bot-finance-item.deposited .bot-finance-value { color: var(--success); }

/* ─── Receipt Thumbnail ────────────────────────────────────────────────── */

.bot-receipt-thumb {
    width: 72px;
    height: 92px;
    border-radius: 4px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
}
.bot-receipt-thumb.sm { width: 36px; height: 46px; }

/* ─── Cell inline saving indicators ───────────────────────────────────── */

@keyframes cell-pulse {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(59, 130, 246, 0.08); }
}
td.cell-saving {
    animation: cell-pulse 0.8s ease-in-out infinite;
}
td.cell-saved {
    background-color: rgba(34, 197, 94, 0.1) !important;
    transition: background-color 0.3s ease;
}
td.cell-error {
    background-color: rgba(239, 68, 68, 0.1) !important;
    transition: background-color 0.3s ease;
}

/* ─── Inline-editable table inputs (look like plain text) ─────────────── */

input.cell-inline {
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    width: 100%;
}
input.cell-inline:focus {
    border-bottom: 1px solid var(--primary);
}
/* Hide number spinners (Chrome, Safari, Firefox) */
input.cell-inline[type="number"]::-webkit-inner-spin-button,
input.cell-inline[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input.cell-inline[type="number"] {
    -moz-appearance: textfield;
}
input.cell-inline.cell-error-text {
    color: var(--danger) !important;
}
/* OCR badges */
.badge-ocr-valid {
    background: #EEF7FD;
    color: var(--success);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}
.badge-ocr-error {
    background: #fce4e4;
    color: var(--danger);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}
.badge-ocr-draft {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
}
/* OCR row highlights */
.table tbody tr.row-ocr-error {
    background-color: rgba(239, 68, 68, 0.06);
}
.table tbody tr.row-ocr-error:hover {
    background-color: rgba(239, 68, 68, 0.1);
}
.table tbody tr.row-ocr-draft {
    opacity: 0.65;
}
.table tbody tr.row-ocr-draft:hover {
    opacity: 1;
}

/* ─── Filters Bar ──────────────────────────────────────────────────────── */

.bot-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
    background: var(--card);
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--border);
    margin-bottom: -1px;
    justify-content: space-between;
}

/* ─── Sub Table (nested tables in modals) ──────────────────────────────── */

.bot-sub-table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-top: 1rem; }
.bot-sub-table-title { padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 0.8rem; }

/* ─── Payments: Dark Theme Overrides ───────────────────────────────────── */

html.theme-kinza-dark .bot-receipt-thumb {
    background: linear-gradient(135deg, #1a2a3d, #1b2934);
}
html.theme-kinza-dark .bot-finance-item.commission {
    background: #332d1a;
}
html.theme-kinza-dark .bot-finance-item.commission .bot-finance-label {
    color: #d4a44a;
}
html.theme-kinza-dark .bot-finance-item.commission .bot-finance-value {
    color: #e8b84d;
}
html.theme-kinza-dark .bot-data-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

@media (max-width: 1200px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .contractor-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .col-4 {
        width: 50%;
    }

    .info-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
    }

    .main {
        margin-left: 0;
    }

    .stat-grid,
    .contractor-grid {
        grid-template-columns: 1fr;
    }

    .col-4,
    .col-6 {
        width: 100%;
    }

    .info-row {
        grid-template-columns: 1fr;
    }

    .bot-card-grid { grid-template-columns: 1fr; }
    .bot-field-grid { grid-template-columns: 1fr; }
    .bot-field { border-right: none; }
    .bot-finance-trio { grid-template-columns: 1fr; }
    .bot-kpi-row { gap: 0.375rem; }
    .bot-kpi-card { min-width: 100px; }
}

/* Cashbox color dot */
.cashbox-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 5px; vertical-align: middle; flex-shrink: 0;
}

/* Cashbox pause menu & muted rows */
.row-muted { opacity: 0.5; }
.cashbox-pause-wrap { position: relative; display: inline-block; }
.cashbox-pause-menu {
    position: absolute; top: 100%; left: 0; z-index: 50;
    background: var(--card-bg, var(--bg)); border: 1px solid var(--border);
    border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 100px; padding: 4px 0; margin-top: 4px;
}
.cashbox-pause-option {
    padding: 6px 12px; font-size: 0.8rem; cursor: pointer;
    white-space: nowrap;
}
.cashbox-pause-option:hover { background: var(--hover-bg, rgba(255,255,255,0.05)); }