:root {
    --bg-color: #121212;
    --glass-bg: rgba(46, 46, 46, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f0f0;
    --text-secondary: #a0a0a0;
    --accent-blue: #007bff;
    --accent-blue-hover: #0a84ff;
    --accent-green: #28a745;
    --accent-green-hover: #34ce57;
    --accent-red: #dc3545;
    --row-hover: rgba(255, 255, 255, 0.05);
    --th-bg: rgba(62, 62, 62, 0.9);
    --border-color: #444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top right, #1a1a2e, #121212);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Casilla: modo "full" (sin header superior) */
body.casilla-fullscreen header {
    display: none;
}

body.casilla-fullscreen .app-container {
    padding: 0.5rem;
    gap: 0.5rem;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0.75rem;
    gap: 0.75rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* ===== HEADER ===== */
header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.35rem 1rem;
    padding: 0.45rem 1.1rem;
    flex-shrink: 0;
}

.header-left {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.header-left h1 {
    font-size: 1.42rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#header-bot-name {
    display: inline-block;
    transform-origin: 50% 55%;
}

#header-bot-name.bot-name-morph {
    animation: botNameMorph 520ms cubic-bezier(.22, .61, .36, 1);
}

@keyframes botNameMorph {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
        letter-spacing: 0;
        filter: brightness(1);
    }

    35% {
        transform: scale(0.92) translateY(-1px);
        opacity: 0.45;
        letter-spacing: 1px;
        filter: brightness(1.35);
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
        letter-spacing: 0;
        filter: brightness(1);
    }
}

.badge {
    font-size: 0.6rem;
    background: var(--accent-blue);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auto-classification-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.14rem 0.42rem;
    border-radius: 999px;
    background: rgba(196, 178, 149, 0.18);
    border: 1px solid rgba(196, 178, 149, 0.38);
    color: #d8ccb7;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.status {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.05rem;
}

#last-update-text {
    display: inline-block;
    line-height: 1.05;
    margin-top: 0;
    transform: translateY(0.08rem);
}

.header-meta-row {
    display: contents;
}

.header-meta-row .status {
    margin-top: 0;
}

.header-user-status {
    line-height: 1.35;
    min-width: 0;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    flex-shrink: 0;
    align-self: end;
}

.header-right-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 0.6rem;
}

body.dashboard-header-mode .header-right {
    width: 100%;
    align-items: center;
    justify-self: stretch;
    align-self: center;
}

body.dashboard-header-mode .header-right-actions {
    width: 100%;
    justify-content: center;
    align-items: center;
}

body.dashboard-header-mode header {
    align-items: center;
    gap: 0 1rem;
    min-height: 56px;
}

body.dashboard-header-mode .header-left {
    justify-content: center;
}

body.dashboard-header-mode .header-left h1 {
    margin: 0;
}

body.dashboard-header-mode .header-meta-row {
    display: none;
}

#btn-refresh-dashboard.is-busy {
    position: static;
    padding-left: 0.9rem;
}

#btn-refresh-dashboard.is-busy::before {
    content: none;
}

.header-right-counters {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    min-width: 0;
    align-self: center;
    margin-top: -0.12rem;
}

.batch-inline-counters {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.12rem 0.35rem;
    margin-top: 0;
    min-width: 0;
}

.batch-counter-tag {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.2;
    display: inline-flex;
    align-items: baseline;
    gap: 0.18rem;
    white-space: nowrap;
}

.batch-counter-card {
    border: none;
    background: transparent;
    border-radius: 0;
    color: var(--text-secondary);
    padding: 0;
    font: inherit;
    font-size: 0.75rem;
    line-height: 1.2;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 0.18rem;
    transition: color 0.18s ease;
    white-space: nowrap;
}

.batch-counter-card:hover {
    color: #d0e9ff;
}

.batch-counter-card:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.batch-inline-counters>*+* {
    border-left: 1px solid rgba(255, 255, 255, 0.22);
    padding-left: 0.42rem;
    margin-left: 0.08rem;
}

.batch-counter-value {
    display: inline-block;
    width: 3ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
    font-weight: 700;
    color: #c5e4ff;
}

.batch-refresh-btn {
    margin-left: 0.18rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 0;
    padding: 0;
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: 0.12rem;
    transition: color 0.2s ease;
    min-width: 30px;
}

.batch-refresh-btn:hover:not(:disabled) {
    color: #d0e9ff;
}

.batch-refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.batch-refresh-icon {
    font-size: 0.75rem;
}

.batch-refresh-dots {
    display: inline-block;
    width: 3ch;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: left;
    letter-spacing: 0.04em;
}

/* ===== BUTTONS ===== */
.btn {
    border: none;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: white;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--accent-blue);
    box-shadow: 0 3px 10px rgba(0, 123, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-blue-hover);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--accent-green);
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
}

.btn-success:hover:not(:disabled) {
    background-color: var(--accent-green-hover);
    transform: translateY(-1px);
}

.btn-success:disabled {
    background-color: #5a7562;
    box-shadow: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-cuadro-sin-presup {
    background-color: #e8a838;
    border-color: #c8902a;
    color: #1a1a1a;
    box-shadow: 0 3px 10px rgba(232, 168, 56, 0.35);
    white-space: nowrap;
    text-align: center;
}

.btn-cuadro-sin-presup:hover:not(:disabled) {
    background-color: #d99620;
    transform: translateY(-1px);
}

.btn-cuadro-sin-presup:disabled {
    background-color: #b8882a;
    box-shadow: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.tag-cuadro-sin-presup {
    display: inline-block;
    background: rgba(232, 168, 56, 0.22);
    border: 1px solid rgba(232, 168, 56, 0.5);
    color: #e8a838;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    margin-right: 5px;
    vertical-align: middle;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.btn-danger {
    background-color: var(--accent-red);
    box-shadow: 0 3px 10px rgba(220, 53, 69, 0.25);
}

.btn-danger:hover:not(:disabled) {
    background-color: #e24a58;
    transform: translateY(-1px);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
}

.btn-mini {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    font-family: inherit;
}

.btn-mini:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

#casilla-asignado.casilla-assigned-warning {
    color: #ff9aa4 !important;
    border-color: rgba(220, 53, 69, 0.95) !important;
    background: rgba(220, 53, 69, 0.16) !important;
    box-shadow: 0 0 0 1px rgba(220, 53, 69, 0.35), 0 0 18px rgba(220, 53, 69, 0.16);
}

/* ===== MAIN ===== */
.main-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

/* Tabs at bottom */
.tabs-bottom {
    display: flex;
    border-top: 1px solid var(--border-color);
    padding: 0 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    order: 10;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 1rem 1.25rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-top: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent-blue);
    border-top-color: var(--accent-blue);
}

.tab-btn .count {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 1px 7px;
    border-radius: 12px;
    font-size: 0.72rem;
}

.tab-btn.active .count {
    background: var(--accent-blue);
    color: white;
}

.tab-content {
    display: none;
    flex-grow: 1;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.table-container {
    flex-grow: 1;
    overflow: auto;
    width: 100%;
}

.table-container::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== TABLE ===== */
table {
    border-collapse: collapse;
    font-size: 0.78rem;
    width: 100%;
    table-layout: auto;
}

thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    background-color: var(--th-bg);
    padding: 0.4rem 0.35rem;
    font-weight: 600;
    font-size: 0.78rem;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
    text-align: center;
    white-space: nowrap;
    position: relative;
    user-select: none;
}

th:last-child {
    border-right: none;
}

/* --- Tight columns: all non-Notas columns shrink to content --- */
th.col-tight {
    width: 1%;
}

th.col-file-num,
td.col-file-num {
    width: 60px;
    min-width: 60px;
}

.filter-row th.col-file-num .filter-input {
    text-align: left;
}

/* Clock column: fixed width for timer display (max 3 chars) */
th.col-clock {
    width: 45px;
    min-width: 45px;
    flex-shrink: 0;
}

.filter-row th.col-clock .filter-input {
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
}

.filter-row th.col-clock .filter-input::placeholder {
    text-align: center;
}

th.col-notas {
    width: 99%;
    min-width: 200px;
}

/* Resizable column handle */
.col-resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    cursor: col-resize;
    z-index: 11;
}

.col-resize-handle:hover {
    background: var(--accent-blue);
}

.filter-row th {
    padding: 0.2rem;
    background-color: rgba(46, 46, 46, 0.95);
    border-bottom: 2px solid var(--border-color);
}

.filter-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 3px 5px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.72rem;
    transition: border-color 0.2s;
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.filter-select {
    appearance: auto;
    cursor: pointer;
}

.filter-select option {
    background-color: #2e2e2e;
    color: #f0f0f0;
}

/* Excel-style filter button */
.filter-btn-excel {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 3px 5px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.72rem;
    cursor: pointer;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-btn-excel:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.filter-btn-excel.active-filter {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* PI/PD filter: icon-only dropdown (avoids clipped "Todos" on tight cols) */
.filter-select-icon-only {
    position: relative;
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.filter-select-icon-only::after {
    content: "▼";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -52%);
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1;
    pointer-events: none;
}

.filter-select-icon-only:hover {
    border-color: var(--accent-blue);
}

.filter-select-icon-only:hover::after {
    color: var(--text-primary);
}

.filter-select-icon-only.active-filter {
    border-color: var(--accent-blue);
}

.filter-select-icon-only.active-filter::after {
    color: var(--accent-blue);
}

.filter-select-icon-only>select {
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

td {
    padding: 0.25rem 0.4rem;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    vertical-align: middle;
    text-align: center;
    font-size: 0.78rem;
    white-space: nowrap;
}

td:last-child {
    border-right: none;
}

tr:hover {
    background-color: var(--row-hover);
}

tr.row-selected {
    background-color: rgba(59, 130, 246, 0.12) !important;
    outline: 1px solid rgba(59, 130, 246, 0.22);
    outline-offset: -1px;
}

tr.row-selected:hover {
    background-color: rgba(59, 130, 246, 0.16) !important;
}

.btn-mini:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Left-aligned columns */
td.align-left {
    text-align: left;
}

td.align-top-left {
    text-align: left;
    vertical-align: top;
}

/* Multi-line cells (docs) */
td.multiline {
    white-space: pre-wrap;
}

/* ===== PI/PD Circles ===== */
.circle-cell {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 20px;
}

.circle-indicator {
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 50%;
}

.circle-red {
    background-color: var(--accent-red);
    box-shadow: 0 0 6px rgba(220, 53, 69, 0.5);
}

.circle-green {
    background-color: var(--accent-green);
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.5);
}

.circle-yellow {
    background-color: #ffc107;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.65);
}

.circle-green-dark {
    background-color: #0f6b2f;
    box-shadow: 0 0 8px rgba(15, 107, 47, 0.65);
}

.file-link {
    color: #4EA3FF;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

.file-link:hover {
    color: #82C2FF;
}

.text-danger {
    color: var(--accent-red);
    font-weight: bold;
}

/* Editable cell (double-click) */
.editable-cell {
    outline: none;
    transition: background-color 0.2s;
    min-height: 18px;
    cursor: default;
}

.editable-cell.editing {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 1px var(--accent-blue);
    cursor: text;
    white-space: pre-wrap;
}

/* Notas column: always wrap */
.notas-cell {
    white-space: pre-wrap !important;
}

/* ===== Context Menu ===== */
.context-menu {
    position: fixed;
    z-index: 1000;
    min-width: 220px;
    padding: 0.4rem 0;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.context-menu ul {
    list-style: none;
}

.context-menu li {
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}

.context-menu li:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--accent-blue);
}

.context-menu li.ctx-separator {
    border-top: 1px solid #3e3e42;
    margin-top: 4px;
    padding-top: 8px;
}

/* Block scroll everywhere while context menu is open */
body.ctx-menu-open,
body.ctx-menu-open .table-container,
body.ctx-menu-open .modal-body,
body.ctx-menu-open .modal-content {
    overflow: hidden !important;
}

/* Drop zone for PD marking */
#mark-pd-dropzone.drag-over {
    border-color: var(--accent-blue) !important;
    background: rgba(14, 99, 156, 0.12) !important;
    color: var(--accent-blue) !important;
}

.pending-docs-modal {
    padding: 0;
    width: 92vw;
    height: 90vh;
    max-width: 1500px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1a1b1f;
    border: 1px solid #3e3e42;
}

.pending-docs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #3e3e42;
}

#pending-docs-file-num {
    color: #7fc7ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#pending-docs-file-num:hover {
    color: #a6dbff;
}

.pending-docs-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 14px;
}

.pending-docs-main {
    display: grid;
    grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.6fr);
    gap: 14px;
    height: 100%;
}

.pending-docs-center {
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 10px;
}

.pending-docs-dropzone {
    border: 2px dashed #555;
    border-radius: 10px;
    padding: 14px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    color: #a4a4a4;
    font-size: 0.82rem;
    transition: all .2s ease;
}

.pending-docs-dropzone.drag-over {
    border-color: var(--accent-blue);
    background: rgba(14, 99, 156, 0.12);
    color: #bcdfff;
}

.pending-docs-drop-icon {
    font-size: 1.35rem;
    margin-bottom: 6px;
}

.pending-docs-drop-sub {
    color: #7f7f7f;
    font-size: 0.74rem;
    margin-top: 4px;
}

.pending-docs-pick-btn {
    margin-top: 10px;
}

.pending-docs-canvas-wrap {
    position: relative;
    flex: 1;
    min-height: 320px;
    border: 1px solid #3e3e42;
    border-radius: 10px;
    background: #111216;
    overflow: auto;
}

.pending-docs-toolbar {
    margin: 10px 12px 0;
    flex-wrap: wrap;
}

.pending-docs-selection-overlay {
    position: absolute;
    display: none;
    border: 2px solid #5fa8ff;
    background: rgba(95, 168, 255, 0.2);
    pointer-events: none;
    z-index: 6;
}

#pending-docs-canvas {
    display: block;
    background: #111216;
}

#pending-docs-pdf-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.pending-docs-canvas-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f7f7f;
    font-size: 0.84rem;
    pointer-events: none;
}

.pending-docs-right {
    border: 1px solid #3e3e42;
    border-radius: 10px;
    background: #17181c;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pending-docs-right-top,
.pending-docs-right-bottom {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pending-docs-right-top {
    flex: 1.15;
    padding-bottom: 10px;
}

.pending-docs-right-bottom {
    flex: 0.85;
    border-top: 1px solid #3e3e42;
}

.pending-docs-right-title {
    padding: 10px 12px;
    border-bottom: 1px solid #3e3e42;
    font-size: 0.84rem;
    color: #d9d9d9;
    font-weight: 600;
}

.pending-docs-right-split {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    min-height: 0;
    flex: 1;
}

.pending-docs-docs-col,
.pending-docs-photos-col {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pending-docs-photos-col {
    border-left: 1px solid #3e3e42;
}

.pending-docs-list,
.pending-docs-photos {
    padding: 8px;
    overflow: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pending-docs-list.drop-target {
    border: 1px dashed #5fa8ff;
    background: rgba(95, 168, 255, 0.08);
}

.pending-docs-item {
    border: 1px solid #3e3e42;
    border-radius: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.pending-docs-item.active {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px rgba(100, 181, 246, 0.35);
}

.pending-docs-item-name {
    font-size: 0.78rem;
    color: #d8d8d8;
    margin-bottom: 6px;
    word-break: break-word;
}

.pending-docs-item-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.pending-docs-item-controls select {
    flex: 1;
    min-width: 140px;
    background: #232428;
    border: 1px solid #3e3e42;
    color: #e0e0e0;
    border-radius: 6px;
    padding: 6px;
    font-size: 0.76rem;
}

.pending-docs-item-controls button {
    white-space: nowrap;
}

.pending-docs-item-split-group {
    border-color: #355b86;
    background: rgba(53, 91, 134, 0.12);
}

.pending-docs-split-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.67rem;
    color: #c6e4ff;
    background: rgba(95, 168, 255, 0.24);
}

.pending-docs-split-summary {
    font-size: 0.74rem;
    color: #b7d4f3;
    margin-bottom: 8px;
}

.pending-docs-split-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.pending-docs-split-row {
    display: grid;
    grid-template-columns: 64px 80px 1fr auto;
    gap: 6px;
    align-items: center;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.02);
}

.pending-docs-split-row.upload {
    border-color: rgba(95, 199, 109, 0.45);
}

.pending-docs-split-row.ignored {
    border-color: rgba(233, 126, 126, 0.45);
    opacity: 0.86;
}

.pending-docs-split-title {
    font-size: 0.73rem;
    color: #dbe8f6;
    font-weight: 600;
}

.pending-docs-split-state {
    font-size: 0.7rem;
    border-radius: 999px;
    text-align: center;
    padding: 3px 6px;
    font-weight: 600;
    background: rgba(127, 199, 255, 0.2);
    color: #bfe2ff;
}

.pending-docs-split-row.ignored .pending-docs-split-state {
    background: rgba(233, 126, 126, 0.2);
    color: #f6c0c0;
}

.pending-docs-split-row select {
    width: 100%;
    background: #232428;
    border: 1px solid #3e3e42;
    color: #e0e0e0;
    border-radius: 6px;
    padding: 6px;
    font-size: 0.74rem;
}

.pending-docs-photo-item {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 8px;
    border: 1px solid #3e3e42;
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.02);
}

.pending-docs-photo-item[draggable="true"] {
    cursor: grab;
}

.pending-docs-photo-item img {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid #4b4b4f;
}

.pending-docs-photo-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.pending-docs-photo-name {
    font-size: 0.75rem;
    color: #e1e1e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pending-docs-photo-tag {
    font-size: 0.72rem;
    color: #9dbadf;
}

.pending-docs-budget-panel {
    border: 1px solid #3e3e42;
    border-radius: 10px;
    padding: 10px;
    background: rgba(43, 76, 112, 0.1);
}

.pending-docs-budget-title {
    font-size: 0.78rem;
    margin-bottom: 8px;
    color: #c2dcfb;
}

.pending-docs-budget-vins {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pending-docs-budget-vin-card {
    border: 1px solid #3e3e42;
    border-radius: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.pending-docs-budget-vin-title {
    font-size: 0.78rem;
    color: #dceaff;
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pending-docs-budget-vin-row {
    display: grid;
    grid-template-columns: 110px 34px 110px 44px 34px;
    gap: 6px;
    align-items: center;
    justify-content: start;
}

.pending-docs-budget-vin-row input,
.pending-docs-budget-reserva input {
    width: 100%;
    background: #232428;
    border: 1px solid #3e3e42;
    color: #e0e0e0;
    border-radius: 6px;
    padding: 6px;
    font-size: 0.76rem;
}

.pending-docs-budget-vin-row button {
    padding: 5px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.pending-docs-budget-reserva {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}

.pending-docs-budget-reserva input {
    background: #1f2f43;
    color: #d9ecff;
    font-weight: 600;
}

.pending-docs-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #3e3e42;
}

.pending-docs-correction-overlay {
    z-index: 220000;
}

.modal.pending-docs-correction-overlay {
    z-index: 230000 !important;
}

.pending-docs-correction-card {
    width: min(520px, 94vw);
    max-width: min(520px, 94vw);
    background: #1b1d22;
    border: 1px solid #3e3e42;
    overflow: hidden;
}

.pending-docs-correction-card-lg {
    width: min(1120px, 95vw);
    max-width: min(1120px, 95vw);
}

.pending-docs-correction-header,
.pending-docs-correction-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #3e3e42;
}

.pending-docs-correction-footer {
    border-bottom: 0;
    border-top: 1px solid #3e3e42;
    justify-content: flex-end;
}

.pending-docs-correction-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: #e1e1e1;
}

.pending-docs-correction-body {
    padding: 12px;
}

.pending-docs-correction-note {
    font-size: 0.76rem;
    color: #9ea7b9;
    margin-bottom: 12px;
}

.pending-docs-correction-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 8px;
    align-items: center;
}

.pending-docs-correction-row select {
    width: 100%;
    background: #232428;
    border: 1px solid #3e3e42;
    color: #e0e0e0;
    border-radius: 6px;
    padding: 6px;
}

.pending-docs-correction-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pending-docs-correction-page {
    width: 140px;
    border: 1px solid #3e3e42;
    border-radius: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pending-docs-correction-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 0.74rem;
    color: #b5bfd2;
}

.pending-docs-correction-page img {
    width: 122px;
    height: 122px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #4b4b4f;
    background: #101114;
    align-self: center;
    transition: transform .2s ease;
}

.pending-docs-correction-page img.rot-90 { transform: rotate(90deg); }
.pending-docs-correction-page img.rot-180 { transform: rotate(180deg); }
.pending-docs-correction-page img.rot-270 { transform: rotate(270deg); }

.pending-docs-correction-page select {
    width: 100%;
    background: #232428;
    border: 1px solid #3e3e42;
    color: #e0e0e0;
    border-radius: 6px;
    padding: 6px;
    font-size: 0.74rem;
}

@media (max-width: 980px) {
    .pending-docs-modal {
        width: 96vw;
        height: 92vh;
    }
    .pending-docs-main {
        grid-template-columns: 1fr;
    }
    .pending-docs-right-split {
        grid-template-columns: 1fr;
    }
    .pending-docs-photos-col {
        border-left: 0;
        border-top: 1px solid #3e3e42;
    }
    .pending-docs-budget-vin-row {
        grid-template-columns: 1fr 36px;
    }
    .pending-docs-budget-vin-row button[data-action="iva"],
    .pending-docs-budget-vin-row button[data-action="detect-importe"] {
        margin-top: 4px;
    }
}

/* ===== Filter Popup ===== */
.filter-popup {
    position: fixed;
    z-index: 1100;
    width: 340px;
    max-width: calc(100vw - 16px);
    padding: 0.6rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 220px;
    background: rgba(20, 20, 24, 0.96);
}

.filter-popup-header {
    display: flex;
    gap: 0.3rem;
}

.filter-popup-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 30px 30px minmax(0, 1.5fr);
    gap: 0.3rem;
    align-items: center;
    min-height: auto;
    overflow: visible;
}

.filter-popup-actions .btn-mini {
    width: 100%;
    min-height: 28px;
    padding-left: 6px;
    padding-right: 6px;
}

.filter-popup-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 220px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.2rem;
    background: rgba(0, 0, 0, 0.2);
}

.filter-popup-list label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 3px 6px;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 3px;
    color: var(--text-primary);
}

.filter-popup-list label:hover {
    background: rgba(255, 255, 255, 0.08);
}

.filter-popup-list input[type="checkbox"] {
    accent-color: var(--accent-blue);
}

.filter-popup-footer {
    display: flex;
    gap: 0.3rem;
    justify-content: flex-end;
}

/* Notas filter popup: compact size */
#notas-filter-popup {
    width: 260px;
    min-height: auto;
}

/* Notas filter: CSP toggle button */
.notas-filter-csp-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    transition: border-color 0.15s, background 0.15s;
}

.notas-filter-csp-toggle:hover {
    border-color: #e8a838;
}

.notas-filter-csp-toggle.active {
    border-color: #e8a838;
    background: rgba(232, 168, 56, 0.13);
}

.notas-filter-csp-toggle.active .tag-cuadro-sin-presup {
    background: rgba(232, 168, 56, 0.35);
    border-color: #e8a838;
}

/* Checkbox indicator inside the CSP toggle */
.notas-csp-check {
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: transparent;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.notas-filter-csp-toggle.active .notas-csp-check {
    border-color: #e8a838;
    background: rgba(232, 168, 56, 0.3);
    color: #e8a838;
}

.notas-filter-csp-toggle.active .notas-csp-check::after {
    content: "✓";
    line-height: 1;
}

/* ===== Toasts ===== */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    z-index: 300000;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    color: white;
    font-size: 0.8rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    animation: slideInFade 0.3s ease forwards;
}

.toast.success {
    border-left: 4px solid var(--accent-green);
}

.toast.error {
    border-left: 4px solid var(--accent-red);
}

.toast.warning {
    border-left: 4px solid #ffc107;
}

.toast-progress {
    min-width: 320px;
}

.toast-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.toast-progress-label {
    line-height: 1.3;
}

.toast-progress-pct {
    font-weight: 700;
    color: #c5e4ff;
    font-variant-numeric: tabular-nums;
}

.toast-progress-bar {
    margin-top: 0.45rem;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    overflow: hidden;
}

.toast-progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0a84ff, #4dabff);
    transition: width 0.25s ease;
}

@keyframes dashboard-btn-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: var(--glass-bg);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    max-width: 500px;
    width: 90%;
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.pending-docs-modal {
    width: 82vw;
    height: 82vh;
    max-width: 82vw;
    max-height: 82vh;
    overflow: hidden;
}

@media (max-width: 980px) {
    .modal-content.pending-docs-modal {
        width: 96vw;
        height: 92vh;
        max-width: 96vw;
        max-height: 92vh;
    }
}

.batch-details-modal-content {
    padding: 0;
    width: 94%;
    max-width: 980px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.batch-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #3e3e42;
}

.batch-details-header h2 {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 600;
}

.batch-details-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.batch-details-summary {
    padding: 12px 16px 10px;
    border-bottom: 1px solid #3e3e42;
    background: rgba(255, 255, 255, 0.02);
}

.batch-details-summary[hidden] {
    display: none;
}

.batch-details-summary-title {
    margin: 0 0 0.6rem;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.batch-details-summary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.batch-details-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 100%;
    padding: 0.36rem 0.68rem;
    border-radius: 999px;
    border: 1px solid rgba(197, 228, 255, 0.18);
    background: rgba(84, 163, 255, 0.08);
}

.batch-details-summary-insured {
    color: #eef6ff;
    font-size: 0.78rem;
    white-space: nowrap;
}

.batch-details-summary-count {
    color: #c5e4ff;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.batch-details-summary-empty {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.batch-details-body .table-container {
    height: 100%;
    overflow: auto;
}

.batch-details-footer {
    display: flex;
    justify-content: flex-end;
    padding: 10px 14px;
    border-top: 1px solid #3e3e42;
}

#batch-details-table th,
#batch-details-table td {
    text-align: left;
}

#batch-details-table th:first-child,
#batch-details-table td:first-child {
    text-align: center;
    width: 120px;
}

@keyframes slideInFade {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== Mail Viewer Window (Web version of Outlook composer layout) ===== */
.mail-window {
    background-color: #252526;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    max-width: 1000px;
    width: 96%;
    margin: auto;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* -- Barra de titulo -- */
.mail-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background-color: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    flex-shrink: 0;
}

.mail-titlebar-icon {
    font-size: 0.9rem;
    color: #999;
}

.mail-titlebar-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #cccccc;
    flex: 1;
}

.mail-titlebar-close {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 3px;
}

.mail-titlebar-close:hover {
    background-color: #c42b1c;
    color: #fff;
}

/* -- Scroll container (campos + cuerpo) -- */
.mail-scroll-container {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    background-color: #1e1e1e;
}

/* custom scrollbar */
.mail-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.mail-scroll-container::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.mail-scroll-container::-webkit-scrollbar-thumb {
    background: #464647;
    border-radius: 4px;
}

.mail-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #555555;
}

/* -- Fields section (Para, CC, CCO, Asunto, etc.) -- */
.mail-fields-section {
    background-color: #252526;
    border-bottom: 1px solid #3e3e42;
    padding: 10px;
}

.mail-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.mail-field-row:last-child {
    margin-bottom: 0;
}

.mail-field-label {
    flex-shrink: 0;
    width: 60px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #999;
    text-align: right;
    padding-right: 8px;
}

.mail-field-input {
    flex: 1;
    background-color: #3c3c40;
    color: #e0e0e0;
    border: 1px solid #555;
    padding: 5px 8px;
    font-size: 0.8rem;
    border-radius: 3px;
    outline: none;
    font-family: inherit;
}

.mail-field-input:focus {
    border-color: #0078d4;
    box-shadow: inset 0 0 0 1px #0078d4;
}

/* -- Attachments section -- */
.mail-attachments-section {
    background-color: #252526;
    border-bottom: 1px solid #3e3e42;
    padding: 8px 10px;
}

.mail-attachments-label {
    font-size: 0.75rem;
    font-weight: bold;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.mail-attachments-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.mail-attachment-item {
    background-color: #3c3c40;
    border: 1px solid #555;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    color: #ccc;
    cursor: default;
}

/* -- Body label -- */
.mail-body-label {
    background-color: #252526;
    border-bottom: 1px solid #3e3e42;
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* -- Body frame (scrolleable content) -- */
.mail-body-frame {
    background-color: #1e1e1e;
    padding: 16px 14px;
    line-height: 1.65;
    font-size: 0.88rem;
    word-break: break-word;
    overflow-x: auto;
    min-height: 200px;
    color: #e0e0e0;
    /* Color por defecto (blanco/gris claro) */
}

/* 
   SOLUCIÓN LETRA NEGRA: 
   Si el usuario pone color negro (#000000 o rgb(0,0,0)), en el visor 
   lo forzamos a blanco para que sea legible, pero como es un cambio 
   solo de CSS del visor, el mail se enviará con el negro original.
*/
.mail-body-frame [style*="color: rgb(0, 0, 0)"],
.mail-body-frame [style*="color: #000000"],
.mail-body-frame [style*="color: black"],
.mail-body-frame font[color="#000000"] {
    color: #ffffff !important;
}

/* 
   No forzamos background: transparent para permitir que los elementos 
   muestren sus backgrounds personalizados (resaltados).
*/
.mail-body-frame * {
    font-family: inherit;
}

/* Listas: contenidas, sin overflow */
.mail-body-frame ul,
.mail-body-frame ol {
    padding-left: 24px !important;
    margin: 6px 0 !important;
}

.mail-body-frame ul {
    list-style-type: disc !important;
}

.mail-body-frame ol {
    list-style-type: decimal !important;
}

.mail-body-frame li {
    margin-bottom: 3px;
}

.mail-body-frame a {
    color: #4ea3ff !important;
    text-decoration: underline;
}

.mail-body-frame strong,
.mail-body-frame b {
    font-weight: bold;
    color: #ffffff;
}

.mail-body-frame em,
.mail-body-frame i {
    font-style: italic;
}

.mail-body-frame h1,
.mail-body-frame h2,
.mail-body-frame h3,
.mail-body-frame h4 {
    margin: 10px 0 6px 0;
    color: #ffffff;
}

.mail-body-frame p {
    margin: 0 0 8px 0;
}

.mail-body-frame table {
    border-collapse: collapse;
    width: auto;
    max-width: 100%;
    font-size: inherit;
    margin: 8px 0;
    border: 1px solid #555 !important;
}

.mail-body-frame td,
.mail-body-frame th {
    border: 1px solid #555 !important;
    padding: 6px 10px;
    text-align: left;
}

.mail-body-frame th {
    font-weight: 600;
    background: rgba(255, 255, 255, 0.04);
}

.mail-body-frame img {
    max-width: 100%;
    height: auto;
}

/* Toolbar de formato del editor de correo */
.fmt-btn {
    background: #3c3c40;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: all 0.12s ease;
}

.fmt-btn:hover {
    background: #454549;
    border-color: #0078d4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.fmt-btn:active {
    background: #0078d4;
    color: #fff;
    border-color: #0078d4;
    transform: scale(0.98);
}

.fmt-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.4) !important;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.fmt-color:hover {
    border-color: rgba(0, 120, 212, 0.8) !important;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1), 0 0 6px rgba(0, 120, 212, 0.3);
}

.fmt-hilite {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.3) !important;
}

/* Dropdowns de formato */
.fmt-dropdown {
    position: relative;
    display: inline-block;
}

.fmt-dropdown-btn {
    padding: 0 !important;
    width: 32px !important;
    height: 30px !important;
    position: relative;
}

.fmt-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 6px;
    min-width: 140px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
}

.fmt-dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    background: transparent;
    border: none;
    color: #ccc;
    padding: 8px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.1s ease;
    text-align: left;
    font-family: inherit;
}

.fmt-dropdown-item:hover {
    background: #3e3e42;
    color: #fff;
}

.fmt-dropdown-item:active {
    background: #0078d4;
    color: #fff;
}

.mail-body-frame blockquote {
    border-left: 3px solid #0078d4 !important;
    margin: 8px 0 !important;
    padding: 4px 0 4px 14px !important;
    opacity: 0.85;
}

.mail-body-frame pre,
.mail-body-frame code {
    background: rgba(0, 0, 0, 0.3) !important;
    color: #e0e0e0 !important;
    border-radius: 3px;
    padding: 3px 6px;
}

/* -- Options bar -- */
.mail-options-bar {
    display: flex;
    gap: 8px;
    padding: 8px 10px;
    background-color: #252526;
    border-top: 1px solid #3e3e42;
    border-bottom: 1px solid #3e3e42;
    flex-shrink: 0;
}

.mail-option-btn {
    background-color: #3e3e42;
    color: #e0e0e0;
    border: 1px solid #555;
    padding: 5px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    border-radius: 3px;
    font-family: inherit;
}

.mail-option-btn:hover {
    background-color: #4e4e52;
}

/* -- Footer -- */
.mail-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px;
    background-color: #252526;
    border-top: 1px solid #3e3e42;
    flex-shrink: 0;
}

.mail-btn {
    padding: 6px 20px;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 3px;
    font-family: inherit;
    border: 1px solid #555;
}

.mail-btn-default {
    background-color: #3e3e42;
    color: #e0e0e0;
}

.mail-btn-default:hover {
    background-color: #4e4e52;
    border-color: #777;
}

.mail-btn-primary {
    background-color: #0078d4;
    color: #ffffff;
    border: 1px solid #0078d4;
    font-weight: bold;
}

.mail-btn-primary:hover {
    background-color: #1084d7;
}

/* ===== Mail Body Content (iframe para renderizar HTML del backend) ===== */
/* El iframe aisla completamente los estilos del backend */
.mail-body-content {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

/* Iframe dentro del contenedor mail-body-content */
.mail-body-content iframe {
    border: none;
    width: 100%;
    height: 100%;
    display: block;
}

/* Hover effects for inline buttons in mail modal */
#mail-result-modal button:hover {
    opacity: 0.9;
    filter: brightness(1.15);
}

/* ===== Action Columns ===== */
.col-action {
    width: 140px;
    text-align: center;
}

.btn-action {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* ===== Cuadro Draft Modal ===== */
#cuadro-draft-modal button:hover {
    opacity: 0.85;
}

.cuadro-suggestion-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    color: #e0e0e0;
    border-bottom: 1px solid #3e3e42;
}

.cuadro-suggestion-item:hover,
.cuadro-suggestion-item.active {
    background-color: #094771;
}

.cuadro-suggestion-item .suggestion-name {
    font-weight: 600;
    color: #ccc;
}

.cuadro-suggestion-item .suggestion-email {
    color: #7abaff;
    font-size: 0.75rem;
}

.attachment-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.attachment-link {
    color: #7abaff;
    text-decoration: none;
}

.attachment-link:hover {
    text-decoration: underline;
}

.informe-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

/* ===== Informe Photos Modal (Step 1) ===== */
.informe-photos-modal {
    max-width: 1200px;
    width: 96%;
    max-height: 90vh;
    font-size: 0.8rem;
}

.informe-photos-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
}

.informe-photos-modal .modal-header h2 {
    font-size: 0.95rem;
}

.informe-photos-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 8px 16px;
}

.informe-photos-body {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 0;
    padding: 0;
    overflow: hidden;
    height: 600px; /* Fixed height for consistency */
}

.report-modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    flex-shrink: 0;
}

.report-modal-title {
    flex: 1;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cccccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-modal-close {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.report-modal-close:hover {
    background: #c42b1c;
    color: #fff;
}

.report-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px;
    background: #252526;
    border-top: 1px solid #3e3e42;
    flex-shrink: 0;
}

.btn-report-primary, .btn-report-secondary {
    padding: 8px 24px;
    font-size: 0.85rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 700; /* Same weight as primary */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.btn-report-primary {
    background-color: #0078d4;
    color: #ffffff;
    border-color: #0078d4;
}

.btn-report-primary:hover:not(:disabled) {
    background-color: #1084d7;
}

.btn-report-secondary {
    background-color: transparent;
    color: #a0a0a0;
    border-color: transparent;
}

.btn-report-secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.btn-report-primary:disabled, .btn-report-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.report-left-panel {
    border-right: 1px solid #3e3e42;
    padding: 16px;
    overflow-y: auto;
    background: #1e1e1e;
}

.report-right-panel {
    padding: 16px;
    overflow-y: auto;
    background: #252526;
}

.report-section-title {
    color: #cccccc;
    font-size: 0.85rem;
    margin-bottom: 12px;
    font-weight: 600;
}

.report-card {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
}

.report-unit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.report-unit-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #cccccc;
    letter-spacing: 0.03em;
}

.report-assignment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.report-assignment-item {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.report-slot-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.report-slot-actions .btn-report-primary,
.report-slot-actions .btn-report-danger {
    flex: 1;
}

.btn-report-icon {
    width: 28px;
    min-width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #3a3a3e;
    background: #2a2a2d;
    color: #9ad8ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.btn-report-icon:hover:not(:disabled) {
    background: #1e3a52;
    border-color: #3a6d9e;
    color: #c1e7ff;
}

.btn-report-icon:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.report-assignment-box {
    aspect-ratio: 4 / 3;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: default;
}
.report-crop-layer {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 3;
    cursor: crosshair;
}
.report-crop-rect {
    position: absolute;
    border: 2px solid rgba(79, 195, 247, 0.95);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    border-radius: 4px;
    cursor: move;
}
.report-crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #4fc3f7;
    border: 1px solid #0b4f79;
    border-radius: 2px;
}
.report-crop-handle.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.report-crop-handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.report-crop-handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.report-crop-handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }

.report-assignment-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #777;
}

.report-assignment-placeholder svg {
    width: 30px;
    height: 30px;
    opacity: 0.65;
}

.report-assignment-placeholder span {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.report-assignment-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.report-assignment-box.has-image {
    border-style: solid;
    border-color: #444;
}

.btn-report-danger {
    padding: 5px 10px;
    font-size: 0.73rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    background-color: rgba(160, 30, 30, 0.15);
    color: #f87171;
    border: 1px solid rgba(160, 30, 30, 0.4);
}

.btn-report-danger:hover:not(:disabled) {
    background-color: rgba(160, 30, 30, 0.28);
    color: #fca5a5;
    border-color: rgba(160, 30, 30, 0.65);
}

/* ===== Informe Doc Nav Bar (Step 2) ===== */
.ocr-nav-bar {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-top: 12px;
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    border-radius: 10px;
    padding: 7px 14px;
}

.ocr-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    background: #2a2a2d;
    color: #c0c0c0;
    border: 1px solid #3a3a3e;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    letter-spacing: 0.02em;
}

.ocr-nav-btn:hover:not(:disabled) {
    background: #3c3c42;
    color: #ffffff;
    border-color: #555;
}

.ocr-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ocr-nav-btn.rotate-btn {
    color: #7cc8f8;
    border-color: #2a4d6e;
    background: #1a2e42;
}

.ocr-nav-btn.rotate-btn:hover:not(:disabled) {
    background: #1e3a52;
    color: #9ad8ff;
    border-color: #3a6d9e;
}

.ocr-nav-sep {
    width: 1px;
    height: 22px;
    background: #333;
    flex-shrink: 0;
    margin: 0 4px;
}

.ocr-page-counter {
    font-size: 0.78rem;
    color: #999;
    min-width: 52px;
    text-align: center;
    padding: 4px 10px;
    background: #111;
    border: 1px solid #2b2b2b;
    border-radius: 5px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.03em;
}

/* ===== Informe OCR Modal (Step 2) ===== */
.informe-ocr-modal {
    max-width: 96vw;
    width: 96vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: 0.8rem;
}

.informe-ocr-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.informe-ocr-modal .modal-header h2 {
    font-size: 0.95rem;
}

.informe-ocr-modal .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding: 8px 16px;
}

.informe-ocr-body {
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
}

.informe-ocr-body .ocr-layout {
    height: 100%;
}

.informe-section h3 {
    margin: 6px 0 10px;
    color: #ffc107;
    font-size: 0.85rem;
}

.thumbs-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.thumb-card {
    background: #222;
    border: 2px solid #2b2b2b;
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.thumb-card.selected {
    border-color: #1f6aa5;
}

.thumb-card img {
    width: 100%;
    height: 90px;
    object-fit: contain;
    background: #111;
    border-radius: 4px;
}

.thumb-card span {
    font-size: 0.7rem;
    color: #ddd;
    text-align: center;
    line-height: 1.1;
}

.thumb-rotate-btns {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.thumb-rotate-btns button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: #4b5563;
    color: white;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.thumb-rotate-btns button:hover {
    background: #3a4452;
}

.placeholder-section {
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.placeholder-section h4 {
    margin: 4px 0 10px;
    color: #7abaff;
    font-size: 0.8rem;
}

.placeholder-row {
    display: grid;
    grid-template-columns: 1fr 120px 120px 120px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.placeholder-preview {
    width: 120px;
    height: 64px;
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    object-fit: contain;
}

.report-doc-card {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #ddd;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 8px;
}

.report-doc-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

.report-doc-card.active {
    border-color: #0078d4;
    background: rgba(0, 120, 212, 0.12);
}

.report-doc-card-name {
    font-size: 12px;
    font-weight: 600;
    color: #e6e6e6;
    line-height: 1.35;
    word-break: break-word;
}

.report-doc-card-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #9ea7b9;
}

.report-ocr-layout {
    display: grid;
    grid-template-columns: 240px 1fr 198px;
    gap: 0;
    height: 600px;
}

.btn-report-secondary-strong {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    background: rgba(255, 255, 255, 0.08);
    color: #e6e6e6;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn-report-secondary-strong:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.32);
}

.report-ocr-sidebar {
    border-right: 1px solid #3e3e42;
    padding: 16px;
    overflow-y: auto;
    background: #1e1e1e;
}

.report-ocr-viewer {
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 14px 12px;
    border-right: 1px solid #3e3e42;
}

.report-ocr-fields {
    background: #252526;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ocr-fields-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 4px;
}

.ocr-sidebar {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ocr-sidebar h4 {
    margin: 0 0 6px;
    color: #ffc107;
    font-size: 0.8rem;
}

.ocr-docs {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
    border: 1px solid #333;
    border-radius: 6px;
}

.ocr-docs li {
    padding: 6px 8px;
    border-bottom: 1px solid #2b2b2b;
    cursor: pointer;
    color: #ddd;
    font-size: 0.75rem;
}

.ocr-docs li:hover {
    background: #2a2a2a;
}

.ocr-docs li.active {
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.22), rgba(255, 193, 7, 0.08));
    color: #fff;
    border-left: 3px solid #ffc107;
    padding-left: 5px;
    font-weight: 600;
}

.ocr-viewer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden;
    min-height: 0;
}

.canvas-wrap {
    position: relative;
    border: 1px solid #333;
    border-radius: 6px;
    overflow: auto;
    flex: 1;
    min-height: 0;
    max-height: 100%;
}

#informe-canvas {
    display: block;
    background: #111;
}

.selection-rect {
    position: absolute;
    border: 2px dashed #1f6aa5;
    display: none;
    pointer-events: none;
}

.ocr-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ccc;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.ocr-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.ocr-field {
    border: 1px solid #2e2e2e;
    border-radius: 7px;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.15);
}

.ocr-field.active {
    border-color: #0078d4;
    background: rgba(0, 120, 212, 0.08);
}

.ocr-field label {
    display: block;
    font-size: 0.7rem;
    color: #888;
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ocr-field input {
    width: 100%;
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #3a3a3a;
    border-radius: 5px;
    padding: 5px 8px;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.ocr-field input:focus {
    border-color: #0078d4;
}

/* ===== Informe Preview Modal (Step 3) ===== */
.informe-preview-modal {
    position: relative;
    width: 70vw;
    max-width: 70vw;
    height: min(92vh, 980px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1e1e1e;
    border: 1px solid #3e3e42;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.72);
}

.informe-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #2d2d30;
    border-bottom: 1px solid #3e3e42;
    flex-shrink: 0;
}

.informe-preview-header-icon {
    font-size: 0.9rem;
    color: #999;
    flex-shrink: 0;
}

.informe-preview-title-text {
    flex: 1;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cccccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.informe-preview-close-x {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.informe-preview-close-x:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.informe-preview-status {
    min-height: 20px;
    font-size: 0.76rem;
    line-height: 1.35;
    color: #c7d2da;
    padding: 0 2px;
}

.informe-preview-status[data-kind="success"] {
    color: #86efac;
}

.informe-preview-status[data-kind="error"] {
    color: #fda4af;
}

.informe-preview-body {
    padding: 0;
    flex: 1 1 auto;
    overflow: hidden;
    min-height: 0;
}

.informe-preview-frame-wrap {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #111;
}

.informe-preview-frame-wrap iframe {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    background: #111;
    display: block;
}

.informe-preview-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 15px 14px;
    background: #252526;
    border-top: 1px solid #3e3e42;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.informe-preview-footer-row {
    display: flex;
    gap: 10px;
    align-items: center;
    min-height: 0;
}

.informe-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.informe-preview-actions .btn {
    min-width: 176px;
    min-height: 36px;
    padding: 0 16px;
    font-size: 0.82rem;
    border-radius: 4px;
}

.informe-preview-progress-wrap {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    gap: 10px;
    align-items: start;
}

.informe-preview-progress {
    border: 1px solid #353535;
    border-radius: 8px;
    background: #1b1b1c;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}

.informe-preview-progress-bar-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.informe-preview-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #0078d4, #4fc3f7);
    transition: width 0.2s ease;
}

.informe-preview-progress-text {
    font-size: 0.74rem;
    color: #9ca3af;
    text-align: right;
    font-weight: 600;
}

.informe-preview-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.informe-preview-error-actions .btn {
    min-height: 38px;
    font-size: 0.8rem;
}

.informe-close-status-modal {
    width: min(92vw, 430px);
    max-width: 430px;
    border-radius: 8px;
    overflow: hidden;
    background: #252526;
    border: 1px solid #3e3e42;
}

.informe-close-status-body {
    padding: 14px 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.informe-close-status-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #3e3e42;
    background: #2d2d30;
}

.informe-close-status-modal .modal-header h2 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.informe-close-status-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
}

.informe-close-status-body label {
    font-size: 0.77rem;
    font-weight: 600;
    color: #cbd5e1;
}

.informe-close-status-body select {
    width: 100%;
    background: #1f1f1f;
    color: #f3f4f6;
    border: 1px solid #454545;
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 0.8rem;
    line-height: 1.3;
}

.informe-close-status-body p {
    margin: 0;
    color: #9ca3af;
    font-size: 0.75rem;
    line-height: 1.45;
}

.informe-close-status-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px 14px;
    border-top: 1px solid #3e3e42;
    background: rgba(255, 255, 255, 0.02);
}

.informe-close-status-footer .btn {
    min-width: 110px;
    min-height: 36px;
    font-size: 0.79rem;
}

.informe-success-modal {
    width: min(92vw, 400px);
    max-width: 400px;
    border-radius: 8px;
    overflow: hidden;
    background: #252526;
    border: 1px solid #3e3e42;
}

.informe-success-header {
    justify-content: center !important;
    padding: 14px 16px !important;
    background: #2d2d30 !important;
    border-bottom: 1px solid #3e3e42 !important;
}

.informe-success-header h2 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #cccccc;
}

.informe-success-body {
    padding: 16px 20px 12px;
}

.informe-success-body p {
    margin: 0;
    font-size: 0.82rem;
    color: #d4d4d4;
    line-height: 1.55;
    text-align: center;
}

.informe-success-footer {
    display: flex;
    justify-content: center;
    padding: 12px 16px 16px;
    border-top: 1px solid #3e3e42;
    background: rgba(255, 255, 255, 0.02);
}

.informe-success-footer .btn {
    min-width: 110px;
    min-height: 36px;
    font-size: 0.8rem;
}

@media (max-width: 1080px) {
    .informe-preview-modal {
        width: 92vw;
        max-width: 92vw;
        height: min(94vh, 980px);
    }
}

/* ===== USER MANAGEMENT ===== */
.tab-config-btn {
    background: none;
    border: none;
    color: #888;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-config-btn:hover {
    color: #ccc;
}

.tab-config-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-card {
    background: rgba(60, 60, 64, 0.5);
    border: 1px solid #555;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}

.user-card:hover {
    background: rgba(70, 70, 74, 0.5);
    border-color: #666;
}

.user-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.user-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: #e0e0e0;
}

.user-card-role {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
}

.user-card-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-card-label {
    color: #aaa;
    min-width: 100px;
}

.user-card-value {
    color: #e0e0e0;
    flex: 1;
}

.user-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #444;
}

.user-token-input {
    width: 100%;
    padding: 6px 8px;
    background: #3c3c40;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
}

.btn-sm-inline {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid #555;
    background: #3c3c40;
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm-inline:hover {
    background: #4c4c50;
    border-color: #666;
}

.btn-sm-inline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-report-icon.active {
    background: #1e3a52;
    border-color: #3a6d9e;
    color: #c1e7ff;
}

.form-field {
    margin-bottom: 12px;
}

.form-field label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
    font-size: 0.85rem;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #555;
    background: #3c3c40;
    color: #e0e0e0;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: #007bff;
}

.pending-filters-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
}

.pending-filters-column {
    display: flex;
    flex-direction: column;
    min-height: 320px;
}

.pending-filters-column-title {
    margin-bottom: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pending-filters-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #444;
    background: rgba(30, 30, 30, 0.75);
    overflow-y: auto;
}

.pending-filter-item {
    width: 100%;
    border: 1px solid #555;
    border-radius: 6px;
    background: rgba(60, 60, 64, 0.65);
    color: #e0e0e0;
    text-align: left;
    padding: 9px 10px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.pending-filter-item:hover {
    background: rgba(74, 74, 78, 0.8);
    border-color: #6b6b6b;
}

.pending-filter-item.active {
    background: rgba(0, 123, 255, 0.18);
    border-color: #64b5f6;
    transform: translateY(-1px);
}

.pending-filters-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    color: #777;
    font-size: 0.82rem;
    border: 1px dashed #4a4a4a;
    border-radius: 6px;
}

.pending-filters-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pending-filters-arrow {
    width: 44px;
    min-width: 44px;
    height: 44px;
    font-size: 1.1rem;
    padding: 0;
}

@media (max-width: 900px) {
    header {
        grid-template-columns: 1fr;
    }

    .pending-filters-layout {
        grid-template-columns: 1fr;
    }

    .pending-filters-controls {
        flex-direction: row;
    }

    .pending-filters-column {
        min-height: 220px;
    }

    .header-right {
        width: 100%;
        align-items: stretch;
        align-self: auto;
    }

    .header-meta-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.15rem;
    }

    .header-right-actions,
    .header-right-counters,
    .batch-inline-counters {
        justify-content: flex-start;
    }

    .header-right-counters {
        width: 100%;
        margin-top: 0;
    }

    .batch-refresh-btn {
        margin-left: 0.12rem;
    }
}

/* -- Outlook-style Attachment Cards -- */
.attachment-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #2d2d30;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 6px 8px;
    min-width: 140px;
    max-width: 200px;
    transition: all 0.2s ease;
    cursor: pointer;
    height: 40px;
}

.attachment-card:hover {
    background-color: #3c3c40;
    border-color: #007bff;
}

.attachment-card-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.attachment-card-name {
    font-size: 0.75rem;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.attachment-card-size {
    font-size: 0.65rem;
    color: #999;
    display: none;
}

.attachment-card-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #dc3545;
    color: white;
    border: 2px solid #1e1e1e;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.83rem;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

.attachment-card-delete:hover {
    background-color: #c82333;
    transform: scale(1.15);
}

.attachment-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: #007bff;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    height: 32px;
    margin-top: 0;
}

.attachment-add-btn:hover {
    background-color: #0056b3;
}

.attachment-add-btn:active {
    background-color: #004085;
}

/* ==================== SEGUIMIENTO TAB ==================== */
.seg-cat {
    font-weight: 600;
    font-size: 0.78rem;
    white-space: nowrap;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.2s ease;
}

.seg-cat:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.seg-cat-pi {
    color: #ffb347;
}

.seg-cat-pd {
    color: #64b5f6;
}

.seg-cat-conf {
    color: #ba68c8;
}

.seg-cat-missing {
    color: #ff6b6b;
}

.seg-cat-pi-missing {
    color: #ff6b6b;
}

.seg-cat-pd-missing {
    color: #ff6b6b;
}

/* Urgency levels for Instancia column */
.seg-urgency-low {
    color: #81c784;
}

.seg-urgency-medium {
    color: #ffb347;
}

.seg-urgency-high {
    color: #ff8a65;
}

.seg-urgency-critical {
    color: #ff5252;
    font-weight: 700;
}

#table-seguimiento-blocked td.seg-unlock-cell {
    text-align: center;
    vertical-align: middle;
    display: flex;
    justify-content: center;
    align-items: center;
}
