.customer-detail {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    padding: 10px;
}

.customer-hero {
    background: #fff;
    border: 1px solid var(--border2-color);
    border-radius: 0;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
}

.customer-hero .title-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.customer-hero .avatar {
    width: 46px;
    height: 46px;
    border-radius: 0;
    background: var(--primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.customer-hero .name {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
}

.customer-hero .meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #334155;
}

.customer-hero .hero-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.customer-hero .meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.customer-hero .tag {
    background: #f8fafb;
    color: #1f2937;
    padding: 6px 10px;
    border-radius: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid var(--border2-color);
}

.customer-hero .back-btn {
    justify-self: auto;
    padding: 8px 10px;
    border-radius: 0;
    border: 1px solid var(--border2-color);
    background: #f8fafb;
    color: #0f172a;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.08s ease, box-shadow 0.1s ease;
}

.customer-hero .back-btn:hover {
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.customer-hero .back-btn:active {
    transform: translateY(0);
}

.smart-schedule-btn {
    padding: 8px 10px;
    border-radius: 0;
    border: 1px solid var(--primary-border);
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.08s ease, box-shadow 0.1s ease;
}

.smart-schedule-btn:hover {
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
    transform: translateY(-1px);
}

.smart-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 60;
}

.smart-modal.is-open {
    display: flex;
}

.smart-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.smart-modal__panel {
    position: relative;
    width: min(720px, 92vw);
    max-height: 90vh;
    background: #fff;
    border: 1px solid var(--border2-color);
    border-radius: 0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.smart-modal__header,
.smart-modal__footer {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.smart-modal__header {
    border-bottom: 1px solid var(--border2-color);
}

.smart-modal__footer {
    border-top: 1px solid var(--border2-color);
}

.smart-modal__body {
    padding: 14px;
    display: grid;
    gap: 12px;
    overflow-y: auto;
}

.smart-form {
    display: grid;
    gap: 12px;
}

.smart-hint {
    font-size: 12px;
    color: #64748b;
}

.smart-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.smart-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.smart-field label {
    font-size: 12px;
    color: #475467;
}

.smart-field input,
.smart-field select,
.smart-field textarea {
    padding: 8px 10px;
    border: 1px solid var(--border2-color);
    border-radius: 4px;
    background: #f8fafc;
    font-size: 13px;
    color: #0f172a;
}

.smart-field input:focus,
.smart-field select:focus,
.smart-field textarea:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 2px var(--focus-soft);
    background: #fff;
}

.smart-result {
    border: 1px dashed var(--border2-color);
    background: #f8fafc;
    padding: 10px 12px;
    font-size: 13px;
    color: #475467;
}

.smart-slots {
    display: grid;
    gap: 8px;
}

.smart-slot {
    border: 1px solid var(--border2-color);
    background: #fff;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    gap: 12px;
    transition: border-color 0.15s ease, box-shadow 0.12s ease, transform 0.1s ease;
}

.smart-slot:hover {
    border-color: var(--primary-border);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.smart-slot.selected {
    border-color: var(--primary-border);
    background: var(--primary-bg);
}

.smart-slot__label {
    font-weight: 700;
    color: #0f172a;
}

.smart-slot__meta {
    font-size: 12px;
    color: #475467;
}

.smart-result.success {
    border-color: #abefc6;
    background: #ecfdf3;
    color: #027a48;
}

.smart-result.error {
    border-color: #fecdca;
    background: #fef3f2;
    color: #b42318;
}

.smart-btn {
    border: 1px solid var(--border2-color);
    background: #f8fafc;
    color: #0f172a;
    padding: 8px 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0;
    transition: transform 0.08s ease, box-shadow 0.1s ease;
}

.smart-btn:hover {
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.smart-btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-border);
}

.smart-btn.secondary {
    background: #f8fafb;
    color: #0f172a;
}

.smart-btn.ghost {
    background: transparent;
    border: 1px dashed var(--border2-color);
    color: #475467;
}

.smart-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.smart-btn:disabled:hover {
    box-shadow: none;
    transform: none;
}

@media (max-width: 720px) {
    .smart-row {
        grid-template-columns: 1fr;
    }
    .smart-modal__footer {
        flex-direction: column;
        align-items: stretch;
    }
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.stat-card {
    padding: 10px;
    border: 1px solid var(--border2-color);
    border-radius: 0;
    background: #fff;
    display: grid;
    gap: 6px;
    position: relative;
}

.stat-card .label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .value {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
}

.stat-card .hint {
    font-size: 12px;
    color: #475467;
}

.stat-card.highlight {
    background: #f8fafb;
    border-color: var(--border2-color);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 10px;
}

.detail-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.panel {
    background: #fff;
    border: 1px solid var(--border2-color);
    border-radius: 0;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.panel.fixed-height {
    min-height: 260px;
    max-height: 320px;
    grid-template-rows: auto 1fr;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.panel-title {
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
}

.panel-sub {
    font-size: 12px;
    color: #64748b;
}

.profile-form {
    display: grid;
    gap: 12px;
    max-width: 860px;
    margin: 0 auto;
    text-align: center;
    background: transparent;
    border: none;
    padding: 0;
}

.profile-row {
    display: grid;
    gap: 10px;
    justify-content: center;
}

.profile-row.two-col {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.profile-row.three-col {
    grid-template-columns: repeat(3, minmax(200px, 1fr));
}

.profile-field {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #e7e9ef;
    background: transparent;
    justify-content: center;
}

.profile-row .profile-field:last-child {
    border-bottom: 1px solid #e7e9ef;
}

.profile-label {
    font-size: 13px;
    color: #0f172a;
    letter-spacing: 0.01em;
    min-width: 110px;
    font-weight: 700;
    text-align: center;
}

.profile-value {
    font-size: 14px;
    color: #0f172a;
    font-weight: 600;
    text-align: center;
}

.note-block {
    margin-top: 6px;
    padding: 6px 0;
    border: 1px dashed #cbd5e1;
    border-radius: 0;
    background: #f9fafb;
    min-height: 70px;
    color: #0f172a;
    text-align: left;
}

.note-block .profile-label {
    text-align: left;
}

.note-block .profile-value {
    text-align: left;
    font-weight: 500;
}

.timeline {
    display: grid;
    gap: 8px;
    /* Keep timeline cards pinned to the top so a single item does not stretch to panel height. */
    align-content: start;
    grid-auto-rows: max-content;
}

.timeline-row {
    border: 1px solid var(--border2-color);
    border-radius: 0;
    padding: 10px;
    background: #fff;
    display: grid;
    gap: 4px;
    /* Preserve a stable card footprint across short lists without forcing full-height stretching. */
    min-height: 84px;
}

.timeline-row .top {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.timeline-row .when {
    font-weight: 700;
    color: #0f172a;
    font-size: 14px;
}

.timeline-row .service {
    color: #475467;
    font-size: 13px;
}

.badge-compact {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-status-confirmed,
.badge-status-finished,
.badge-status-checked_in {
    background: #ecfdf3;
    color: #15803d;
}

.badge-status-pending {
    background: #fff7ed;
    color: #b45309;
}

.badge-status-canceled,
.badge-status-removed {
    background: #fef2f2;
    color: #b91c1c;
}

.badge-status-rescheduled {
    background: #eef2ff;
    color: #4338ca;
}

.history-grid {
    display: grid;
    gap: 8px;
}

.scroll-area {
    overflow-y: auto;
    padding-right: 4px;
}

.history-grid.scroll-area {
    max-height: 260px;
}

.timeline.scroll-area {
    max-height: 260px;
}

.panel.fixed-height .scroll-area,
.panel.fixed-height .timeline.scroll-area,
.panel.fixed-height .history-grid.scroll-area {
    height: 100%;
    max-height: none;
}

.timeline-filters {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.timeline-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #475467;
}

.timeline-filters select {
    min-width: 160px;
    padding: 6px 8px;
    border: 1px solid var(--border2-color);
    background: #fff;
    color: #0f172a;
    border-radius: 0;
    font-size: 13px;
}

.history-item {
    border: 1px solid var(--border2-color);
    border-radius: 0;
    padding: 10px;
    background: #f8fafc;
    display: grid;
    gap: 4px;
}

.history-item .row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.history-item .title {
    font-weight: 700;
    color: #0f172a;
}

.history-item .meta {
    font-size: 12px;
    color: #475467;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.empty {
    color: #667085;
    font-size: 13px;
    padding: 6px 0;
}

@media (max-width: 1080px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}
