/* ==========================================
   PLAN HISTORY PATH
   ========================================== */
.action-plan-history-path {
    margin: 0 auto 10px;
    padding: 0;
    width: 100%;
    display: grid;
    place-items: center;
}

.action-plan-history-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin-bottom: 4px;
}

.action-plan-history-steps {
    display: flex;
    align-items: center;
    gap: 32px;
    /* Space for connectors */
    padding: 12px 16px;
    overflow-x: auto;
    max-width: 100%;

    /* Scrollbar hidden by default for cleaner look, valid in all browsers? */
    scrollbar-width: thin;
    mask-image: linear-gradient(to right, transparent 0%, black 16px, black calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 16px, black calc(100% - 16px), transparent 100%);
}

.action-plan-history-steps::-webkit-scrollbar {
    height: 4px;
}

.action-plan-history-steps::-webkit-scrollbar-track {
    background: transparent;
}

.action-plan-history-steps::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.action-plan-step-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
}

.action-plan-history-step {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100px;
    padding: 8px 6px;
    border-radius: 10px;
    border-width: 1px;
    border-style: solid;
    text-decoration: none;
    color: #2d3748;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Consume variables from inline style - punchy defaults */
    background-color: var(--level-bg, #eef2ff);
    border-color: var(--level-border, #6366f1);

    z-index: 2;
    /* Sit above the line */
    overflow: hidden;
    /* For pseudo-element fill */
}

/* Background Flush Animation */
.action-plan-history-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--level-border);
    opacity: 0;
    transform: translateY(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.action-plan-history-step:hover {
    border-color: var(--level-border);
    color: #fff;
    /* Invert text for contrast against dark fill */
    text-decoration: none;
    z-index: 10;
}

.action-plan-history-step:hover::before {
    opacity: 1;
    transform: translateY(0);
}

.action-plan-history-step:hover .step-date,
.action-plan-history-step:hover .step-meta {
    color: rgba(255, 255, 255, 0.9);
}

.action-plan-history-step .step-level {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.action-plan-history-step .step-date {
    font-size: 0.7rem;
    color: #4a5568;
    font-weight: 500;
}

.action-plan-history-step .step-meta {
    font-size: 0.65rem;
    color: #718096;
    margin-top: 2px;
    font-weight: 400;
}

/* Chevron connector between steps */
.action-plan-step-wrapper:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -20px;
    width: 8px;
    height: 8px;
    border-right: 2.5px solid #94a3b8;
    border-bottom: 2.5px solid #94a3b8;
    transform: translateY(-50%) rotate(-45deg);
    z-index: 0;
    pointer-events: none;
}



/* ==========================================
   CURRENT PLAN (Modern Refreshed)
   ========================================== */
.ap-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    max-width: 100%;
}

.ap-card.inactive {
    border-style: dashed;
    /* Background remains default for better readability */
}

.ap-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ap-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.ap-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a202c;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ap-id-badge {
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: inherit;
    opacity: 0.7;
}

.ap-status-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ap-status-badge.inactive {
    background: #e2e8f0;
    color: #4a5568;
}

.ap-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.ap-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ap-meta-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #718096;
    letter-spacing: 0.05em;
}

.ap-meta-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: #2d3748;
}

.ap-body {
    padding: 24px;
}

.ap-section {
    margin-bottom: 32px;
}

.ap-section:last-child {
    margin-bottom: 0;
}

.ap-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #4a5568;
    margin-bottom: 12px;
    letter-spacing: 0.025em;
    border-bottom: 2px solid #edf2f7;
    padding-bottom: 6px;
    display: inline-block;
}

.ap-summary-content {
    line-height: 1.4;
    /* Increased line height for better readability */
    font-size: 0.9rem;
    /* Slightly increased font size */
    color: #4a5568;
}

.ap-table-wrapper {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.ap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ap-table th {
    background: #f7fafc;
    text-align: left;
    padding: 10px 16px;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.ap-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    color: #2d3748;
    vertical-align: top;
}

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

.ap-check-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ap-check-yes {
    background: #c6f6d5;
    color: #22543d;
}

.ap-check-no {
    background: #fed7d7;
    color: #742a2a;
}

.ap-check-pending {
    background: #edf2f7;
    color: #718096;
}

.ap-footer {
    text-align: center;
    padding: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    border-top: 1px solid #e2e8f0;
}

.ap-footer.request-pending {
    background: #feebc8;
    color: #744210;
}

.ap-footer.scheduled {
    background: #fffff0;
    color: #975a16;
}

.ap-footer.due-today {
    background: #ebf8ff;
    color: #2b6cb0;
}

.ap-footer.overdue {
    background: #fff5f5;
    color: #c53030;
}

.ap-no-reviews {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    padding: 16px;
}

/* ==========================================
   CREATE PLAN SECTION
   ========================================== */
.action-plan-level-change {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 0.4rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.action-plan-level-change-title {
    font-size: 15px;
    font-weight: bold;
}

.action-plan-level-change-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-plan-level-change-label {
    margin: 0;
    white-space: nowrap;
    font-weight: bold;
}

.action-plan-create-title {
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}