/* ==========================================================================
   TMS Dashboard — Consolidated Stylesheet
   Covers: therapist dashboard, patient dashboard, profiles, tasks, forms
   ========================================================================== */

/* ---------- Reset ---------- */
* { box-sizing: border-box; }

/* ==========================================================================
   1. LAYOUT — Dashboard Shell
   ========================================================================== */

.tms-dashboard {
    display: flex;
    min-height: 100vh;
    background: #fdf6f0;
    font-family: Arial, sans-serif;
}

/* ---------- Sidebar ---------- */
.tms-sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #f0e6dc;
    padding: 30px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.tms-sidebar-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
    border: 3px solid #e0d5ca;
}

.tms-sidebar-name {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.tms-sidebar-role {
    font-size: 12px;
    color: #0d9488;
    margin: 2px 0 6px;
}

.tms-sidebar-status {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 12px;
}

.tms-sidebar-status-active {
    background: #d1fae5;
    color: #065f46;
}

.tms-sidebar-status-inactive {
    background: #fee2e2;
    color: #991b1b;
}

.tms-btn-edit-profile {
    display: inline-block;
    padding: 6px 18px;
    background: transparent;
    color: #dc4a68;
    border: 1.5px solid #dc4a68;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 20px;
}

.tms-btn-edit-profile:hover {
    background: #dc4a68;
    color: #fff;
}

.tms-sidebar-nav {
    width: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
}

.tms-sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 25px;
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.tms-sidebar-nav li a:hover,
.tms-sidebar-nav li a.active {
    background: #fdf2e9;
    color: #dc4a68;
    border-left-color: #dc4a68;
    font-weight: 600;
}

.tms-sidebar-nav li a .nav-icon {
    width: 18px;
    text-align: center;
}

/* ---------- Main Content ---------- */
.tms-main {
    flex: 1;
    padding: 30px 40px;
    overflow-x: auto;
}

.tms-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.tms-main-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

/* ==========================================================================
   2. BUTTONS
   ========================================================================== */

.tms-btn-add {
    padding: 10px 20px;
    background: #dc4a68;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

.tms-btn-add:hover {
    opacity: 0.9;
}

.tms-btn-view {
    padding: 6px 16px;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

.tms-btn-view:hover {
    opacity: 0.85;
}

.tms-btn-assign {
    padding: 6px 16px;
    background: #0d9488;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

.tms-btn-assign:hover {
    opacity: 0.85;
}

.tms-btn-add-small {
    padding: 6px 14px;
    background: #0d9488;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.tms-btn-add-small:hover {
    opacity: 0.85;
}

.tms-btn-remove {
    padding: 4px 12px;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.tms-btn-remove:hover {
    background: #fecaca;
}

.tms-btn-remove-sm {
    margin-left: auto;
    width: 24px;
    height: 24px;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.tms-btn-remove-sm:hover {
    background: #fecaca;
}

.tms-btn-sm {
    font-size: 11px;
    padding: 3px 10px;
}

.tms-actions {
    display: flex;
    gap: 6px;
}

/* ==========================================================================
   3. TABLE
   ========================================================================== */

.tms-table-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.tms-table {
    width: 100%;
    border-collapse: collapse;
}

.tms-table thead th {
    background: #fdf6f0;
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #f0e6dc;
    transition: color 0.15s;
}

.tms-table thead th:hover {
    color: #dc4a68;
}

.tms-sort-icon {
    font-size: 10px;
    color: #d1d5db;
    vertical-align: middle;
}

.tms-table thead th:hover .tms-sort-icon {
    color: #dc4a68;
}

.tms-table tbody tr {
    border-bottom: 1px solid #f5ede6;
    transition: background 0.15s;
}

.tms-table tbody tr:last-child {
    border-bottom: none;
}

.tms-table tbody tr:hover {
    background: #fefaf6;
}

.tms-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: #374151;
    vertical-align: middle;
}

.tms-patient-id {
    font-weight: 700;
    color: #1f2937;
}

.tms-patient-contact {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tms-patient-phone {
    font-size: 13px;
    color: #374151;
}

.tms-patient-email {
    font-size: 12px;
    color: #9ca3af;
}

/* ==========================================================================
   4. STATUS BADGES & CATEGORY BADGES
   ========================================================================== */

.tms-status {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.tms-status-active {
    background: #d1fae5;
    color: #065f46;
}

.tms-status-paused {
    background: #fef3c7;
    color: #92400e;
}

.tms-status-completed {
    background: #dbeafe;
    color: #1e40af;
}

.tms-status-archived {
    background: #ffe4e6;
    color: #9f1239;
}

.tms-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.tms-badge-thought-diary {
    background: #ede9fe;
    color: #5b21b6;
}

.tms-badge-behaviour-tracker {
    background: #dbeafe;
    color: #1e40af;
}

.tms-badge-mood-tracker {
    background: #fef3c7;
    color: #92400e;
}

.tms-badge-sleep-diary {
    background: #e0e7ff;
    color: #3730a3;
}

/* Category badge (dynamic from taxonomy) */
.tms-cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: default;
    white-space: nowrap;
}

.tms-cat-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* ==========================================================================
   5. EMPTY STATE
   ========================================================================== */

.tms-empty {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.tms-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.tms-empty p {
    font-size: 15px;
    margin: 0;
}

/* ==========================================================================
   6. FORMS
   ========================================================================== */

.tms-form-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    padding: 35px;
    max-width: 600px;
}

.tms-form-card-wide {
    max-width: 750px;
}

.tms-form-row {
    margin-bottom: 20px;
}

.tms-form-row-half {
    display: flex;
    gap: 20px;
}

.tms-form-row-half .tms-form-row {
    flex: 1;
}

.tms-form-label {
    display: block;
    color: #374151;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.tms-form-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.tms-form-input:focus {
    border-color: #dc4a68;
    outline: none;
}

.tms-form-input-range {
    padding: 0;
}

.tms-form-hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.tms-form-hint-inline {
    margin-top: 0;
    margin-bottom: 8px;
}

.tms-form-btn {
    padding: 12px 30px;
    background: #dc4a68;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.tms-form-btn:hover {
    opacity: 0.9;
}

.tms-form-btn-secondary {
    padding: 12px 30px;
    background: #e5e7eb;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}

.tms-form-btn-secondary:hover {
    opacity: 0.85;
}

.tms-form-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.tms-form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.tms-form-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.tms-form-success a {
    color: #166534;
    font-weight: 600;
}

/* ==========================================================================
   7. TASK BUILDER — Parts & Questions
   ========================================================================== */

.tms-form-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 15px;
}

.tms-parts-header,
.tms-questions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.tms-part-block {
    background: #fdf6f0;
    border: 1px solid #f0e6dc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.tms-part-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.tms-part-header-toggle {
    cursor: pointer;
    padding: 10px 15px;
    margin: -10px -15px 15px;
    border-radius: 8px;
    transition: background 0.15s;
}

.tms-part-header-toggle:hover {
    background: rgba(0,0,0,0.03);
}

.tms-part-drag {
    cursor: grab;
    font-size: 16px;
    color: #d1d5db;
    flex-shrink: 0;
}

.tms-part-drag:hover {
    color: #9ca3af;
}

.tms-part-title-display {
    font-weight: 400;
    color: #6b7280;
}

.tms-part-body {
    /* collapsible body wrapper */
}

.tms-part-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
}

.tms-questions-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5ddd5;
}

.tms-question-block {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
}

.tms-question-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.tms-question-block.sortable-ghost {
    opacity: 0.4;
    background: #fdf6f0;
}

.tms-question-num {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 10px;
    border-radius: 4px;
}

.tms-ref-id-badge {
    font-size: 9px;
    font-family: monospace;
    font-weight: 600;
    background: #f3f4f6;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    user-select: none;
}

.tms-drag-handle {
    cursor: grab;
    font-size: 16px;
    color: #9ca3af;
    user-select: none;
}

.tms-drag-handle:hover {
    color: #374151;
}

/* ==========================================================================
   8. TOOLTIP
   ========================================================================== */

.tms-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d1ccc7;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
    line-height: 1;
}

.tms-tooltip:hover {
    background: #c2956b;
}

.tms-tooltip:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: normal;
    width: 260px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    pointer-events: none;
}

.tms-tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    z-index: 100;
    pointer-events: none;
}

/* ==========================================================================
   9. TASK DETAIL VIEW — Cards, Grids, Parts
   ========================================================================== */

.tms-detail-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    padding: 25px 30px;
    margin-bottom: 25px;
}

.tms-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.tms-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tms-detail-label {
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tms-detail-value {
    font-size: 14px;
    color: #1f2937;
    font-weight: 500;
}

.tms-detail-instructions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0e6dc;
}

.tms-detail-instructions p {
    font-size: 14px;
    color: #374151;
    margin: 6px 0 0;
    line-height: 1.6;
}

.tms-detail-separator {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0e6dc;
}

.tms-detail-label-block {
    display: block;
    margin-bottom: 8px;
}

.tms-detail-rich-text {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
}

/* ---------- Part Detail Block ---------- */
.tms-part-detail-block {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    padding: 25px 30px;
    margin-bottom: 20px;
}

.tms-part-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.tms-part-detail-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #1f2937;
}

.tms-part-detail-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tms-detail-meta-tag {
    font-size: 11px;
    background: #f3f4f6;
    color: #6b7280;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.tms-part-detail-desc {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 15px;
    line-height: 1.5;
    padding: 10px 14px;
    background: #fdf6f0;
    border-radius: 8px;
}

/* ---------- Question Detail ---------- */
.tms-questions-detail {
    border-top: 1px solid #f0e6dc;
    padding-top: 15px;
}

.tms-question-detail-row {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f5f0eb;
}

.tms-question-detail-row:last-child {
    border-bottom: none;
}

.tms-question-detail-num {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
    background: #f3f4f6;
    padding: 3px 8px;
    border-radius: 4px;
    height: fit-content;
    flex-shrink: 0;
}

.tms-question-detail-content {
    flex: 1;
}

.tms-question-detail-label {
    font-size: 14px;
    color: #1f2937;
    font-weight: 600;
    margin-bottom: 4px;
}

.tms-required-dot {
    color: #dc2626;
    margin-left: 2px;
}

.tms-question-detail-type {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.tms-type-tag {
    font-size: 11px;
    background: #ede9fe;
    color: #5b21b6;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.tms-question-detail-hint {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

.tms-question-detail-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.tms-option-chip {
    font-size: 12px;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 2px 10px;
    border-radius: 12px;
}

/* ==========================================================================
   10. PROFILE — Header, Avatar, Sections
   ========================================================================== */

.tms-profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.tms-profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.tms-profile-name {
    margin: 0 0 4px;
    font-size: 20px;
    color: #1f2937;
}

.tms-profile-subtitle {
    color: #9ca3af;
    font-size: 13px;
}

.tms-section {
    margin-top: 25px;
}

.tms-section-lg {
    margin-top: 40px;
}

.tms-section-heading {
    font-size: 18px;
}

.tms-main-title.tms-section-heading {
    margin-bottom: 30px;
    margin-top: 60px;
}

.tms-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ==========================================================================
   11. FORM FIELDS — Question Fill / Edit Views
   ========================================================================== */

.tms-question-field-row {
    padding: 15px 0;
    border-bottom: 1px solid #f5f0eb;
}

.tms-required {
    color: #e74c3c;
}

.tms-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.tms-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

.tms-yesno-group {
    display: flex;
    gap: 16px;
    margin-top: 6px;
}

.tms-range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tms-range-label {
    font-size: 13px;
    color: #6b7280;
}

.tms-range-value {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    min-width: 24px;
    text-align: center;
}

/* ==========================================================================
   12. SUBMISSIONS
   ========================================================================== */

.tms-submissions-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0e6dc;
}

.tms-submissions-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 0;
    width: 100%;
    text-align: left;
}

.tms-submissions-toggle:hover .tms-submissions-title {
    color: #dc4a68;
}

.tms-toggle-arrow {
    font-size: 10px;
    color: #9ca3af;
}

.tms-submissions-title {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    transition: color 0.15s;
}

.tms-submission-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tms-submission-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #fdf6f0;
    border-radius: 6px;
    font-size: 13px;
}

.tms-submission-date {
    color: #374151;
    flex: 1;
}

/* ==========================================================================
   13. ANSWERS VIEW
   ========================================================================== */

.tms-answers-title {
    margin: 0 0 15px;
    font-size: 17px;
    font-weight: 700;
    color: #1f2937;
}

.tms-answer-box {
    margin-top: 6px;
    padding: 10px 14px;
    background: #fdf6f0;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
}

/* ==========================================================================
   14. STATE MODIFIERS & TEXT UTILITIES
   ========================================================================== */

.tms-locked {
    opacity: 0.5;
}

.tms-text-danger-bold {
    color: #dc2626;
    font-weight: 600;
}

.tms-link-accent {
    color: #c2956b;
    text-decoration: none;
    font-weight: 500;
}

.tms-text-muted-sm {
    font-size: 13px;
    color: #6b7280;
}

.tms-btn-danger {
    color: #dc2626;
    border-color: #fecaca;
}

.tms-hr {
    border: none;
    border-top: 1px solid #f0e6dc;
    margin: 30px 0;
}

/* ==========================================================================
   15. AVATAR EDIT — Upload, Crop Modal
   ========================================================================== */

.tms-avatar-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0e6dc;
}

.tms-avatar-edit-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid #e0d5ca;
    position: relative;
    cursor: pointer;
}

.tms-avatar-edit-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.tms-avatar-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.5);
    color: #fff;
    text-align: center;
    font-size: 11px;
    padding: 4px 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.tms-avatar-edit-wrapper:hover .tms-avatar-overlay {
    opacity: 1;
}

/* ---------- Crop Modal ---------- */
.tms-crop-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.7);
    align-items: center;
    justify-content: center;
}

.tms-crop-modal-inner {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.tms-crop-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tms-crop-modal-title {
    margin: 0;
    font-size: 18px;
    color: #1f2937;
}

.tms-crop-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #9ca3af;
    line-height: 1;
}

.tms-crop-preview {
    max-height: 400px;
    overflow: hidden;
    background: #f3f4f6;
    border-radius: 8px;
}

.tms-crop-preview img {
    display: block;
    max-width: 100%;
}

.tms-crop-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

.tms-crop-btn {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
}

.tms-crop-btn-text {
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
}

/* ---------- Cropper.js circle mask ---------- */
.cropper-view-box,
.cropper-face {
    border-radius: 50%;
}

/* ==========================================================================
   16. RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .tms-dashboard {
        flex-direction: column;
    }

    .tms-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        padding: 15px;
        gap: 10px;
    }

    .tms-sidebar-avatar {
        width: 50px;
        height: 50px;
        margin-bottom: 0;
    }

    .tms-sidebar-nav {
        display: flex;
        justify-content: center;
        gap: 5px;
    }

    .tms-sidebar-nav li a {
        padding: 8px 14px;
        border-left: none;
        border-radius: 6px;
        font-size: 13px;
    }

    .tms-main {
        padding: 20px 15px;
    }

    .tms-table-wrapper {
        overflow-x: auto;
    }
}

/* ---------- Admin Role Toggle ---------- */
.tms-admin-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
    padding: 0 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.tms-admin-toggle-label {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tms-admin-toggle-btn {
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    text-decoration: none;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.tms-admin-toggle-btn.active {
    background: #dc4a68;
    color: #fff;
    border-color: #dc4a68;
}

.tms-admin-toggle-btn:hover {
    opacity: 0.85;
}

/* ---------- Sidebar Logout ---------- */
.tms-sidebar-logout {
    margin-top: auto;
    padding: 15px 25px;
    width: 100%;
}

.tms-sidebar-logout-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 0;
    transition: color 0.2s;
}

.tms-sidebar-logout-link:hover {
    color: #dc2626;
}

/* ---------- Help / Guide Accordion ---------- */
.tms-help-accordion {
    max-width: 800px;
}

.tms-help-item {
    background: #fff;
    border: 1px solid #f0e6dc;
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
}

.tms-help-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    transition: background 0.15s;
}

.tms-help-toggle:hover {
    background: #fdf6f0;
}

.tms-help-toggle-icon {
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.tms-help-content {
    padding: 0 20px 20px 46px;
    font-size: 14px;
    color: #374151;
    line-height: 1.7;
}

.tms-help-content h3 {
    font-size: 16px;
    color: #1f2937;
    margin: 0 0 10px;
}

.tms-help-content h4 {
    font-size: 14px;
    color: #1f2937;
    margin: 16px 0 6px;
}

.tms-help-content p {
    margin: 0 0 10px;
}

.tms-help-content ul,
.tms-help-content ol {
    margin: 0 0 10px;
    padding-left: 20px;
}

.tms-help-content li {
    margin-bottom: 4px;
}

.tms-help-open {
    border-color: #dc4a68;
}

.tms-help-open .tms-help-toggle {
    color: #dc4a68;
}

/* ==========================================================================
   UNSEEN BADGES (sidebar nav + therapist patient-list View button)
   ========================================================================== */
.tms-nav-badge {
    margin-left: auto;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tms-sidebar-nav li a.active .tms-nav-badge,
.tms-sidebar-nav li a:hover .tms-nav-badge { background: #b91c1c; }

.tms-view-wrap {
    position: relative;
    display: inline-flex;
}
.tms-view-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px #fff;
}

/* ==========================================================================
   INLINE STATUS FILTER + PAGINATION (therapist patient detail page)
   ========================================================================== */
.tms-filter-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tms-filter-form-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}
.tms-filter-form select {
    font-size: 12px;
    padding: 5px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    cursor: pointer;
}
.tms-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 0 4px;
}
.tms-pagination-info {
    font-size: 12px;
    color: #6b7280;
}

.tms-section-subcount{margin:-18px 0 22px;color:#6b7280;font-size:13px;font-weight:600}

.tms-sidebar-legal{display:flex;flex-wrap:wrap;gap:4px 12px;padding:6px 18px 16px}
.tms-sidebar-legal a{font-size:11px;color:#9aa3b2;text-decoration:none;line-height:1.6}
.tms-sidebar-legal a:hover{color:#cbd2dd;text-decoration:underline}

/* Edit Profile — account-deletion request (patients) */
.tms-danger-card{margin-top:22px;border:1px solid #f3c2c2;background:#fffafa}
.tms-danger-title{margin:0 0 6px;font-size:16px;font-weight:700;color:#a3261f}
.tms-danger-note{margin:0 0 12px;font-size:13px;line-height:1.55;color:#6b7280}
.tms-danger-card textarea{margin-bottom:12px}
.tms-danger-btn{background:#c0392b;border-color:#c0392b}
.tms-danger-btn:hover{background:#a93226;border-color:#a93226}

/* Feedback page — list of the user's own submissions */
.tms-feedback-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:12px}
.tms-feedback-item{border:1px solid #f0e6dc;border-radius:8px;padding:10px 14px;background:#fdfbf9}
.tms-feedback-meta{display:block;font-size:12px;font-weight:600;color:#9ca3af;margin-bottom:4px}
.tms-feedback-body{font-size:14px;line-height:1.55;color:#374151}
.tms-feedback-body p{margin:0 0 8px}.tms-feedback-body p:last-child{margin-bottom:0}

.tms-feedback-item--link{padding:0}
.tms-feedback-item--link a{display:block;padding:10px 14px;text-decoration:none;color:inherit}
.tms-feedback-item--link a:hover{background:#fff5ee}
.tms-feedback-preview{display:block;font-size:14px;color:#374151;margin-top:2px}

/* Feedback attachments (admin detail view) */
.tms-feedback-att-grid{display:flex;flex-wrap:wrap;gap:10px;margin-top:4px}
.tms-feedback-att{display:block;border:1px solid #e6e8ee;border-radius:8px;overflow:hidden;background:#fafbfc;line-height:0}
.tms-feedback-att img{display:block;max-width:160px;max-height:140px;width:auto;height:auto;object-fit:cover}
.tms-feedback-att span{display:inline-block;padding:8px 12px;font-size:12px;color:#6b7280;line-height:1.4}
.tms-feedback-att:hover{border-color:#c2956b}

/* Username + avatar cell in patient-list tables */
.tms-user-cell{display:inline-flex;align-items:center;gap:9px}
.tms-user-avatar-sm{width:28px;height:28px;border-radius:50%;object-fit:cover;flex:0 0 auto;border:1px solid #f0e6dc}

/* Short description below the page title — same look as .tms-resource-prelude / .tms-quiz-prelude. */
.tms-page-prelude{margin:0 0 20px;max-width:700px;color:#6b7280;font-size:14px;line-height:1.55}

/* Cancel button — same shape as .tms-btn-view, red. */
.tms-btn-cancel{padding:6px 16px;background:#dc2626;color:#fff;border:none;border-radius:6px;font-size:12px;font-weight:600;cursor:pointer;text-decoration:none;transition:opacity 0.2s;line-height:1.4}
.tms-btn-cancel:hover{opacity:.85;color:#fff}

/* User cell as a link (clickable patient/therapist row) */
a.tms-user-cell{color:inherit;text-decoration:none}
a.tms-user-cell:hover{color:#dc4a68}
a.tms-user-cell:hover code,a.tms-user-cell:hover span{text-decoration:underline}
