/* ===================================================
   ช่างพร้อม — Global Styles
   Font: Sarabun | Colors: Blue #1565C0, Light BG #EEF4FF
   =================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
    --blue-primary:  #1565C0;
    --blue-dark:     #0D47A1;
    --blue-light:    #1E88E5;
    --sidebar-bg:    #1565C0;
    --sidebar-width: 230px;
    --body-bg:       #F0F4F8;
    --card-bg:       #FFFFFF;
    --card-border:   #E0E7EF;
    --text-main:     #212529;
    --text-muted:    #6B7280;
    --text-label:    #374151;
    --status-done:       #16A34A;
    --status-cancelled:  #DC2626;
    --status-active:     #2563EB;
    --status-pending:    #D97706;
    --status-confirmed:  #059669;
    --status-postponed:  #7C3AED;
    --radius:        10px;
    --shadow:        0 2px 12px rgba(21,101,192,.08);
}

html, body {
    font-family: 'Sarabun', sans-serif;
    font-size: 15px;
    color: var(--text-main);
    background: var(--body-bg);
    min-height: 100vh;
    margin: 0; padding: 0;
}

/* ===================================================
   AUTH PAGES
   =================================================== */
.auth-body {
    background: #F0F4FB;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    background: #E8F0FD;
    border-radius: 18px;
    padding: 36px 40px 32px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 4px 24px rgba(21,101,192,.10);
}

.auth-card-wide {
    max-width: 640px;
    padding: 32px 36px;
}

.auth-brand {
    color: var(--blue-primary);
    font-weight: 700;
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: .5px;
}

.auth-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-tab {
    color: var(--text-muted);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 500;
    padding-bottom: 2px;
    transition: color .2s;
}
.auth-tab.active {
    color: var(--blue-primary);
    font-weight: 600;
    border-bottom: 2px solid var(--blue-primary);
}
.auth-tab-divider { color: #CBD5E1; }

.auth-input {
    border: 1.5px solid #C5D5EA;
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Sarabun', sans-serif;
    font-size: .95rem;
    background: #FFFFFF;
    transition: border-color .2s, box-shadow .2s;
}
.auth-input:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,.12);
    outline: none;
}

.auth-btn {
    background: var(--blue-primary);
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Sarabun', sans-serif;
    letter-spacing: .3px;
    transition: background .2s, transform .1s;
}
.auth-btn:hover { background: var(--blue-dark); }
.auth-btn:active { transform: scale(.98); }

.auth-label {
    font-size: .9rem;
    color: var(--text-label);
    font-weight: 500;
    text-align: right;
}
@media (max-width: 576px) {
    .auth-label { text-align: left; }
}

.auth-link-small {
    color: var(--blue-primary);
    font-size: .88rem;
    text-decoration: none;
}
.auth-link-small:hover { text-decoration: underline; }

/* Success icon in modal */
.success-icon i { color: #4CAF50 !important; }

/* ===================================================
   LAYOUT: Sidebar + Main
   =================================================== */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
    padding: 24px 20px 8px;
}
.sidebar-brand {
    color: #FFFFFF;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: .4px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px 20px;
}
.user-avatar i {
    font-size: 2.4rem;
    color: rgba(255,255,255,.7);
}
.user-name {
    color: #FFFFFF;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.3;
}
.user-phone {
    color: rgba(255,255,255,.7);
    font-size: .82rem;
}

.sidebar-nav {
    padding: 4px 0 20px;
    flex: 1;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-size: .93rem;
    font-weight: 500;
    transition: background .18s, color .18s;
    border-radius: 0;
}
.nav-item i { font-size: 1rem; flex-shrink: 0; }
.nav-item:hover {
    background: rgba(255,255,255,.12);
    color: #FFFFFF;
}
.nav-item.active {
    background: rgba(255,255,255,.18);
    color: #FFFFFF;
    font-weight: 600;
}
.nav-item.text-danger { color: #FF8A80 !important; }
.nav-item.text-danger:hover { background: rgba(255,80,80,.12); }

.sidebar-divider {
    border-color: rgba(255,255,255,.18);
    margin: 8px 20px;
}

/* MAIN CONTENT */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 28px 28px 40px;
    min-height: 100vh;
    background: var(--body-bg);
}

/* ===================================================
   SIDEBAR TOGGLE (Mobile)
   =================================================== */
.sidebar-toggle-btn {
    position: fixed;
    top: 14px; left: 14px;
    z-index: 1100;
    background: var(--blue-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 40px; height: 40px;
    font-size: 1.3rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(21,101,192,.25);
    transition: background .2s;
}
.sidebar-toggle-btn:hover { background: var(--blue-dark); }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 999;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.2);
    }
    .main-content {
        margin-left: 0;
        padding: 20px 16px 40px;
        padding-top: 64px; /* room for toggle btn */
    }
}

/* ===================================================
   PAGE HEADER
   =================================================== */
.page-header {
    margin-bottom: 20px;
}
.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}
.btn-back {
    color: var(--blue-primary);
    font-size: 1.1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color .2s;
}
.btn-back:hover { color: var(--blue-dark); }

/* ===================================================
   SECTION HEADER (Dashboard)
   =================================================== */
.section-header {
    background: #E8EDF5;
    border-radius: 8px 8px 0 0;
    padding: 10px 16px;
    margin-bottom: 2px;
}
.section-label {
    font-size: .93rem;
    font-weight: 600;
    color: var(--text-main);
}
.badge-count {
    font-size: .85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===================================================
   JOB CARDS
   =================================================== */
.job-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow .2s;
}
.job-card:hover { box-shadow: 0 4px 18px rgba(21,101,192,.13); }

.job-card-header {
    padding: 12px 16px 8px;
    border-bottom: 1px solid #F0F4F8;
}
.job-title {
    font-size: .93rem;
    font-weight: 600;
    color: var(--text-main);
    flex: 1;
    padding-right: 12px;
    line-height: 1.4;
}
.job-amount {
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.job-card-body {
    padding: 8px 16px 10px;
}
.job-meta {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
    font-size: .88rem;
    align-items: flex-start;
    flex-wrap: wrap;
}
.job-meta-label {
    color: var(--text-label);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 90px;
}
.job-meta-value {
    color: var(--text-main);
    flex: 1;
    word-break: break-word;
}

.job-card-footer {
    padding: 8px 16px 12px;
}

/* Status badges */
.job-status {
    font-size: .8rem;
    font-weight: 600;
    padding: 2px 0;
}
.status-done       { color: var(--status-done); }
.status-cancelled  { color: var(--status-cancelled); }
.status-active     { color: var(--status-active); }
.status-pending    { color: var(--status-pending); }
.status-confirmed  { color: var(--status-confirmed); }
.status-postponed  { color: var(--status-postponed); }

/* Detail button */
.btn-detail {
    background: var(--blue-primary);
    border: none;
    border-radius: 6px;
    font-size: .85rem;
    font-weight: 600;
    padding: 5px 16px;
    font-family: 'Sarabun', sans-serif;
    color: #fff;
    transition: background .2s;
}
.btn-detail:hover { background: var(--blue-dark); color: #fff; }

/* Start job button */
.btn-start-job {
    background: var(--blue-primary);
    border: none;
    border-radius: 8px;
    padding: 10px 32px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Sarabun', sans-serif;
    color: #fff;
    display: inline-block;
    text-decoration: none;
    transition: background .2s, transform .1s;
}
.btn-start-job:hover { background: var(--blue-dark); color: #fff; }
.btn-start-job:active { transform: scale(.98); }

.btn-close-job {
    background: var(--blue-primary);
    border: none;
    border-radius: 8px;
    padding: 10px 32px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Sarabun', sans-serif;
    color: #fff;
    transition: background .2s, transform .1s;
}
.btn-close-job:hover { background: var(--blue-dark); color: #fff; }

/* Empty state */
.empty-state {
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 12px;
}

/* ===================================================
   DETAIL CARD
   =================================================== */
.detail-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    padding: 20px 24px 28px;
    margin-bottom: 16px;
}

.detail-card-header {
    padding-bottom: 12px;
    border-bottom: 1px solid #F0F4F8;
    margin-bottom: 14px;
}
.detail-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    flex: 1;
    padding-right: 12px;
    line-height: 1.4;
}
.detail-amount {
    font-size: .88rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.detail-body {}
.detail-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    font-size: .9rem;
    align-items: flex-start;
    flex-wrap: wrap;
}
.detail-label {
    color: var(--text-label);
    font-weight: 500;
    min-width: 120px;
    flex-shrink: 0;
}
.detail-value {
    color: var(--text-main);
    flex: 1;
    word-break: break-word;
}

.detail-section-label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-label);
    margin-bottom: 10px;
}

.detail-input {
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    padding: 9px 13px;
    font-family: 'Sarabun', sans-serif;
    font-size: .93rem;
    transition: border-color .2s, box-shadow .2s;
}
.detail-input:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,.1);
    outline: none;
}

.form-label-detail {
    font-size: .9rem;
    color: var(--text-label);
    font-weight: 500;
    text-align: right;
}
@media (max-width: 576px) {
    .form-label-detail { text-align: left; }
}

/* ===================================================
   PHOTO UPLOAD GRID
   =================================================== */
.photo-upload-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.photo-slot {
    aspect-ratio: 1/1;
    background: #E8EDF5;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s;
    border: 1.5px solid #D1DAE8;
}
.photo-slot:hover { background: #D5E3F5; }
.photo-slot-empty { color: #9CA3AF; font-size: 1.1rem; }
.photo-slot img { width:100%; height:100%; object-fit:cover; }

@media (max-width: 576px) {
    .photo-upload-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ===================================================
   SIGNATURE PAD
   =================================================== */
.signature-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 520px;
}
#sigCanvas {
    display: block;
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    background: #F8FAFC;
    touch-action: none;
    width: 100%;
    height: auto;
    cursor: crosshair;
}
.btn-sig-clear {
    position: absolute;
    bottom: 10px; right: 10px;
    background: rgba(255,255,255,.9);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: .8rem;
    color: var(--text-muted);
    font-family: 'Sarabun', sans-serif;
    padding: 4px 10px;
    display: flex; align-items: center; gap: 4px;
    transition: background .2s, color .2s;
}
.btn-sig-clear:hover { background: #FDECEA; color: #DC2626; border-color: #DC2626; }

/* ===================================================
   HISTORY FILTERS
   =================================================== */
.filter-bar {
    margin-bottom: 16px;
}
.filter-select {
    max-width: 160px;
    font-family: 'Sarabun', sans-serif;
    font-size: .9rem;
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    padding: 7px 12px;
    background: var(--card-bg);
}
.filter-select:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,.1);
    outline: none;
}
.btn-filter {
    background: var(--blue-primary);
    border: none;
    border-radius: 8px;
    padding: 7px 20px;
    font-family: 'Sarabun', sans-serif;
    font-weight: 600;
    font-size: .9rem;
    color: #fff;
    transition: background .2s;
}
.btn-filter:hover { background: var(--blue-dark); color: #fff; }

/* ===================================================
   PHOTO PREVIEW (done state)
   =================================================== */
.photo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.photo-thumb {
    width: 80px; height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1.5px solid var(--card-border);
}
.photo-thumb img { width:100%; height:100%; object-fit:cover; }

.sig-preview {
    background: #F8FAFC;
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    padding: 12px;
    display: inline-block;
}

/* ===================================================
   BOOTSTRAP OVERRIDES
   =================================================== */
.btn-primary {
    background-color: var(--blue-primary) !important;
    border-color: var(--blue-primary) !important;
    font-family: 'Sarabun', sans-serif;
    font-weight: 600;
}
.btn-primary:hover {
    background-color: var(--blue-dark) !important;
    border-color: var(--blue-dark) !important;
}
.form-control, .form-select {
    font-family: 'Sarabun', sans-serif;
}
.form-control::placeholder, .form-select::placeholder {
    color: #AEBBD0;
}
.alert { font-family: 'Sarabun', sans-serif; font-size: .9rem; }

/* ===================================================
   RESPONSIVE UTILITIES
   =================================================== */
@media (max-width: 767.98px) {
    .detail-row { flex-direction: column; gap: 2px; }
    .detail-label { min-width: unset; }
    .job-card-header { flex-direction: column; gap: 4px; }
    .filter-bar { flex-direction: column; }
    .filter-select { max-width: 100%; }
}

/* ===================================================
   DISABLED INPUT STYLE (profile page)
   =================================================== */
.detail-input-disabled,
.detail-input:disabled,
.form-control:disabled,
.form-select:disabled {
    background-color: #F1F5F9 !important;
    color: #64748B !important;
    border-color: #E2E8F0 !important;
    cursor: not-allowed;
    opacity: 1;
}

/* ===================================================
   JOB TABS (Dashboard)
   =================================================== */
.job-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #E0E7EF;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.job-tab {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    padding: 10px 20px;
    font-family: 'Sarabun', sans-serif;
    font-size: .93rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color .18s, border-color .18s;
}
.job-tab:hover {
    color: var(--blue-primary);
}
.job-tab.active {
    color: var(--blue-primary);
    font-weight: 700;
    border-bottom-color: var(--blue-primary);
}
.tab-count {
    background: #E8EDF5;
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 600;
    border-radius: 20px;
    padding: 1px 8px;
    min-width: 24px;
    text-align: center;
    transition: background .18s, color .18s;
}
.job-tab.active .tab-count {
    background: var(--blue-primary);
    color: #fff;
}

/* Tab panels */
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* ===================================================
   JOB ACCORDION (Dashboard)
   =================================================== */
.job-accordion-item {
    border: 1px solid var(--card-border);
    border-radius: var(--radius) !important;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.job-accordion-btn {
    background: #EEF3FB;
    font-family: 'Sarabun', sans-serif;
    font-size: .97rem;
    font-weight: 600;
    color: var(--text-main);
    padding: 13px 18px;
    display: flex;
    align-items: center;
    gap: 0;
    border: none;
    width: 100%;
}
.job-accordion-btn:not(.collapsed) {
    background: #E3EDF8;
    color: var(--blue-primary);
    box-shadow: none;
}
.job-accordion-btn:focus { box-shadow: none; }
.acc-label { flex: 1; display: flex; align-items: center; }
.acc-badge {
    font-size: .8rem;
    font-weight: 600;
    background: #fff;
    color: var(--text-muted);
    border-radius: 20px;
    padding: 2px 10px;
    margin-right: 8px;
    border: 1px solid var(--card-border);
}
.job-accordion-btn:not(.collapsed) .acc-badge {
    background: var(--blue-primary);
    color: #fff;
    border-color: var(--blue-primary);
}

/* ===================================================
   CALENDAR (History)
   =================================================== */
.cal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.cal-header {
    padding: 14px 20px;
    border-bottom: 1px solid #EEF0F5;
    background: #F7FAFF;
}
.cal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}
.cal-nav-btn {
    color: var(--blue-primary);
    background: none;
    border: 1.5px solid var(--blue-primary);
    border-radius: 6px;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    font-size: .9rem;
    transition: background .18s, color .18s;
}
.cal-nav-btn:hover { background: var(--blue-primary); color: #fff; }

/* Grid */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.cal-dow-row {
    border-bottom: 1px solid #EEF0F5;
    background: #F7FAFF;
}
.cal-dow {
    text-align: center;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 4px;
}
.cal-body { border-top: none; }
.cal-cell {
    min-height: 90px;
    height: auto;
    border-right: 1px solid #EEF0F5;
    border-bottom: 1px solid #EEF0F5;
    padding: 4px 5px 6px;
    vertical-align: top;
    font-size: .8rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell-empty { min-height: 90px; border-right: 1px solid #EEF0F5; border-bottom: 1px solid #EEF0F5; }
.cal-day-num {
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 3px;
    text-align: right;
}
.cal-today { background: #FFFDE7; }
.cal-today .cal-day-num {
    color: var(--blue-primary);
    background: var(--blue-primary);
    color: #fff;
    border-radius: 50%;
    width: 22px; height: 22px;
    display: inline-flex;
    align-items: center; justify-content: center;
    float: right;
    font-size: .78rem;
}

/* Events */
.cal-event {
    font-size: .72rem;
    border-radius: 4px;
    padding: 2px 5px;
    margin-bottom: 2px;
    white-space: normal;
    overflow: visible;
    word-break: break-all;
    line-height: 1.3;
    cursor: pointer;
    display: block;
}
.cal-pending   { background: #FEF3C7; color: #92400E; }
.cal-active    { background: #DBEAFE; color: #1E40AF; }
.cal-done      { background: #D1FAE5; color: #065F46; }
.cal-cancelled { background: #FEE2E2; color: #991B1B; }
.cal-postponed { background: #EDE9FE; color: #5B21B6; }

/* Legend */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid #EEF0F5;
    background: #F7FAFF;
}
.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .78rem;
    color: var(--text-muted);
}
.cal-dot {
    width: 10px; height: 10px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}

@media (max-width: 575.98px) {
    .cal-cell { min-height: 56px; padding: 2px 3px; }
    .cal-event { font-size: .6rem; padding: 1px 3px; word-break: break-all; white-space: normal; }
    .cal-day-num { font-size: .72rem; }
}

/* Calendar event as link */
a.cal-event {
    display: block;
    text-decoration: none;
    transition: filter .15s, transform .1s;
}
a.cal-event:hover {
    filter: brightness(.88);
    transform: translateY(-1px);
    text-decoration: none;
}

/* ===================================================
   SUMMARY CARDS (Dashboard)
   =================================================== */
.summary-card {
    border-radius: 14px;
    padding: 18px 16px;
    color: #fff;
    min-height: 110px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.10);
    transition: transform .18s, box-shadow .18s;
}
.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
}
.summary-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}
.summary-info { flex: 1; }
.summary-label {
    font-size: .82rem;
    font-weight: 500;
    opacity: .88;
    margin-bottom: 4px;
}
.summary-num {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
}
.summary-sub {
    font-size: .75rem;
    opacity: .78;
}
.summary-icon {
    font-size: 2.2rem;
    opacity: .25;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Color themes */
.summary-card-purple {
    background: linear-gradient(135deg, #7B2FF7 0%, #4A00E0 100%);
}
.summary-card-pink {
    background: linear-gradient(135deg, #F857A6 0%, #FF5858 100%);
}
.summary-card-blue {
    background: linear-gradient(135deg, #11C5CF 0%, #1565C0 100%);
}
.summary-card-orange {
    background: linear-gradient(135deg, #F7971E 0%, #FFD200 100%);
}

@media (max-width: 575.98px) {
    .summary-num { font-size: 1.7rem; }
    .summary-card { padding: 14px 12px; min-height: 90px; }
    .summary-icon { font-size: 1.7rem; }
}

/* Calendar month/year select */
.cal-select {
    font-family: 'Sarabun', sans-serif;
    font-size: .88rem;
    font-weight: 600;
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    padding: 5px 10px;
    color: var(--text-main);
    background: #fff;
    cursor: pointer;
    min-width: 0;
    width: auto;
}
.cal-select:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,.1);
    outline: none;
}

/* Bill search input in filter bar */
.filter-input {
    font-family: 'Sarabun', sans-serif;
    font-size: .9rem;
    border: 1.5px solid var(--card-border);
    border-radius: 8px;
    padding: 7px 12px;
    min-width: 200px;
    max-width: 260px;
    transition: border-color .2s, box-shadow .2s;
}
.filter-input:focus {
    border-color: var(--blue-primary);
    box-shadow: 0 0 0 3px rgba(21,101,192,.1);
    outline: none;
}
@media (max-width: 575.98px) {
    .filter-input { min-width: 100%; max-width: 100%; }
}

/* ===================================================
   NOTIFICATION BELL
   =================================================== */
.notif-wrapper {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 1050;
}
.notif-btn {
    position: relative;
    background: #fff;
    border: 1.5px solid var(--card-border);
    border-radius: 50%;
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    color: var(--blue-primary);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(21,101,192,.15);
    transition: background .18s, box-shadow .18s;
}
.notif-btn:hover { background: #EEF3FB; box-shadow: 0 4px 16px rgba(21,101,192,.2); }
.notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: #EF4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    border-radius: 50%;
    min-width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
    border: 2px solid #fff;
    font-family: 'Sarabun', sans-serif;
}
/* Dropdown */
.notif-dropdown {
    position: absolute;
    top: 52px; right: 0;
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(21,101,192,.15);
    width: 320px;
    max-height: 420px;
    overflow: hidden;
    display: flex; flex-direction: column;
    animation: notifFadeIn .18s ease;
}
@keyframes notifFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #EEF0F5;
    background: #F7FAFF;
    border-radius: 12px 12px 0 0;
}
.notif-title { font-size: .95rem; font-weight: 700; color: var(--text-main); }
.notif-close-btn {
    background: none; border: none;
    color: var(--text-muted); font-size: .85rem;
    cursor: pointer; padding: 2px 4px;
    border-radius: 4px;
    transition: background .15s, color .15s;
}
.notif-close-btn:hover { background: #E8EDF5; color: var(--text-main); }
.notif-body { overflow-y: auto; flex: 1; }
.notif-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: .88rem;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #F0F4F8;
    text-decoration: none;
    color: var(--text-main);
    transition: background .15s;
}
.notif-item:hover { background: #F7FAFF; }
.notif-item-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #EEF3FB;
    display: flex; align-items: center; justify-content: center;
    color: var(--blue-primary);
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}
.notif-item-content { flex: 1; min-width: 0; }
.notif-item-title {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-item-sub {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.notif-item-time {
    font-size: .72rem;
    color: var(--blue-primary);
    font-weight: 500;
    white-space: nowrap;
    margin-top: 3px;
}

/* Bell shake animation */
@keyframes bellShake {
    0%,100%{ transform: rotate(0); }
    15%    { transform: rotate(15deg); }
    30%    { transform: rotate(-12deg); }
    45%    { transform: rotate(10deg); }
    60%    { transform: rotate(-8deg); }
    75%    { transform: rotate(5deg); }
}
.notif-btn.has-notif i { animation: bellShake 1.2s ease .5s; }

@media (max-width: 575.98px) {
    .notif-wrapper { top: 12px; right: 12px; }
    .notif-dropdown { width: 290px; right: -8px; }
}

/* Toast notification */
.notif-toast {
    position: fixed;
    top: 72px; right: 20px;
    background: var(--blue-primary);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-family: 'Sarabun', sans-serif;
    font-size: .9rem;
    font-weight: 500;
    box-shadow: 0 6px 24px rgba(21,101,192,.3);
    z-index: 2000;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity .3s, transform .3s;
    max-width: 300px;
}
.notif-toast.show { opacity: 1; transform: translateX(0); }

/* Google Maps link */
.btn-map-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #1565C0;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    background: #EEF3FB;
    border: 1.5px solid #C5D5EA;
    border-radius: 6px;
    padding: 4px 12px;
    transition: background .18s, color .18s;
}
.btn-map-link:hover {
    background: #1565C0;
    color: #fff;
    border-color: #1565C0;
}

/* ===================================================
   JOB CARD PHOTOS ROW
   =================================================== */
.job-photos-row {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
}
.job-photo-thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    border: 1.5px solid var(--card-border);
    flex-shrink: 0;
    display: block;
    transition: opacity .18s;
}
.job-photo-thumb:hover { opacity: .82; }
.job-photo-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.job-photo-more {
    width: 56px; height: 56px;
    border-radius: 6px;
    background: #E8EDF5;
    border: 1.5px solid var(--card-border);
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ===================================================
   LOCATION MODAL
   =================================================== */
.location-modal-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, #EEF3FB, #DBEAFE);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    font-size: 2rem;
    color: var(--blue-primary);
}
.location-warning {
    background: #FFFBEB;
    border: 1.5px solid #FCD34D;
    border-radius: 10px;
    padding: 10px 16px;
    font-size: .83rem;
    color: #92400E;
    line-height: 1.6;
}
.location-warning i { color: #D97706; }

/* ===================================================
   MOBILE COMPACT JOB CARD
   =================================================== */
.job-card-mobile {
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    background: var(--card-bg);
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.jcm-inner {
    display: flex;
    align-items: stretch;
    min-height: 100px;
}
/* Left icon strip */
.jcm-icon {
    width: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.jcm-icon.status-active    { background: #DBEAFE; color: #1D4ED8; }
.jcm-icon.status-pending   { background: #FEF3C7; color: #D97706; }
.jcm-icon.status-confirmed { background: #D1FAE5; color: #059669; }
.jcm-icon.status-done      { background: #D1FAE5; color: #059669; }
.jcm-icon.status-cancelled { background: #FEE2E2; color: #DC2626; }
.jcm-icon.status-postponed { background: #EDE9FE; color: #7C3AED; }

/* Center body */
.jcm-body {
    flex: 1;
    padding: 10px 10px 10px 12px;
    min-width: 0;
    border-right: 1px solid var(--card-border);
}
.jcm-bill {
    font-size: .82rem;
    font-weight: 700;
    color: var(--blue-primary);
    margin-bottom: 3px;
}
.jcm-name {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jcm-phone, .jcm-addr {
    font-size: .76rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jcm-phone i, .jcm-addr i { font-size: .72rem; }

/* Right: date + button */
.jcm-right {
    width: 96px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 8px;
    gap: 4px;
}
.jcm-date {
    background: var(--blue-primary);
    color: #fff;
    border-radius: 8px;
    text-align: center;
    padding: 5px 10px;
    width: 100%;
}
.jcm-date-day {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}
.jcm-date-month {
    font-size: .65rem;
    opacity: .85;
    line-height: 1.3;
}
.jcm-date-year {
    font-size: .65rem;
    opacity: .75;
}
.jcm-time {
    font-size: .72rem;
    color: var(--text-muted);
    font-weight: 500;
}
.jcm-btn {
    font-size: .72rem;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    width: 100%;
    text-align: center;
}

/* Override: mobile card - no icon strip, no date background */
.jcm-icon { display: none !important; }
.jcm-body { border-right: 1px solid var(--card-border); }
.jcm-date {
    background: none !important;
    color: var(--text-main) !important;
    border-radius: 0;
    padding: 0;
    width: 100%;
    text-align: center;
}
.jcm-date-day   { font-size: 1.3rem; font-weight: 700; color: var(--text-main); line-height: 1; }
.jcm-date-month { font-size: .68rem; color: var(--text-muted); line-height: 1.4; }
.jcm-date-year  { font-size: .68rem; color: var(--text-muted); }
.jcm-time       { font-size: .75rem; color: var(--blue-primary); font-weight: 600; }

/* ===================================================
   MOBILE CARD v3 — match sketch layout
   =================================================== */
.job-card-mobile {
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    background: var(--card-bg);
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Row 1: ชื่อ + บิล */
.jcm-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 12px 6px;
    border-bottom: 1px solid #EEF0F5;
    gap: 8px;
}
.jcm-name {
    font-size: .9rem;
    font-weight: 700;
    color: var(--text-main);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.jcm-bill {
    font-size: .8rem;
    font-weight: 700;
    color: var(--blue-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Row 2: ที่อยู่+เบอร์ (left) + วันที่+ปุ่ม (right) */
.jcm-inner {
    display: flex;
    align-items: stretch;
    min-height: 80px;
}
.jcm-body {
    flex: 1;
    padding: 8px 10px 10px 12px;
    min-width: 0;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.jcm-addr {
    font-size: .78rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: flex;
    gap: 5px;
    align-items: flex-start;
}
.jcm-addr i { font-size: .72rem; flex-shrink: 0; margin-top: 2px; }
.jcm-divider {
    border-bottom: 1px solid #EEF0F5;
    margin: 6px 0;
}
.jcm-phone {
    font-size: .8rem;
    color: var(--text-main);
    display: flex;
    gap: 5px;
    align-items: center;
}
.jcm-phone i { font-size: .72rem; flex-shrink: 0; }

/* Right panel: วันที่ + ปุ่ม */
.jcm-right {
    width: 100px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    gap: 6px;
}
.jcm-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    justify-content: center;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 6px 8px;
    width: 100%;
    background: #F8FAFF;
}
.jcm-date-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}
.jcm-date-month-full {
    font-size: .68rem;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
}
.jcm-date-time {
    font-size: .76rem;
    color: var(--blue-primary);
    font-weight: 600;
    margin-top: 3px;
}
.jcm-btn {
    font-size: .72rem;
    padding: 5px 6px;
    border-radius: 6px;
    white-space: nowrap;
    width: 100%;
    text-align: center;
}

/* ===================================================
   MOBILE CARD — date block & button override (v4)
   =================================================== */
.jcm-date-block {
    border: none !important;
    background: none !important;
    padding: 4px 0 !important;
}
.jcm-date-num {
    font-size: 2rem !important;
    font-weight: 800 !important;
    color: var(--text-main) !important;
    line-height: 1 !important;
}
.jcm-date-month-full {
    font-size: .75rem !important;
    color: var(--text-main) !important;
    margin-top: 2px !important;
    line-height: 1.5 !important;
}
.jcm-date-time {
    font-size: .88rem !important;
    color: var(--text-main) !important;
    font-weight: 600 !important;
    margin-top: 2px !important;
}
.jcm-btn {
    background: var(--blue-primary) !important;
    color: #fff !important;
    border-radius: 8px !important;
    font-size: .82rem !important;
    font-weight: 600 !important;
    padding: 7px 6px !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
    text-decoration: none !important;
}
.jcm-btn:hover {
    background: var(--blue-dark) !important;
    color: #fff !important;
}

/* Remove divider line */
.jcm-divider { display: none !important; }

/* Revert date block to original style */
.jcm-date-block {
    border: 1px solid var(--card-border) !important;
    background: #F8FAFF !important;
    padding: 6px 8px !important;
    border-radius: 8px !important;
}
.jcm-date-num         { font-size: 1.5rem !important; }
.jcm-date-month-full  { font-size: .68rem !important; color: var(--text-muted) !important; }
.jcm-date-time        { font-size: .76rem !important; color: var(--blue-primary) !important; font-weight: 600 !important; }

/* ===================================================
   NOTE BOX (detail page)
   =================================================== */
.note-box-wrapper { margin-bottom: 4px; }
.note-box {
    border: 1.5px solid #C5D5EA;
    border-radius: 10px;
    overflow: hidden;
    background: #F8FAFF;
}
.note-box-item {
    padding: 12px 16px;
}
.note-box-label {
    font-size: .82rem;
    font-weight: 700;
    color: var(--blue-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}
.note-box-value {
    font-size: .9rem;
    color: var(--text-main);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}
.note-box-divider {
    border-top: 1.5px dashed #C5D5EA;
    margin: 0;
}

/* ===================================================
   LOADING OVERLAY
   =================================================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.loading-box {
    background: #fff;
    border-radius: 16px;
    padding: 36px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    min-width: 200px;
}
.loading-spinner {
    width: 48px; height: 48px;
    border: 5px solid #E0E7EF;
    border-top-color: var(--blue-primary, #1565C0);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-label {
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
}

/* ===================================================
   PHOTO SLOT STATES
   =================================================== */
.photo-count-label {
    font-size: .8rem;
    font-weight: 500;
    color: var(--blue-primary);
    margin-left: 10px;
}
.upload-status-text {
    font-size: .85rem;
    font-weight: 500;
    color: #374151;
    transition: color .2s;
}
.slot-uploading {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: #F0F4F8;
    border-radius: 6px;
}
.slot-spinner {
    width: 28px; height: 28px;
    border: 3px solid #E0E7EF;
    border-top-color: var(--blue-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.slot-done-badge {
    position: absolute;
    bottom: 4px; right: 4px;
    color: #22C55E;
    font-size: 1.1rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
}
.photo-slot { position: relative; }
.slot-error {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: #FEF2F2;
    border-radius: 6px;
    color: #DC2626;
    font-size: 1.4rem;
}
