#add-plan-modal .modal-content {
    width: min(760px, calc(100vw - 32px));
}

.schedule-planning-grid {
    display: grid;
    grid-template-columns: minmax(280px, 35fr) minmax(0, 65fr);
    gap: 16px;
    align-items: stretch;
}

.schedule-planning-grid > .widget {
    margin: 0;
    min-width: 0;
}

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

.schedule-panel-header h3 {
    margin: 0 0 4px;
    font-size: 14px;
}

.schedule-panel-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 12px;
}

.schedule-assignment-filters,
.schedule-priority-filters {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.schedule-assignment-filters .search-box {
    width: min(210px, 24vw);
}

.schedule-assignment-filters select,
.schedule-priority-filters select {
    min-height: 36px;
    font-size: 11px;
}

.schedule-assignment-table-wrap {
    max-height: 330px;
    overflow: auto;
}

#audit-plan-table {
    table-layout: fixed;
    width: 100%;
}

#audit-plan-table th,
#audit-plan-table td {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.4;
    vertical-align: middle;
}

#audit-plan-table th {
    text-align: center;
    font-weight: 600;
}

#audit-plan-table th:nth-child(1),
#audit-plan-table td:nth-child(1) {
    width: 12%;
}

#audit-plan-table th:nth-child(2),
#audit-plan-table td:nth-child(2) {
    width: 17%;
}

#audit-plan-table th:nth-child(3),
#audit-plan-table td:nth-child(3) {
    width: 21%;
}

#audit-plan-table th:nth-child(4),
#audit-plan-table td:nth-child(4) {
    width: 14%;
}

#audit-plan-table th:nth-child(5),
#audit-plan-table td:nth-child(5) {
    width: 11%;
}

#audit-plan-table th:nth-child(6),
#audit-plan-table td:nth-child(6) {
    width: 8%;
}

#audit-plan-table th:nth-child(7),
#audit-plan-table td:nth-child(7) {
    width: 8%;
}

#audit-plan-table th:nth-child(8),
#audit-plan-table td:nth-child(8) {
    width: 9%;
}

#audit-plan-table td:nth-child(1),
#audit-plan-table td:nth-child(5),
#audit-plan-table td:nth-child(6) {
    text-align: center;
}

#audit-plan-table td:nth-child(1),
#audit-plan-table td:nth-child(2),
#audit-plan-table td:nth-child(5),
#audit-plan-table td:nth-child(6),
#audit-plan-table td:nth-child(7) {
    white-space: nowrap;
}

#audit-plan-table td:nth-child(3),
#audit-plan-table td:nth-child(4) {
    overflow-wrap: anywhere;
}

#audit-plan-table .action-cell-content {
    justify-content: center;
}

#audit-plan-table .btn-icon {
    width: 30px;
    height: 30px;
}

#audit-plan-table .schedule-admin-column {
    display: none;
}

#audit-plan-table.schedule-admin .schedule-admin-column {
    display: table-cell;
}

.schedule-created-by {
    white-space: nowrap;
}

.schedule-assignment-state {
    padding: 28px 12px !important;
    color: var(--text-muted);
    text-align: center;
}

.schedule-assignment-state.is-error {
    color: var(--danger);
}

.assignment-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    white-space: normal;
}

.assignment-status-generating {
    background: #DBEAFE;
    color: #1D4ED8;
}

.assignment-status-generated {
    background: #DCFCE7;
    color: #15803D;
}

.assignment-status-generation-failed {
    background: #FEE2E2;
    color: #B91C1C;
}

.assignment-status-legacy-incomplete {
    background: #FEF3C7;
    color: #92400E;
}

.assignment-status-cancelled {
    background: #E5E7EB;
    color: #4B5563;
}

.assignment-action-buttons {
    display: grid;
    gap: 5px;
}

.assignment-action-buttons .btn {
    min-height: 28px;
    padding: 5px 7px;
    font-size: 10px;
    white-space: normal;
}

.assignment-manage-menu-trigger {
    width: 30px;
    height: 30px;
    min-width: 30px;
    font-size: 17px;
}

.assignment-manage-menu-trigger[aria-expanded="true"] {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-light);
}

.assignment-manage-menu-popover {
    position: fixed;
    z-index: 1200;
    display: grid;
    min-width: 180px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.assignment-manage-menu-popover[hidden] {
    display: none;
}

.assignment-manage-menu-item {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 9px;
    background: transparent;
    color: var(--text-main);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.assignment-manage-menu-item.danger {
    color: var(--danger);
}

.assignment-manage-menu-item:hover,
.assignment-manage-menu-item:focus-visible {
    background: rgba(220, 38, 38, 0.08);
    outline: none;
}

.assignment-cleanup-error {
    color: var(--danger);
    font-size: 10px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.schedule-site-cell strong {
    display: block;
    font-size: 11px;
    color: var(--text-main);
}

.schedule-site-cell span {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schedule-priority-widget {
    margin-top: 16px;
}

.schedule-priority-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.schedule-priority-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.schedule-priority-tab span {
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 999px;
    background: var(--bg-color);
    font-size: 10px;
    text-align: center;
}

.schedule-priority-tab.is-active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.schedule-priority-tab.is-active span {
    background: var(--primary-light);
}

.schedule-priority-filters .search-box {
    width: min(260px, 28vw);
}

#schedule-priority-table {
    table-layout: fixed;
    min-width: 1120px;
}

#schedule-priority-table th,
#schedule-priority-table td {
    padding: 9px 8px;
    font-size: 12px;
    line-height: 1.35;
    vertical-align: middle;
}

#schedule-priority-table th {
    text-align: left;
    font-weight: 600;
}

#schedule-priority-table th:nth-child(1),
#schedule-priority-table td:nth-child(1) { width: 4%; }
#schedule-priority-table th:nth-child(2),
#schedule-priority-table td:nth-child(2) { width: 11%; }
#schedule-priority-table th:nth-child(3),
#schedule-priority-table td:nth-child(3) { width: 20%; }
#schedule-priority-table th:nth-child(4),
#schedule-priority-table td:nth-child(4) { width: 9%; }
#schedule-priority-table th:nth-child(5),
#schedule-priority-table td:nth-child(5) { width: 9%; }
#schedule-priority-table th:nth-child(6),
#schedule-priority-table td:nth-child(6) { width: 9%; }
#schedule-priority-table th:nth-child(7),
#schedule-priority-table td:nth-child(7) { width: 9%; }
#schedule-priority-table th:nth-child(8),
#schedule-priority-table td:nth-child(8) { width: 10%; }
#schedule-priority-table th:nth-child(9),
#schedule-priority-table td:nth-child(9) { width: 11%; }
#schedule-priority-table th:nth-child(10),
#schedule-priority-table td:nth-child(10) { width: 8%; }

#schedule-priority-table td:nth-child(1),
#schedule-priority-table td:nth-child(5),
#schedule-priority-table td:nth-child(6),
#schedule-priority-table td:nth-child(7),
#schedule-priority-table td:nth-child(8),
#schedule-priority-table td:nth-child(10) {
    text-align: center;
}

.schedule-priority-table-wrap {
    max-height: 520px;
    overflow: auto;
}

.schedule-priority-empty {
    padding: 28px 12px !important;
    color: var(--text-muted);
    text-align: center;
}

.schedule-priority-due {
    display: inline-flex;
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.schedule-priority-due.is-overdue {
    background: #FCE7E7;
    color: #B91C1C;
}

.schedule-priority-due.is-due-soon {
    background: #FEF3C7;
    color: #92400E;
}

.schedule-priority-schedule-btn {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 11px;
}

.schedule-priority-scheduled {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

@media (max-width: 1180px) {
    .schedule-planning-grid {
        grid-template-columns: 1fr;
    }

    .schedule-assignment-filters,
    .schedule-priority-header {
        align-items: stretch;
        flex-direction: column;
    }

    .schedule-assignment-filters .search-box,
    .schedule-priority-filters .search-box {
        width: 100%;
    }
}

.assignment-store-wrapper {
    position: relative;
}

.assignment-automatic-number {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-muted);
    font-size: 13px;
}

.assignment-cancel-modal-content {
    width: min(520px, calc(100vw - 32px));
}

.assignment-cancel-warning {
    margin: 0 0 16px;
    padding: 10px 12px;
    border: 1px solid #FCA5A5;
    border-radius: 8px;
    background: #FEF2F2;
    color: #991B1B;
    font-size: 13px;
}

#assignment-cancel-reason {
    width: 100%;
    resize: vertical;
}

.assignment-store-suggestions {
    width: 100%;
    z-index: 120;
}

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

.pic-multiselect {
    position: relative;
}

.pic-multiselect-trigger {
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-main);
    font-family: inherit;
    cursor: pointer;
}

.pic-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.pic-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.pic-chip button {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 14px;
}

.pic-multiselect-options {
    display: none;
    position: absolute;
    z-index: 130;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    max-height: 380px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pic-multiselect-options.show {
    display: grid;
    gap: 6px;
}

.pic-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-main);
}

.pic-option:hover,
.pic-option.selected {
    background: var(--bg-color);
}

.pic-option.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.pic-option-id {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}

@media (max-width: 640px) {
    .assignment-form-grid {
        grid-template-columns: 1fr;
    }
}

.schedule-detail-modal-content {
    width: min(620px, calc(100vw - 32px));
}

.schedule-detail-grid {
    display: grid;
    gap: 12px;
}

.schedule-detail-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-color);
}

.schedule-detail-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.schedule-detail-value {
    display: block;
    font-size: 14px;
    color: var(--text-main);
    overflow-wrap: anywhere;
}
