/* Import Open Sans font - must be first */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');

/**
 * TPM Dashboard Styles
 * 
 * External CSS for therapist dashboard, patient data, AI analysis, and credits pages.
 * Extracted from inline styles to prevent Salient theme conflicts.
 *
 * @package TPM
 * @version 7.6.260
 * @since   7.1.89
  * Scoped to body.tpm-page to override theme styles
 */

/* ==========================================================================
   CSS Variables (Design Tokens)
   
   TPM uses CSS custom properties for easy theming. Override these in your
   theme CSS or the Custom CSS settings to customize the look.
   
   Typography inherits from your theme by default - TPM adapts to your site's
   fonts, sizes, and line heights automatically.
   ========================================================================== */
:root {
    /* Colors - override these to match your theme */
    --tpm-primary: #0073aa;
    --tpm-primary-hover: #005a87;
    --tpm-success: #28a745;
    --tpm-success-hover: #218838;
    --tpm-warning: #f57c00;
    --tpm-danger: #dc3545;
    --tpm-danger-hover: #c82333;
    --tpm-secondary: #6c757d;
    --tpm-secondary-hover: #5a6268;
    
    /* Text colors */
    --tpm-text: #1e1e1e;
    --tpm-text-muted: #666;
    --tpm-text-light: #888;
    
    /* Backgrounds & borders */
    --tpm-border: #e8e8e8;
    --tpm-bg: #f8f9fa;
    --tpm-bg-white: #fff;
    
    /* Effects */
    --tpm-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --tpm-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
    
    /* Border radius - adjust for sharper or rounder corners */
    --tpm-radius: 8px;
    --tpm-radius-sm: 6px;
    --tpm-radius-pill: 20px;
}

/* ==========================================================================
   TPM Typography Reset - Consistent fonts across all elements
   ========================================================================== */

/* Base font settings for all TPM elements (excludes Bootstrap and Font Awesome) */
body.tpm-page [class*="tpm-"]:not([class*="fa-"]):not([class*="icon-"]),
body.tpm-page [class*="tpm-"] p,
body.tpm-page [class*="tpm-"] span:not([class*="fa-"]):not([class*="icon-"]),
body.tpm-page [class*="tpm-"] a,
body.tpm-page [class*="tpm-"] strong,
body.tpm-page [class*="tpm-"] em,
body.tpm-page [class*="tpm-"] b,
body.tpm-page [class*="tpm-"] label,
body.tpm-page [class*="tpm-"] li,
body.tpm-page [class*="tpm-"] td,
body.tpm-page [class*="tpm-"] th,
body.tpm-page [class*="tpm-"] div:not([class*="fa-"]):not([class*="icon-"]),
body.tpm-page [class*="tpm-"] button:not([class*="btn-"]),
body.tpm-page [class*="tpm-"] input,
body.tpm-page [class*="tpm-"] select,
body.tpm-page [class*="tpm-"] textarea,
body.tpm-page [class*="tpm-"] option {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 1rem !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

/* Bold/strong elements - same font, just bolder */
body.tpm-page [class*="tpm-"] strong,
body.tpm-page [class*="tpm-"] b {
    font-weight: 600 !important;
}

/* Headings - larger sizes and weights for prominence */
body.tpm-page [class*="tpm-"] h1 {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 2rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

body.tpm-page [class*="tpm-"] h2 {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

body.tpm-page [class*="tpm-"] h3 {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

body.tpm-page [class*="tpm-"] h4 {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

body.tpm-page [class*="tpm-"] h5,
body.tpm-page [class*="tpm-"] h6 {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}

/* Small text - for captions, hints, and secondary info */
body.tpm-page [class*="tpm-"] small,
body.tpm-page [class*="tpm-"] .tpm-text-small,
body.tpm-page [class*="tpm-"] .tpm-hint,
body.tpm-page [class*="tpm-"] .tpm-caption {
    font-size: 0.875rem !important;
    font-weight: 400 !important;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
body.tpm-page .tpm-hidden {
    display: none !important;
}

/* ==========================================================================
   Base Dashboard Layout
   ========================================================================== */
body.tpm-page .tpm-therapist-dashboard {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: var(--tpm-text);
}

/* Admin Navigation Bar */
body.tpm-page .tpm-admin-nav {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    padding: 12px 20px;
    border-radius: var(--tpm-radius);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
}

body.tpm-page .tpm-admin-nav-link {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875em;
    padding: 0.5em 1em;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    transition: all 0.2s ease;
}

body.tpm-page .tpm-admin-nav-link:hover {
    background: rgba(255,255,255,0.3);
    color: #fff;
    text-decoration: none;
}

body.tpm-page .tpm-admin-badge {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6875em;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

body.tpm-page .tpm-dashboard-header {
    background: var(--tpm-bg-white);
    padding: 25px 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
    border-left: 4px solid var(--tpm-primary);
}

body.tpm-page .tpm-dashboard-header h2 {
    margin: 0 0 5px 0;
    color: var(--tpm-text);
    font-size: 1.5em;
    font-weight: 600;
}

body.tpm-page .tpm-dashboard-header p {
    margin: 0;
    color: var(--tpm-text-muted);
    font-size: 0.875em;
}

/* ==========================================================================
   Stats Grid
   ========================================================================== */
body.tpm-page .tpm-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

body.tpm-page .tpm-stat-box {
    background: var(--tpm-bg-white);
    padding: 25px;
    border-radius: var(--tpm-radius);
    box-shadow: var(--tpm-shadow);
    border: 1px solid var(--tpm-border);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: box-shadow 0.2s, transform 0.2s;
}

body.tpm-page .tpm-stat-box:hover {
    box-shadow: var(--tpm-shadow-hover);
    transform: translateY(-2px);
}

body.tpm-page .tpm-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    flex-shrink: 0;
}

body.tpm-page .tpm-stat-icon-patients {
    background: #e8f4fd;
    color: var(--tpm-primary);
}

body.tpm-page .tpm-stat-icon-credits {
    background: #e8f5e9;
    color: #2e7d32;
}

body.tpm-page .tpm-stat-icon-action {
    background: #fff3e0;
    color: #e65100;
}

body.tpm-page .tpm-stat-content {
    flex: 1;
}

body.tpm-page .tpm-stat-number {
    font-size: 2em;
    font-weight: 700;
    color: var(--tpm-text);
    line-height: 1.2;
}

body.tpm-page .tpm-stat-label {
    font-size: 0.875em;
    color: var(--tpm-text-muted);
    margin-top: 2px;
}

body.tpm-page .tpm-stat-action {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

body.tpm-page .tpm-stat-action .tpm-stat-icon {
    margin: 0 auto 15px;
}

/* Assessments stat box - wider format */
body.tpm-page .tpm-stat-box-wide {
    min-width: 280px;
}

body.tpm-page .tpm-stat-icon-assessments {
    background: #f3e5f5;
    color: #7b1fa2;
}

body.tpm-page .tpm-stat-icon-ai {
    background: #e3f2fd;
    color: #1565c0;
}

body.tpm-page .tpm-stat-breakdown {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

body.tpm-page .tpm-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

body.tpm-page .tpm-stat-mini-number {
    font-size: 1.5em;
    font-weight: 700;
    line-height: 1.2;
}

body.tpm-page .tpm-stat-mini-label {
    font-size: 0.75em;
    color: var(--tpm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-stat-completed {
    color: #2e7d32;
}

body.tpm-page .tpm-stat-ongoing {
    color: #f57c00;
}

body.tpm-page .tpm-stat-pending {
    color: #1976d2;
}

body.tpm-page .tpm-stat-failed {
    color: #c62828;
}

/* ==========================================================================
   Quick Actions Bar
   ========================================================================== */
body.tpm-page .tpm-quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

body.tpm-page .tpm-quick-actions .tpm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

body.tpm-page .tpm-btn-active {
    background: var(--tpm-primary-hover) !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
}

body.tpm-page .tpm-btn-secondary.tpm-btn-active {
    background: #5a6268 !important;
    color: white !important;
}

/* ==========================================================================
   Buttons
   
   All TPM buttons use consistent padding to override theme-specific styles.
   ========================================================================== */

body.tpm-page .tpm-btn,
body.tpm-page .btn.tpm-btn,
body.tpm-page button.tpm-btn,
body.tpm-page a.tpm-btn,
body.tpm-page input.tpm-btn,
body.tpm-page button[type="submit"].tpm-btn,
body.tpm-page button[type="submit"].btn,
body.tpm-page button[type="button"].tpm-btn,
body.tpm-page button[type="button"].btn {
    display: inline-block;
    padding: 0.375rem 0.75rem !important;
    height: auto !important;
    min-height: auto !important;
    color: white;
    text-decoration: none !important;
    border-radius: var(--tpm-radius-sm);
    border: none !important;
    cursor: pointer;
    font-weight: 500 !important;
    transition: background 0.2s, transform 0.2s;
}

body.tpm-page .tpm-btn:hover {
    background: var(--tpm-primary-hover);
    transform: translateY(-1px);
    color: white;
    text-decoration: none !important;
}

/* Default: tpm-btn without any variant class gets primary styling */
body.tpm-page .tpm-btn:not(.tpm-btn-primary):not(.tpm-btn-secondary):not(.tpm-btn-danger):not(.tpm-btn-success):not(.tpm-btn-warning):not(.tpm-btn-info):not(.tpm-btn-outline):not(.tpm-btn-link) {
    background: var(--tpm-primary) !important;
    color: #ffffff !important;
}

body.tpm-page .tpm-btn:not(.tpm-btn-primary):not(.tpm-btn-secondary):not(.tpm-btn-danger):not(.tpm-btn-success):not(.tpm-btn-warning):not(.tpm-btn-info):not(.tpm-btn-outline):not(.tpm-btn-link):hover {
    background: var(--tpm-primary-hover) !important;
    color: #ffffff !important;
}

body.tpm-page .tpm-btn-primary,
body.tpm-page .tpm-btn.tpm-btn-primary {
    background: var(--tpm-primary) !important;
    color: #ffffff !important;
}

body.tpm-page .tpm-btn-primary:hover,
body.tpm-page .tpm-btn.tpm-btn-primary:hover {
    background: var(--tpm-primary-hover) !important;
    color: #ffffff !important;
}

/* Ensure button text/spans inside buttons stay white (except outline) */
body.tpm-page .tpm-btn:not(.tpm-btn-outline):not(.tpm-btn-link) span,
body.tpm-page .tpm-btn:not(.tpm-btn-outline):not(.tpm-btn-link) .btn-text,
body.tpm-page .tpm-btn:not(.tpm-btn-outline):not(.tpm-btn-link) .btn-loading {
    color: #ffffff !important;
}

body.tpm-page .tpm-btn-secondary {
    background: var(--tpm-secondary) !important;
    color: white !important;
}

body.tpm-page .tpm-btn-secondary:hover {
    background: var(--tpm-secondary-hover) !important;
    color: white !important;
}

body.tpm-page .tpm-btn-success {
    background: var(--tpm-success) !important;
    color: white !important;
}

body.tpm-page .tpm-btn-success:hover {
    background: var(--tpm-success-hover) !important;
    color: white !important;
}

body.tpm-page .tpm-btn-danger {
    background: var(--tpm-danger) !important;
    color: white !important;
}

body.tpm-page .tpm-btn-danger:hover {
    background: var(--tpm-danger-hover) !important;
    color: white !important;
}

body.tpm-page .tpm-btn-warning {
    background: #f59e0b !important;
    color: white !important;
}

body.tpm-page .tpm-btn-warning:hover {
    background: #d97706 !important;
    color: white !important;
}

body.tpm-page .tpm-btn:disabled ,
body.tpm-page .tpm-btn.disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed !important;
    transform: none !important;
}

body.tpm-page .tpm-btn-small {
    font-size: 0.875em;
    margin-right: 5px;
}

body.tpm-page .tpm-btn-large {
    font-size: 1.125em;
}

body.tpm-page .tpm-add-patient-btn {
    background: var(--tpm-primary);
    border: none;
    color: white;
    border-radius: var(--tpm-radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    transition: background 0.2s, transform 0.2s;
}

body.tpm-page .tpm-add-patient-btn:hover {
    background: var(--tpm-primary-hover);
    transform: translateY(-1px);
}

body.tpm-page .tpm-credits-link {
    display: inline-block;
    margin-top: 0.5em;
    color: var(--tpm-primary);
    text-decoration: none;
    font-size: 0.875em;
    font-weight: 500;
    transition: color 0.2s;
}

body.tpm-page .tpm-credits-link:hover {
    color: var(--tpm-primary-hover);
    text-decoration: underline;
}

body.tpm-page .tpm-archived-link {
    display: inline-block;
    margin-top: 0.5em;
    color: #92400e;
    text-decoration: none;
    font-size: 0.8em;
    font-weight: 500;
    transition: color 0.2s;
}

body.tpm-page .tpm-archived-link:hover {
    color: #78350f;
    text-decoration: underline;
}

/* Archived Section */
body.tpm-page .tpm-archived-section {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

body.tpm-page .tpm-archived-section h3 {
    margin: 0 0 10px 0;
    font-size: 1.125em;
    color: #92400e;
}

body.tpm-page .tpm-archived-section .tpm-section-description {
    margin: 0 0 20px 0;
    color: #92400e;
    font-size: 0.875em;
}

body.tpm-page .tpm-archived-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--tpm-radius);
}

body.tpm-page .tpm-archived-table th ,
body.tpm-page .tpm-archived-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--tpm-border);
}

body.tpm-page .tpm-archived-table th {
    background: var(--tpm-bg);
    font-weight: 600;
    font-size: 0.875em;
    color: var(--tpm-text-muted);
}

body.tpm-page .tpm-archived-table tbody tr:last-child td {
    border-bottom: none;
}

body.tpm-page .tpm-archived-table tbody tr:hover {
    background: #fef3c7;
}

/* ==========================================================================
   Dashboard Sections
   ========================================================================== */
body.tpm-page .tpm-dashboard-section {
    background: var(--tpm-bg-white);
    padding: 25px 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 20px;
    box-shadow: var(--tpm-shadow);
    border: 1px solid var(--tpm-border);
}

body.tpm-page .tpm-dashboard-section h3 {
    margin: 0 0 20px 0;
    color: var(--tpm-text);
    font-size: 1.125em;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-section-header h3 {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}

body.tpm-page .tpm-dashboard-actions {
    text-align: center;
    padding: 20px;
}

/* ==========================================================================
   Forms
   ========================================================================== */
body.tpm-page .tpm-form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

body.tpm-page .tpm-form-group {
    flex: 1;
}

body.tpm-page .tpm-form-group label {
    display: block;
    margin-bottom: 0.375em;
    font-weight: 500;
    color: #333;
    font-size: 0.875em;
}

body.tpm-page .tpm-input {
    width: 100%;
    padding: 0.625em 0.875em;
    border: 1px solid #ddd;
    border-radius: var(--tpm-radius-sm);
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.tpm-page .tpm-input:focus {
    outline: none;
    border-color: var(--tpm-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

body.tpm-page .tpm-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ==========================================================================
   Login Form (Auth Pages)
   ========================================================================== */
body.tpm-page .tpm-login-form {
    max-width: 400px;
    margin: 30px auto;
    padding: 30px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: var(--tpm-radius);
    box-shadow: var(--tpm-shadow);
}

body.tpm-page .tpm-login-form h2 {
    margin: 0 0 5px 0;
    text-align: center;
    color: #333;
    font-size: 1.5em;
}

body.tpm-page .tpm-login-subtitle {
    text-align: center;
    color: #666;
    margin: 0 0 25px 0;
    font-size: 0.875em;
}

body.tpm-page .tpm-login-form .tpm-form-group {
    margin-bottom: 20px;
    flex: none;
}

body.tpm-page .tpm-login-form .tpm-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 0.875em;
}

body.tpm-page .tpm-login-form .tpm-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9375em;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

body.tpm-page .tpm-login-form .tpm-input:focus {
    outline: none !important;
    border-color: var(--tpm-primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1) !important;
}

body.tpm-page .tpm-login-form .tpm-input::placeholder {
    color: #999;
}

body.tpm-page .tpm-login-form .tpm-btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

body.tpm-page .tpm-login-form .tpm-btn:active {
    transform: scale(0.98);
}

body.tpm-page .tpm-login-form .tpm-link {
    color: #64748b !important;
    font-size: 0.875em !important;
    text-decoration: none !important;
    transition: color 0.2s;
}

body.tpm-page .tpm-login-form .tpm-link:hover {
    color: #334155 !important;
    text-decoration: underline !important;
}

body.tpm-page .tpm-login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 18px 0;
}

/* ==========================================================================
   Bulk Import
   ========================================================================== */
body.tpm-page .tpm-section-description {
    color: #666;
    margin-bottom: 20px;
}

body.tpm-page .tpm-download-template-link {
    display: inline-block;
    margin-left: 10px;
    color: var(--tpm-primary);
    text-decoration: none;
    font-weight: 500;
}

body.tpm-page .tpm-download-template-link:hover {
    text-decoration: underline;
}

body.tpm-page .tpm-btn-download-template {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 1em;
    font-weight: 600;
}

body.tpm-page .tpm-bulk-import-container ,
body.tpm-page .tpm-bulk-import-area {
    max-width: 700px;
}

/* File Drop Zone Styles */
body.tpm-page .tpm-file-drop-zone {
    border: 2px dashed #ccc;
    border-radius: var(--tpm-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

body.tpm-page .tpm-file-drop-zone:hover ,
body.tpm-page .tpm-file-drop-zone.tpm-drag-over {
    border-color: var(--tpm-primary);
    background: #f0f7ff;
}

body.tpm-page .tpm-drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

body.tpm-page .tpm-drop-zone-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

body.tpm-page .tpm-drop-zone-content p {
    margin: 0;
    color: #333;
}

body.tpm-page .tpm-drop-zone-content .tpm-text-muted {
    color: #666;
    font-size: 0.875em;
}

body.tpm-page .tpm-browse-link {
    color: var(--tpm-primary);
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
}

body.tpm-page .tpm-browse-link:hover {
    color: var(--tpm-primary-hover);
}

/* Legacy upload area styles */
body.tpm-page .tpm-upload-area {
    border: 2px dashed #ccc;
    border-radius: var(--tpm-radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

body.tpm-page .tpm-upload-area:hover ,
body.tpm-page .tpm-upload-area.tpm-drag-over {
    border-color: var(--tpm-primary);
    background: #f0f7ff;
}

body.tpm-page .tpm-upload-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

body.tpm-page .tpm-upload-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

body.tpm-page .tpm-upload-text strong {
    font-size: 1em;
    color: #333;
}

body.tpm-page .tpm-upload-text span {
    color: #666;
    font-size: 0.875em;
}

body.tpm-page .tpm-upload-hint {
    margin-top: 15px;
    font-size: 0.75em;
    color: #999;
}

body.tpm-page .tpm-template-download {
    margin-top: 15px;
    text-align: center;
}

body.tpm-page .tpm-bulk-preview {
    margin-top: 25px;
    border: 1px solid #e0e0e0;
    border-radius: var(--tpm-radius);
    overflow: hidden;
}

body.tpm-page .tpm-bulk-preview h4 {
    margin: 0;
    padding: 12px 15px;
    background: var(--tpm-bg);
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.875em;
}

body.tpm-page .tpm-bulk-preview h4 span {
    font-weight: normal;
    color: #666;
    margin-left: 8px;
}

body.tpm-page .tpm-bulk-preview-table-wrapper {
    max-height: 300px;
    overflow-y: auto;
}

body.tpm-page .tpm-bulk-preview-table {
    width: 100%;
    border-collapse: collapse;
}

body.tpm-page .tpm-bulk-preview-table th ,
body.tpm-page .tpm-bulk-preview-table td {
    padding: 10px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.8125em;
}

body.tpm-page .tpm-bulk-preview-table th {
    background: #f9f9f9;
    font-weight: 600;
    position: sticky;
    top: 0;
}

body.tpm-page .tpm-bulk-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.6875em;
    font-weight: 500;
}

body.tpm-page .tpm-status-pending {
    background: #e5e7eb;
    color: #4b5563;
}

body.tpm-page .tpm-status-pending-summary {
    background: #e5e7eb;
    color: #4b5563;
}

body.tpm-page .tpm-status-in-progress {
    background: #dbeafe;
    color: #1d4ed8;
}

body.tpm-page .tpm-status-in-progress-summary {
    background: #dbeafe;
    color: #1d4ed8;
}

body.tpm-page .tpm-status-expired {
    background: #fef3cd;
    color: #856404;
}

body.tpm-page .tpm-status-error {
    background: #ffebee;
    color: #c62828;
}

body.tpm-page .tpm-status-success {
    background: #e8f5e9;
    color: #2e7d32;
}

body.tpm-page .tpm-bulk-errors {
    padding: 12px 15px;
    background: #fff8e1;
    border-top: 1px solid #ffe082;
    color: #f57c00;
    font-size: 0.8125em;
}

body.tpm-page .tpm-bulk-errors .tpm-error {
    color: #c62828;
}

body.tpm-page .tpm-bulk-errors .tpm-warning {
    color: #f57c00;
}

/* Row status styles for bulk import */
body.tpm-page tr.tpm-row-error {
    background: #ffebee;
}

body.tpm-page tr.tpm-row-error td:first-child {
    border-left: 3px solid #c62828;
}

body.tpm-page tr.tpm-row-exists {
    background: #fff8e1;
}

body.tpm-page tr.tpm-row-exists td:first-child {
    border-left: 3px solid #f57c00;
}

body.tpm-page tr.tpm-row-valid {
    background: #e8f5e9;
}

body.tpm-page tr.tpm-row-valid td:first-child {
    border-left: 3px solid #2e7d32;
}

/* Inline error/warning/info messages in cells */
body.tpm-page div.tpm-row-error ,
body.tpm-page div.tpm-row-warning ,
body.tpm-page div.tpm-row-info {
    display: block;
    font-size: 0.85em;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 3px;
}

body.tpm-page div.tpm-row-error {
    color: #c62828;
    background: #ffcdd2;
}

body.tpm-page div.tpm-row-warning {
    color: #e65100;
    background: #ffe0b2;
}

body.tpm-page div.tpm-row-info {
    color: #1565c0;
    background: #bbdefb;
}

/* Status badge warning */
body.tpm-page .tpm-status-warning {
    background: #fff3e0;
    color: #e65100;
}

body.tpm-page .tpm-bulk-progress {
    margin-top: 20px;
}

body.tpm-page .tpm-progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

body.tpm-page .tpm-progress-bar-fill {
    height: 100%;
    background: var(--tpm-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

body.tpm-page .tpm-progress-text {
    margin-top: 8px;
    font-size: 0.8125em;
    color: #666;
    text-align: center;
}

body.tpm-page .tpm-bulk-result {
    margin-top: 20px;
}

body.tpm-page .tpm-alert-warning {
    background: #fff8e1;
    border-color: #ffe082;
    color: #e65100;
}

body.tpm-page .tpm-setup-links-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: var(--tpm-radius);
}

body.tpm-page .tpm-setup-links-section h4 {
    margin: 0 0 10px 0;
    font-size: 1em;
    color: #333;
}

body.tpm-page .tpm-setup-links-note {
    font-size: 0.8125em;
    color: #666;
    margin-bottom: 15px;
}

body.tpm-page .tpm-setup-links-actions {
    margin-bottom: 15px;
}

body.tpm-page .tpm-setup-links-table-wrapper {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

body.tpm-page .tpm-setup-links-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125em;
}

body.tpm-page .tpm-setup-links-table th ,
body.tpm-page .tpm-setup-links-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-setup-links-table th {
    background: #f5f5f5;
    font-weight: 600;
    position: sticky;
    top: 0;
}

body.tpm-page .tpm-setup-link-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.75em;
    background: #fff;
    cursor: text;
}

body.tpm-page .tpm-setup-link-input:focus {
    border-color: var(--tpm-primary);
    outline: none;
}

/* ==========================================================================
   Tables
   ========================================================================== */

/* Scrollable table containers with max-height */
body.tpm-page .tpm-table-scroll-container {
    position: relative;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--tpm-border);
    border-radius: var(--tpm-radius);
    background: var(--tpm-bg-white);
    /* Prevent scroll chaining to parent/page when at boundaries */
    overscroll-behavior: contain;
}

body.tpm-page .tpm-table-scroll-container.tpm-table-sm {
    max-height: 300px;
}

body.tpm-page .tpm-table-scroll-container.tpm-table-md {
    max-height: 400px;
}

body.tpm-page .tpm-table-scroll-container.tpm-table-lg {
    max-height: 600px;
}

/* Visual cue when hovering over scrollable container */
body.tpm-page .tpm-table-scroll-container.has-scroll {
    cursor: default;
}

body.tpm-page .tpm-table-scroll-container.has-scroll:hover {
    border-color: #cbd5e1;
}

/* Inner shadow at bottom when scrollable and not at bottom */
body.tpm-page .tpm-table-scroll-container.has-scroll:not(.scrolled-to-bottom) {
    box-shadow: inset 0 -20px 20px -20px rgba(0,0,0,0.1);
}

/* Sticky header for tables inside scroll container */
body.tpm-page .tpm-table-scroll-container .tpm-patients-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--tpm-bg);
    box-shadow: 0 1px 0 #eee;
}

body.tpm-page .tpm-patients-table {
    width: 100%;
    border-collapse: collapse;
}

body.tpm-page .tpm-patients-table th ,
body.tpm-page .tpm-patients-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-patients-table th {
    background: var(--tpm-bg);
    font-weight: 600;
    font-size: 0.8125em;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

body.tpm-page .tpm-patients-table tbody tr {
    transition: background-color 0.15s;
}

body.tpm-page .tpm-patients-table tbody tr:hover {
    background: var(--tpm-bg);
}

body.tpm-page .tpm-patients-table td strong {
    color: var(--tpm-text);
}

body.tpm-page .tpm-patients-table tr {
    transition: background-color 0.3s ease, opacity 0.3s ease;
}

body.tpm-page .tpm-inactive-row {
    background: #fafafa;
}

body.tpm-page .tpm-inactive-row td {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

body.tpm-page .tpm-inactive-row:hover td {
    opacity: 1;
}

body.tpm-page .tpm-new-row {
    animation: tpm-highlight-fade 1.5s ease-out;
}

@keyframes tpm-highlight-fade {
    0% {
        background-color: #e8f5e9;
    }
    100% {
        background-color: transparent;
    }
}

/* ==========================================================================
   Pagination
   ========================================================================== */
body.tpm-page .tpm-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    margin-top: 15px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
}

body.tpm-page .tpm-pagination-info {
    font-size: 0.875em;
    color: var(--tpm-text-muted);
}

body.tpm-page .tpm-pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.tpm-page .tpm-pagination-pages {
    display: flex;
    align-items: center;
    gap: 4px;
}

body.tpm-page .tpm-pagination-pages .tpm-btn {
    min-width: 36px;
    text-align: center;
}

body.tpm-page .tpm-pagination-ellipsis {
    padding: 0 8px;
    color: var(--tpm-text-muted);
}

body.tpm-page .tpm-pagination-perpage {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875em;
    color: var(--tpm-text-muted);
}

body.tpm-page .tpm-pagination-perpage select {
    padding: 6px 10px;
    border: 1px solid var(--tpm-border);
    border-radius: var(--tpm-radius-sm);
    background: var(--tpm-bg-white);
    font-size: inherit;
}

@media (max-width: 768px) {
    body.tpm-page .tpm-pagination {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    body.tpm-page .tpm-pagination-controls {
        justify-content: center;
    }
    
    body.tpm-page .tpm-pagination-perpage {
        justify-content: center;
    }
}

/* ==========================================================================
   Status Badges
   ========================================================================== */
body.tpm-page .tpm-status {
    display: inline-block;
    padding: 0.3em 0.75em;
    border-radius: var(--tpm-radius-pill);
    font-size: 0.75em;
    font-weight: 600;
}

body.tpm-page .tpm-status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

body.tpm-page .tpm-status-inactive {
    background: #ffebee;
    color: #c62828;
}

body.tpm-page .tpm-status-pending {
    background: #e5e7eb;
    color: #4b5563;
}

body.tpm-page .tpm-status-pending-summary {
    background: #e5e7eb;
    color: #4b5563;
}

body.tpm-page .tpm-status-in-progress {
    background: #dbeafe;
    color: #1d4ed8;
}

body.tpm-page .tpm-status-in-progress-summary {
    background: #dbeafe;
    color: #1d4ed8;
}

body.tpm-page .tpm-status-completed {
    background: #d4edda;
    color: #155724;
}

body.tpm-page .tpm-status-abandoned {
    background: #e2e3e5;
    color: #383d41;
}

/* Questionnaire variant badges */
body.tpm-page .tpm-variant-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 9999px;
    margin-left: 8px;
    vertical-align: middle;
}

body.tpm-page .tpm-variant-short {
    background: #fef3c7;
    color: #92400e;
}

body.tpm-page .tpm-variant-full {
    background: #dbeafe;
    color: #1e40af;
}

body.tpm-page .tpm-status-setup-needed {
    background: #fef3c7;
    color: #b45309;
    font-size: 0.75em;
    padding: 2px 6px;
    margin-left: 4px;
    cursor: help;
}

body.tpm-page .tpm-needs-setup-info {
    color: #b45309;
    font-size: 0.875em;
}

/* ==========================================================================
   Pending Details Expandable Row
   ========================================================================== */
body.tpm-page .tpm-pending-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

body.tpm-page .tpm-pending-toggle:hover {
    opacity: 0.85;
}

body.tpm-page .tpm-assignment-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: default;
}

body.tpm-page .tpm-pending-toggle:hover .tpm-status-pending {
    filter: brightness(0.95);
}

body.tpm-page .tpm-expand-icon {
    font-size: 0.625em;
    color: #666;
    transition: transform 0.2s ease;
}

body.tpm-page .tpm-pending-toggle.expanded .tpm-expand-icon {
    transform: rotate(180deg);
}

body.tpm-page .tpm-pending-details-row {
    background: #f9fafb;
}

body.tpm-page .tpm-pending-details-row > td {
    padding: 0 !important;
    border-top: none !important;
}

body.tpm-page .tpm-pending-details {
    padding: 12px 20px 12px 50px;
    border-top: 1px dashed #e5e7eb;
}

body.tpm-page .tpm-pending-details strong {
    font-size: 0.75em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-pending-list {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.tpm-page .tpm-pending-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.8125em;
}

body.tpm-page .tpm-pending-name {
    color: #92400e;
    font-weight: 500;
}

body.tpm-page .tpm-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.75em;
    line-height: 1;
    border-radius: 3px;
    transition: all 0.15s ease;
}

body.tpm-page .tpm-btn-icon:hover {
    background: #fee2e2;
    color: #dc2626;
}

body.tpm-page .tpm-remove-assignment {
    margin-left: 4px;
}

/* Assignments sections */
body.tpm-page .tpm-assignments-section {
    margin-bottom: 12px;
}

body.tpm-page .tpm-assignments-section:last-child {
    margin-bottom: 0;
}

body.tpm-page .tpm-assignments-completed {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #d1d5db;
}

body.tpm-page .tpm-completed-list {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.tpm-page .tpm-completed-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.8125em;
}

body.tpm-page .tpm-completed-name {
    color: #065f46;
    font-weight: 500;
}

body.tpm-page .tpm-completed-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

body.tpm-page .tpm-completed-title {
    font-size: 0.75rem;
    color: #047857;
    font-weight: 500;
    font-style: italic;
}

body.tpm-page .tpm-completed-subtitle {
    font-size: 0.6875rem;
    color: #10b981;
    font-weight: 400;
}

body.tpm-page .tpm-completed-date {
    color: #6b7280;
    font-size: 0.6875em;
}

body.tpm-page .tpm-completed-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

body.tpm-page .tpm-completed-clickable:hover {
    background: #d1fae5;
    border-color: #34d399;
    transform: translateX(3px);
}

body.tpm-page .tpm-completed-clickable:hover .tpm-completed-name {
    color: #047857;
}

body.tpm-page .tpm-view-arrow {
    margin-left: auto;
    color: #10b981;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
}

body.tpm-page .tpm-completed-clickable:hover .tpm-view-arrow {
    opacity: 1;
}

/* Redesigned Completed Assessments List */
body.tpm-page .tpm-completed-list-redesign {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

body.tpm-page .tpm-completed-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

body.tpm-page .tpm-completed-item-row:last-child {
    border-bottom: none;
}

body.tpm-page .tpm-completed-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

body.tpm-page .tpm-completed-item-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

body.tpm-page .tpm-item-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

body.tpm-page .tpm-item-title-row .tpm-status {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-weight: 500;
    white-space: nowrap;
}

body.tpm-page .tpm-completed-item-title {
    font-size: 0.9rem;
    color: #4b5563;
    font-style: italic;
}

body.tpm-page .tpm-completed-item-date {
    font-size: 0.8rem;
    color: #9ca3af;
}

body.tpm-page .tpm-view-result {
    color: #10b981;
    font-weight: bold;
    margin-left: auto;
}

/* Result highlight animation */
body.tpm-page .tpm-result-highlight {
    animation: tpm-result-pulse 3s ease-out;
}

@keyframes tpm-result-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
        background-color: #ecfdf5;
    }
    20% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0.3);
        background-color: #d1fae5;
    }
    40% {
        box-shadow: 0 0 0 20px rgba(16, 185, 129, 0);
        background-color: #ecfdf5;
    }
    60% {
        background-color: #d1fae5;
    }
    80% {
        background-color: #ecfdf5;
    }
    100% {
        box-shadow: none;
        background-color: transparent;
    }
}

/* Multiple status badges in toggle */
body.tpm-page .tpm-pending-toggle .tpm-status {
    margin-right: 4px;
}

body.tpm-page .tpm-pending-toggle .tpm-status:last-of-type {
    margin-right: 0;
}

/* ==========================================================================
   Filter Bar
   ========================================================================== */
body.tpm-page .tpm-filter-bar {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

body.tpm-page .tpm-filter-bar .tpm-search-box {
    flex: 0 0 auto;
    width: 250px;
    margin-bottom: 0;
}

/* Search Box Styling */
body.tpm-page .tpm-search-box {
    position: relative;
    display: flex;
    align-items: center;
}

body.tpm-page .tpm-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--tpm-text-muted, #6b7280);
    pointer-events: none;
    z-index: 1;
}

body.tpm-page .tpm-search-icon svg {
    width: 100%;
    height: 100%;
}

body.tpm-page .tpm-icon-search ,
body.tpm-page .tpm-icon-spinner {
    position: absolute;
    top: 0;
    left: 0;
}

body.tpm-page .tpm-icon-spinner {
    animation: tpm-spin 1s linear infinite;
}

@keyframes tpm-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

body.tpm-page .tpm-search-input {
    width: 100%;
    padding: 10px 38px 10px 12px;
    border: 1px solid var(--tpm-border);
    border-radius: var(--tpm-radius-sm);
    font-size: 0.875em;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.tpm-page .tpm-search-input:focus {
    outline: none;
    border-color: var(--tpm-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

body.tpm-page .tpm-search-input::placeholder {
    color: var(--tpm-text-muted, #9ca3af);
}

body.tpm-page .tpm-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: none;
    background: var(--tpm-border);
    color: var(--tpm-text-muted);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

body.tpm-page .tpm-search-clear:hover {
    background: var(--tpm-text-muted);
    color: white;
}

/* Hide search icon when clear button is visible (has text) */
body.tpm-page .tpm-search-box.has-text .tpm-search-icon {
    display: none;
}

body.tpm-page .tpm-search-box.is-searching .tpm-icon-search {
    display: none;
}

body.tpm-page .tpm-search-box.is-searching .tpm-icon-spinner {
    display: block;
}

body.tpm-page .tpm-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

body.tpm-page .tpm-filter-select {
    padding: 8px 12px;
    border: 1px solid var(--tpm-border);
    border-radius: var(--tpm-radius-sm);
    background: white;
    font-size: 0.875em;
    cursor: pointer;
}

body.tpm-page .tpm-filter-select:focus {
    outline: none;
    border-color: var(--tpm-primary);
}

/* ==========================================================================
   Bulk Actions
   ========================================================================== */
body.tpm-page .tpm-bulk-actions {
    background: var(--tpm-bg);
    border: 1px solid var(--tpm-border);
    border-radius: var(--tpm-radius-sm);
    padding: 15px 20px;
    margin-bottom: 15px;
}

body.tpm-page .tpm-bulk-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

body.tpm-page .tpm-bulk-row:last-child {
    margin-bottom: 0;
}

body.tpm-page .tpm-bulk-separator {
    color: var(--tpm-border);
    font-weight: 300;
    padding: 0 5px;
}

body.tpm-page .tpm-credit-indicator {
    margin-left: auto;
    font-size: 0.8125em;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 4px;
}

body.tpm-page .tpm-credit-ok {
    background: #e8f5e9;
    color: #2e7d32;
}

body.tpm-page .tpm-credit-warning {
    background: #ffebee;
    color: #c62828;
}

body.tpm-page .tpm-credit-exact {
    background: #fff8e1;
    color: var(--tpm-warning);
}

/* Bulk Message Styles */
body.tpm-page .tpm-bulk-message {
    display: none;
    padding: 12px 16px;
    border-radius: var(--tpm-radius-sm);
    margin-top: 12px;
    font-size: 0.875em;
    font-weight: 500;
}

body.tpm-page .tpm-bulk-message.tpm-message-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #6ee7b7;
    color: #065f46;
}

body.tpm-page .tpm-bulk-message.tpm-message-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* Pending cell highlight animation */
body.tpm-page .tpm-pending-cell.tpm-highlight {
    animation: tpm-pending-highlight 2s ease-out;
}

@keyframes tpm-pending-highlight {
    0% {
        background-color: #bbf7d0;
    }
    100% {
        background-color: transparent;
    }
}

/* ==========================================================================
   Notices & Alerts
   ========================================================================== */
body.tpm-page .tpm-notice {
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: var(--tpm-radius-sm);
}

body.tpm-page .tpm-notice-inline {
    margin: 10px 0 15px 0;
}

body.tpm-page .tpm-notice p {
    margin: 0;
}

body.tpm-page .tpm-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

body.tpm-page .tpm-notice.tpm-error ,
body.tpm-page .tpm-notice-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

body.tpm-page .tpm-notice.tpm-success ,
body.tpm-page .tpm-notice-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #6ee7b7;
    color: #065f46;
    font-weight: 500;
    animation: tpmSuccessPop 0.3s ease-out;
}

body.tpm-page .tpm-notice.tpm-warning ,
body.tpm-page .tpm-notice-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}

@keyframes tpmSuccessPop {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

body.tpm-page .tpm-notice a {
    color: var(--tpm-primary);
}

body.tpm-page .tpm-message {
    margin-top: 15px;
}

body.tpm-page .tpm-alert {
    padding: 12px 16px;
    border-radius: var(--tpm-radius-sm);
    margin-top: 10px;
}

body.tpm-page .tpm-alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

body.tpm-page .tpm-alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
body.tpm-page .tpm-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--tpm-bg);
    border-radius: var(--tpm-radius);
    border: 2px dashed #ddd;
}

body.tpm-page .tpm-empty-state-icon {
    font-size: 3em;
    margin-bottom: 20px;
}

body.tpm-page .tpm-empty-state-title {
    font-size: 1.25em;
    font-weight: 600;
    color: var(--tpm-text);
    margin-bottom: 8px;
}

body.tpm-page .tpm-empty-state-text {
    color: var(--tpm-text-muted);
    font-size: 0.9375em;
    margin-bottom: 20px;
}

/* ==========================================================================
   Patient Data Page
   ========================================================================== */
body.tpm-page .tpm-patient-data {
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 20px;
    font-family: inherit;
}

body.tpm-page .tpm-patient-header {
    background: var(--tpm-bg-white);
    padding: 25px 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
    border-left: 4px solid var(--tpm-primary);
}

body.tpm-page .tpm-patient-header h2 {
    margin: 10px 0 0 0;
    color: var(--tpm-text);
    font-size: 1.5em;
}

body.tpm-page .tpm-back-link {
    color: var(--tpm-primary);
    text-decoration: none;
    font-size: 0.875em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

body.tpm-page .tpm-back-link:hover {
    text-decoration: underline;
}

/* Patient Info Card */
body.tpm-page .tpm-patient-info-card {
    background: var(--tpm-bg-white);
    padding: 25px 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
}

body.tpm-page .tpm-patient-info-card h3 {
    margin: 0 0 20px 0;
    font-size: 1.125em;
    color: var(--tpm-text);
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
}

body.tpm-page .tpm-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

body.tpm-page .tpm-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

body.tpm-page .tpm-info-label {
    font-size: 0.75em;
    text-transform: uppercase;
    color: var(--tpm-text-muted);
    font-weight: 500;
}

body.tpm-page .tpm-info-value {
    font-size: 0.9375em;
    color: var(--tpm-text);
}

/* Patient Profile Notes Card */
body.tpm-page .tpm-patient-profile-card {
    background: var(--tpm-bg-white);
    padding: 25px 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
}

body.tpm-page .tpm-patient-profile-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.125em;
    color: var(--tpm-text);
}

body.tpm-page .tpm-profile-description {
    margin: 0 0 15px 0;
    font-size: 0.8125em;
    color: var(--tpm-text-muted);
}

body.tpm-page .tpm-profile-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--tpm-border);
    border-radius: 6px;
    font-size: 0.875em;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.tpm-page .tpm-profile-form textarea:focus {
    outline: none;
    border-color: var(--tpm-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

body.tpm-page .tpm-profile-form textarea::placeholder {
    color: var(--tpm-text-muted);
}

body.tpm-page .tpm-profile-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 12px;
}

body.tpm-page .tpm-profile-status {
    font-size: 0.8125em;
    transition: opacity 0.3s ease;
}

body.tpm-page .tpm-profile-status.tpm-profile-saved {
    color: var(--tpm-success);
}

body.tpm-page .tpm-profile-status.tpm-profile-error {
    color: var(--tpm-danger);
}

/* Assign Assessment Card */
body.tpm-page .tpm-assign-assessment-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
}

body.tpm-page .tpm-assign-assessment-card h3 {
    border-bottom-color: #7dd3fc;
}

body.tpm-page .tpm-assign-form {
    margin-top: 15px;
}

body.tpm-page .tpm-assign-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

body.tpm-page .tpm-form-group-flex {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 10px;
}

body.tpm-page .tpm-select-assessment ,
body.tpm-page #tpm-assessment-select {
    flex: 1;
    min-width: 200px;
    font-size: 0.9375em !important;
    border: 1px solid var(--tpm-border) !important;
    border-radius: 6px !important;
    background: var(--tpm-bg-white) !important;
    cursor: pointer !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    box-sizing: border-box !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
}

/* Variant select for short/full questionnaire */
body.tpm-page .tpm-select-variant,
body.tpm-page #tpm-variant-select {
    flex-shrink: 0;
    width: auto !important;
    min-width: 180px;
    font-size: 0.9375em !important;
    border: 1px solid var(--tpm-border) !important;
    border-radius: 6px !important;
    background: var(--tpm-bg-white) !important;
    cursor: pointer !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    box-sizing: border-box !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding: 8px 32px 8px 12px !important;
    height: 38px !important;
}

body.tpm-page .tpm-select-variant:focus,
body.tpm-page #tpm-variant-select:focus {
    outline: none !important;
    border-color: var(--tpm-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

body.tpm-page .tpm-select-assessment:focus ,
body.tpm-page #tpm-assessment-select:focus {
    outline: none !important;
    border-color: var(--tpm-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

body.tpm-page .tpm-assign-actions {
    flex-shrink: 0;
    margin: 0px;
    margin-bottom: 1.25rem;
}

/* Assign button */
body.tpm-page #tpm-assign-btn {
    font-size: 0.9375em !important;
    line-height: 1 !important;
    color: #fff !important;
    background: var(--tpm-primary) !important;
    border: none !important;
    border-radius: 6px !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    height: 38px !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s, transform 0.2s !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

body.tpm-page #tpm-assign-btn:hover:not(:disabled) {
    background: var(--tpm-primary-hover) !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
}

body.tpm-page #tpm-assign-btn:disabled {
    background: #d1d5db !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

body.tpm-page .tpm-assign-options {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

body.tpm-page .tpm-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125em;
    color: var(--tpm-text-muted);
    cursor: pointer;
}

body.tpm-page .tpm-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--tpm-primary);
}

body.tpm-page .tpm-checkbox-label span {
    user-select: none;
}

body.tpm-page .tpm-assign-status {
    margin-top: 10px;
    font-size: 0.8125em;
}

body.tpm-page .tpm-assign-status .tpm-status-error {
    color: var(--tpm-danger);
}

body.tpm-page .tpm-assign-status .tpm-status-success {
    color: var(--tpm-success);
}

/* Results Section */
/* Pending Assignments Section (Patient Data View) */
body.tpm-page .tpm-pending-assignments-section {
    background: var(--tpm-bg-white);
    padding: 25px 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
}

body.tpm-page .tpm-pending-assignments-section h3 {
    margin: 0 0 20px 0;
    font-size: 1.125em;
    color: var(--tpm-text);
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
}

body.tpm-page .tpm-pending-assignments-table {
    width: 100%;
    border-collapse: collapse;
}

body.tpm-page .tpm-pending-assignments-table th ,
body.tpm-page .tpm-pending-assignments-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--tpm-border);
}

body.tpm-page .tpm-pending-assignments-table th {
    background: var(--tpm-bg);
    font-weight: 600;
    font-size: 0.875em;
    color: var(--tpm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-pending-assignments-table tbody tr:last-child td {
    border-bottom: none;
}

body.tpm-page .tpm-pending-assignments-table tbody tr:hover {
    background: #f9fafb;
}

body.tpm-page .tpm-pending-assignments-table .tpm-actions-cell {
    white-space: nowrap;
}

body.tpm-page .tpm-pending-assignments-table .tpm-actions-cell .tpm-btn {
    margin-right: 5px;
}

body.tpm-page .tpm-pending-assignments-table .tpm-actions-cell .tpm-btn:last-child {
    margin-right: 0;
}

/* Expired Assignments Section */
body.tpm-page .tpm-expired-assignments-section {
    background: var(--tpm-bg-white);
    padding: 25px 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
    border-left: 4px solid #f59e0b;
}

body.tpm-page .tpm-expired-assignments-section h3 {
    margin: 0 0 10px 0;
    font-size: 1.125em;
    color: var(--tpm-text);
}

body.tpm-page .tpm-expired-assignments-section .tpm-section-description {
    margin: 0 0 20px 0;
    color: var(--tpm-text-muted);
    font-size: 0.875em;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-expired-assignments-table {
    width: 100%;
    border-collapse: collapse;
}

body.tpm-page .tpm-expired-assignments-table th ,
body.tpm-page .tpm-expired-assignments-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--tpm-border);
}

body.tpm-page .tpm-expired-assignments-table th {
    background: var(--tpm-bg);
    font-weight: 600;
    font-size: 0.875em;
    color: var(--tpm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-expired-assignments-table tbody tr:last-child td {
    border-bottom: none;
}

body.tpm-page .tpm-expired-assignments-table tbody tr:hover {
    background: #fffbeb;
}

body.tpm-page .tpm-expired-assignments-table .tpm-actions-cell {
    white-space: nowrap;
}

body.tpm-page .tpm-expired-assignments-table .tpm-actions-cell .tpm-btn {
    margin-right: 5px;
}

body.tpm-page .tpm-expired-assignments-table .tpm-actions-cell .tpm-btn:last-child {
    margin-right: 0;
}

body.tpm-page .tpm-results-section {
    background: var(--tpm-bg-white);
    padding: 25px 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
}

body.tpm-page .tpm-results-section h3 {
    margin: 0 0 20px 0;
    font-size: 1.125em;
    color: var(--tpm-text);
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
}

/* Result Cards */
body.tpm-page .tpm-result-card {
    background: var(--tpm-bg);
    border: 1px solid var(--tpm-border);
    border-radius: var(--tpm-radius);
    margin-bottom: 20px;
    overflow: hidden;
}

body.tpm-page .tpm-result-card.tpm-result-completed {
    border-left: 4px solid var(--tpm-success);
}

body.tpm-page .tpm-result-card.tpm-result-incomplete {
    border-left: 4px solid var(--tpm-warning);
}

body.tpm-page .tpm-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    background: var(--tpm-bg-white);
    border-bottom: 1px solid var(--tpm-border);
}

body.tpm-page .tpm-result-title h4 {
    margin: 0 0 5px 0;
    font-size: 1em;
    color: var(--tpm-text);
}

body.tpm-page .tpm-result-type {
    font-size: 0.75em;
    color: var(--tpm-text-muted);
    background: var(--tpm-bg);
    padding: 2px 8px;
    border-radius: 3px;
}

body.tpm-page .tpm-result-meta {
    text-align: right;
}

body.tpm-page .tpm-result-date {
    font-size: 0.8125em;
    color: var(--tpm-text-muted);
    display: block;
    margin-bottom: 5px;
}

body.tpm-page .tpm-result-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--tpm-radius-pill);
    font-size: 0.6875em;
    font-weight: 600;
    text-transform: uppercase;
}

body.tpm-page .tpm-result-body {
    padding: 20px;
}

body.tpm-page .tpm-result-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: var(--tpm-bg-white);
    border-top: 1px solid var(--tpm-border);
}

/* AI Conversations Section */
/* AI Analysis Section - Inline */
body.tpm-page .tpm-analysis-section {
    padding: 20px;
    background: #f8fafc;
    border-top: 1px solid var(--tpm-border);
}

body.tpm-page .tpm-analysis-section-header {
    margin-bottom: 15px;
}

body.tpm-page .tpm-analysis-section-header h5 {
    margin: 0;
    font-size: 0.9375em;
    font-weight: 600;
    color: #1e293b;
}

/* New Analysis Form */
body.tpm-page .tpm-analysis-new-form {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

body.tpm-page .tpm-analysis-form-group {
    margin-bottom: 12px;
}

body.tpm-page .tpm-analysis-form-group label {
    display: block;
    font-size: 0.8125em;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

body.tpm-page .tpm-analysis-goal-field ,
body.tpm-page .tpm-analysis-prompt-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8125em;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.tpm-page .tpm-analysis-goal-field:focus ,
body.tpm-page .tpm-analysis-prompt-field:focus {
    outline: none;
    border-color: var(--tpm-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

body.tpm-page .tpm-analysis-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

body.tpm-page .tpm-analysis-loading {
    color: #6b7280;
    font-size: 0.8125em;
}

body.tpm-page .tpm-analysis-error {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.8125em;
}

/* Pending Analysis Status */
/* Pending Analysis Status */
body.tpm-page .tpm-analysis-pending-status {
    padding: 20px;
    background: #fefcf5;
    border: 1px solid #f0e4c8;
    border-left: 3px solid #d4a84b;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Pending Header with Spinner */
body.tpm-page .tpm-pending-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

body.tpm-page .tpm-pending-spinner-container {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

body.tpm-page .tpm-pending-spinner {
    position: absolute;
    inset: 0;
    border: 3px solid #f0e4c8;
    border-top-color: #d4a84b;
    border-radius: 50%;
    animation: tpm-pending-spin 1s linear infinite;
}

body.tpm-page .tpm-pending-header-text {
    flex: 1;
}

body.tpm-page .tpm-pending-header-text strong {
    display: block;
    font-size: 1.1em;
    color: #8a6d2b;
    margin-bottom: 4px;
}

body.tpm-page .tpm-pending-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 0.875em;
    line-height: 1.4;
}

@keyframes tpm-pending-spin {
    to { transform: rotate(360deg); }
}

/* Pending Analyses List */
body.tpm-page .tpm-pending-analyses-list {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

body.tpm-page .tpm-pending-analysis-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

body.tpm-page .tpm-pending-analysis-item:last-child {
    border-bottom: none;
}

body.tpm-page .tpm-pending-analysis-item:hover {
    background-color: #fafbfc;
}

body.tpm-page .tpm-pending-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

body.tpm-page .tpm-pending-item-info {
    flex: 1;
    min-width: 0;
}

body.tpm-page .tpm-pending-goal {
    margin: 0 0 4px 0;
    color: #374151;
    font-size: 0.925em;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

body.tpm-page .tpm-pending-goal-default {
    color: #9ca3af;
    font-style: italic;
}

body.tpm-page .tpm-pending-time {
    color: #9ca3af;
    font-size: 0.8em;
}

/* Status Badges */
body.tpm-page .tpm-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75em;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

body.tpm-page .tpm-status-queued {
    background: #fef9ec;
    color: #8a6d2b;
}

body.tpm-page .tpm-status-processing {
    background: #fef9ec;
    color: #8a6d2b;
}

body.tpm-page .tpm-status-failed {
    background: #fdf2f2;
    color: #9b4444;
}

body.tpm-page .tpm-status-dot {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: tpm-status-pulse 1.5s ease-in-out infinite;
}

@keyframes tpm-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Pending Inline Form */
body.tpm-page .tpm-pending-inline-form {
    margin-top: 16px;
    padding: 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

body.tpm-page .tpm-pending-inline-form label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

body.tpm-page .tpm-pending-inline-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    resize: vertical;
    font-size: 0.925em;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.tpm-page .tpm-pending-inline-form textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

body.tpm-page .tpm-pending-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

body.tpm-page .tpm-inline-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6366f1;
    font-size: 0.875em;
}

body.tpm-page .tpm-mini-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e0e7ff;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: tpm-pending-spin 0.8s linear infinite;
}

body.tpm-page .tpm-inline-error {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626;
    font-size: 0.875em;
}

/* Submit Another Button */
body.tpm-page .tpm-analysis-pending-status .tpm-new-analysis-btn {
    margin-top: 12px;
    color: #6366f1 !important;
    font-weight: 500;
}

body.tpm-page .tpm-analysis-pending-status .tpm-new-analysis-btn:hover {
    color: #4338ca !important;
}

/* Failed Analysis Status */
body.tpm-page .tpm-analysis-failed-status {
    padding: 15px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    margin-bottom: 15px;
}

body.tpm-page .tpm-analysis-failed-status .tpm-analysis-error {
    margin: 0 0 10px 0;
    padding: 0;
    background: none;
    border: none;
    color: #dc2626;
}

body.tpm-page .tpm-analysis-failed-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

body.tpm-page .tpm-analysis-failed-goal {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #fecaca;
}

body.tpm-page .tpm-btn-link {
    background: none !important;
    border: none !important;
    color: #64748b !important;
    cursor: pointer;
    padding: 0;
    font-size: 0.875em;
}

body.tpm-page .tpm-btn-link:hover {
    text-decoration: underline !important;
    color: #334155 !important;
}

/* Analysis Result */
body.tpm-page .tpm-analysis-result {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

body.tpm-page .tpm-analysis-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    border-left: 3px solid #4a7c72;
    color: #1e293b;
}

body.tpm-page .tpm-analysis-result-title {
    font-weight: 600;
    color: #1e293b;
}

body.tpm-page .tpm-analysis-result-time {
    font-size: 0.75em;
    color: #94a3b8;
}

body.tpm-page .tpm-analysis-result-meta {
    padding: 12px 15px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

body.tpm-page .tpm-analysis-result-meta-item {
    font-size: 0.8125em;
    color: #475569;
    margin-bottom: 6px;
}

body.tpm-page .tpm-analysis-result-meta-item:last-child {
    margin-bottom: 0;
}

body.tpm-page .tpm-analysis-result-meta-item strong {
    color: #1e293b;
}

body.tpm-page .tpm-analysis-form-hint {
    font-size: 0.75em;
    color: #64748b;
    margin-top: 6px;
    font-style: italic;
}

/* Analysis Generated Success */
body.tpm-page .tpm-analysis-generated {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

body.tpm-page .tpm-analysis-generated-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 0.9375em;
    color: #166534;
}

body.tpm-page .tpm-analysis-generated-icon {
    font-size: 1.25em;
    color: #22c55e;
}

body.tpm-page .tpm-analysis-generated-text {
    font-weight: 600;
}

body.tpm-page .tpm-view-analysis-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

body.tpm-page .tpm-analysis-result-content {
    padding: 15px;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
}

body.tpm-page .tpm-analysis-result-content h2 ,
body.tpm-page .tpm-analysis-result-content h3 ,
body.tpm-page .tpm-analysis-result-content h4 {
    margin-top: 15px;
    margin-bottom: 8px;
    color: #1e293b;
}

body.tpm-page .tpm-analysis-result-content h2:first-child ,
body.tpm-page .tpm-analysis-result-content h3:first-child {
    margin-top: 0;
}

body.tpm-page .tpm-analysis-result-content ul ,
body.tpm-page .tpm-analysis-result-content ol {
    margin: 10px 0;
    padding-left: 25px;
}

body.tpm-page .tpm-analysis-result-content li {
    margin-bottom: 5px;
}

/* Previous Analyses History */
body.tpm-page .tpm-analysis-history {
    margin-top: 15px;
}

body.tpm-page .tpm-analysis-history h6 {
    margin: 0 0 10px 0;
    font-size: 0.8125em;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
}

body.tpm-page .tpm-analysis-history-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

body.tpm-page .tpm-analysis-history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 15px;
    gap: 15px;
}

body.tpm-page .tpm-analysis-history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

body.tpm-page .tpm-analysis-history-date {
    font-size: 0.8125em;
    font-weight: 600;
    color: #1e293b;
}

body.tpm-page .tpm-analysis-history-goal {
    font-size: 0.8125em;
    color: #64748b;
    font-style: normal;
    font-weight: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

body.tpm-page .tpm-analysis-history-item.tpm-analysis-history-failed {
    background: #fef2f2;
    border-left: 3px solid #dc2626;
}

body.tpm-page .tpm-analysis-history-error {
    display: block;
    font-size: 0.75em;
    color: #dc2626;
    margin-top: 4px;
}

body.tpm-page .tpm-analysis-notes-field {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8125em;
    resize: vertical;
    min-height: 36px;
    max-height: 120px;
    font-family: inherit;
    background: #f8fafc;
    transition: border-color 0.2s, background-color 0.2s;
}

body.tpm-page .tpm-analysis-notes-field:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
}

body.tpm-page .tpm-analysis-notes-field.tpm-notes-changed {
    border-color: #f59e0b;
    background: #fffbeb;
}

body.tpm-page .tpm-save-notes-btn {
    flex-shrink: 0;
}

/* Score Display */
body.tpm-page .tpm-primary-result {
    text-align: center;
    padding: 30px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #4a7c72;
    border-radius: var(--tpm-radius);
    color: #1e293b;
    margin-bottom: 25px;
}

body.tpm-page .tpm-primary-label {
    font-size: 0.875em;
    color: #64748b;
    display: block;
}

body.tpm-page .tpm-primary-value {
    font-size: 3em;
    font-weight: 700;
    color: #4a7c72;
    display: block;
    margin: 10px 0;
}

body.tpm-page .tpm-scores-grid {
    margin-bottom: 25px;
}

body.tpm-page .tpm-scores-grid h5 {
    margin: 0 0 15px 0;
    font-size: 0.875em;
    color: var(--tpm-text-muted);
    text-transform: uppercase;
}

body.tpm-page .tpm-score-item {
    margin-bottom: 12px;
}

body.tpm-page .tpm-score-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

body.tpm-page .tpm-category-name {
    font-weight: 500;
    color: var(--tpm-text);
}

body.tpm-page .tpm-score-value {
    font-weight: 600;
    color: var(--tpm-primary);
}

body.tpm-page .tpm-score-bar-container {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

body.tpm-page .tpm-score-bar {
    height: 100%;
    background: #4a7c72;
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* Percentage Grid */
body.tpm-page .tpm-percentages h5 {
    margin: 0 0 15px 0;
    font-size: 0.875em;
    color: var(--tpm-text-muted);
    text-transform: uppercase;
}

body.tpm-page .tpm-percentage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

body.tpm-page .tpm-pct-item {
    background: var(--tpm-bg-white);
    border: 1px solid var(--tpm-border);
    border-radius: var(--tpm-radius-sm);
    padding: 12px;
    text-align: center;
}

body.tpm-page .tpm-pct-category {
    display: block;
    font-size: 0.6875em;
    color: var(--tpm-text-muted);
    margin-bottom: 4px;
}

body.tpm-page .tpm-pct-value {
    display: block;
    font-size: 1.25em;
    font-weight: 700;
    color: var(--tpm-primary);
}

/* Pie Charts */
body.tpm-page .tpm-pie-charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

body.tpm-page .tpm-pie-section {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

body.tpm-page .tpm-pie-section h5 {
    margin: 0 0 15px;
    font-size: 0.875em;
    color: #1d2327;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-pie-chart-wrapper {
    margin-bottom: 15px;
}

body.tpm-page .tpm-pie-svg {
    width: 100%;
    max-width: 200px;
    height: auto;
}

body.tpm-page .tpm-pie-slice {
    transition: opacity 0.2s ease;
}

body.tpm-page .tpm-pie-slice:hover {
    opacity: 0.8;
}

body.tpm-page .tpm-pie-legend {
    text-align: left;
}

body.tpm-page .tpm-legend-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
    font-size: 1em;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-legend-item:last-child {
    border-bottom: none;
}

body.tpm-page .tpm-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 10px;
    flex-shrink: 0;
}

body.tpm-page .tpm-legend-label {
    flex: 1;
    color: #1d2327;
    font-weight: 500;
}

body.tpm-page .tpm-legend-value {
    font-weight: 700;
    font-size: 1.125em;
    color: #1d2327;
}

/* Archetype Table */
body.tpm-page .tpm-archetype-table {
    margin-top: 25px;
}

body.tpm-page .tpm-archetype-table h5 {
    margin: 0 0 15px;
    font-size: 0.875em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-scores-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875em;
}

body.tpm-page .tpm-scores-table th ,
body.tpm-page .tpm-scores-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-scores-table th {
    background: #f9f9f9;
    font-weight: 600;
    color: #1d2327;
}

body.tpm-page .tpm-scores-table td {
    color: #666;
}

body.tpm-page .tpm-scores-table td:first-child {
    color: #1d2327;
}

body.tpm-page .tpm-global-scores {
    margin-top: 15px;
    padding: 10px 15px;
    background: #f0f0f1;
    border-radius: 4px;
    font-size: 0.875em;
}

/* Time Spent */
body.tpm-page .tpm-time-spent {
    display: flex;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

body.tpm-page .tpm-time-label {
    color: #666;
}

body.tpm-page .tpm-time-value {
    font-weight: 500;
    color: #1d2327;
}

/* Validation Warnings */
body.tpm-page .tpm-validation-warnings {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

body.tpm-page .tpm-validation-warnings ul {
    margin: 10px 0 0 20px;
    padding: 0;
}

body.tpm-page .tpm-validation-warnings li {
    margin-bottom: 5px;
}

/* Incomplete Notice */
body.tpm-page .tpm-incomplete-notice {
    text-align: center;
    color: #666;
}

body.tpm-page .tpm-incomplete-notice p {
    margin: 0 0 10px;
}

body.tpm-page .tpm-status-text {
    font-style: italic;
}

/* Action Buttons */
body.tpm-page .tpm-reprocess-btn ,
body.tpm-page .tpm-export-btn {
    background: #f0f0f1;
    border: 1px solid #c3c4c7;
    color: #2271b1;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875em;
    transition: all 0.2s ease;
}

body.tpm-page .tpm-reprocess-btn:hover ,
body.tpm-page .tpm-export-btn:hover {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

body.tpm-page .tpm-reprocess-btn:disabled ,
body.tpm-page .tpm-export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

body.tpm-page .tpm-export-btn {
    margin-left: 10px;
}

body.tpm-page .tpm-analysis-btn {
    background: #4a7c72;
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875em;
    transition: all 0.2s ease;
    margin-left: 10px;
    text-decoration: none;
    display: inline-block;
}

body.tpm-page .tpm-analysis-btn:hover {
    background: #3d6b56;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 124, 114, 0.3);
}

/* EI Assessment Results */
body.tpm-page .tpm-ei-results {
    margin-top: 20px;
}

body.tpm-page .tpm-ei-overall {
    text-align: center;
    padding: 25px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 25px;
}

body.tpm-page .tpm-ei-overall-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

body.tpm-page .tpm-ei-score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(
        body.tpm-page #4A90A4 calc(var(--percentage) * 1%) ,
        #e0e0e0 calc(var(--percentage) * 1%)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

body.tpm-page .tpm-ei-score-circle::before {
    content: '';
    position: absolute;
    width: 70px;
    height: 70px;
    background: white;
    border-radius: 50%;
}

body.tpm-page .tpm-ei-score-value {
    position: relative;
    font-size: 1.5em;
    font-weight: 700;
    color: #333;
}

body.tpm-page .tpm-ei-score-label {
    text-align: left;
}

body.tpm-page .tpm-ei-score-label strong {
    display: block;
    font-size: 1.125em;
    color: #333;
    margin-bottom: 5px;
}

body.tpm-page .tpm-ei-level {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8125em;
    font-weight: 600;
}

.tpm-ei-level-very-high { background: #d4edda; color: #155724; }
.tpm-ei-level-high { background: #cce5ff; color: #004085; }
.tpm-ei-level-moderate { background: #fff3cd; color: #856404; }
.tpm-ei-level-developing { background: #ffe5d0; color: #8a4500; }
.tpm-ei-level-foundational { background: #f8d7da; color: #721c24; }

body.tpm-page .tpm-ei-interpretation {
    margin: 0;
    color: #666;
    font-size: 0.875em;
    max-width: 500px;
    margin: 0 auto;
}

body.tpm-page .tpm-ei-chart-section {
    margin-bottom: 25px;
}

body.tpm-page .tpm-ei-chart-section h5 {
    margin: 0 0 15px;
    font-size: 0.875em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-ei-chart-wrapper {
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

body.tpm-page .tpm-ei-pie-container {
    width: 200px;
    height: 200px;
    flex-shrink: 0;
}

body.tpm-page .tpm-ei-pie-svg {
    width: 100%;
    height: 100%;
}

body.tpm-page .tpm-ei-pie-slice {
    transition: opacity 0.2s;
}

body.tpm-page .tpm-ei-pie-slice:hover {
    opacity: 0.8;
}

body.tpm-page .tpm-ei-legend {
    flex: 1;
    min-width: 200px;
}

body.tpm-page .tpm-ei-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
}

body.tpm-page .tpm-ei-legend-item:last-child {
    border-bottom: none;
}

body.tpm-page .tpm-ei-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

body.tpm-page .tpm-ei-legend-label {
    flex: 1;
    font-size: 1.0625em;
    font-weight: 500;
    color: #333;
}

body.tpm-page .tpm-ei-legend-value {
    font-weight: 700;
    font-size: 1.125em;
    color: #1d2327;
}

body.tpm-page .tpm-ei-table-section h5 {
    margin: 0 0 15px;
    font-size: 0.875em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-ei-scores-table {
    width: 100%;
    border-collapse: collapse;
}

body.tpm-page .tpm-ei-scores-table th ,
body.tpm-page .tpm-ei-scores-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-ei-scores-table th {
    background: #f9f9f9;
    font-weight: 600;
    font-size: 0.75em;
    text-transform: uppercase;
    color: #666;
}

body.tpm-page .tpm-ei-scores-table td strong {
    display: block;
    color: #333;
    margin-bottom: 3px;
}

body.tpm-page .tpm-ei-cat-desc {
    display: block;
    color: #888;
    font-size: 0.75em;
    line-height: 1.4;
}

body.tpm-page .tpm-ei-score-cell {
    font-weight: 600;
    font-size: 1em;
    color: #333;
    width: 80px;
}

body.tpm-page .tpm-ei-bar-cell {
    width: 40%;
}

body.tpm-page .tpm-ei-bar-container {
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}

body.tpm-page .tpm-ei-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* ==========================================================================
   Personality V3 Results
   ========================================================================== */
body.tpm-page .tpm-pv3-results {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

body.tpm-page .tpm-pv3-title {
    margin: 0 0 20px;
    font-size: 1em;
    color: #1d2327;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

body.tpm-page .tpm-pv3-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

body.tpm-page .tpm-pv3-summary-section {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body.tpm-page .tpm-pv3-summary-section strong {
    display: block;
    margin-bottom: 12px;
    font-size: 0.9375em;
    color: #1d2327;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-pv3-summary-section ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

body.tpm-page .tpm-pv3-summary-section li {
    padding: 10px 0;
    font-size: 1.0625em;
    font-weight: 500;
    color: #1d2327;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
}

body.tpm-page .tpm-pv3-summary-section li::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #4B72B2;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

body.tpm-page .tpm-pv3-summary-section:nth-child(2) li::before {
    background: #E8A838;
}

body.tpm-page .tpm-pv3-summary-section:nth-child(3) li::before {
    background: #6C4F92;
}

body.tpm-page .tpm-pv3-summary-section li:last-child {
    border-bottom: none;
}

/* ==========================================================================
   AI Analysis Page
   ========================================================================== */
body.tpm-page .tpm-analysis-analysis {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 20px;
    font-family: inherit;
}

body.tpm-page .tpm-analysis-card {
    background: var(--tpm-bg-white);
    border-radius: var(--tpm-radius);
    box-shadow: var(--tpm-shadow);
    overflow: hidden;
}

body.tpm-page .tpm-analysis-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 25px 30px;
    background: #fff;
    border-left: 4px solid #4a7c72;
    color: #1e293b;
}

body.tpm-page .tpm-analysis-icon {
    font-size: 3em;
    line-height: 1;
    color: #4a7c72;
}

body.tpm-page .tpm-analysis-title {
    flex: 1;
}

body.tpm-page .tpm-analysis-title h2 {
    margin: 0 0 5px 0;
    font-size: 1.5em;
    color: #1e293b;
}

body.tpm-page .tpm-analysis-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 0.875em;
}

body.tpm-page .tpm-analysis-nav {
    padding: 12px 30px;
    background: var(--tpm-bg);
    border-bottom: 1px solid var(--tpm-border);
}

body.tpm-page .tpm-analysis-nav .tpm-back-link {
    color: var(--tpm-primary);
    text-decoration: none;
    font-size: 0.875em;
    font-weight: 500;
}

body.tpm-page .tpm-analysis-nav .tpm-back-link:hover {
    text-decoration: underline;
}

body.tpm-page .tpm-analysis-content {
    padding: 30px;
    line-height: 1.7;
}

body.tpm-page .tpm-analysis-content h1 ,
body.tpm-page .tpm-analysis-content h2 ,
body.tpm-page .tpm-analysis-content h3 ,
body.tpm-page .tpm-analysis-content h4 {
    color: var(--tpm-text);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

body.tpm-page .tpm-analysis-content h1:first-child ,
body.tpm-page .tpm-analysis-content h2:first-child ,
body.tpm-page .tpm-analysis-content h3:first-child {
    margin-top: 0;
}

body.tpm-page .tpm-analysis-content ul ,
body.tpm-page .tpm-analysis-content ol {
    padding-left: 1.5em;
    margin: 1em 0;
}

body.tpm-page .tpm-analysis-content li {
    margin-bottom: 0.5em;
}

body.tpm-page .tpm-analysis-content blockquote {
    border-left: 4px solid var(--tpm-primary);
    margin: 1.5em 0;
    padding: 1em 1.5em;
    background: var(--tpm-bg);
    border-radius: 0 var(--tpm-radius-sm) var(--tpm-radius-sm) 0;
}

body.tpm-page .tpm-analysis-content strong {
    color: var(--tpm-text);
}

/* AI Analysis - Actions and Results */
body.tpm-page .tpm-analysis-actions {
    text-align: center;
    padding: 30px;
    background: var(--tpm-bg);
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
}

body.tpm-page .tpm-cached-notice {
    background: #e8f4fd;
    color: #1565c0;
    padding: 12px 18px;
    border-radius: var(--tpm-radius-sm);
    margin-bottom: 20px;
    font-size: 0.875em;
    border-left: 4px solid #1565c0;
}

body.tpm-page .tpm-cached-notice p {
    margin: 0;
}

body.tpm-page .tpm-analysis-disclaimer {
    margin-top: 15px;
    font-size: 0.75em;
    color: var(--tpm-text-light);
}

body.tpm-page .tpm-analysis-result {
    background: var(--tpm-bg-white);
    border: 1px solid var(--tpm-border);
    border-radius: var(--tpm-radius);
    overflow: hidden;
}

body.tpm-page .tpm-analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    background: var(--tpm-bg);
    border-bottom: 1px solid var(--tpm-border);
}

body.tpm-page .tpm-analysis-header h4 {
    margin: 0;
    font-size: 1em;
    color: var(--tpm-text);
}

body.tpm-page .tpm-analysis-actions {
    display: flex;
    gap: 10px;
}

body.tpm-page .tpm-analysis-meta {
    padding: 10px 25px;
    background: #fafafa;
    border-bottom: 1px solid var(--tpm-border);
    color: var(--tpm-text-light);
    font-size: 0.75em;
}

body.tpm-page .tpm-analysis-content {
    padding: 25px 30px;
    line-height: 1.8;
    font-size: 0.9375em;
}

body.tpm-page .tpm-analysis-content h1 ,
body.tpm-page .tpm-analysis-content h2 ,
body.tpm-page .tpm-analysis-content h3 ,
body.tpm-page .tpm-analysis-content h4 ,
body.tpm-page .tpm-analysis-content h5 {
    color: var(--tpm-text);
    margin-top: 1.5em;
    margin-bottom: 0.6em;
    line-height: 1.3;
}

.tpm-analysis-content h1 { font-size: 1.5em; }
.tpm-analysis-content h2 { font-size: 1.25em; }
.tpm-analysis-content h3 { font-size: 1.125em; }
.tpm-analysis-content h4 { font-size: 1em; }

body.tpm-page .tpm-analysis-content h1:first-child ,
body.tpm-page .tpm-analysis-content h2:first-child ,
body.tpm-page .tpm-analysis-content h3:first-child {
    margin-top: 0;
}

body.tpm-page .tpm-analysis-content p {
    margin: 0 0 1em 0;
}

body.tpm-page .tpm-analysis-content ul ,
body.tpm-page .tpm-analysis-content ol {
    padding-left: 1.8em;
    margin: 1em 0;
}

body.tpm-page .tpm-analysis-content li {
    margin-bottom: 0.6em;
}

body.tpm-page .tpm-analysis-content blockquote {
    border-left: 4px solid var(--tpm-primary);
    margin: 1.5em 0;
    padding: 15px 20px;
    background: var(--tpm-bg);
    border-radius: 0 var(--tpm-radius-sm) var(--tpm-radius-sm) 0;
    font-style: italic;
}

body.tpm-page .tpm-analysis-content hr {
    border: none;
    border-top: 1px solid var(--tpm-border);
    margin: 2em 0;
}

/* Markdown tables */
body.tpm-page .tpm-md-table ,
body.tpm-page .tpm-analysis-content table ,
body.tpm-page .tpm-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.875em;
    background: #fff;
    border-radius: var(--tpm-radius-sm);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body.tpm-page .tpm-md-table thead ,
body.tpm-page .tpm-analysis-content table thead ,
body.tpm-page .tpm-message-content table thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

body.tpm-page .tpm-md-table th ,
body.tpm-page .tpm-analysis-content table th ,
body.tpm-page .tpm-message-content table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--tpm-text);
    border-bottom: 2px solid var(--tpm-border);
    white-space: nowrap;
}

body.tpm-page .tpm-md-table td ,
body.tpm-page .tpm-analysis-content table td ,
body.tpm-page .tpm-message-content table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--tpm-text-light);
    vertical-align: top;
}

body.tpm-page .tpm-md-table tbody tr:hover ,
body.tpm-page .tpm-analysis-content table tbody tr:hover ,
body.tpm-page .tpm-message-content table tbody tr:hover {
    background: #f8fafc;
}

body.tpm-page .tpm-md-table tbody tr:last-child td ,
body.tpm-page .tpm-analysis-content table tbody tr:last-child td ,
body.tpm-page .tpm-message-content table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive table wrapper */
body.tpm-page .tpm-table-wrapper {
    overflow-x: auto;
    margin: 1.5em 0;
}

body.tpm-page .tpm-analysis-content strong {
    color: var(--tpm-text);
    font-weight: 600;
}

body.tpm-page .tpm-analysis-content em {
    font-style: italic;
}

body.tpm-page .tpm-analysis-content code {
    background: var(--tpm-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

body.tpm-page .tpm-analysis-loading {
    text-align: center;
    padding: 60px 30px;
    background: var(--tpm-bg);
    border-radius: var(--tpm-radius);
}

body.tpm-page .tpm-analysis-loading .tpm-spinner {
    margin: 0 auto 20px;
}

body.tpm-page .tpm-analysis-loading p {
    color: var(--tpm-text-light);
    margin: 0;
}

body.tpm-page .tpm-analysis-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 20px 25px;
    border-radius: var(--tpm-radius);
    margin-top: 20px;
}

body.tpm-page .tpm-analysis-error p {
    margin: 0;
}

/* ==========================================================================
   Credits Page
   ========================================================================== */
body.tpm-page .tpm-credits-page {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 20px;
    font-family: inherit;
}

body.tpm-page .tpm-credits-header {
    background: var(--tpm-bg-white);
    padding: 25px 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
    border-left: 4px solid var(--tpm-primary);
}

body.tpm-page .tpm-credits-header h2 {
    margin: 10px 0 0 0;
    font-size: 1.5em;
    color: var(--tpm-text);
}

body.tpm-page .tpm-credits-balance {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: var(--tpm-radius);
    text-align: center;
    margin-bottom: 25px;
}

body.tpm-page .tpm-balance-label {
    display: block;
    font-size: 0.875em;
    opacity: 0.9;
    margin-bottom: 10px;
}

body.tpm-page .tpm-balance-value {
    font-size: 4.5em;
    font-weight: 700;
    display: block;
    line-height: 1;
}

body.tpm-page .tpm-balance-unit {
    display: block;
    font-size: 1em;
    opacity: 0.8;
    margin-top: 5px;
}

/* Credit Packages */
body.tpm-page .tpm-credits-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

body.tpm-page .tpm-credit-option {
    background: var(--tpm-bg-white);
    border: 2px solid var(--tpm-border);
    border-radius: var(--tpm-radius);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

body.tpm-page .tpm-credit-option:hover {
    border-color: var(--tpm-primary);
    box-shadow: var(--tpm-shadow-hover);
}

body.tpm-page .tpm-credit-option.selected {
    border-color: var(--tpm-primary);
    background: #f0f7ff;
}

body.tpm-page .tpm-option-amount {
    font-size: 2.25em;
    font-weight: 700;
    color: var(--tpm-text);
    margin-bottom: 5px;
}

body.tpm-page .tpm-option-price {
    font-size: 1.125em;
    color: var(--tpm-text-muted);
}

body.tpm-page .tpm-option-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--tpm-success);
    color: white;
    padding: 4px 12px;
    border-radius: var(--tpm-radius-pill);
    font-size: 0.6875em;
    font-weight: 600;
    text-transform: uppercase;
}

/* Payment History */
body.tpm-page .tpm-payments-table {
    width: 100%;
    border-collapse: collapse;
}

body.tpm-page .tpm-payments-table th ,
body.tpm-page .tpm-payments-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-payments-table th {
    background: var(--tpm-bg);
    font-weight: 600;
    font-size: 0.75em;
    color: #555;
    text-transform: uppercase;
}

body.tpm-page .tpm-payment-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
}

body.tpm-page .tpm-muted {
    color: #999;
}

body.tpm-page .tpm-no-history {
    color: #888;
    font-style: italic;
    padding: 20px 0;
}

/* Coupon Section */
body.tpm-page .tpm-coupon-section {
    border-left: 4px solid var(--tpm-success);
}

body.tpm-page .tpm-coupon-input-group {
    display: flex;
    gap: 10px;
    max-width: 500px;
}

body.tpm-page .tpm-coupon-input-group .tpm-input {
    flex: 1;
    padding: 12px 15px;
}

body.tpm-page .tpm-coupon-input-group .tpm-btn {
    white-space: nowrap;
}

/* ==========================================================================
   Credits Page
   ========================================================================== */
body.tpm-page .tpm-credits-page {
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    font-family: inherit;
}

body.tpm-page .tpm-credits-header {
    background: var(--tpm-bg-white);
    padding: 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
    text-align: center;
}

body.tpm-page .tpm-credits-header h2 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 1.75em;
}

body.tpm-page .tpm-credits-header p {
    margin: 0;
    color: var(--tpm-text-muted);
    font-size: 1em;
}

body.tpm-page .tpm-credits-overview {
    margin-bottom: 30px;
}

body.tpm-page .tpm-credit-balance-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 30px 35px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 115, 170, 0.3);
}

body.tpm-page .tpm-balance-icon {
    font-size: 3.5em;
}

body.tpm-page .tpm-balance-info .tpm-balance-label {
    font-size: 0.875em;
    opacity: 0.9;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

body.tpm-page .tpm-balance-amount {
    font-size: 2.25em;
    font-weight: bold;
}

body.tpm-page .tpm-credits-section {
    background: var(--tpm-bg-white);
    padding: 30px;
    border-radius: var(--tpm-radius);
    margin-bottom: 25px;
    box-shadow: var(--tpm-shadow);
}

body.tpm-page .tpm-credits-section h3 {
    margin: 0 0 15px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
    color: #333;
    font-size: 1.25em;
}

body.tpm-page .tpm-credits-description {
    color: var(--tpm-text-muted);
    margin-bottom: 25px;
}

body.tpm-page .tpm-section-description {
    color: var(--tpm-text-muted);
    font-size: 0.875em;
    margin-bottom: 15px;
}

/* Credit Packages */
body.tpm-page .tpm-credit-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

body.tpm-page .tpm-credit-package {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px 20px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

body.tpm-page .tpm-credit-package:hover {
    border-color: var(--tpm-primary);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    transform: translateY(-5px);
}

body.tpm-page .tpm-package-popular {
    border-color: var(--tpm-primary);
    background: linear-gradient(180deg, #f0f7fc 0%, #fff 100%);
}

body.tpm-page .tpm-package-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 5px 18px;
    border-radius: 20px;
    font-size: 0.6875em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body.tpm-page .tpm-package-name {
    font-size: 1.125em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    margin-top: 5px;
}

body.tpm-page .tpm-package-credits {
    font-size: 2em;
    font-weight: bold;
    color: var(--tpm-primary);
    margin-bottom: 5px;
}

body.tpm-page .tpm-package-price {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 5px;
}

body.tpm-page .tpm-package-per-credit {
    font-size: 0.75em;
    color: #888;
    margin-bottom: 20px;
}

body.tpm-page .tpm-add-to-cart {
    display: inline-block;
    text-decoration: none;
}

/* WooCommerce Notices */
body.tpm-page .tpm-woo-notice {
    margin-top: 25px;
    padding: 20px;
    background: #f0f7fc;
    border-radius: var(--tpm-radius);
    border-left: 4px solid var(--tpm-primary);
}

body.tpm-page .tpm-woo-notice.tpm-woo-success {
    background: #d4edda;
    border-left-color: var(--tpm-success);
}

body.tpm-page .tpm-woo-notice.tpm-woo-success .dashicons {
    color: var(--tpm-success);
}

body.tpm-page .tpm-woo-notice p {
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.tpm-page .tpm-woo-notice p:last-child {
    margin-bottom: 0;
    margin-top: 15px;
}

body.tpm-page .tpm-woo-notice .dashicons {
    color: var(--tpm-primary);
}

/* Setup Notice */
body.tpm-page .tpm-setup-notice {
    padding: 25px;
    background: #fffbeb;
    border-radius: var(--tpm-radius);
    border-left: 4px solid #f59e0b;
}

body.tpm-page .tpm-setup-notice h4 {
    margin: 0 0 15px 0;
    color: #92400e;
}

body.tpm-page .tpm-setup-notice ol {
    margin: 15px 0;
    padding-left: 20px;
}

body.tpm-page .tpm-setup-notice li {
    margin-bottom: 8px;
}

/* History Table */
body.tpm-page .tpm-history-table {
    width: 100%;
    border-collapse: collapse;
}

body.tpm-page .tpm-history-table th ,
body.tpm-page .tpm-history-table td {
    padding: 14px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

body.tpm-page .tpm-history-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #555;
}

body.tpm-page .tpm-history-table tr:hover {
    background: #fafafa;
}

body.tpm-page .tpm-credit-positive {
    color: var(--tpm-success);
    font-weight: bold;
}

body.tpm-page .tpm-credit-negative {
    color: var(--tpm-danger);
    font-weight: bold;
}

body.tpm-page .tpm-credits-actions {
    text-align: center;
    margin-top: 10px;
}

/* ==========================================================================
   Loading & Spinners
   ========================================================================== */
body.tpm-page .tpm-loading:not(.tpm-btn) {
    text-align: center;
    padding: 40px;
}

body.tpm-page .tpm-btn.tpm-loading {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

body.tpm-page .tpm-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--tpm-border);
    border-radius: 50%;
    border-top-color: var(--tpm-primary);
    animation: tpm-spin 0.8s linear infinite;
}

/* Smaller spinner for inside buttons */
body.tpm-page .tpm-btn .tpm-spinner ,
body.tpm-page .tpm-btn-loading .tpm-spinner {
    width: 14px;
    height: 14px;
    border-width: 2px;
    vertical-align: middle;
    margin-right: 4px;
}

body.tpm-page .tpm-btn-loading {
    opacity: 0.8;
    cursor: wait;
    pointer-events: none;
}

body.tpm-page .tpm-btn-success-state {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: #fff;
    cursor: default;
    pointer-events: none;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

body.tpm-page .tpm-spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

@keyframes tpm-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes tpmFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    body.tpm-page .tpm-form-row {
        flex-direction: column;
        gap: 10px;
    }
    
    body.tpm-page .tpm-dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    body.tpm-page .tpm-patients-table {
        font-size: 0.875em;
    }
    
    body.tpm-page .tpm-patients-table th ,
    body.tpm-page .tpm-patients-table td {
        padding: 10px 8px;
    }
    
    body.tpm-page .tpm-credit-indicator {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
    
    body.tpm-page .tpm-info-grid {
        grid-template-columns: 1fr;
    }
    
    body.tpm-page .tpm-result-header {
        flex-direction: column;
        gap: 15px;
    }
    
    body.tpm-page .tpm-result-meta {
        text-align: left;
    }
    
    body.tpm-page .tpm-result-actions {
        flex-wrap: wrap;
    }
    
    /* Credits page responsive */
    body.tpm-page .tpm-credit-balance-card {
        flex-direction: column;
        text-align: center;
        padding: 25px;
    }
    
    body.tpm-page .tpm-credit-packages {
        grid-template-columns: 1fr;
    }
    
    body.tpm-page .tpm-coupon-input-group {
        flex-direction: column;
    }
    
    body.tpm-page .tpm-credits-balance {
        padding: 30px 20px;
    }
    
    body.tpm-page .tpm-balance-value {
        font-size: 3em;
    }
    
    body.tpm-page .tpm-analysis-header {
        flex-direction: column;
        text-align: center;
    }
    
    /* Pie charts responsive */
    body.tpm-page .tpm-pie-charts-container {
        flex-direction: column;
        align-items: center;
    }
    
    body.tpm-page .tpm-pie-section {
        width: 100%;
        max-width: 350px;
    }
    
    /* EI responsive */
    body.tpm-page .tpm-ei-overall-score {
        flex-direction: column;
    }
    
    body.tpm-page .tpm-ei-score-label {
        text-align: center;
    }
    
    body.tpm-page .tpm-ei-chart-wrapper {
        flex-direction: column;
    }
    
    body.tpm-page .tpm-ei-bar-cell {
        display: none;
    }
    
    /* PV3 responsive */
    body.tpm-page .tpm-pv3-summary {
        grid-template-columns: 1fr;
    }
    
    body.tpm-page .tpm-export-btn {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    body.tpm-page .tpm-bulk-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    body.tpm-page .tpm-bulk-row select ,
    body.tpm-page .tpm-bulk-row .tpm-btn {
        width: 100%;
    }
    
    body.tpm-page .tpm-percentage-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    body.tpm-page .tpm-result-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    body.tpm-page .tpm-result-actions .tpm-export-btn ,
    body.tpm-page .tpm-result-actions .tpm-analysis-btn {
        margin-left: 0;
    }
}

/* ==========================================================================
   Logout Page
   ========================================================================== */
body.tpm-page .tpm-logout-page {
    max-width: 400px;
    margin: 50px auto;
    padding: 40px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: var(--tpm-radius);
    box-shadow: var(--tpm-shadow);
    text-align: center;
}

body.tpm-page .tpm-logout-page h2 {
    margin: 0 0 10px 0;
    color: #166534;
    font-size: 1.5em;
}

body.tpm-page .tpm-logout-message {
    color: #666;
    margin: 0 0 25px 0;
    font-size: 1em;
}

body.tpm-page .tpm-logout-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

body.tpm-page .tpm-logout-page .tpm-btn {
    border-radius: 5px;
    font-size: 0.875em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}


body.tpm-page .tpm-redirect-notice {
    margin-top: 20px;
    color: #999;
    font-size: 0.8125em;
}

/* ==========================================================================
   Profile Page
   ========================================================================== */
body.tpm-page .tpm-profile-page {
    max-width: 600px;
    margin: 0 auto;
}

body.tpm-page .tpm-profile-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--tpm-radius);
    padding: 25px;
    margin-bottom: 20px;
}

body.tpm-page .tpm-profile-section h3 {
    margin: 0 0 20px;
    font-size: 1.125em;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
}

body.tpm-page .tpm-profile-field {
    margin-bottom: 15px;
}

body.tpm-page .tpm-profile-field label {
    display: block;
    font-size: 0.875em;
    font-weight: 500;
    margin-bottom: 5px;
    color: #374151;
}

body.tpm-page .tpm-profile-field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: var(--tpm-radius-sm);
    font-size: 0.875em;
    box-sizing: border-box;
}

body.tpm-page .tpm-profile-field input:focus {
    outline: none;
    border-color: var(--tpm-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

body.tpm-page .tpm-profile-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--tpm-radius-sm);
    font-size: 0.875em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

body.tpm-page .tpm-profile-btn-primary {
    background: var(--tpm-primary);
    color: #fff;
}

body.tpm-page .tpm-profile-btn-primary:hover {
    background: var(--tpm-primary-hover);
}

body.tpm-page .tpm-profile-btn-danger {
    background: #dc2626;
    color: #fff;
}

body.tpm-page .tpm-profile-btn-danger:hover {
    background: #b91c1c;
}

body.tpm-page .tpm-profile-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

body.tpm-page .tpm-profile-btn-secondary:hover {
    background: #e2e8f0;
}

body.tpm-page .tpm-profile-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

body.tpm-page .tpm-profile-message {
    padding: 12px;
    border-radius: var(--tpm-radius-sm);
    margin-bottom: 15px;
    font-size: 0.875em;
    display: none;
}

body.tpm-page .tpm-profile-message.success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    display: block;
}

body.tpm-page .tpm-profile-message.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    display: block;
}

body.tpm-page .tpm-profile-info {
    background: #f8fafc;
    padding: 12px;
    border-radius: var(--tpm-radius-sm);
    margin-bottom: 15px;
    font-size: 0.875em;
    color: #64748b;
}

/* 2FA Setup */
body.tpm-page .tpm-2fa-setup {
    display: none;
}

body.tpm-page .tpm-2fa-setup.active {
    display: block;
}

body.tpm-page .tpm-2fa-qr {
    text-align: center;
    margin: 20px 0;
}

body.tpm-page .tpm-2fa-qr img {
    max-width: 200px;
    border: 1px solid #e2e8f0;
    border-radius: var(--tpm-radius);
    padding: 10px;
    background: #fff;
}

body.tpm-page #tpm-2fa-qr-container {
    display: inline-block;
    border: 1px solid #e2e8f0;
    border-radius: var(--tpm-radius);
    padding: 10px;
    background: #fff;
}

body.tpm-page #tpm-2fa-qr-container img {
    display: block !important;
}

body.tpm-page .tpm-2fa-secret {
    font-family: monospace;
    background: #f1f5f9;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    margin: 10px 0;
    word-break: break-all;
    font-size: 1em;
    letter-spacing: 2px;
}

body.tpm-page .tpm-2fa-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

body.tpm-page .tpm-2fa-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
}

body.tpm-page .tpm-2fa-badge.enabled {
    background: #dcfce7;
    color: #166534;
}

body.tpm-page .tpm-2fa-badge.disabled {
    background: #fef2f2;
    color: #991b1b;
}

/* Recovery Codes */
body.tpm-page .tpm-recovery-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: var(--tpm-radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

body.tpm-page .tpm-recovery-warning-icon {
    font-size: 1.25em;
    flex-shrink: 0;
}

body.tpm-page .tpm-recovery-warning-text {
    font-size: 0.8125em;
    color: #92400e;
    line-height: 1.5;
}

body.tpm-page .tpm-recovery-codes {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--tpm-radius);
    padding: 16px;
    margin-bottom: 20px;
}

body.tpm-page .tpm-recovery-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

body.tpm-page .tpm-recovery-code {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9375em;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    text-align: center;
    color: #1e293b;
    letter-spacing: 1px;
}

body.tpm-page .tpm-recovery-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

body.tpm-page .tpm-recovery-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: var(--tpm-radius-sm);
    background: #fff;
    cursor: pointer;
    font-size: 0.875em;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    color: #374151;
}

body.tpm-page .tpm-recovery-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

body.tpm-page .tpm-recovery-btn.copied {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

body.tpm-page .tpm-recovery-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.875em;
    color: #374151;
    cursor: pointer;
}

body.tpm-page .tpm-recovery-checkbox input {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Print styles for recovery codes */
@media print {
    body.tpm-page * {
        visibility: hidden;
    }
    body.tpm-page .tpm-recovery-print-area ,
    body.tpm-page .tpm-recovery-print-area * {
        visibility: visible;
    }
    body.tpm-page .tpm-recovery-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 40px;
    }
    body.tpm-page .tpm-recovery-print-area h2 {
        margin-bottom: 10px;
    }
    body.tpm-page .tpm-recovery-print-area .print-site {
        color: #666;
        margin-bottom: 20px;
    }
    body.tpm-page .tpm-recovery-print-area .print-codes {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-top: 20px;
    }
    body.tpm-page .tpm-recovery-print-area .print-code {
        font-family: monospace;
        font-size: 1em;
        padding: 8px;
        border: 1px solid #ccc;
        text-align: center;
    }
}

/* ==========================================================================
   Role Switcher
   ========================================================================== */
body.tpm-page .tpm-role-switcher {
    display: inline-block;
    font-family: inherit;
}

body.tpm-page .tpm-role-switcher-label {
    color: inherit;
    opacity: 0.8;
    margin-right: 6px;
}

body.tpm-page .tpm-viewing-as {
    font-size: 0.75em;
    color: inherit;
    opacity: 0.7;
    margin-right: 6px;
    font-weight: normal;
}

/* Role badge styling */
body.tpm-page .tpm-role-badge {
    font-size: 0.6875em;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

body.tpm-page .tpm-role-badge.tpm-role-admin {
    background: #fef2f2;
    color: #dc2626;
}

body.tpm-page .tpm-role-badge.tpm-role-therapist {
    background: #eff6ff;
    color: #2563eb;
}

body.tpm-page .tpm-role-badge.tpm-role-patient {
    background: #ecfdf5;
    color: #059669;
}

/* Role icons */
body.tpm-page .tpm-role-badge::before {
    font-size: 0.75em;
}

body.tpm-page .tpm-role-badge.tpm-role-admin::before {
    content: '👑';
}

body.tpm-page .tpm-role-badge.tpm-role-therapist::before {
    content: '🩺';
}

body.tpm-page .tpm-role-badge.tpm-role-patient::before {
    content: '👤';
}

/* Native Dropdown Style */
body.tpm-page .tpm-role-switcher[data-style="dropdown"] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

body.tpm-page .tpm-role-switcher[data-style="dropdown"] select {
    padding: 8px 32px 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background-color: #fff;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23333" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 18px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    min-width: 140px;
}

body.tpm-page .tpm-role-switcher[data-style="dropdown"] select:hover {
    border-color: rgba(0, 0, 0, 0.3);
}

body.tpm-page .tpm-role-switcher[data-style="dropdown"] select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

body.tpm-page .tpm-role-switcher[data-style="dropdown"] select.switching {
    opacity: 0.6;
    pointer-events: none;
}

/* Dropdown role-specific border colors */
body.tpm-page .tpm-role-switcher.tpm-current-role-admin[data-style="dropdown"] select {
    border-color: rgba(220, 38, 38, 0.3);
}

body.tpm-page .tpm-role-switcher.tpm-current-role-therapist[data-style="dropdown"] select {
    border-color: rgba(37, 99, 235, 0.3);
}

body.tpm-page .tpm-role-switcher.tpm-current-role-patient[data-style="dropdown"] select {
    border-color: rgba(5, 150, 105, 0.3);
}

/* Accordion/Menu Style */
body.tpm-page .tpm-role-switcher[data-style="accordion"] {
    position: relative;
    display: inline-block;
    line-height: inherit;
}

body.tpm-page .tpm-role-switcher-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    background: transparent;
    border: none;
    white-space: nowrap;
    line-height: inherit;
    vertical-align: middle;
}

body.tpm-page .tpm-role-switcher-toggle:hover {
    opacity: 0.8;
}

body.tpm-page .tpm-role-switcher-toggle .tpm-current-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

body.tpm-page .tpm-role-switcher-toggle .tpm-arrow {
    transition: transform 0.3s ease;
    font-size: 0.5em;
    opacity: 0.6;
    line-height: 1;
}

body.tpm-page .tpm-role-switcher.open .tpm-arrow {
    transform: rotate(180deg);
}

/* Role badge compact for menu */
body.tpm-page .tpm-role-switcher[data-style="accordion"] .tpm-role-badge {
    padding: 2px 8px;
    font-size: 0.6875em;
}

/* Overlay popup for options */
body.tpm-page .tpm-role-options {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 160px;
    background: #fff;
    border-radius: var(--tpm-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    transform: translateX(-50%) translateY(-8px);
    z-index: 9999;
    overflow: hidden;
    margin-top: 4px;
}

body.tpm-page .tpm-role-switcher.open .tpm-role-options {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

body.tpm-page .tpm-role-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 0.875em;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

body.tpm-page .tpm-role-option:hover {
    background: #f3f4f6;
}

body.tpm-page .tpm-role-option.active {
    font-weight: 600;
}

body.tpm-page .tpm-role-option.switching {
    opacity: 0.6;
    pointer-events: none;
}

/* Buttons Style */
body.tpm-page .tpm-role-switcher[data-style="buttons"] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

body.tpm-page .tpm-role-switcher-buttons {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
}

body.tpm-page .tpm-role-switcher-btn {
    padding: 6px 12px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8125em;
    font-family: inherit;
    color: inherit;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

body.tpm-page .tpm-role-switcher-btn:hover {
    opacity: 0.8;
}

body.tpm-page .tpm-role-switcher-btn.switching {
    opacity: 0.6;
    pointer-events: none;
}

/* Button role-specific styling */
body.tpm-page .tpm-role-switcher-btn[data-role="admin"] {
    border-color: rgba(220, 38, 38, 0.3);
    color: #dc2626;
}

body.tpm-page .tpm-role-switcher-btn[data-role="admin"].active {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

body.tpm-page .tpm-role-switcher-btn[data-role="therapist"] {
    border-color: rgba(37, 99, 235, 0.3);
    color: #2563eb;
}

body.tpm-page .tpm-role-switcher-btn[data-role="therapist"].active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

body.tpm-page .tpm-role-switcher-btn[data-role="patient"] {
    border-color: rgba(5, 150, 105, 0.3);
    color: #059669;
}

body.tpm-page .tpm-role-switcher-btn[data-role="patient"].active {
    background: #059669;
    color: #fff;
    border-color: #059669;
}

/* Button icons */
body.tpm-page .tpm-role-switcher-btn[data-role="admin"]::before {
    content: '👑';
}

body.tpm-page .tpm-role-switcher-btn[data-role="therapist"]::before {
    content: '🩺';
}

body.tpm-page .tpm-role-switcher-btn[data-role="patient"]::before {
    content: '👤';
}

/* ==========================================================================
   Role Menu Style - Multi-theme Support
   theme="nectar" - Salient/Nectar optimized
   theme="generic" - Universal/clean markup
   ========================================================================== */

/* Reset - works for all themes */
body.tpm-page .tpm-role-menu.sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Menu item - inherits theme styles via standard .menu-item class */
body.tpm-page .tpm-role-menu-item {
    /* Theme handles most styling */
}

/* Link styling - minimal base, themes override */
body.tpm-page .tpm-role-menu-item > .tpm-role-link {
    display: flex;
    align-items: center;
    gap: 0.5em;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

body.tpm-page .tpm-role-menu-item > .tpm-role-link:hover {
    text-decoration: none;
}

/* Current role indicator */
body.tpm-page .tpm-role-menu-item.tpm-role-current > .tpm-role-link {
    font-weight: 600;
}

body.tpm-page .tpm-role-check {
    opacity: 0.6;
    font-size: 0.85em;
    margin-left: 4px;
}

/* Switching state */
body.tpm-page .tpm-role-menu-item .tpm-role-link.switching {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Generic Theme Styles (theme="generic") --- */
/* Icon styling for generic markup */
body.tpm-page .tpm-role-menu-item > .tpm-role-link > .fa {
    width: 1.25em;
    text-align: center;
}

/* ==========================================================================
   Native WordPress Menu Integration
   For use with #tpm-role-switcher menu items
   
   NOTE: All styling (colors, padding, hover states) inherited from theme.
   Only minimal functional CSS is defined here.
   ========================================================================== */

/* Visual feedback during role switch */
body.tpm-page .tpm-role-menu-item > a[style*="opacity: 0.5"] {
    cursor: wait;
}

/* ==========================================================================
   Patient Dashboard - Assessment Cards
   
   By default, inherits typography from theme. Colors use CSS variables
   that can be overridden. When "Force TPM styling" is enabled,
   tpm-defaults.css provides opinionated values.
   ========================================================================== */

body.tpm-page .tpm-assessment-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

body.tpm-page .tpm-assessment-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--tpm-bg-light, transparent);
    border-radius: var(--tpm-radius-md, 4px);
    border: 1px solid var(--tpm-border, currentColor);
    border-color: var(--tpm-border, rgba(0,0,0,0.1));
}

body.tpm-page .tpm-assessment-icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tpm-primary, currentColor);
    color: white;
    border-radius: 50%;
}

body.tpm-page .tpm-assessment-icon .dashicons {
    font-size: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
}

body.tpm-page .tpm-assessment-info {
    flex: 1;
    min-width: 0;
}

body.tpm-page .tpm-assessment-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: inherit;
    font-weight: 600;
    color: inherit;
}

body.tpm-page .tpm-assessment-meta {
    margin: 0;
    font-size: 0.875em;
    color: inherit;
    opacity: 0.7;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

body.tpm-page .tpm-in-progress-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--tpm-secondary, #f59e0b);
    color: white;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    opacity: 1;
}

body.tpm-page .tpm-assessment-card .tpm-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* Responsive: Stack on small screens */
@media (max-width: 480px) {
    body.tpm-page .tpm-assessment-card {
        flex-direction: column;
        text-align: center;
    }
    
    body.tpm-page .tpm-assessment-meta {
        justify-content: center;
    }
    
    body.tpm-page .tpm-assessment-card .tpm-btn {
        width: 100%;
    }
}

/* Completed assessment cards - clickable */
body.tpm-page .tpm-assessment-card-clickable {
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

body.tpm-page .tpm-assessment-card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

body.tpm-page .tpm-assessment-card-completed .tpm-assessment-icon {
    background: var(--tpm-success, #22c55e);
}

body.tpm-page .tpm-assessment-arrow {
    font-size: 1.25rem;
    color: var(--tpm-text-muted, #6b7280);
    transition: transform 0.2s;
}

body.tpm-page .tpm-assessment-card-clickable:hover .tpm-assessment-arrow {
    transform: translateX(4px);
    color: var(--tpm-primary, currentColor);
}

/* ==========================================================================
   Patient My Result View
   ========================================================================== */
body.tpm-page .tpm-my-result {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

body.tpm-page .tpm-result-header {
    margin-bottom: 2rem;
}

body.tpm-page .tpm-result-header h2 {
    margin: 0.5rem 0 0.25rem;
    font-size: 1.75rem;
}

body.tpm-page .tpm-result-meta {
    color: var(--tpm-text-muted, #6b7280);
    margin: 0;
}

body.tpm-page .tpm-result-scores ,
body.tpm-page .tpm-result-summary {
    background: var(--tpm-bg-light, #f8f9fa);
    border-radius: var(--tpm-radius-md, 8px);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

body.tpm-page .tpm-result-scores h3 ,
body.tpm-page .tpm-result-summary h3 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
}

body.tpm-page .tpm-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

body.tpm-page .tpm-score-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: var(--tpm-radius-sm, 4px);
    border: 1px solid var(--tpm-border, #e0e0e0);
}

body.tpm-page .tpm-score-label {
    font-weight: 500;
}

body.tpm-page .tpm-score-value {
    font-weight: 600;
    color: var(--tpm-primary, #2563eb);
}

/* Score bar styles */
body.tpm-page .tpm-personality-scores ,
body.tpm-page .tpm-ei-scores {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

body.tpm-page .tpm-score-bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

body.tpm-page .tpm-score-bar-label {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

body.tpm-page .tpm-score-bar-value {
    font-weight: 600;
}

body.tpm-page .tpm-score-bar-track {
    height: 12px;
    background: var(--tpm-border, #e0e0e0);
    border-radius: 6px;
    overflow: hidden;
}

body.tpm-page .tpm-score-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease-out;
}

/* ==========================================================================
   Assessment List View (Patient Data Page)
   ========================================================================== */
body.tpm-page .tpm-assessments-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

body.tpm-page .tpm-assessment-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--tpm-bg-light, #f8f9fa);
    border: 1px solid var(--tpm-border, #e0e0e0);
    border-radius: var(--tpm-radius-md, 8px);
    transition: background 0.2s, box-shadow 0.2s;
}

body.tpm-page .tpm-assessment-list-item:hover {
    background: var(--tpm-bg-hover, #f0f1f3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

body.tpm-page .tpm-assessment-list-item.tpm-assessment-incomplete {
    opacity: 0.7;
    background: var(--tpm-bg-muted, #f5f5f5);
}

body.tpm-page .tpm-assessment-list-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

body.tpm-page .tpm-assessment-list-type {
    font-weight: 600;
    font-size: 1rem;
    color: var(--tpm-text, #1f2937);
}

body.tpm-page .tpm-assessment-list-date {
    font-size: 0.875rem;
    color: var(--tpm-text-muted, #6b7280);
}

body.tpm-page .tpm-variant-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    vertical-align: middle;
}

body.tpm-page .tpm-variant-badge.tpm-variant-short {
    background-color: #dbeafe;
    color: #1e40af;
}

body.tpm-page .tpm-variant-badge.tpm-variant-full {
    background-color: #e5e7eb;
    color: #374151;
}

@media (max-width: 480px) {
    body.tpm-page .tpm-assessment-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    body.tpm-page .tpm-assessment-list-item .tpm-btn {
        width: 100%;
    }
}

/* ============================================
   Assessment Detail Page
   ============================================ */

body.tpm-page .tpm-assessment-detail {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

body.tpm-page .tpm-assessment-detail .tpm-patient-header {
    margin-bottom: 2rem;
}

body.tpm-page .tpm-assessment-detail .tpm-patient-header h2 {
    margin: 0.5rem 0;
    font-size: 1.75rem;
}

body.tpm-page .tpm-assessment-detail .tpm-assessment-meta {
    color: var(--tpm-text-muted, #6b7280);
    font-size: 0.9375rem;
    margin: 0;
}

body.tpm-page .tpm-charts-section {
    background: var(--tpm-bg-card, #fff);
    border: 1px solid var(--tpm-border, #e0e0e0);
    border-radius: var(--tpm-radius-lg, 12px);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

body.tpm-page .tpm-charts-section h3 {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
    color: var(--tpm-text, #1f2937);
}

body.tpm-page .tpm-charts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

body.tpm-page .tpm-charts-header h3 {
    margin: 0;
}

body.tpm-page .tpm-scores-action-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

/* Ensure analysis section styling in assessment detail */
body.tpm-page .tpm-assessment-detail .tpm-analysis-section {
    background: var(--tpm-bg-card, #fff);
    border: 1px solid var(--tpm-border, #e0e0e0);
    border-radius: var(--tpm-radius-lg, 12px);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

body.tpm-page .tpm-assessment-detail .tpm-analysis-section h3 {
    margin: 0 0 1rem;
    font-size: 1.25rem;
}

/* Notice styling in assessment detail */
body.tpm-page .tpm-assessment-detail .tpm-notice {
    padding: 1rem 1.25rem;
    border-radius: var(--tpm-radius-md, 8px);
    margin-bottom: 1.5rem;
}

body.tpm-page .tpm-assessment-detail .tpm-notice.tpm-warning {
    background: #fef3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

body.tpm-page .tpm-assessment-detail .tpm-notice h4 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

body.tpm-page .tpm-assessment-detail .tpm-notice p {
    margin: 0.25rem 0;
}

@media (max-width: 768px) {
    body.tpm-page .tpm-assessment-detail {
        padding: 0 0.75rem;
    }
    
    body.tpm-page .tpm-charts-section ,
    body.tpm-page .tpm-assessment-detail .tpm-analysis-section {
        padding: 1rem;
    }
    
    body.tpm-page .tpm-assessment-detail .tpm-patient-header h2 {
        font-size: 1.5rem;
    }
}

/* ============================================
   Analysis History List (Assessment Detail)
   ============================================ */

body.tpm-page .tpm-analysis-history {
    margin-top: 1.5rem;
}

body.tpm-page .tpm-analysis-history h4 {
    margin: 0 0 1rem;
    font-size: 1.125rem;
    color: var(--tpm-text, #1f2937);
}

body.tpm-page .tpm-analysis-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

body.tpm-page .tpm-analysis-history-item {
    background: #fff;
    border: 1px solid var(--tpm-border, #e0e0e0);
    border-left: 3px solid #6b9e8a;
    border-radius: var(--tpm-radius-md, 8px);
    padding: 1rem 1.25rem;
    transition: background 0.2s, box-shadow 0.2s;
}

body.tpm-page .tpm-analysis-history-item:hover {
    background: #f8fafb;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

body.tpm-page .tpm-analysis-history-item.tpm-analysis-failed {
    border-left-color: #c47a7a;
    background: #fdf8f8;
}

body.tpm-page .tpm-analysis-history-item.tpm-analysis-pending {
    border-left-color: #d4a84b;
}

body.tpm-page .tpm-history-item-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

body.tpm-page .tpm-history-item-info {
    flex: 1;
    min-width: 0;
}

body.tpm-page .tpm-history-goal {
    margin: 0 0 0.25rem;
    font-size: 0.9375rem;
    color: var(--tpm-text, #1f2937);
    line-height: 1.4;
}

body.tpm-page .tpm-history-date {
    font-size: 0.8125rem;
    color: var(--tpm-text-muted, #6b7280);
}

body.tpm-page .tpm-history-item-actions {
    flex-shrink: 0;
}

body.tpm-page .tpm-history-error {
    margin: 0.75rem 0 0;
    padding: 0.5rem 0.75rem;
    background: #fdf2f2;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #9b4444;
}

body.tpm-page .tpm-analysis-outdated-warning {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.125rem 0.5rem;
    background: #fff3cd;
    color: #856404;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: help;
}

body.tpm-page .tpm-history-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    body.tpm-page .tpm-history-item-content {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    body.tpm-page .tpm-history-item-actions {
        width: 100%;
    }
    
    body.tpm-page .tpm-history-item-actions .tpm-btn {
        width: 100%;
    }
}

/* ============================================
   Assessment Title (Assessment Detail Page)
   ============================================ */

body.tpm-page .tpm-assessment-title-wrapper {
    margin: 1rem 0;
}

body.tpm-page .tpm-assessment-title-wrapper label {
    display: block;
    font-size: 0.875rem;
    color: var(--tpm-text-muted, #6b7280);
    margin-bottom: 0.375rem;
}

body.tpm-page .tpm-assessment-title-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

body.tpm-page .tpm-assessment-title-input {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--tpm-border, #e0e0e0);
    border-radius: var(--tpm-radius-md, 6px);
    background: var(--tpm-bg-card, #fff);
    color: var(--tpm-text, #1f2937);
}

body.tpm-page .tpm-assessment-title-input:focus {
    outline: none;
    border-color: var(--tpm-primary, #0073aa);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

body.tpm-page .tpm-assessment-title-input::placeholder {
    color: var(--tpm-text-muted, #9ca3af);
}

body.tpm-page .tpm-title-status {
    font-size: 0.875rem;
    min-width: 80px;
}

body.tpm-page .tpm-title-status.tpm-title-saved {
    color: #22c55e;
}

body.tpm-page .tpm-title-status.tpm-title-error {
    color: #dc3545;
}

/* ============================================
   Assessment List Title (Patient Data Page)
   ============================================ */

body.tpm-page .tpm-assessment-list-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--tpm-text, #1f2937);
    display: block;
}

body.tpm-page .tpm-assessment-type-secondary {
    font-weight: 400 !important;
    font-size: 0.8125rem !important;
    color: var(--tpm-text-muted, #6b7280) !important;
}

@media (max-width: 480px) {
    body.tpm-page .tpm-assessment-title-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    body.tpm-page .tpm-assessment-title-input {
        max-width: none;
    }
    
    body.tpm-page .tpm-save-title-btn {
        width: 100%;
    }
}

/* ============================================
   Section Header with Actions
   ============================================ */

body.tpm-page .tpm-section-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

body.tpm-page .tpm-section-header-with-actions h3 {
    margin: 0;
}

body.tpm-page .tpm-bulk-download-btn {
    white-space: nowrap;
}

@media (max-width: 480px) {
    body.tpm-page .tpm-section-header-with-actions {
        flex-direction: column;
        align-items: flex-start;
    }
    
    body.tpm-page .tpm-bulk-download-btn {
        width: 100%;
        text-align: center;
    }
}

/* ============================================
   EI Assessment Bar Charts
   ============================================ */

body.tpm-page .tpm-ei-overall-score {
    background: var(--tpm-bg-white, #ffffff);
    border-radius: var(--tpm-radius-lg, 0.75rem);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--tpm-border, #e5e7eb);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.tpm-page .tpm-ei-overall-content {
    display: flex;
    align-items: center;
    gap: 2rem;
}

body.tpm-page .tpm-ei-overall-gauge {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

body.tpm-page .tpm-ei-circle-gauge {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
}

body.tpm-page .tpm-ei-gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    align-items: baseline;
    justify-content: center;
}

body.tpm-page .tpm-ei-gauge-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--tpm-text-primary, #1f2937);
    line-height: 1;
}

body.tpm-page .tpm-ei-gauge-percent {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--tpm-text-muted, #6b7280);
    margin-left: 2px;
}

body.tpm-page .tpm-ei-overall-details {
    flex: 1;
}

body.tpm-page .tpm-ei-overall-title {
    margin: 0 0 0.75rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--tpm-text-primary, #1f2937);
}

body.tpm-page .tpm-ei-level-badge {
    display: inline-block;
    padding: 0.375rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

body.tpm-page .tpm-ei-level-exceptional ,
body.tpm-page .tpm-ei-level-high {
    background: #ecf5f0;
    color: #3d6b56;
}

body.tpm-page .tpm-ei-level-above.average ,
body.tpm-page .tpm-ei-level-above {
    background: #eef2f7;
    color: #3b5998;
}

body.tpm-page .tpm-ei-level-moderate {
    background: #fef9ec;
    color: #8a6d2b;
}

body.tpm-page .tpm-ei-level-developing ,
body.tpm-page .tpm-ei-level-low {
    background: #fdf2f2;
    color: #9b4444;
}

body.tpm-page .tpm-ei-description {
    margin: 0;
    color: var(--tpm-text-muted, #6b7280);
    font-size: 0.95rem;
    line-height: 1.6;
}

body.tpm-page .tpm-ei-categories {
    background: var(--tpm-bg-white, #ffffff);
    border: 1px solid var(--tpm-border, #e5e7eb);
    border-radius: var(--tpm-radius-lg, 0.75rem);
    padding: 1.5rem 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.tpm-page .tpm-ei-categories h4 {
    margin: 0 0 1.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--tpm-text-primary, #1f2937);
}

body.tpm-page .tpm-ei-category-row {
    margin-bottom: 1.25rem;
}

body.tpm-page .tpm-ei-category-row:last-child {
    margin-bottom: 0;
}

body.tpm-page .tpm-ei-category-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

body.tpm-page .tpm-ei-category-name {
    font-weight: 500;
    color: var(--tpm-text-primary, #1f2937);
    font-size: 0.95rem;
}

body.tpm-page .tpm-ei-category-value {
    font-weight: 600;
    color: var(--tpm-text-primary, #374151);
    font-size: 0.95rem;
}

body.tpm-page .tpm-ei-category-bar {
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
}

body.tpm-page .tpm-ei-category-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease-out;
    min-width: 3%;
}

@media (max-width: 600px) {
    body.tpm-page .tpm-ei-overall-content {
        flex-direction: column;
        text-align: center;
    }
    
    body.tpm-page .tpm-ei-overall-gauge {
        width: 120px;
        height: 120px;
    }
    
    body.tpm-page .tpm-ei-gauge-value {
        font-size: 2rem;
    }
    
    body.tpm-page .tpm-ei-overall-details {
        text-align: center;
    }
    
    body.tpm-page .tpm-ei-categories {
        padding: 1.25rem;
    }
}

/* ==========================================================================
   Login Form - Extracted Inline Styles
   ========================================================================== */

/* Hidden fields for password managers */
body.tpm-page .tpm-hidden-field {
    display: none;
}

/* Login header section (icon + title + subtitle) */
body.tpm-page .tpm-login-header {
    text-align: center;
    margin-bottom: 25px;
}

body.tpm-page .tpm-login-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

body.tpm-page .tpm-login-header h2 {
    margin: 0 0 5px;
}

body.tpm-page .tpm-login-header-subtitle {
    color: #64748b;
    margin: 0;
    font-size: 14px;
}

body.tpm-page .tpm-login-header-email {
    color: #94a3b8;
    margin: 10px 0 0;
    font-size: 13px;
}

/* Alert spacing */
body.tpm-page .tpm-login-form .tpm-alert {
    margin-bottom: 20px;
}

body.tpm-page .tpm-login-form .tpm-alert-success {
    padding: 12px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    color: #166534;
}

/* Password requirements list */
body.tpm-page .tpm-password-requirements {
    margin-top: 10px;
}

body.tpm-page .tpm-password-requirements ul {
    color: #64748b;
    font-size: 13px;
    margin: 0;
    padding-left: 20px;
}

/* Full width button */
body.tpm-page .tpm-btn-block {
    width: 100%;
    margin-top: 20px;
}

/* 2FA code input */
body.tpm-page .tpm-2fa-input {
    font-size: 28px;
    letter-spacing: 8px;
    text-align: center;
    font-family: monospace;
    padding: 15px;
}

/* 2FA footer section */
body.tpm-page .tpm-2fa-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

body.tpm-page .tpm-2fa-footer p {
    color: #64748b;
    font-size: 13px;
    margin: 0 0 10px;
}

body.tpm-page .tpm-2fa-footer p:last-of-type {
    margin: 0;
}

body.tpm-page .tpm-btn-back {
    display: inline-block;
    margin-top: 15px;
    background: transparent;
    border: 1px solid #d1d5db;
    color: #64748b;
    text-decoration: none;
}

/* Login options row (remember me + forgot password) */
body.tpm-page .tpm-login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 18px 0;
}

body.tpm-page .tpm-remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #475569;
    user-select: none;
}

body.tpm-page .tpm-remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    cursor: pointer;
}

/* Remove margin from submit button group */
body.tpm-page .tpm-form-group-submit {
    margin-top: 0;
}

/* ==========================================================================
   Assessment Detail View
   ========================================================================== */

body.tpm-page .tpm-assessment-detail {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 0;
}

/* Result Header Card */
body.tpm-page .tpm-result-header-card {
    border-top: 4px solid var(--tpm-success);
}

body.tpm-page .tpm-result-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    flex-wrap: wrap;
}

body.tpm-page .tpm-result-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: #ecf5f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
}

body.tpm-page .tpm-result-details {
    flex: 1;
    min-width: 200px;
}

body.tpm-page .tpm-result-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--tpm-text);
}

body.tpm-page .tpm-result-meta {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9375rem;
    color: var(--tpm-text-muted);
}

body.tpm-page .tpm-result-meta strong {
    color: var(--tpm-text);
}

body.tpm-page .tpm-result-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Badges */
body.tpm-page .tpm-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--tpm-radius-pill);
    font-size: 0.8125rem;
    font-weight: 500;
}

body.tpm-page .tpm-badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

body.tpm-page .tpm-badge-info {
    background: #e3f2fd;
    color: #1565c0;
}

/* Scores Grid */
body.tpm-page .tpm-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

body.tpm-page .tpm-score-item {
    background: var(--tpm-bg);
    padding: 1rem;
    border-radius: var(--tpm-radius-sm);
}

body.tpm-page .tpm-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

body.tpm-page .tpm-score-label {
    font-weight: 500;
    color: var(--tpm-text);
}

body.tpm-page .tpm-score-value {
    font-weight: 700;
    font-size: 1rem;
}

body.tpm-page .tpm-score-value.tpm-score-high {
    color: var(--tpm-success);
}

body.tpm-page .tpm-score-value.tpm-score-medium {
    color: var(--tpm-warning);
}

body.tpm-page .tpm-score-value.tpm-score-low {
    color: var(--tpm-danger);
}

body.tpm-page .tpm-score-bar {
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
}

body.tpm-page .tpm-score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

body.tpm-page .tpm-score-fill.tpm-score-high {
    background: #6b9e8a;
}

body.tpm-page .tpm-score-fill.tpm-score-medium {
    background: #d4a84b;
}

body.tpm-page .tpm-score-fill.tpm-score-low {
    background: #c47a7a;
}

/* Score Legend */
body.tpm-page .tpm-score-legend {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--tpm-border);
    font-size: 0.8125rem;
    color: var(--tpm-text-muted);
}

body.tpm-page .tpm-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

body.tpm-page .tpm-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

body.tpm-page .tpm-legend-color.tpm-score-high {
    background: var(--tpm-success);
}

body.tpm-page .tpm-legend-color.tpm-score-medium {
    background: var(--tpm-warning);
}

body.tpm-page .tpm-legend-color.tpm-score-low {
    background: var(--tpm-danger);
}

/* AI Analysis Card */
body.tpm-page .tpm-analysis-card {
    border-left: 4px solid #1565c0;
}

body.tpm-page .tpm-analysis-content {
    line-height: 1.7;
    color: var(--tpm-text);
}

body.tpm-page .tpm-analysis-content h1 ,
body.tpm-page .tpm-analysis-content h2 ,
body.tpm-page .tpm-analysis-content h3 ,
body.tpm-page .tpm-analysis-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--tpm-text);
}

body.tpm-page .tpm-analysis-content h1:first-child ,
body.tpm-page .tpm-analysis-content h2:first-child ,
body.tpm-page .tpm-analysis-content h3:first-child ,
body.tpm-page .tpm-analysis-content h4:first-child {
    margin-top: 0;
}

body.tpm-page .tpm-analysis-content p {
    margin-bottom: 1rem;
}

body.tpm-page .tpm-analysis-content ul ,
body.tpm-page .tpm-analysis-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

body.tpm-page .tpm-analysis-content li {
    margin-bottom: 0.5rem;
}

body.tpm-page .tpm-analysis-content strong {
    color: var(--tpm-text);
}

body.tpm-page .tpm-analysis-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--tpm-border);
}

body.tpm-page .tpm-analysis-disclaimer {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--tpm-text-light);
}

/* Empty State */
body.tpm-page .tpm-empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

body.tpm-page .tpm-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

body.tpm-page .tpm-empty-state h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    color: var(--tpm-text);
}

body.tpm-page .tpm-empty-state p {
    margin: 0;
    color: var(--tpm-text-muted);
}

/* Result Actions */
body.tpm-page .tpm-result-actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Print styles */
@media print {
    body.tpm-page .tpm-page-header ,
    body.tpm-page .tpm-result-actions {
        display: none !important;
    }
    
    body.tpm-page .tpm-card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }
    
    body.tpm-page .tpm-assessment-detail {
        max-width: 100%;
        padding: 0;
    }
}

/* Responsive adjustments for assessment detail */
@media (max-width: 640px) {
    body.tpm-page .tpm-assessment-detail {
        padding: 1rem 0;
    }
    
    body.tpm-page .tpm-result-header {
        flex-direction: column;
        text-align: center;
    }
    
    body.tpm-page .tpm-result-icon {
        margin: 0 auto;
    }
    
    body.tpm-page .tpm-result-details {
        text-align: center;
    }
    
    body.tpm-page .tpm-result-badges {
        justify-content: center;
    }
    
    body.tpm-page .tpm-scores-grid {
        grid-template-columns: 1fr;
    }
    
    body.tpm-page .tpm-score-legend {
        justify-content: center;
    }
    
    body.tpm-page .tpm-result-actions {
        flex-direction: column;
    }
    
    body.tpm-page .tpm-result-actions .tpm-btn {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   Logout Page
   ========================================================================== */
body.tpm-page .tpm-logout-page {
    max-width: 400px;
    margin: 50px auto;
    padding: 40px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: var(--tpm-radius, 8px);
    box-shadow: var(--tpm-shadow, 0 1px 3px rgba(0,0,0,0.1));
    text-align: center;
}

body.tpm-page .tpm-logout-page h2 {
    margin: 0 0 10px 0;
    color: #166534;
    font-size: 1.5em;
}

body.tpm-page .tpm-logout-message {
    color: #666;
    margin: 0 0 25px 0;
    font-size: 1em;
}

body.tpm-page .tpm-logout-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

body.tpm-page .tpm-logout-page .tpm-btn {
    border-radius: 5px;
    font-size: 0.875em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}


body.tpm-page .tpm-redirect-notice {
    margin-top: 20px;
    color: #999;
    font-size: 0.8125em;
}

/* ==========================================================================
   Success Checkmark Animation
   ========================================================================== */
body.tpm-page .tpm-success-icon-wrapper {
    margin-bottom: 25px;
}

body.tpm-page .tpm-success-circle {
    width: 100px;
    height: 100px;
    margin: 0 auto;
}

body.tpm-page .tpm-checkmark-svg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #22c55e;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px #22c55e;
    animation: tpm-fill .4s ease-in-out .4s forwards, tpm-scale .3s ease-in-out .9s both;
}

body.tpm-page .tpm-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #22c55e;
    fill: none;
    animation: tpm-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

body.tpm-page .tpm-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-width: 3;
    animation: tpm-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes tpm-stroke {
    100% { stroke-dashoffset: 0; }
}

@keyframes tpm-scale {
    0%, 100% { transform: none; }
    50% { transform: scale3d(1.1, 1.1, 1); }
}

@keyframes tpm-fill {
    100% { box-shadow: inset 0px 0px 0px 50px #f0fdf4; }
}

/* Smaller variant for logout page */
body.tpm-page .tpm-success-icon-wrapper.tpm-success-sm .tpm-success-circle ,
body.tpm-page .tpm-success-icon-wrapper.tpm-success-sm .tpm-checkmark-svg {
    width: 60px;
    height: 60px;
}

body.tpm-page .tpm-success-icon-wrapper.tpm-success-sm {
    margin-bottom: 15px;
}

/* ============================================
   Patient Dashboard
   ============================================ */

body.tpm-page .tpm-patient-dashboard {
    max-width: 700px;
    margin: 20px auto;
    padding: 20px;
}

body.tpm-page .tpm-assessments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

body.tpm-page .tpm-no-assessments-notice {
    text-align: center;
    padding: 40px 20px;
    background: var(--tpm-bg-light, #f8f9fa);
    border-radius: var(--tpm-radius-lg, 12px);
    border: 2px dashed var(--tpm-border, #ddd);
    margin-top: 15px;
}

body.tpm-page .tpm-notice-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.6;
}

body.tpm-page .tpm-notice-title {
    font-weight: 600;
    color: var(--tpm-text, #333);
    margin: 0 0 10px 0;
    font-size: 16px;
}

body.tpm-page .tpm-notice-text {
    color: var(--tpm-text-muted, #666);
    margin: 0;
    font-size: 14px;
}

body.tpm-page .tpm-status-pending {
    background: #fff3cd;
    color: #856404;
}

body.tpm-page .tpm-status-inprogress {
    background: #cce5ff;
    color: #004085;
}

/* Privacy Section */
body.tpm-page .tpm-privacy-section {
    border-left: 4px solid #17a2b8;
}

body.tpm-page .tpm-privacy-info p {
    margin: 10px 0;
}

body.tpm-page .tpm-privacy-info a {
    color: var(--tpm-primary, #0073aa);
    text-decoration: none;
}

body.tpm-page .tpm-privacy-info a:hover {
    text-decoration: underline;
}

body.tpm-page .tpm-privacy-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

body.tpm-page .tpm-btn-danger-outline {
    background: transparent;
    border: 2px solid #dc3545;
    color: #dc3545;
}

body.tpm-page .tpm-btn-danger-outline:hover {
    background: #dc3545;
    color: white;
}

/* AJAX Grid Loading States */
body.tpm-page .tpm-ajax-grid {
    min-height: 100px;
}

body.tpm-page .tpm-grid-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6c757d;
}

body.tpm-page .tpm-grid-loading .tpm-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: tpm-spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes tpm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

body.tpm-page .tpm-grid-loading p {
    margin: 0;
    font-size: 14px;
}

body.tpm-page .tpm-grid-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    margin-top: -1px;
}

body.tpm-page .tpm-grid-pagination .tpm-pagination-info {
    color: #6c757d;
    font-size: 13px;
}

body.tpm-page .tpm-grid-pagination .tpm-pagination-controls {
    display: flex;
    gap: 8px;
}

body.tpm-page .tpm-hidden {
    display: none !important;
}

/* ==========================================================================
   Patient Actions - Improved UX
   ========================================================================== */
body.tpm-page .tpm-actions-cell {
    white-space: nowrap;
}

body.tpm-page .tpm-patient-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.tpm-page .tpm-action-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}

body.tpm-page .tpm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    line-height: 1;
}

body.tpm-page .tpm-icon-btn:hover {
    transform: scale(1.1);
}

body.tpm-page .tpm-icon-btn:active {
    transform: scale(0.95);
}

body.tpm-page .tpm-icon-btn .tpm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

body.tpm-page .tpm-icon-btn-danger {
    background: #fee2e2;
    color: #dc2626;
}

body.tpm-page .tpm-icon-btn-danger:hover {
    background: #fecaca;
}

body.tpm-page .tpm-icon-btn-success {
    background: #dcfce7;
    color: #16a34a;
}

body.tpm-page .tpm-icon-btn-success:hover {
    background: #bbf7d0;
}

body.tpm-page .tpm-icon-btn-warning {
    background: #fef3c7;
    color: #d97706;
}

body.tpm-page .tpm-icon-btn-warning:hover {
    background: #fde68a;
}

body.tpm-page .tpm-icon-btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
}

body.tpm-page .tpm-icon-btn-secondary:hover {
    background: #e5e7eb;
}

/* ==========================================================================
   Clinical Profile Card
   ========================================================================== */

body.tpm-page .tpm-clinical-profile-card {
    margin-top: 0;
}

body.tpm-page .tpm-clinical-profile-header {
    cursor: pointer;
    user-select: none;
}

body.tpm-page .tpm-clinical-profile-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.tpm-page .tpm-toggle-icon {
    font-size: 0.7em;
    transition: transform 0.2s ease;
    color: var(--tpm-text-muted, #6b7280);
}

body.tpm-page .tpm-clinical-section {
    border: 1px solid var(--tpm-border, #e2e8f0);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    background: var(--tpm-bg-light, #f8fafc);
}

body.tpm-page .tpm-clinical-section legend {
    font-weight: 600;
    font-size: 0.95em;
    padding: 0 8px;
    color: var(--tpm-text, #1e293b);
}

body.tpm-page .tpm-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px 16px;
}

body.tpm-page .tpm-checkbox-group .tpm-checkbox-label,
body.tpm-page .tpm-radio-group .tpm-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    cursor: pointer;
    padding: 3px 0;
}

body.tpm-page .tpm-checkbox-group .tpm-checkbox-label input,
body.tpm-page .tpm-radio-group .tpm-checkbox-label input {
    margin: 0;
    flex-shrink: 0;
}

body.tpm-page .tpm-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
}

body.tpm-page .tpm-risk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

body.tpm-page .tpm-risk-item label {
    display: block;
    font-weight: 500;
    font-size: 0.85em;
    margin-bottom: 4px;
    color: var(--tpm-text-muted, #6b7280);
}

body.tpm-page .tpm-risk-item select {
    width: 100%;
}

@media (max-width: 600px) {
    body.tpm-page .tpm-checkbox-group {
        grid-template-columns: 1fr;
    }
    body.tpm-page .tpm-risk-grid {
        grid-template-columns: 1fr;
    }
}
