* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --primary-light: #34495e;
    --secondary-color: #3498db;
    --background: #f5f7fa;
    --surface: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border: #dfe6e9;
    --success: #27ae60;
    --error: #e74c3c;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-lg: rgba(0, 0, 0, 0.12);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    margin-bottom: 40px;
    padding: 30px 40px;
    background: var(--surface);
    border-radius: 2px;
    box-shadow: 0 1px 3px var(--shadow);
    border-left: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-title {
    text-align: left;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: var(--background);
    border-radius: 2px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.user-info svg {
    display: none;
}

#usernameDisplay {
    font-weight: 500;
    color: var(--text-primary);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout svg {
    display: none;
}

.btn-logout:hover {
    background: var(--background);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Dropdown Section */
.dropdown-section {
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0;
}

.dropdown-header label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

#resultsCount {
    font-weight: 600;
    color: var(--primary-color);
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.dropdown-selected:hover {
    border-color: var(--text-secondary);
}

.dropdown-selected.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.dropdown-selected .placeholder {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.dropdown-selected .selected-text {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.dropdown-selected.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    box-shadow: 0 4px 12px var(--shadow-lg);
    z-index: 1000;
    max-height: 500px;
    display: flex;
    flex-direction: column;
}

/* Dropdown Search */
.dropdown-search {
    position: relative;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    background: var(--background);
}

.search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    pointer-events: none;
}

.dropdown-search #searchInput {
    width: 100%;
    padding: 8px 36px 8px 36px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface);
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.dropdown-search #searchInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.clear-btn {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    color: var(--text-secondary);
}

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

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

/* Dropdown List */
.dropdown-list {
    overflow-y: auto;
    max-height: 400px;
    padding: 4px;
}

.dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}

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

.dropdown-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Dropdown Item */
.dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 2px;
}

.dropdown-item:hover {
    background: var(--background);
}

.dropdown-item:active {
    background: rgba(52, 152, 219, 0.1);
}

.dropdown-item-icon {
    display: none;
}

.dropdown-item-content {
    flex: 1;
}

.dropdown-item-code {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 2px;
}

.dropdown-item-name {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 400;
    line-height: 1.4;
}

/* No Results in Dropdown */
.no-results-dropdown {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-results-dropdown svg {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    opacity: 0.3;
}

.no-results-dropdown p {
    font-size: 0.875rem;
}

/* Selected Product Card */
.selected-product {
    margin-top: 30px;
    background: var(--surface);
    border-radius: 2px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.selected-product-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.selected-product-icon {
    display: none;
}

.selected-product-title {
    flex: 1;
}

.selected-product-code {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 4px;
}

.selected-product-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.selected-product-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.product-plan {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--background);
    color: var(--text-primary);
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border);
}

.product-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }

    header {
        padding: 20px 16px;
        margin-bottom: 30px;
        gap: 16px;
        flex-wrap: wrap;
    }

    .header-content {
        flex: 1;
        min-width: 200px;
    }

    .header-title {
        width: 100%;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
        gap: 8px !important;
    }

    header h1 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.8125rem;
    }

    .dropdown-section {
        max-width: 100%;
    }

    .dropdown-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .selected-product {
        padding: 20px;
    }

    .selected-product-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .patient-info-section {
        margin-left: 0;
        margin-right: 0;
    }

    .products-table-section {
        margin-left: 0;
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px 10px;
    }

    header {
        padding: 16px;
    }

    header h1 {
        font-size: 1.125rem;
    }

    .subtitle {
        font-size: 0.8125rem;
    }

    .user-info,
    .btn-logout {
        font-size: 0.8125rem;
        padding: 6px 10px;
    }

    .sedena-orders-section,
    .products-table-section {
        padding: 12px;
        border-radius: 0;
        margin-left: -10px;
        margin-right: -10px;
        width: calc(100% + 20px);
    }

    .sedena-order-field {
        font-size: 0.8125rem;
    }

    .btn-create-planning,
    .btn-request-collection {
        padding: 10px 16px;
        font-size: 0.8125rem;
    }

    .table-container {
        margin: 0 -12px;
        padding: 0 12px;
    }
}

/* Action Section */
.action-section {
    max-width: 800px;
    margin: 30px auto;
    text-align: center;
}

.btn-primary {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Products Table Section */
.products-table-section {
    max-width: 1000px;
    margin: 0 auto 30px;
    background: var(--surface);
    border-radius: 2px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
    overflow: visible;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.table-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.table-container {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
}

.products-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    overflow: visible;
    table-layout: auto;
}

.products-table thead {
    background: var(--background);
}

.products-table th {
    padding: 8px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}

/* Columna de Producto (index.html - primera columna) */
.products-table th:first-child:not(:has(input[type="checkbox"])),
.products-table td:first-child:not(:has(input[type="checkbox"])) {
    min-width: 80px;
    width: 25%;
    padding-right: 4px;
}

/* Columna de checkbox (order.html) */
.products-table th:has(input[type="checkbox"]),
.products-table td:has(input[type="checkbox"]) {
    width: 40px;
    min-width: 40px;
    text-align: center;
}

/* Columna de Producto (order.html - segunda columna cuando hay checkbox) */
.products-table th:nth-child(2):not(:has(input[type="checkbox"])),
.products-table td:nth-child(2):not(:has(input[type="checkbox"])) {
    min-width: 80px;
    width: 25%;
    padding-right: 4px;
}

/* Columna de Unidades */
.products-table th:nth-child(2),
.products-table td:nth-child(2),
.products-table th:nth-child(3),
.products-table td:nth-child(3) {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
}

/* Columna de Dientes */
.products-table th:nth-child(3),
.products-table td:nth-child(3),
.products-table th:nth-child(4),
.products-table td:nth-child(4) {
    min-width: 200px;
    width: 25%;
    padding-left: 4px;
    vertical-align: middle;
}

.products-table td:nth-child(3) > div,
.products-table td:nth-child(4) > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

/* Contenedor de celda de dientes */
.teeth-cell-container {
    display: flex !important;
    flex-direction: row !important;
    gap: 4px !important;
    width: 100% !important;
    align-items: center !important;
}

/* Columna de Colores */
.products-table th:nth-child(4),
.products-table td:nth-child(4),
.products-table th:nth-child(5),
.products-table td:nth-child(5) {
    min-width: 120px;
    width: 15%;
    vertical-align: middle;
}

/* Columna de Acciones */
.products-table th:last-child,
.products-table td:last-child {
    min-width: 100px;
    width: 10%;
    text-align: center;
    vertical-align: middle;
}

.products-table th input[type="checkbox"],
.products-table td input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.products-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

/* Asegurar alineación vertical en celdas específicas */
.products-table td:nth-child(3),
.products-table td:nth-child(4),
.products-table td:nth-child(5),
.products-table td:nth-child(6) {
    vertical-align: middle !important;
}

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

.products-table tbody tr {
    overflow: visible;
}

.products-table tbody tr:hover {
    background: var(--background);
}

/* Table Select with Search */
.products-table td {
    overflow: visible;
}

.custom-select-wrapper {
    position: relative;
    width: 100%;
    overflow: visible;
}

.custom-select-trigger {
    width: 100%;
    padding: 8px 30px 8px 10px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.custom-select-trigger:hover {
    border-color: var(--text-secondary);
}

.custom-select-trigger.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.custom-select-trigger .placeholder {
    color: var(--text-secondary);
}

.custom-select-trigger .arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-secondary);
    transition: transform 0.2s ease;
    pointer-events: none;
}

.custom-select-trigger.active .arrow {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-dropdown {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 2px;
    box-shadow: 0 4px 12px var(--shadow-lg);
    z-index: 1001;
    max-height: 300px;
    display: none;
    flex-direction: column;
}

.custom-select-dropdown.active {
    display: flex;
}

.custom-select-search {
    padding: 8px;
    border-bottom: 1px solid var(--border);
}

.custom-select-search input {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    outline: none;
    font-family: inherit;
}

.custom-select-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.custom-select-options {
    overflow-y: auto;
    max-height: 240px;
}

.custom-select-options::-webkit-scrollbar {
    width: 6px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.custom-select-option {
    padding: 8px 10px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.custom-select-option:hover {
    background: var(--background);
}

.custom-select-option.selected {
    background: rgba(44, 62, 80, 0.1);
    font-weight: 500;
}

.custom-select-option.no-results {
    color: var(--text-secondary);
    text-align: center;
    cursor: default;
    padding: 16px;
}

.custom-select-option.no-results:hover {
    background: transparent;
}

/* Table Input */
.table-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    vertical-align: middle;
    height: 34px;
    box-sizing: border-box;
}

.table-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.table-input[type="number"] {
    text-align: center;
}

/* Small Table Input (for units field) */
.table-input-small {
    width: 60px !important;
    min-width: 60px;
    max-width: 60px;
    text-align: center;
    padding: 8px 5px;
}

/* Teeth Input - Asegurar visibilidad */
.teeth-input {
    min-width: 80px !important;
    flex: 1 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
}

/* Botón de Odontograma */
.btn-open-odontogram {
    padding: 5px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    transition: all 0.2s;
    position: relative !important;
    margin: 0 !important;
    flex-shrink: 0;
    box-sizing: border-box;
}

.btn-open-odontogram svg {
    display: block;
    flex-shrink: 0;
}

.btn-open-odontogram:hover:not(:disabled) {
    background: #34495e;
    transform: scale(1.05);
}

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

/* Delete Button */
.btn-delete {
    padding: 6px 12px;
    background: transparent;
    color: var(--error);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 2px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.btn-delete:hover {
    background: rgba(231, 76, 60, 0.1);
    border-color: var(--error);
}

/* Add Row Button */
.btn-add-row {
    width: 100%;
    padding: 10px;
    margin-top: 16px;
    background: transparent;
    color: var(--primary-color);
    border: 1px dashed var(--border);
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-row svg {
    width: 16px;
    height: 16px;
}

.btn-add-row:hover {
    background: rgba(44, 62, 80, 0.05);
    border-color: var(--primary-color);
    border-style: solid;
}

/* Tests Section */
.tests-section {
    max-width: 1000px;
    margin: 0 auto 30px;
    background: var(--surface);
    border-radius: 2px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.tests-selector {
    display: block;
}

.tests-input-group {
    display: block;
    margin-bottom: 20px;
}

.tests-input-group select {
    width: 100%;
    margin-bottom: 16px;
}

.btn-add-test {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--primary-color);
    border: 1px dashed var(--border);
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-test svg {
    width: 16px;
    height: 16px;
}

.btn-add-test:hover {
    background: rgba(44, 62, 80, 0.05);
    border-color: var(--primary-color);
    border-style: solid;
}

.tests-list {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 16px;
}

.tests-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.tests-list-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
}

.btn-clear-tests {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-clear-tests:hover {
    background: var(--danger);
    color: white;
}

.tests-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.test-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 2px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.test-item:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.test-item:last-child {
    margin-bottom: 0;
}

.test-item-content {
    flex: 1;
}

.test-item-number {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 12px;
}

.test-item-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.btn-remove-test {
    padding: 6px 10px;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-remove-test:hover {
    background: var(--danger);
    color: white;
}

@media (max-width: 768px) {
    .tests-list-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .btn-clear-tests {
        width: 100%;
        justify-content: center;
    }
}

/* Waiting for Model Section */
.waiting-model-section {
    max-width: 1000px;
    margin: 0 auto 30px;
}

.waiting-model-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    gap: 24px;
}

.waiting-model-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waiting-model-icon svg {
    width: 36px;
    height: 36px;
    color: white;
}

.waiting-model-content {
    flex: 1;
    color: white;
}

.waiting-model-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: white;
}

.waiting-model-content p {
    font-size: 1rem;
    margin: 0 0 20px 0;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

.btn-collection-guide {
    padding: 12px 24px;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-collection-guide:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    background: #f8f9ff;
}

.btn-collection-guide svg {
    width: 18px;
    height: 18px;
}

/* Responsive para Waiting Model Section */
@media (max-width: 768px) {
    .waiting-model-banner {
        flex-direction: column;
        text-align: center;
        padding: 24px 20px;
    }
    
    .waiting-model-content h3 {
        font-size: 1.25rem;
    }
    
    .waiting-model-content p {
        font-size: 0.9375rem;
    }
}

/* Tests Display Section (for order.html) */
.tests-display-section {
    max-width: 1000px;
    margin: 0 auto 30px;
    background: var(--surface);
    border-radius: 2px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.tests-display-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.test-display-item {
    padding: 10px 12px;
    background: var(--background);
    border-left: 3px solid var(--secondary-color);
    border-radius: 2px;
    font-size: 0.875rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.test-display-item .btn-request-collection {
    margin-left: auto;
    padding: 8px 16px;
    font-size: 0.875rem;
    white-space: nowrap;
}

/* Test Selector Section */
.tests-selector-section {
    background: white;
    border-radius: 2px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tests-selector-section .section-header {
    margin-bottom: 20px;
}

.tests-selector-section .section-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.tests-selector-section .section-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Phase Options (similar to triage) */
.phase-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.phase-option {
    padding: 16px 12px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: var(--background);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.phase-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.phase-option.selected {
    border-width: 2px;
    transform: scale(1.02);
}

.phase-option.accepted.selected {
    border-color: var(--success-color);
    background: rgba(46, 204, 113, 0.1);
    color: var(--success-color);
}

.phase-option.incident.selected {
    border-color: var(--warning-color);
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning-color);
}

.phase-option svg {
    flex-shrink: 0;
}

/* Responsive Phase Options */
@media (max-width: 768px) {
    .phase-options {
        grid-template-columns: 1fr;
    }
}

.btn-qualify-phase {
    margin-left: auto;
    padding: 8px 16px;
    font-size: 0.875rem;
    white-space: nowrap;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    background: var(--primary-color);
    color: white;
}

.btn-qualify-phase:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

/* Botón Nueva Prueba - estilo igual a Agregar Producto */
.btn-new-phase {
    width: 100%;
    padding: 10px;
    margin-top: 16px;
    background: transparent;
    color: var(--primary-color);
    border: 1px dashed var(--border);
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-new-phase svg {
    width: 16px;
    height: 16px;
}

.btn-new-phase:hover {
    background: rgba(44, 62, 80, 0.05);
    border-color: var(--primary-color);
    border-style: solid;
}

/* Botón Orden Completa */
.btn-complete-order {
    padding: 10px;
    font-size: 0.875rem;
    white-space: nowrap;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    background: var(--success-color);
    color: white;
    margin-top: 8px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-complete-order svg {
    width: 16px;
    height: 16px;
}

.btn-complete-order:hover {
    background: #27ae60;
    transform: translateY(-1px);
}

/* Dropzone Styles */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: 4px;
    padding: 10px;
    transition: all 0.3s;
    background: var(--background);
}

.dropzone.dragover {
    border-color: var(--primary-color);
    background: rgba(52, 152, 219, 0.05);
}

.dropzone-content {
    padding: 30px;
    text-align: center;
    cursor: pointer;
    color: var(--text-secondary);
}

.dropzone-content svg {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.dropzone-content p {
    margin: 8px 0;
    font-size: 0.9375rem;
    font-weight: 500;
}

.dropzone-hint {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.files-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.file-preview-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface);
}

.file-preview-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.file-preview-item .file-name {
    display: block;
    padding: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--background);
}

.file-preview-item .remove-file {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.file-preview-item .remove-file:hover {
    background: var(--danger-color);
    transform: scale(1.1);
}

.test-display-item svg {
    width: 16px;
    height: 16px;
    color: var(--secondary-color);
    flex-shrink: 0;
}

.test-display-item:nth-child(even) {
    background: rgba(52, 152, 219, 0.05);
}

/* Patient Info Section */
.patient-info-section {
    max-width: 1000px;
    margin: 0 auto 30px;
    background: var(--surface);
    border-radius: 2px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow);
}

.section-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.section-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.patient-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    resize: vertical;
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.form-input:required {
    background-image: none;
}

textarea.form-input {
    min-height: 80px;
    line-height: 1.5;
}

/* Observations Section */
.observations-section {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.observations-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.observations-textarea {
    width: 100%;
    padding: 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.observations-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

/* Table Actions */
.table-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.btn-create-planning {
    padding: 12px 24px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-create-planning svg {
    width: 18px;
    height: 18px;
}

.btn-create-planning:hover:not(:disabled) {
    background: #229954;
    transform: translateY(-1px);
}

.btn-create-planning:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spinner-small {
    width: 16px;
    height: 16px;
    animation: spin 0.8s linear infinite;
}

.spinner-small circle {
    stroke: white;
    stroke-dasharray: 50;
    stroke-dashoffset: 25;
}

/* Responsive Table */
@media (max-width: 768px) {
    .products-table-section {
        padding: 16px;
        margin: 30px 0;
    }

    .sedena-orders-section {
        margin: 0 0 20px 0;
        padding: 16px;
    }

    .sedena-order-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .sedena-order-row {
        flex-direction: column;
        gap: 8px;
    }

    .sedena-order-actions {
        width: 100%;
    }

    .btn-request-collection {
        width: 100%;
        justify-content: center;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .table-header h2 {
        font-size: 1rem;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
    }

    .products-table {
        min-width: 650px;
    }

    .custom-select-dropdown {
        min-width: 300px;
        max-width: 90vw;
    }
}

/* Sedena Orders Section */
.sedena-orders-section {
    max-width: 1000px;
    margin: 0 auto 30px;
    background: var(--surface);
    border-radius: 2px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.section-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sedena-order-card {
    padding: 16px;
    margin-bottom: 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.sedena-order-info {
    flex: 1;
}

.sedena-order-row {
    display: flex;
    gap: 30px;
    margin-bottom: 8px;
}

.sedena-order-row:last-child {
    margin-bottom: 0;
}

.sedena-order-field {
    display: flex;
    gap: 8px;
}

.sedena-order-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sedena-order-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.sedena-order-actions {
    display: flex;
    gap: 10px;
}

.btn-request-collection {
    padding: 8px 16px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-request-collection:hover {
    background: #2980b9;
}

.btn-request-collection:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Approve Order Button */
.btn-approve-order {
    padding: 12px 24px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-approve-order:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-approve-order svg {
    width: 18px;
    height: 18px;
}

.state-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.state-badge.placed {
    background: rgba(241, 196, 15, 0.15);
    color: #f39c12;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.state-badge.pickup {
    background: rgba(39, 174, 96, 0.15);
    color: var(--success);
    border: 1px solid rgba(39, 174, 96, 0.3);
}

.state-badge.waiting-supervisor {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.state-badge.waiting-admin {
    background: rgba(156, 39, 176, 0.15);
    color: #9c27b0;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.state-badge.production {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
    border: 1px solid rgba(52, 152, 219, 0.3);
}

.state-badge.success {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.state-badge.incident {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.state-badge.rejected {
    background: rgba(192, 57, 43, 0.15);
    color: #c0392b;
    border: 1px solid rgba(192, 57, 43, 0.3);
}

.state-badge.waiting {
    background: rgba(241, 196, 15, 0.15);
    color: #f1c40f;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

/* Comments Section Styles */
.comments-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: 100%;
    position: relative;
    z-index: 1;
}

.comments-container {
    margin-bottom: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.comments-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
}

.comments-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.comment-item {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    border-left: 3px solid var(--primary-color);
    transition: all 0.2s ease;
}

.comment-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.comment-item.lab-comment {
    border-left-color: #9c27b0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.comment-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--primary-color);
    color: white;
}

.comment-badge.lab {
    background: #9c27b0;
}

.comment-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.comment-text {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comment-form {
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.comment-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s ease;
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.comment-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.char-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn-send-comment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-send-comment:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

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

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

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

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

/* Patient Info Grid (for order page) */
.patient-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.info-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-display {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    padding: 8px 12px;
    background: var(--background);
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* Loading Spinner */
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Sección de Odontograma */
.odontogram-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.odontogram-section .section-header {
    margin-bottom: 25px;
}

.odontogram-section .section-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.odontogram-section .section-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

/* Contenedor del odontograma integrado */
.odontogram-section .odontogram-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Layout de dos columnas */
.odontogram-layout {
    display: flex !important;
    flex-direction: row !important;
    gap: 30px;
    align-items: flex-start;
    width: 100%;
    min-height: 200px;
}

/* Forzar que el grid funcione */
.odontogram-layout > * {
    min-width: 0;
}

/* Columna del odontograma */
.odontogram-column {
    display: flex !important;
    flex-direction: column;
    flex: 2 !important;
    width: 66% !important;
    overflow: hidden;
}

/* Asegurar que el odontograma respete el contenedor */
.odontogram-column .odontogram-single-line {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    gap: 6px;
    padding: 8px 0;
}

/* Ajustar los cuadrantes para que quepan en la columna */
.odontogram-column .quadrant-section {
    gap: 4px;
}

.odontogram-column .quadrant-label {
    font-size: 0.6rem;
    padding: 2px 4px;
}

.odontogram-column .teeth-row {
    gap: 3px;
}

.odontogram-column .central-separator {
    margin: 0 4px;
    min-width: 20px;
}

.odontogram-column .separator-line {
    height: 15px;
}

.odontogram-column .separator-text {
    font-size: 0.5rem;
}

/* Columna del color */
.color-column {
    display: flex !important;
    flex-direction: column;
    flex: 1 !important;
    width: 33% !important;
    max-width: 33% !important;
}

.color-section {
    background: var(--background);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid var(--border);
    height: fit-content;
}

.color-section h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.color-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.color-input::placeholder {
    color: var(--text-secondary);
}

/* Responsive para sección de odontograma */
@media (max-width: 768px) {
    .odontogram-section {
        padding: 20px;
    }
    
    .odontogram-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .color-section {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .odontogram-layout {
        gap: 15px;
    }
    
    .color-section {
        padding: 12px;
    }
    
    .color-section h3 {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .color-input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

/* Sección del botón Crear Planeación */
.create-planning-section {
    display: flex;
    justify-content: center;
    padding: 30px 0;
    margin-top: 20px;
}

.create-planning-section .btn-create-planning {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.create-planning-section .btn-create-planning:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.create-planning-section .btn-create-planning:active {
    transform: translateY(0);
}

.create-planning-section .btn-create-planning:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.create-planning-section .spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

/* Responsive para botón crear planeación */
@media (max-width: 768px) {
    .create-planning-section {
        padding: 20px 0;
    }
    
    .create-planning-section .btn-create-planning {
        padding: 14px 28px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .create-planning-section .btn-create-planning {
        padding: 12px 24px;
        font-size: 0.95rem;
        width: 100%;
        max-width: 280px;
    }
}

/* Scan Section */
.scan-section {
    max-width: 1000px;
    margin: 0 auto 30px;
    background: var(--surface);
    border-radius: 2px;
    padding: 24px;
    box-shadow: 0 1px 3px var(--shadow);
    border: 1px solid var(--border);
}

.scan-dropzone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--background);
}

.scan-dropzone:hover {
    border-color: var(--primary-color);
    background: rgba(44, 62, 80, 0.02);
}

.scan-dropzone.dragover {
    border-color: var(--secondary-color);
    background: rgba(46, 204, 113, 0.05);
    border-style: solid;
}

.dropzone-content {
    pointer-events: none;
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--text-secondary);
}

.scan-dropzone:hover .dropzone-icon {
    color: var(--primary-color);
}

.scan-dropzone h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.scan-dropzone p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.file-types {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--surface);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.scan-file-preview {
    margin-top: 20px;
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.scan-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.scan-file-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border-radius: 8px;
    color: white;
}

.scan-file-icon svg {
    width: 20px;
    height: 20px;
}

.scan-file-info {
    flex: 1;
    min-width: 0;
}

.scan-file-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-file-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.scan-file-actions {
    display: flex;
    gap: 8px;
}

.btn-remove-scan {
    padding: 8px 16px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-remove-scan:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Responsive Scan Section */
@media (max-width: 768px) {
    .scan-section {
        padding: 20px;
    }

    .scan-dropzone {
        padding: 30px 15px;
    }

    .dropzone-icon {
        width: 40px;
        height: 40px;
    }

    .scan-dropzone h3 {
        font-size: 1rem;
    }

    .scan-file-item {
        flex-direction: column;
        text-align: center;
    }

    .scan-file-actions {
        width: 100%;
    }

    .btn-remove-scan {
        width: 100%;
    }
}

/* Clinics Admin Styles */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 10px 10px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.clinics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.clinic-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.clinic-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-2px);
}

.clinic-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.clinic-card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.clinic-code {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--background);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.clinic-card-body {
    margin-bottom: 16px;
}

.clinic-info-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.clinic-info-item svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.clinic-info-item .label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: block;
}

.clinic-info-item .value {
    font-size: 0.9rem;
    color: var(--text-primary);
    display: block;
}

.clinic-card-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    color: var(--text-primary);
}

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

.btn-icon:hover svg {
    color: white;
}

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

.modal-large {
    max-width: 800px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

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

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: var(--surface);
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

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

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

/* Documents Section */
.documents-section {
    background: var(--surface);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px var(--shadow);
}

.documents-section .section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.documents-section .section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.document-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.document-card:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-2px);
}

.document-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary-color);
    border-radius: 8px;
}

.document-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.document-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-document-action {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--secondary-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.btn-document-action:hover:not(.disabled) {
    background: var(--primary-color);
    transform: scale(1.1);
}

.btn-document-action:active:not(.disabled) {
    transform: scale(0.95);
}

.btn-document-action.disabled {
    background: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

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

/* Responsive Documents Section */
@media (max-width: 768px) {
    .documents-section {
        padding: 20px;
    }

    .documents-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .document-card {
        padding: 14px;
    }

    .document-icon {
        width: 36px;
        height: 36px;
    }

    .document-icon svg {
        width: 20px;
        height: 20px;
    }

    .document-info h3 {
        font-size: 0.9rem;
    }

    .document-info p {
        font-size: 0.75rem;
    }

    .btn-document-action {
        width: 32px;
        height: 32px;
    }

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

/* ============================================ */
/* PÁGINA DE PERFIL */
/* ============================================ */

.page-content {
    padding: 2rem;
    background-color: #f8f9fa;
    min-height: calc(100vh - 80px);
}

.content-section {
    max-width: 800px;
    margin: 0 auto;
}

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

.section-header h2 {
    font-size: 1.75rem;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
}

.section-header p {
    font-size: 1rem;
    color: #6c757d;
    margin: 0;
}

.form-container {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.clinic-form .form-group {
    margin-bottom: 1.5rem;
}

.clinic-form .form-label {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.75rem;
}

.clinic-form .form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    transition: all 0.2s ease;
    background-color: white;
}

.clinic-form .form-input:focus {
    outline: none;
    border-color: #c69749;
    box-shadow: 0 0 0 3px rgba(198, 151, 73, 0.1);
}

.clinic-form .form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
}

.clinic-form .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clinic-form .btn-primary {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
}

.clinic-form .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.3);
}

.clinic-form .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

@media (max-width: 768px) {
    .page-content {
        padding: 1rem;
    }

    .form-container {
        padding: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: var(--primary-color);
    }
}
