/* ==========================================
   PLAN HISTORY PATH – Segmented Bar
   ========================================== */
.action-plan-history-path {
    margin: 0 auto 16px;
    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: 6px;
}

.action-plan-history-steps {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 600px;
    height: 36px;
    border-radius: 8px;
    overflow: visible;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
}

.action-plan-step-wrapper {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
}

/* Chevron-shaped segments via clip-path */
.action-plan-history-step {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background-color: var(--level-bg, #eef2ff);
    border: none;
    text-decoration: none;
    color: #2d3748;
    cursor: pointer;
    transition: filter 0.2s ease, opacity 0.2s ease;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}

/* First segment – flat left edge */
.action-plan-step-wrapper:first-child .action-plan-history-step {
    border-radius: 8px 0 0 8px;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%);
}

/* Last segment – flat right edge */
.action-plan-step-wrapper:last-child .action-plan-history-step {
    border-radius: 0 8px 8px 0;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%);
}

/* Single segment – no chevrons */
.action-plan-step-wrapper:first-child:last-child .action-plan-history-step {
    border-radius: 8px;
    clip-path: none;
}

/* Level initial label */
.action-plan-history-step .step-level {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Date hidden by default, shown in tooltip */
.action-plan-history-step .step-date {
    display: none;
}

/* Hover – brighten the segment */
.action-plan-history-step:hover {
    text-decoration: none;
    filter: brightness(0.9) saturate(1.3);
}

/* Active step (currently viewed plan) */
.action-plan-history-step--active {
    background: linear-gradient(180deg, var(--level-border) 0%, color-mix(in srgb, var(--level-border), #000 18%) 100%);
    color: #fff;
    z-index: 2;
}

.action-plan-history-step--active .step-level {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}

/* Pulsing glow on active */
.action-plan-history-step--active::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    animation: activeShimmer 2s ease-in-out infinite;
}

@keyframes activeShimmer {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Future steps (after the currently viewed plan) */
.action-plan-history-step--future {
    filter: grayscale(100%);
    opacity: 0.45;
}

.action-plan-history-step--future:hover {
    filter: grayscale(0%) brightness(0.9) saturate(1.3);
    opacity: 1;
}



/* ==========================================
   CURRENT PLAN (Modern Refreshed)
   ========================================== */
.ap-card {
    background: #fff;
    border: 2px 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;
}