/* ── Full-height chain (outer .app-shell: global layout.css) ── */
body.page-site-planner .main-content {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

body.page-site-planner .page-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

.site-planner-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.site-planner-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin: 0 0 4px;
    letter-spacing: -0.2px;
}

.site-planner-subtitle {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
}

.site-project-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.site-project-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.site-project-card:hover {
    border-color: #c7d2dc;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.site-project-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.site-project-name {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--color-primary-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.site-project-location {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: block;
}

.site-status-badge {
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    white-space: nowrap;
}

.site-status-on-track {
    color: #166534;
    background: #dcfce7;
}

.site-status-delayed {
    color: #854d0e;
    background: #fef9c3;
}

.site-status-not-started {
    color: #475569;
    background: #e2e8f0;
}

/* Draft badge — amber */
.site-status-draft {
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

/* Step indicator shown beside the Draft badge */
.site-draft-step {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    color: #78716c;
    background: #f5f5f4;
    border: 1px solid #e7e5e4;
    border-radius: 20px;
    padding: 2px 8px;
    white-space: nowrap;
}

/* Subtle left-border accent on draft cards */
.site-card--draft {
    border-left: 3px solid #fcd34d;
}

.site-project-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.site-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.site-meta-label {
    color: var(--color-text-medium);
}

.site-meta-value {
    color: var(--color-primary-dark);
    font-weight: 600;
}

.site-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.site-progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.site-progress-fill {
    height: 100%;
    background: var(--color-primary-blue);
    border-radius: inherit;
    transition: width 0.2s ease;
}

.site-progress-percent {
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* ── Empty State ── */
.site-empty-state:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 48px 24px;
}

.site-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--empty-icon-bg, #f1f3f5);
    border: 1px solid var(--color-neutral-border, #e2e8f0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    flex-shrink: 0;
}

.site-empty-icon i {
    font-size: 22px;
    color: var(--empty-icon-color, #6b7280);
}

.site-empty-state h3 {
    margin: 0 0 8px;
    color: var(--color-primary-dark);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.1px;
}

.site-empty-desc {
    margin: 0 0 28px;
    color: var(--empty-icon-color, #6b7280);
    font-size: 14px;
    max-width: 280px;
    line-height: 1.6;
}

.site-empty-state .dashboard-card__btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: none;
    transition: background 0.15s ease;
}

.site-empty-state .dashboard-card__btn:hover {
    background: var(--color-primary-blue-hover);
    box-shadow: none;
    transform: none;
}

/* ── Header controls: search + new-project button ── */
.site-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Search input wrapper ── */
.site-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.site-search-icon {
    position: absolute;
    left: 11px;
    font-size: 13px;
    color: #94a3b8;
    pointer-events: none;
    z-index: 1;
}

.site-search-input {
    height: 36px;
    width: 220px;
    padding: 0 12px 0 34px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--color-primary-dark);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, width 0.2s ease;
}

.site-search-input::placeholder {
    color: #cbd5e1;
}

.site-search-input:focus {
    border-color: rgba(29, 111, 242, 0.4);
    box-shadow: 0 0 0 3px rgba(29, 111, 242, 0.08);
    width: 260px;
}

/* Clear (×) button injected by type=search — keep it styled */
.site-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath fill='%2394a3b8' d='M7 5.59 2.41 1 1 2.41 5.59 7 1 11.59 2.41 13 7 8.41 11.59 13 13 11.59 8.41 7 13 2.41 11.59 1z'/%3E%3C/svg%3E") center/12px no-repeat;
    cursor: pointer;
    opacity: 0.7;
}

.site-search-input::-webkit-search-cancel-button:hover {
    opacity: 1;
}

/* ── Search "no results" state ── */
.site-search-empty:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 56px 24px;
    text-align: center;
}

.site-search-empty i {
    font-size: 28px;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.site-search-empty__title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-primary-dark);
}

.site-search-empty__hint {
    margin: 0;
    font-size: 13px;
    color: #94a3b8;
}

@media (max-width: 1024px) {
    .site-project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .site-planner-header {
        flex-direction: column;
        align-items: stretch;
    }

    .site-header-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .site-search-wrap {
        width: 100%;
    }

    .site-search-input,
    .site-search-input:focus {
        width: 100%;
    }

    .site-planner-header .dashboard-card__btn,
    .site-header-controls .dashboard-card__btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .site-project-grid {
        grid-template-columns: 1fr;
    }
}

/* ── New / duplicated card highlight ── */
@keyframes spCardFlash {
    0%   { border-color: rgba(29, 111, 242, 0.55); box-shadow: 0 0 0 3px rgba(29, 111, 242, 0.12); }
    70%  { border-color: rgba(29, 111, 242, 0.3);  box-shadow: 0 0 0 2px rgba(29, 111, 242, 0.07); }
    100% { border-color: #e2e8f0; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05); }
}

.site-card--new {
    animation: spCardFlash 1.5s ease forwards;
}

/* ── Project serial number ── */
.site-project-serial {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

/* ── Card top row: info left, actions right ── */
.site-project-info {
    flex: 1;
    min-width: 0;
}

/* ── Card actions: status badge + 3-dot button ── */
.site-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── 3-dot menu wrapper (positions dropdown) ── */
.site-card-menu-wrap {
    position: relative;
}

/* ── 3-dot button ── */
.site-card-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    padding: 0;
    font-family: inherit;
}

.site-card-menu-btn:hover {
    background: #f1f5f9;
    color: var(--color-primary-dark);
}

/* ── Dropdown panel ── */
.site-card-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 156px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.1), 0 1px 4px rgba(15, 23, 42, 0.06);
    z-index: 500;
    padding: 4px;
    animation: spDropIn 0.12s ease;
}

@keyframes spDropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Dropdown items ── */
.site-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-primary-dark);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    font-family: inherit;
    text-align: left;
}

.site-dropdown-item i {
    width: 14px;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    flex-shrink: 0;
    transition: color 0.12s;
}

.site-dropdown-item:hover {
    background: #f8fafc;
}

.site-dropdown-item:hover i {
    color: var(--color-primary-blue);
}

.site-dropdown-item--danger {
    color: #dc2626;
}

.site-dropdown-item--danger i {
    color: #fca5a5;
}

.site-dropdown-item--danger:hover {
    background: #fef2f2;
}

.site-dropdown-item--danger:hover i {
    color: #dc2626;
}

.site-dropdown-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 3px 6px;
}

/* ── Delete confirmation dialog ── */
.sp-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sp-confirm-overlay[hidden] {
    display: none;
}

.sp-confirm-dialog {
    background: #fff;
    border-radius: 14px;
    padding: 28px 28px 24px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15);
    text-align: center;
    animation: spDialogIn 0.18s ease;
}

@keyframes spDialogIn {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

.sp-confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.sp-confirm-icon i {
    font-size: 18px;
    color: #dc2626;
}

.sp-confirm-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin: 0 0 8px;
}

.sp-confirm-body {
    font-size: 13.5px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0 0 22px;
}

.sp-confirm-body strong {
    color: var(--color-primary-dark);
}

.sp-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.sp-confirm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.sp-confirm-btn--cancel {
    background: #f1f5f9;
    color: var(--color-primary-dark);
    border: 1px solid #e2e8f0;
}

.sp-confirm-btn--cancel:hover {
    background: #e2e8f0;
}

.sp-confirm-btn--delete {
    background: #dc2626;
    color: #fff;
}

.sp-confirm-btn--delete:hover {
    background: #b91c1c;
}

/* ── Global mode: no-project guidance ── */
.sp-no-project {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    min-height: calc(100vh - 150px);
    padding: 12vh 24px 40px;
    gap: 12px;
}

/* .sp-no-project__icon — see layout.css (tokens --empty-icon-bg, --empty-icon-color) */

.sp-no-project__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-primary-dark, #1e293b);
    margin: 0;
}

.sp-no-project__hint {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
    max-width: 340px;
}

.sp-no-project__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.sp-no-project__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #2563eb;
    color: #fff;
    border: 1.5px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.sp-no-project__btn:hover {
    background: #1d4ed8;
}

.sp-no-project__btn--ghost {
    background: transparent;
    color: #2563eb;
    border-color: #93c5fd;
}

.sp-no-project__btn--ghost:hover {
    background: #eff6ff;
    border-color: #2563eb;
}

/* ── Project mode (site-planner.html?projectId=) ── */
.sp-pm-header {
    margin-bottom: 24px;
}

.sp-pm-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
    text-decoration: none;
    margin-bottom: 14px;
    transition: color 0.15s;
}

.sp-pm-back:hover {
    color: var(--color-primary-dark, #1e293b);
}

.sp-pm-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.sp-pm-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-primary-dark, #1e293b);
    margin: 0;
    letter-spacing: -0.2px;
}

.sp-pm-list {
    margin-top: 8px;
}

/* Plan list rows use shared /css/tool-file-list.css */
