/* Shared dashboard layout */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 0.25rem;
}

.dashboard-title p {
    color: var(--muted-foreground);
    font-size: 0.9rem;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box input {
    width: 100%;
    height: 2.5rem;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
    transition: all 0.2s ease;
}

.search-box input:focus {
    border-color: var(--foreground);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.search-box svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted-foreground);
    pointer-events: none;
}

.filters,
.filters-bar,
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    height: 2.5rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    font-size: 0.875rem;
    color: var(--foreground);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

.filter-select:focus {
    border-color: var(--foreground);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.smart-filter-select {
    position: relative;
    width: 100%;
}

.smart-filter-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.smart-filter-trigger {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.5rem 0.8rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    color: var(--foreground);
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.smart-filter-trigger:hover,
.smart-filter-select.open .smart-filter-trigger,
.smart-filter-trigger:focus-visible {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
    background: rgba(255, 255, 255, 0.98);
}

.smart-filter-trigger:disabled {
    cursor: not-allowed;
    opacity: 0.68;
}

.smart-filter-trigger-text {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 500;
}

.smart-filter-trigger-text.is-placeholder {
    color: var(--muted-foreground);
    font-weight: 400;
}

.smart-filter-trigger-chevron {
    width: 0.78rem;
    height: 0.78rem;
    border-right: 2px solid var(--muted-foreground);
    border-bottom: 2px solid var(--muted-foreground);
    transform: rotate(45deg) translateY(-1px);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.smart-filter-select.open .smart-filter-trigger-chevron {
    transform: rotate(225deg) translateY(-1px);
}

.smart-filter-panel {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    width: max(100%, 20rem);
    min-width: 100%;
    max-width: min(32rem, 92vw);
    z-index: 35;
    display: none;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--card);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16);
}

.smart-filter-select.open .smart-filter-panel {
    display: block;
}

.smart-filter-search-wrap {
    margin-bottom: 0.6rem;
}

.smart-filter-search {
    width: 100%;
    height: 2.4rem;
    padding: 0.5rem 0.75rem;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid var(--border);
    border-radius: 0.7rem;
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
}

.smart-filter-search:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
    background: #ffffff;
}

.smart-filter-options {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-right: 0.1rem;
}

.smart-filter-option,
.smart-filter-empty {
    width: 100%;
    min-height: 2.3rem;
    padding: 0.55rem 0.7rem;
    border-radius: 0.7rem;
    font-size: 0.875rem;
}

.smart-filter-option {
    border: 1px solid transparent;
    background: transparent;
    color: var(--foreground);
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.smart-filter-option:hover,
.smart-filter-option:focus-visible {
    background: rgba(241, 245, 249, 0.95);
    border-color: rgba(148, 163, 184, 0.3);
    outline: none;
}

.smart-filter-option.is-selected {
    background: rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.2);
    color: #1d4ed8;
    font-weight: 600;
}

.smart-filter-option:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.smart-filter-option-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smart-filter-check {
    flex-shrink: 0;
    font-size: 0.86rem;
}

.smart-filter-empty {
    color: var(--muted-foreground);
    background: rgba(248, 250, 252, 0.88);
    border: 1px dashed rgba(148, 163, 184, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-input {
    height: 2.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    font-size: 0.875rem;
    color: var(--foreground);
    outline: none;
}

.date-input:focus {
    border-color: var(--foreground);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.filter-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-chip,
.advanced-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.75rem;
    color: var(--foreground);
}

.filter-chip button,
.advanced-filter-tag button {
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    font-size: 0.95rem;
}

.filter-chip button:hover,
.advanced-filter-tag button:hover {
    color: var(--error);
}

.advanced-filters {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.advanced-filter-builder {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(140px, 180px) minmax(180px, 1fr) auto;
    gap: 0.625rem;
    align-items: center;
}

.advanced-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.column-filters {
    margin-bottom: 1rem;
}

.column-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.625rem;
}

.column-filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
}

.column-filter-label {
    font-size: 0.72rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.column-filter-control {
    width: 100%;
}

.column-filter-item-range {
    min-width: 260px;
    grid-column: span 2;
}

.range-filter {
    position: relative;
}

.range-filter-trigger {
    width: 100%;
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    background: var(--card);
    color: var(--foreground);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.range-filter-trigger:hover,
.range-filter.open .range-filter-trigger {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
    background: rgba(255, 255, 255, 0.98);
}

.range-filter-trigger-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 300;
    text-align: left;
}

.range-filter-trigger-chevron {
    width: 0.8rem;
    height: 0.8rem;
    border-right: 2px solid var(--muted-foreground);
    border-bottom: 2px solid var(--muted-foreground);
    transform: rotate(45deg) translateY(-1px);
    transition: transform 0.18s ease;
    flex-shrink: 0;
}

.range-filter.open .range-filter-trigger-chevron {
    transform: rotate(225deg) translateY(-1px);
}

.range-filter-panel {
    position: absolute;
    top: calc(100% + 0.45rem);
    left: 0;
    z-index: 30;
    width: min(420px, 92vw);
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--card);
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16);
    display: none;
}

.range-filter.open .range-filter-panel {
    display: block;
}

.range-filter-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.range-filter-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--foreground);
}

.range-filter-clear {
    background: none;
    border: none;
    color: #2563eb;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.range-filter-chart-wrap {
    padding: 0.35rem 0.1rem 0.25rem;
}

.range-filter-bars {
    height: 82px;
    display: grid;
    grid-template-columns: repeat(24, minmax(0, 1fr));
    align-items: end;
    gap: 0.16rem;
    margin-bottom: 0.4rem;
}

.range-filter-bar {
    display: block;
    width: 100%;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    opacity: 0.95;
}

.range-filter-slider {
    position: relative;
    height: 28px;
    margin-bottom: 0.3rem;
}

.range-filter-track,
.range-filter-selection {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 0.42rem;
    border-radius: 999px;
}

.range-filter-track {
    left: 0;
    right: 0;
    background: #dbeafe;
}

.range-filter-selection {
    background: linear-gradient(90deg, #2563eb, #1d4ed8);
}

.range-filter-range {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 34px;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    background: none;
    pointer-events: none;
    z-index: 2;
}

.range-filter-range-min {
    z-index: 3;
}

.range-filter-range.is-active {
    z-index: 5;
}

.range-filter-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 1.18rem;
    height: 1.18rem;
    border-radius: 999px;
    background: #ffffff;
    border: 3px solid #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
    pointer-events: auto;
    cursor: pointer;
}

.range-filter-range::-moz-range-thumb {
    width: 1.18rem;
    height: 1.18rem;
    border-radius: 999px;
    background: #ffffff;
    border: 3px solid #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
    pointer-events: auto;
    cursor: pointer;
}

.range-filter-range::-webkit-slider-runnable-track,
.range-filter-range::-moz-range-track {
    background: transparent;
    border: none;
}

.range-filter-scale {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--muted-foreground);
    font-weight: 600;
}

.range-filter-manual {
    margin-top: 0.95rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.65rem;
    align-items: end;
}

.range-filter-manual-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.range-filter-manual-item label {
    font-size: 0.76rem;
    color: var(--muted-foreground);
    font-weight: 700;
}

.range-filter-manual-separator {
    padding-bottom: 0.7rem;
    color: var(--muted-foreground);
    font-weight: 700;
}

.column-filter-actions {
    margin-top: 0.6rem;
    display: flex;
    justify-content: flex-end;
}

.table-wrapper {
    background: var(--card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.table-wrapper .data-table {
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    position: sticky;
    top: 0;
    white-space: nowrap;
    text-align: center;
    padding: 0.7rem 0.8rem;
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.96), rgba(248, 250, 252, 0.98));
    border-bottom: 1px solid #d7dee8;
    border-right: 1px solid rgba(203, 213, 225, 0.75);
    color: var(--muted-foreground);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.data-table td {
    text-align: center;
    vertical-align: middle;
    padding: 0.68rem 0.78rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    border-right: 1px solid rgba(226, 232, 240, 0.8);
    background: rgba(255, 255, 255, 0.98);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.data-table th.align-flow-col,
.data-table td[data-label="Client"],
.data-table td[data-label="Contractor"],
.data-table td[data-label="Project Address"],
.data-table td[data-label="Division"],
.data-table td[data-label="Amount"] {
    text-align: left;
}

.data-table th:last-child,
.data-table td:last-child {
    border-right: none;
}

.data-table tbody tr:hover td {
    background: rgba(248, 250, 252, 0.98);
}

.data-table td.address-cell,
.data-table td[data-label*="Address"],
.data-table td[data-label*="address"] {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    max-width: 360px;
    line-height: 1.3;
    text-transform: uppercase;
}

.data-table td[data-label="Actions"] {
    max-width: none;
    overflow: visible;
}

.action-btns {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Base button styles */
.btn {
    padding: 0.3rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    appearance: none;
    font-family: inherit;
    line-height: 1.2;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.28rem 0.5rem;
    font-size: 0.7rem;
}

/* Action-btn: mismo estilo que .btn */
.action-btn {
    padding: 0.3rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--foreground);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    appearance: none;
    font-family: inherit;
    line-height: 1.2;
    white-space: nowrap;
}

.btn:hover,
.action-btn:hover {
    background: var(--muted);
    border-color: #cbd5e1;
}

.btn-primary,
.action-btn.primary {
    background: var(--foreground);
    color: var(--primary-foreground);
    border: none;
}

.btn-primary:hover,
.action-btn.primary:hover {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

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

.btn-danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

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

.action-btn svg {
    width: 14px;
    height: 14px;
}

.btn svg,
.action-btn svg {
    width: 14px;
    height: 14px;
}

.add-action-btn {
    justify-content: center;
}

.add-action-btn svg {
    width: 14px;
    height: 14px;
}

.btn svg {
    width: 14px;
    height: 14px;
}

.status-badge {
    display: inline-flex;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    white-space: nowrap;
}

.status-presented {
    background: #dbeafe;
    color: #2563eb;
}

.status-jobcreated {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-inreviewbycustomer {
    background: #fef3c7;
    color: #b45309;
}

.status-negotiating {
    background: #ede9fe;
    color: #6d28d9;
}

.status-awarded {
    background: #dcfce7;
    color: #16a34a;
}

.status-denied {
    background: #fee2e2;
    color: #b91c1c;
}

.amount-cell {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    font-weight: 600;
    color: var(--foreground);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--muted-foreground);
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--muted-foreground);
    font-size: 0.9rem;
}

.kpi-section {
    margin-bottom: 2rem;
}

.kpi-title {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.875rem;
}

.kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.kpi-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-foreground);
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.kpi-value {
    font-size: 1.25rem;
    line-height: 1.2;
    font-weight: 700;
    color: var(--foreground);
}

.kpi-subtext {
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.chart-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    padding: 0.9rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.chart-head {
    margin-bottom: 0.7rem;
}

.chart-title {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    text-align: center;
}

.chart-subtitle {
    margin-top: 0.3rem;
    font-size: 0.76rem;
    color: var(--muted-foreground);
    text-align: center;
}

.chart-canvas-wrap {
    position: relative;
    height: 260px;
}

/* Shared bid/detail/history modal */
#bidModal .modal,
#historyModal .modal {
    background: var(--card);
    border-radius: 1rem;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
}

#bidModal .modal {
    max-width: 1100px;
}

#historyModal .modal {
    max-width: 600px;
}

#modalContent {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
}

.modal-body {
    display: flex;
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.5rem;
}

.modal-sidebar {
    width: 380px;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--muted);
    border-radius: 0 1rem 1rem 0;
    border: 1px solid var(--border);
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
}

.modal-sidebar-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--foreground) 0%, rgba(15, 23, 42, 0.85) 100%);
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-foreground);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.sidebar-title svg {
    width: 18px;
    height: 18px;
    color: var(--primary-foreground);
    opacity: 0.9;
}

.sidebar-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

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

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

.modal-main::-webkit-scrollbar {
    width: 8px;
}

.modal-main::-webkit-scrollbar-track {
    background: var(--muted);
    border-radius: 4px;
}

.modal-main::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.modal-main::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

#bidModal .modal-header,
#historyModal .modal-header,
#editBidModal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

#bidModal .modal-title,
#historyModal .modal-title,
#editBidModal .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
}

#bidModal .modal-close,
#historyModal .modal-close,
#editBidModal .modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

#bidModal .modal-close:hover,
#historyModal .modal-close:hover,
#editBidModal .modal-close:hover {
    background: var(--muted);
    color: var(--foreground);
}

.history-timeline {
    padding: 0.15rem 0 0.15rem 0.2rem;
}

.history-item {
    position: relative;
    padding: 0.8rem 0.9rem 0.8rem 2.55rem;
    margin-bottom: 0.6rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
    border-radius: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    transition: all 0.18s ease;
    animation: fadeInHistory 0.3s ease-out;
}

.history-item:hover {
    border-color: rgba(148, 163, 184, 0.32);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    transform: translateY(-1px);
}

@keyframes fadeInHistory {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-item::before {
    content: '';
    position: absolute;
    left: 0.95rem;
    top: 1rem;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--foreground);
    border: 2.5px solid var(--card);
    box-shadow: 0 0 0 2px var(--border);
    z-index: 1;
}

.history-flow-line {
    position: absolute;
    left: 1.18rem;
    top: 1.65rem;
    bottom: -0.8rem;
    width: 2px;
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.45), rgba(226, 232, 240, 0.12));
}

.history-item:last-child .history-flow-line {
    display: none;
}

.history-item.admin-change::before {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    box-shadow: 0 0 0 2px var(--card), 0 0 0 4px rgba(139, 92, 246, 0.2);
}

.history-item.estimator-change::before {
    background: linear-gradient(135deg, #10b981, #34d399);
    box-shadow: 0 0 0 2px var(--card), 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.45rem;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.history-header-main {
    display: flex;
    align-items: center;
    gap: 0.42rem;
    flex-wrap: wrap;
}

.history-step-label {
    display: inline-flex;
    align-items: center;
    padding: 0.24rem 0.5rem;
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--foreground);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.history-user {
    font-weight: 600;
    color: var(--foreground);
    font-size: 0.76rem;
    letter-spacing: 0.01em;
}

.history-role {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    margin-left: 0.375rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.history-role.admin {
    background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
    color: #9333ea;
    border: 1px solid rgba(147, 51, 234, 0.1);
}

.history-role.estimator {
    background: linear-gradient(135deg, #dcfce7, #d1fae5);
    color: #16a34a;
    border: 1px solid rgba(22, 163, 74, 0.1);
}

.history-date {
    font-size: 0.68rem;
    color: var(--muted-foreground);
    font-weight: 500;
}

.history-mini-note {
    font-size: 0.7rem;
    color: var(--muted-foreground);
    margin-bottom: 0.45rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-flowchart {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.history-flow-box {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.45rem 0.7rem;
    border-radius: 0.7rem;
    border: 1px solid var(--border);
    background: var(--card);
    font-size: 0.82rem;
    line-height: 1.25;
    max-width: min(280px, 100%);
    word-break: break-word;
}

.history-flow-box-old {
    color: #b45309;
    background: linear-gradient(180deg, rgba(254, 243, 199, 0.72), rgba(255, 251, 235, 0.96));
    border-color: rgba(245, 158, 11, 0.22);
}

.history-flow-box-new {
    color: #166534;
    background: linear-gradient(180deg, rgba(220, 252, 231, 0.75), rgba(240, 253, 244, 0.96));
    border-color: rgba(34, 197, 94, 0.22);
}

.history-flow-arrow {
    position: relative;
    width: 1.6rem;
    height: 1px;
    background: rgba(100, 116, 139, 0.5);
    flex-shrink: 0;
}

.history-flow-arrow::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    width: 0.48rem;
    height: 0.48rem;
    border-top: 2px solid rgba(100, 116, 139, 0.72);
    border-right: 2px solid rgba(100, 116, 139, 0.72);
    transform: translateY(-50%) rotate(45deg);
}

.history-old {
    color: inherit;
    text-decoration: none;
    opacity: 1;
    font-weight: 500;
}

.history-new {
    color: inherit;
    font-weight: 600;
}

.history-arrow {
    display: none;
}

.edit-bid-button {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1.5rem;
    background: var(--foreground);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.edit-bid-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
    background: var(--foreground);
}

.edit-bid-button:active {
    transform: translateY(0);
}

.edit-bid-button svg {
    width: 18px;
    height: 18px;
}

/* Shared workflow forms (status / follow-up / phase edit) */
.workflow-form {
    padding: 1.25rem 1.5rem 1.5rem;
}

.workflow-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

.workflow-grid.full {
    grid-column: 1 / -1;
}

.workflow-group.full {
    grid-column: 1 / -1;
}

.workflow-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--muted-foreground);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.workflow-group input,
.workflow-group select,
.workflow-group textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.55rem 0.7rem;
    font-size: 0.88rem;
    background: var(--card);
    color: var(--foreground);
}

.workflow-group input[readonly] {
    background: var(--muted);
}

.workflow-group textarea {
    min-height: 86px;
    resize: vertical;
}

.workflow-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    margin-top: 1rem;
}

#estimatorProfileModal .modal {
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.2rem;
    width: 100%;
    max-width: 1120px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.estimator-profile-content {
    padding-top: 0.5rem;
}

.estimator-profile-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.estimator-profile-shell.pdf-export-mode {
    background: #ffffff;
    padding: 0.25rem;
}

.estimator-profile-shell.pdf-export-mode .estimator-profile-toolbar-actions .btn,
.estimator-profile-shell.pdf-export-mode .estimator-history-hint {
    display: none !important;
}

.estimator-profile-shell.pdf-export-mode .estimator-profile-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.estimator-profile-shell.pdf-export-mode .estimator-profile-coverage-grid,
.estimator-profile-shell.pdf-export-mode .estimator-pipeline-grid,
.estimator-profile-shell.pdf-export-mode .estimator-accountability-grid,
.estimator-profile-shell.pdf-export-mode .estimator-kpi-grid {
    gap: 0.75rem;
}

.estimator-profile-shell.pdf-export-mode .estimator-accountability-card,
.estimator-profile-shell.pdf-export-mode .estimator-profile-meta-card,
.estimator-profile-shell.pdf-export-mode .kpi-card {
    padding: 0.8rem 0.9rem;
    min-height: 94px;
}

.estimator-profile-shell.pdf-export-mode .estimator-accountability-value,
.estimator-profile-shell.pdf-export-mode .kpi-value {
    font-size: 1.05rem;
}

.estimator-profile-shell.pdf-export-mode .estimator-accountability-subtext,
.estimator-profile-shell.pdf-export-mode .kpi-subtext {
    font-size: 0.68rem;
}

.estimator-profile-shell.pdf-export-mode .chart-card {
    padding: 0.7rem 0.8rem;
    min-height: 272px;
}

.estimator-profile-shell.pdf-export-mode .chart-canvas-wrap {
    height: 232px !important;
}

.estimator-profile-toolbar {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.8), rgba(255, 255, 255, 0.95));
}

.estimator-profile-filter-grid {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) auto;
    gap: 0.8rem;
    align-items: end;
}

.estimator-profile-date-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.estimator-profile-filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.estimator-profile-filter-item label {
    font-size: 0.76rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.estimator-profile-toolbar-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.estimator-profile-toolbar-note {
    font-size: 0.82rem;
    color: var(--muted-foreground);
}

.is-hidden {
    display: none !important;
}

.estimator-profile-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.1rem 1.15rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.1), transparent 35%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.03), rgba(15, 23, 42, 0.01));
}

.estimator-profile-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.estimator-profile-avatar {
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #334155);
    color: #f8fafc;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.estimator-profile-kicker {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: var(--muted-foreground);
    margin-bottom: 0.25rem;
}

.estimator-profile-meta h4 {
    margin: 0 0 0.25rem;
    font-size: 1.2rem;
    color: var(--foreground);
}

.estimator-profile-meta p {
    margin: 0;
    color: var(--muted-foreground);
    font-size: 0.9rem;
}

.estimator-profile-supervisors {
    min-width: 260px;
}

.estimator-profile-supervisors-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--muted-foreground);
    margin-bottom: 0.45rem;
}

.estimator-profile-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: flex-end;
}

.estimator-profile-chip,
.estimator-profile-empty-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.8);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--foreground);
}

.estimator-profile-empty-chip {
    color: var(--muted-foreground);
}

.estimator-profile-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.estimator-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.75rem;
}

.estimator-section-head h5 {
    margin: 0;
    font-size: 1rem;
    color: var(--foreground);
}

.estimator-section-head p {
    margin: 0.2rem 0 0;
    font-size: 0.84rem;
    color: var(--muted-foreground);
}

.estimator-profile-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

.estimator-profile-meta-card {
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    padding: 0.95rem 1rem;
    background: var(--card);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.estimator-profile-meta-card.success {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), rgba(255, 255, 255, 0.96));
}

.estimator-profile-meta-card.muted {
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.12), rgba(255, 255, 255, 0.96));
}

.estimator-profile-meta-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--muted-foreground);
    margin-bottom: 0.35rem;
}

.estimator-profile-meta-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--foreground);
}

.estimator-profile-coverage-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.estimator-pipeline-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.estimator-weight-note {
    font-size: 0.82rem;
    color: var(--muted-foreground);
    padding: 0 0.15rem;
}

.estimator-breakdown-wrap,
.estimator-history-wrap {
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    overflow: auto;
    background: var(--card);
}

.estimator-history-wrap {
    max-height: 360px;
}

.estimator-breakdown-table,
.estimator-history-table {
    min-width: 880px;
}

.estimator-history-toolbar {
    width: min(100%, 360px);
}

.estimator-history-search {
    width: 100%;
}

.estimator-history-hint {
    font-size: 0.78rem;
    color: var(--muted-foreground);
    margin-top: -0.2rem;
}

.estimator-history-row {
    cursor: pointer;
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.estimator-history-row:hover td {
    background: rgba(59, 130, 246, 0.05);
}

.estimator-history-row:focus-visible {
    outline: none;
}

.estimator-history-row:focus-visible td {
    background: rgba(37, 99, 235, 0.08);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.estimator-accountability-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.estimator-accountability-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.875rem;
    padding: 0.9rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.estimator-accountability-card.tone-accent {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.98));
}

.estimator-accountability-label {
    font-size: 0.78rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.estimator-accountability-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--foreground);
}

.estimator-accountability-subtext {
    font-size: 0.78rem;
    color: var(--muted-foreground);
    margin-top: 0.3rem;
}

.estimator-kpi-grid .kpi-card,
.estimator-kpi-grid .kpi-label,
.estimator-kpi-grid .kpi-value,
.estimator-kpi-grid .kpi-subtext {
    text-align: left;
}

.estimator-profile-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.chart-card.chart-card-wide {
    grid-column: 1 / -1;
}

.estimator-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.28rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(255, 255, 255, 0.98));
    color: var(--foreground);
    font-size: 0.78rem;
    font-weight: 700;
    text-underline-offset: 2px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.estimator-link::before {
    content: '';
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #2563eb, #0f766e);
    flex-shrink: 0;
}

.estimator-link::after {
    content: '';
    width: 0.9rem;
    height: 0.9rem;
    flex-shrink: 0;
    background-color: var(--muted-foreground);
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 12c2.761 0 5-2.239 5-5S14.761 2 12 2 7 4.239 7 7s2.239 5 5 5Zm0 2c-4.418 0-8 2.239-8 5v1h16v-1c0-2.761-3.582-5-8-5Z'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 12c2.761 0 5-2.239 5-5S14.761 2 12 2 7 4.239 7 7s2.239 5 5 5Zm0 2c-4.418 0-8 2.239-8 5v1h16v-1c0-2.761-3.582-5-8-5Z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
}

.estimator-link:hover {
    color: var(--foreground);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.12), rgba(255, 255, 255, 1));
    border-color: #93c5fd;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.estimator-link:focus-visible {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.workflow-switch {
    display: inline-flex;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.workflow-switch .btn.active {
    background: var(--foreground);
    color: var(--primary-foreground);
}

.workflow-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.file-item,
.workflow-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--card);
    font-size: 0.85rem;
    gap: 0.5rem;
}

.file-item span,
.workflow-file-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
    background: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-zone.drag {
    border-color: var(--foreground);
    background: var(--border);
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    justify-content: center;
    align-items: stretch;
}

/* Desktop: botones en columnas verticales por tipo */
@media (min-width: 769px) {
    .action-row {
        flex-direction: column;
        gap: 0.25rem;
        align-items: stretch;
    }

    .action-row > .btn,
    .action-row > .action-btn {
        width: 100%;
        padding: 0.28rem 0.5rem;
        font-size: 0.7rem;
        min-width: auto;
        max-width: none;
        justify-content: center;
        white-space: nowrap;
    }

    /* Botones primarios primero */
    .action-row > .btn-primary,
    .action-row > .action-btn.primary {
        order: 1;
    }

    /* Botones secundarios */
    .action-row > .btn-secondary,
    .action-row > .action-btn:not(.primary):not(.btn-danger) {
        order: 2;
    }

    /* Botones de danger al final */
    .action-row > .btn-danger,
    .action-row > .action-btn[onclick*="Delete"] {
        order: 99;
    }
}

/* Shared edit bid modal layout */
.edit-form {
    padding: 1.5rem;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
}

.edit-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.edit-form-group {
    margin-bottom: 1rem;
}

.edit-form-group.full-width {
    grid-column: 1 / -1;
}

.edit-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.edit-form-input {
    width: 100%;
    height: 2.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s ease;
}

.edit-form-input:focus {
    border-color: var(--foreground);
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.edit-form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--card);
    flex-shrink: 0;
}

#editBidModal {
    align-items: center;
    padding: 0.75rem;
}

#editBidModal .modal {
    width: 100%;
    max-width: 900px !important;
    max-height: calc(100vh - var(--navbar-height, 5rem) - 1.25rem - env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - var(--navbar-height, 5rem) - 1.25rem - env(safe-area-inset-top, 0px));
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
}

#editBidContent {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

#editBidForm {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

#editBidModal .edit-form {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 1.5rem;
}

#editBidModal .edit-form-actions {
    border-top: 1px solid var(--border);
    background: var(--card);
    padding: 1rem 1.5rem calc(1rem + env(safe-area-inset-bottom, 0px));
    position: sticky;
    bottom: 0;
    z-index: 2;
}

#historyModal .modal {
    overflow: hidden;
}

@media (max-width: 768px) {
    .table-wrapper {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    .table-wrapper .data-table {
        min-width: 0 !important;
        width: 100% !important;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
    }

    .filters,
    .filters-bar,
    .action-buttons {
        width: 100%;
    }

    .action-btn {
        justify-content: center;
    }

    /* Mobile/tablets: action-row horizontal */
    .action-row {
        flex-direction: row !important;
        gap: 0.25rem;
        justify-content: center;
    }

    .action-row > .btn,
    .action-row > .action-btn {
        padding: 0.25rem 0.45rem;
        font-size: 0.68rem;
        max-width: 7rem;
        width: auto !important;
    }

    .advanced-filter-builder {
        grid-template-columns: 1fr;
    }

    .filter-select {
        width: 100%;
    }

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

    .estimator-profile-summary-grid,
    .estimator-profile-coverage-grid,
    .estimator-pipeline-grid,
    .estimator-accountability-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .data-table td {
        max-width: none !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .data-table td.address-cell,
    .data-table td[data-label*="Address"],
    .data-table td[data-label*="address"] {
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .modal-body {
        flex-direction: column;
    }

    .modal-main {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 50vh;
    }

    .modal-sidebar {
        width: 100%;
        max-height: 40vh;
        border-radius: 0 0 1rem 1rem;
    }

    .edit-form-grid {
        grid-template-columns: 1fr;
    }

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

    /* Mobile pequeño: mantener horizontal */
    .action-row {
        flex-direction: row !important;
        gap: 0.2rem;
        justify-content: center;
    }

    .action-row > .action-btn,
    .action-row > .btn {
        padding: 0.22rem 0.4rem;
        font-size: 0.65rem;
        max-width: 6rem;
        width: auto !important;
    }

    .estimator-profile-hero,
    .estimator-profile-identity,
    .estimator-section-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .estimator-profile-supervisors {
        min-width: 0;
        width: 100%;
    }

    .estimator-profile-filter-grid,
    .estimator-profile-date-grid {
        grid-template-columns: 1fr;
    }

    .column-filter-item-range {
        grid-column: span 1;
    }

    .estimator-profile-chip-row {
        justify-content: flex-start;
    }

    .estimator-profile-summary-grid,
    .estimator-profile-coverage-grid,
    .estimator-pipeline-grid,
    .estimator-accountability-grid,
    .estimator-profile-chart-grid {
        grid-template-columns: 1fr;
    }

    #editBidModal {
        padding: 0.5rem;
    }

    #editBidModal .modal {
        max-height: calc(100vh - 1rem);
    }

    #editBidModal .edit-form-actions {
        padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
        flex-wrap: wrap;
        justify-content: stretch;
    }

    #editBidModal .edit-form-actions .btn {
        flex: 1 1 calc(50% - 0.375rem);
    }
}

@media (max-width: 480px) {
    /* Mobile muy pequeño: mantener horizontal */
    .action-row {
        flex-direction: row !important;
        gap: 0.15rem;
        justify-content: center;
    }

    .action-row > .action-btn,
    .action-row > .btn,
    .action-row > .btn-sm {
        padding: 0.2rem 0.35rem;
        font-size: 0.62rem;
        max-width: 5.5rem;
        min-width: auto;
        width: auto !important;
    }

    .btn:not(.action-row > .btn),
    .action-btn:not(.action-row > .action-btn) {
        padding: 0.25rem 0.45rem;
        font-size: 0.68rem;
    }

    .action-btns {
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .add-action-btn {
        font-size: 0.65rem;
        padding: 0.25rem 0.45rem;
    }
}

@media print {
    body.print-estimator-profile * {
        visibility: hidden !important;
    }

    body.print-estimator-profile #estimatorProfileModal,
    body.print-estimator-profile #estimatorProfileModal * {
        visibility: visible !important;
    }

    body.print-estimator-profile #estimatorProfileModal {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        display: block !important;
        background: #ffffff !important;
        inset: 0 !important;
        padding: 0 !important;
    }

    body.print-estimator-profile #estimatorProfileModal .modal {
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        max-width: none !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
    }

    body.print-estimator-profile #estimatorProfileModal .modal-header {
        display: none !important;
    }

    body.print-estimator-profile #estimatorProfileContent {
        padding: 0 !important;
    }

    body.print-estimator-profile #estimatorProfileContent .btn,
    body.print-estimator-profile #estimatorProfileContent .modal-close,
    body.print-estimator-profile #estimatorProfileContent .estimator-history-hint {
        display: none !important;
    }

    body.print-estimator-profile #estimatorProfileContent .chart-card,
    body.print-estimator-profile #estimatorProfileContent .estimator-profile-meta-card,
    body.print-estimator-profile #estimatorProfileContent .estimator-accountability-card,
    body.print-estimator-profile #estimatorProfileContent .kpi-card,
    body.print-estimator-profile #estimatorProfileContent .estimator-breakdown-wrap,
    body.print-estimator-profile #estimatorProfileContent .estimator-history-wrap,
    body.print-estimator-profile #estimatorProfileContent .estimator-profile-toolbar,
    body.print-estimator-profile #estimatorProfileContent .estimator-profile-hero {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

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