/* Staff Dashboard styles - deliberately reuses the exact design
   tokens from the customer-facing dashboard (includes/shortcode-dashboard.php)
   so the two feel like the same product: same gradient, same card
   radius/shadow, same badge and progress-bar colors. */

* { box-sizing: border-box; }

.nps-staff-wrap {
    max-width: 1100px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    background: #f8f9fa;
    padding-bottom: 60px;
}

/* Header - reuses the exact .nps-app-header / .nps-balance-card rules
   from the customer dashboard (includes/shortcode-dashboard.php).
   Duplicated here deliberately: that stylesheet is inline and only
   loads on the customer-facing page, never on staff pages, so staff.css
   needs its own copy of these base rules to look the same. */
.nps-app-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 30px 20px;
    border-bottom-left-radius: 30px;
    border-bottom-right-radius: 30px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    margin-bottom: 20px;
}
.nps-welcome { font-size: 14px; opacity: 0.9; margin-bottom: 5px; }
.nps-user-name { font-size: 24px; font-weight: 700; margin: 0; }
.nps-balance-card {
    background: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 16px 18px;
}
.nps-staff-header-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.nps-staff-logout-link {
    color: #fff;
    background: rgba(255,255,255,0.18);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 20px;
    white-space: nowrap;
}
.nps-staff-readonly-card.nps-balance-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    margin-top: 0;
}

/* Nav - styled as a row of pills below the header, like quick actions */
.nps-staff-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    overflow-x: auto;
    padding: 0 20px;
    margin-bottom: 20px;
}
.nps-staff-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 16px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    white-space: nowrap;
    flex-shrink: 0;
}
.nps-staff-nav-item.is-active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.nps-staff-content { padding: 0 20px; }

/* Login */
.nps-staff-login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 20px;
}
.nps-staff-login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    padding: 32px;
    max-width: 380px;
    width: 100%;
}
.nps-staff-login-header { text-align: center; margin-bottom: 20px; }
.nps-staff-login-header i {
    font-size: 32px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nps-staff-login-header h2 { margin: 8px 0 4px; }
.nps-staff-login-header p { color: #999; font-size: 13px; margin: 0; }

.nps-staff-form-group { margin-bottom: 16px; }
.nps-staff-form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.nps-staff-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.nps-staff-alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.nps-staff-alert-error { background: #f8d7da; color: #721c24; }
.nps-staff-login-footnote { text-align: center; font-size: 12px; color: #999; margin-top: 16px; }

/* Buttons */
.nps-staff-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.nps-staff-btn-block { width: 100%; justify-content: center; }
.nps-staff-btn-outline { background: #fff; color: #667eea; border: 2px solid #667eea; }
.nps-staff-quick-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* Access denied */
.nps-staff-denied { text-align: center; padding: 60px 20px; }
.nps-staff-denied i { font-size: 40px; color: #dc3545; }

/* Dashboard cards */
.nps-staff-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
@media (min-width: 768px) { .nps-staff-cards-grid { grid-template-columns: repeat(4, 1fr); } }
.nps-staff-card {
    background: #fff;
    border-radius: 20px;
    padding: 18px 14px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-bottom: 4px solid #667eea;
    text-decoration: none;
    color: inherit;
    display: block;
}
.nps-staff-card-warn { border-bottom-color: #ffc107; }
.nps-staff-card-danger { border-bottom-color: #dc3545; }
.nps-staff-card-success { border-bottom-color: #28a745; }
.nps-staff-card-icon { font-size: 18px; color: #999; margin-bottom: 6px; }
.nps-staff-card-number { font-size: 24px; font-weight: 700; }
.nps-staff-card-label { font-size: 12px; color: #666; margin-top: 4px; }

/* Section title - matches .nps-section-title in the user dashboard */
.nps-staff-wrap .nps-section-title { padding: 0; margin-bottom: 15px; }
.nps-staff-wrap .nps-section-title h2 { font-size: 18px; font-weight: 700; margin: 0; }

/* Filter bar */
.nps-staff-filter-bar {
    background: #fff;
    padding: 14px;
    border-radius: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.nps-staff-filter-bar input[type=text],
.nps-staff-filter-bar select {
    flex: 1;
    min-width: 180px;
    padding: 9px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

/* Plan cards - matches .nps-installment-card exactly */
.nps-staff-plan-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border-left: 4px solid #667eea;
}
.nps-staff-plan-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 15px; }
.nps-staff-plan-header h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.nps-staff-plan-id { color: #999; font-weight: 400; font-size: 12px; }
.nps-staff-plan-customer { margin: 0; font-size: 12px; color: #666; }

.nps-staff-plan-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 14px 0;
    font-size: 13px;
}
@media (min-width: 640px) { .nps-staff-plan-grid { grid-template-columns: repeat(3, 1fr); } }
.nps-staff-plan-grid span { display: block; color: #999; font-size: 11px; text-transform: uppercase; }
.nps-staff-plan-grid strong { display: block; margin-top: 2px; color: #333; }

.nps-staff-plan-footer { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.nps-staff-link { color: #667eea; text-decoration: none; font-size: 13px; font-weight: 600; }

/* Progress bar - identical to .nps-progress-bar-bg / -fill in the user dashboard */
.nps-progress-bar-bg { background: #f0f0f0; height: 8px; border-radius: 4px; overflow: hidden; margin: 4px 0; }
.nps-progress-bar-fill { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 4px; }

/* Badges - identical classes/colors to the user dashboard's badge-active / badge-completed / badge-overdue */
.nps-installment-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge-active { background: #e3f2fd; color: #1976d2; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-overdue { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-never-paid { background: #343a40; color: #fff; }

/* Tables */
.nps-staff-table-wrap { overflow-x: auto; border-radius: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.nps-staff-table { width: 100%; border-collapse: collapse; background: #fff; }
.nps-staff-table th, .nps-staff-table td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid #f0f0f0; }
.nps-staff-table th { background: #f8f9fa; font-size: 11px; text-transform: uppercase; color: #999; }
.nps-staff-table tr:last-child td { border-bottom: none; }

.nps-staff-empty { text-align: center; color: #999; padding: 40px 0; }

/* Customer profile */
.nps-staff-customer-profile { display: flex; align-items: center; gap: 16px; background: #fff; padding: 20px; border-radius: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); margin-bottom: 20px; }
.nps-staff-avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; flex-shrink: 0; }
.nps-staff-customer-profile h2 { margin: 0 0 4px; font-size: 18px; }
.nps-staff-customer-profile p { margin: 2px 0; font-size: 13px; color: #666; }
.nps-staff-muted { color: #999 !important; }
.nps-staff-section-title { margin: 24px 0 12px; font-size: 15px; font-weight: 700; }

/* Pagination */
.nps-staff-pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 20px 0; font-size: 13px; }
.nps-staff-page-link { color: #667eea; text-decoration: none; font-weight: 600; }

/* -----------------------------------------------------------------
   Per-plan mini payment calendar.
   Built as a plain HTML <table>, not CSS grid + aspect-ratio: this
   renders identically on every browser/WebView (including older
   Android WebViews) with zero dependency on modern CSS layout
   features, which is what made the earlier grid-based version fail
   to display correctly on some devices.
   ----------------------------------------------------------------- */
.nps-mini-cal {
    margin: 15px 0 5px;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
}
.nps-mini-cal-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}
.nps-mini-cal-title i { color: #667eea; margin-right: 4px; }
.nps-mini-cal-count { color: #999; font-weight: 400; margin-left: 6px; }
.nps-mini-cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.nps-mini-cal-month { font-size: 13px; font-weight: 700; color: #333; }
.nps-mini-cal-nav-btn {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    padding: 4px 12px;
    border-radius: 8px;
    background: #f0f2fa;
}

.nps-mini-cal-table { width: 100%; max-width: 320px; border-collapse: collapse; table-layout: fixed; }
.nps-mini-cal-table th {
    font-size: 9px;
    font-weight: 700;
    color: #aaa;
    text-transform: uppercase;
    text-align: center;
    padding: 4px 0;
}
.nps-mini-cal-table td {
    text-align: center;
    vertical-align: middle;
    font-size: 11px;
    color: #555;
    height: 30px;
    width: 14.28%;
    padding: 2px;
}
.nps-mini-cal-table td.nps-mini-cal-empty { background: transparent; }
.nps-mini-cal-day {
    background: #f8f9fa;
    border-radius: 6px;
}
/* Fallback class-based colors in case inline styles are ever stripped
   (e.g. by an overzealous "sanitize HTML" step somewhere) - the inline
   !important styles on the actual <td> elements are what's authoritative
   and win in the normal case. */
.nps-mini-cal-day.is-paid { background: #28a745; color: #fff; font-weight: 700; }
.nps-mini-cal-day.is-today:not(.is-paid) { background: #fff; border: 2px solid #667eea; color: #667eea; font-weight: 700; }

.nps-mini-cal-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 11px; color: #888; }
.nps-mini-cal-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 5px;
    vertical-align: middle;
}
.nps-mini-cal-swatch.is-paid { background: #28a745; }
.nps-mini-cal-swatch.is-today { border: 1.5px solid #667eea; background: #fff; }

@media (max-width: 480px) {
    .nps-staff-content { padding: 0 15px; }
    .nps-staff-nav { padding: 0 15px; }
    .nps-staff-header.nps-app-header { padding: 25px 15px; }
    .nps-mini-cal-table td { height: 26px; font-size: 10px; }
}
