/* --- CSS Variables & Theme --- */
:root {
    --primary: #252525;
    --primary-hover: #3a3a3a;
    --primary-light: #F5F5F5;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --bg-main: #F3F4F6;
    /* Light gray background */
    --bg-surface: #FFFFFF;
    /* Pure white surface */
    --bg-surface-hover: #F9FAFB;
    /* Slightly off-white for hover */
    --bg-surface2: #FFFFFF;
    --bg-surface-hover2: #F9FAFB;

    --text-primary: #111827;
    /* Near black text */
    --text-secondary: #4B5563;
    /* Medium gray */
    --text-muted: #9CA3AF;
    /* Light gray */

    --border-color: #E5E7EB;
    /* Subtle light borders */

    --radius-sm: 5px;
    --radius-md: 10px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --transition: all 0.2s ease-in-out;
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
    --primary: #D4D4D8;
    --primary-hover: #F4F4F5;
    --primary-light: #2E2E2E;
    --bg-main: #111111;
    --bg-surface: #1A1A1A;
    --bg-surface-hover: #2E2E2E;
    --bg-surface2: #131313;
    --bg-surface-hover2: #2E2E2E;
    --text-primary: #EDEDEF;
    --text-secondary: #8B95A8;
    --text-muted: #727272;
    --border-color: #3E3E3E;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

/* Dark mode: date/time inputs need color-scheme so the browser's native calendar
   picker icon and popup also render in dark mode (otherwise icon is invisible) */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"] {
    color-scheme: dark;
}

/* Dark mode: elements with hardcoded colors or needing text color flip
   (primary in dark mode is light gray — elements using it as bg need dark text) */
[data-theme="dark"] a {
    color: var(--text-primary);
}

[data-theme="dark"] a:hover {
    color: var(--primary-hover);
}

[data-theme="dark"] .btn-primary {
    color: #0F1015;
}

[data-theme="dark"] .nav-item.active {
    color: var(--text-primary);
}

[data-theme="dark"] .chat-user-item.active {
    color: var(--text-primary);
}

[data-theme="dark"] .phase-rule-badge {
    color: var(--text-primary);
}

[data-theme="dark"] .msg-sent {
    color: #0F1015;
}

[data-theme="dark"] .avatar {
    color: #0F1015;
}

[data-theme="dark"] .task-comment-indicator .comment-count {
    color: #0F1015;
}

[data-theme="dark"] .mentee-taskview-item.active {
    color: #0F1015;
}

[data-theme="dark"] .mentee-taskview-item.active .checkbox-custom {
    border-color: rgba(0, 0, 0, 0.35);
    color: rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .floating-toolbar {
    background: #22252F;
}

[data-theme="dark"] .floating-toolbar .toolbar-select option {
    background: #22252F;
    color: var(--text-primary);
}

[data-theme="dark"] .toast {
    background: #22252F;
    color: var(--text-primary);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    box-shadow: 0 0 0 2px rgba(212, 212, 216, 0.25);
}

[data-theme="dark"] .video-progress-track {
    background: var(--border-color);
}

/* Theme toggle icon state */
.btn-theme-toggle .icon-sun {
    display: none;
}

.btn-theme-toggle .icon-moon {
    display: inline-flex;
}

[data-theme="dark"] .btn-theme-toggle .icon-sun {
    display: inline-flex;
}

[data-theme="dark"] .btn-theme-toggle .icon-moon {
    display: none;
}

/* --- Base Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    height: 100dvh;
    overflow: hidden;
}

/* Typography */
b,
strong {
    font-weight: 500;
}

h1,
h2,
h3,
h4 {
    color: var(--text-primary);
    font-weight: 600;
}

a {
    color: #000000;
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* --- Utility Classes --- */
.view {
    display: none;
    height: 100dvh;
    width: 100vw;
}

.view.active {
    display: flex;
}

.mb-4 {
    margin-bottom: 1rem;
}

.hidden {
    display: none !important;
}

/* --- Buttons & Inputs --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-icon input {
    padding-left: 2.75rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* --- Login View --- */
.login-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
}

.login-card {
    width: 100%;
    max-width: 480px;
    margin: auto;
    padding: 3rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    z-index: 10;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.login-header .community-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 1.25rem;
}

/* login logo: wide and centered */
.login-header .community-brand img {
    width: 240px;
    max-width: 100%;
    height: auto;
    display: block;
}

/* login name without logo: large prominent text */
.login-header .community-brand span {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.login-hint {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.75rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
}


/* --- Dashboard Layout --- */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar .logo {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.community-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
}

/* sidebar logo: scales proportionally, max 212px wide (260px sidebar − 48px padding), max 60px tall, centered */
.community-brand img {
    max-width: 212px;
    max-height: 60px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* sidebar name without logo: larger readable text */
.community-brand span {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Both admin and mentee sidebar navs scroll internally */
.sidebar-nav {
    overflow-y: auto;
}

/* Custom scrollbar for sidebar nav */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
    border: none;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
    transition: background 0.2s;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:active {
    background: var(--primary-hover);
}
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.sidebar-nav-fixed {
    flex: 0 0 auto;
    padding: 1.5rem 0.5rem 0 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: #000000;
}

.nav-item.locked {
    opacity: 0.6;
    background: transparent;
    cursor: not-allowed;
}

/* ── Phase Accordion ────────────────────────────────────────────────────────── */
.nav-phase-group {
    display: flex;
    flex-direction: column;
}

.nav-phase-caret {
    margin-left: auto;
    font-size: 0.85rem !important;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
    padding: 4px;
    margin-right: -4px;
    border-radius: 4px;
    cursor: pointer;
}

.nav-phase-caret:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-item.open .nav-phase-caret {
    transform: rotate(180deg);
}

.nav-phase-badge {
    margin-left: auto;
    margin-right: 4px;
}

.nav-phase-tasks {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0;
    overflow: hidden;
}

.nav-phase-tasks.open {
    display: flex;
}

/* Inside accordion: labels always visible, compact style */
.nav-phase-tasks .mentee-taskview-item {
    white-space: nowrap;
    overflow: hidden;
}

.nav-phase-tasks .mentee-taskview-item .task-label {
    opacity: 1 !important;
    transition: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Sidebar Community Nav ─────────────────────────────────────────────────── */
#sidebar-community-nav {
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.sidebar-community-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.sidebar-community-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-section-label {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem 0.25rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.35rem;
    cursor: default;
}

.sidebar-subsection-item {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.75rem 0.35rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.sidebar-subsection-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar-subsection-item.active {
    background: var(--primary-light);
    color: #000;
}

[data-theme="dark"] .sidebar-subsection-item.active {
    color: var(--text-primary);
}

/* ── Sidebar drag handles ──────────────────────────────────────────────────── */
.sidebar-drag-handle {
    font-size: 0.9rem;
    opacity: 0;
    cursor: grab;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: 0.25rem;
    order: 98;
    transition: opacity 0.15s;
}

.sidebar-section-group:hover .sidebar-drag-handle,
.sidebar-subsection-item:hover .sidebar-drag-handle,
.sidebar-section-clickable:hover .sidebar-drag-handle {
    opacity: 0.45;
}

/* ── Sidebar section header (clickable) ────────────────────────────────────── */
.sidebar-section-clickable {
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.sidebar-section-clickable:hover {
    background: var(--bg-surface-hover);
}

.sidebar-section-clickable.active {
    background: var(--primary-light);
    color: var(--text-primary);
}

.sidebar-section-label-text {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-sidebar-add-subsec {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0;
    padding: 0 2px;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.btn-sidebar-add-subsec i {
    font-size: 0.65rem;
}

.sidebar-section-clickable:hover .btn-sidebar-add-subsec {
    opacity: 0.7;
}

.btn-sidebar-add-subsec:hover {
    opacity: 1 !important;
    color: var(--primary);
}

/* ── Sidebar add section dropdown ──────────────────────────────────────────── */
.sidebar-add-section-wrapper {
    position: relative;
}

.sidebar-add-section-dropdown {
    position: fixed;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    min-width: 210px;
    padding: 4px 0;
}

.sidebar-add-opt {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.85rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    text-align: left;
    color: var(--text-primary);
    transition: background 0.1s;
}

.sidebar-add-opt:hover {
    background: var(--bg-surface-hover);
}

.sidebar-add-opt i {
    opacity: 0.6;
}

/* ── End Sidebar Community Nav ─────────────────────────────────────────────── */

/* ── Nav Group (collapsible, e.g. Configurações) ──────────────────────────── */
.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-group-trigger {
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
}

.nav-group-arrow {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-group-trigger[aria-expanded="true"] .nav-group-arrow {
    transform: rotate(180deg);
}

.nav-group-trigger.has-active-child {
    background: var(--primary-light);
    color: #000;
}

[data-theme="dark"] .nav-group-trigger.has-active-child {
    color: var(--text-primary);
}

.nav-group-children {
    display: none;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.15rem 0 0.15rem 0.75rem;
}

.nav-group-children.open {
    display: flex;
}

.nav-sub-item {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.82rem !important;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-sub-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-sub-item.active {
    background: var(--primary-light);
    color: #000;
    font-weight: 600;
}

[data-theme="dark"] .nav-sub-item.active {
    color: var(--text-primary);
}

/* ── End Nav Group ─────────────────────────────────────────────────────────── */


/* ── Post Card ─────────────────────────────────────────────────────────────── */
.post-card {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    border: 1px solid #E5E7EB;
    border-radius: 15px;
    overflow: hidden;
    background: var(--bg-surface);
}

[data-theme="dark"] .post-card {
    border-color: var(--border-color);
}

.post-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem 0;
}

.post-card-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    overflow: hidden;
    user-select: none;
}

.post-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.post-card-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.post-card-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.post-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1rem 1.5rem 0.5rem;
}

.post-card-content {
    padding: 0 1.5rem 1.25rem;
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.6;
}

.post-card-footer {
    border-top: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    gap: 0.25rem;
}

[data-theme="dark"] .post-card-footer {
    border-color: var(--border-color);
}

.post-card-action-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.post-card-action-btn:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.post-card-action-btn.liked {
    color: #E53E3E;
}

/* Heart icon toggle via CSS — no JS icon manipulation needed */
.btn-like-post .heart-fill {
    display: none;
}

.btn-like-post .heart-outline {
    display: block;
}

.btn-like-post.liked .heart-outline {
    display: none;
}

.btn-like-post.liked .heart-fill {
    display: block;
}

.post-card-comments {
    border-top: 1px solid #E5E7EB;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

[data-theme="dark"] .post-card-comments {
    border-color: var(--border-color);
}

.post-card-comment-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.post-card-comment-input {
    flex: 1;
    padding: 0.6rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.875rem;
    resize: none;
    font-family: inherit;
}

.post-card-comment-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── End Post Card ─────────────────────────────────────────────────────────── */

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-info .details {
    display: flex;
    flex-direction: column;
}

.user-info .name {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Super Admin / shared layout: content panel next to sidebar */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-width: 0;
}

.scrollable-area {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}


.topbar {
    height: 70px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.topbar h2 {
    font-size: 1.25rem;
}

/* ── Notifications dropdown ─────────────────────────────────────────────── */
.mentee-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
    position: relative;
}

.mentee-notif-item:last-child {
    border-bottom: none;
}

.mentee-notif-item:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.mentee-notif-item--read {
    opacity: 0.55;
}

.mentee-notif-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.mentee-notif-body {
    flex: 1;
    min-width: 0;
}

.mentee-notif-title {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.2rem;
}

.mentee-notif-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

.mentee-notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.mentee-notif-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 4px;
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* --- Admin Views --- */
.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

/* Phase Cards */
.phase-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.phase-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--bg-surface);
}

.phase-editor-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    user-select: none;
}

#select-global-trajectory {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 256 256'%3E%3Cpath fill='%236b7280' d='m213.66 101.66-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.phase-card-title h3 {
    margin-bottom: 0.25rem;
}

.phase-card-title p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.phase-rule-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary-light);
    color: #000000;
    font-size: 0.75rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-weight: 500;
}

.task-list {
    padding: 1rem 1.5rem;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    background: var(--bg-main);
}

.task-item:last-child {
    margin-bottom: 0;
}

/* Admin Users: fill full scroll-area, ignoring content-wrapper max-width */
.content-wrapper:has(#admin-users.active) {
    max-width: none !important;
    height: 100%;
}

#admin-users.admin-section.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Admin Users: match sidebar background and remove padding so dividers reach edges */
.scroll-area:has(#admin-users.active) {
    background: var(--bg-surface);
    padding: 0;
}

/* Admin Users Split Layout */
.admin-users-layout {
    display: flex;
    height: 100%;
    visibility: hidden;
}

.admin-users-layout.loaded {
    visibility: visible;
}

.admin-users-left {
    flex: 0 0 33.333%;
    max-width: 33.333%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
}

.admin-users-left > div:first-child {
    margin-bottom: 0 !important;
    padding: 0 1.5rem;
    height: 80px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.admin-users-left .users-list {
    border: none;
    border-radius: 0;
    overflow-y: auto;
    flex: 1;
}

.admin-users-left .users-list .user-progress-card:last-child {
    border-bottom: 1px solid var(--border-color);
}

.admin-users-detail {
    flex: 0 0 66.666%;
    max-width: 66.666%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem 0 1.5rem;
    height: 80px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.detail-header-identity {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

.detail-header-identity .mentee-card-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    font-size: 1.125rem;
}

.detail-header-name {
    font-weight: 600;
    font-size: 1.0625rem;
    color: var(--text-primary);
}

.detail-header-email {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-top: 0;
    padding: 0 1.5rem;
}

.detail-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.detail-tab:hover {
    color: var(--text-primary);
}

.detail-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

.detail-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem 1.5rem 1.5rem;
}

/* Compact mentee cards inside the left panel */
.admin-users-left .user-progress-card.mentee-card-new {
    gap: 0.875rem;
    padding: 1rem;
}


.admin-users-left .user-progress-card .mentee-card-progress {
    gap: 1rem;
}

.admin-users-left .user-progress-card.selected {
    background: var(--bg-surface-hover);
}

/* Mentee list container */
.users-list {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

/* Mentee Progress Cards */
.user-progress-card {
    background: var(--bg-surface);
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    padding: 1.5rem;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
}

.user-progress-card:hover {
    background: var(--bg-surface-hover);
}

.user-progress-card:last-child {
    border-bottom: none;
}

/* New mentee card layout */
.mentee-card-new {
    flex-direction: column;
    align-items: stretch;
    padding: 24px;
    gap: 1.25rem;
}

.mentee-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mentee-card-identity {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

.mentee-card-avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

[data-theme="dark"] .mentee-card-avatar {
    background: var(--primary);
    color: var(--bg-main);
}

.mentee-card-identity-info {
    min-width: 0;
}

.mentee-card-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.mentee-card-email {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mentee-card-progress {
    display: flex;
    gap: 2rem;
}

/* Three-dot menu */
.mentee-card-menu-wrapper {
    position: relative;
    flex-shrink: 0;
}

.btn-mentee-menu {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-mentee-menu:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.mentee-card-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 170px;
    z-index: 200;
    overflow: hidden;
    flex-direction: column;
}

.mentee-card-dropdown.open {
    display: flex;
}

.mentee-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    width: 100%;
}

.mentee-dropdown-item:hover {
    background: var(--bg-surface-hover);
}

.mentee-dropdown-item i {
    font-size: 1rem;
    color: var(--text-secondary);
}

.user-progress-info h4 {
    margin-bottom: 0.5rem;
}

.user-progress-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-bar-container {
    width: 200px;
}

/* --- Mentee Views --- */
.phase-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Phase banner (full-bleed within scroll-area) */
.phase-banner-wrapper {
    margin: -2rem -2rem 0 -2rem;
}

.phase-banner {
    width: 100%;
    aspect-ratio: 6 / 1;
    object-fit: cover;
    display: block;
}

/* Inner container when banner is present — re-applies the max-width centering */
.phase-inner-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Phase hero card overlapping the banner */
.phase-hero--with-banner {
    margin-top: -2.5rem;
    position: relative;
    z-index: 1;
}

.phase-hero {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.phase-hero h1 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.phase-hero p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.progress-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.progress-track {
    height: 8px;
    background: var(--bg-main);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    width: 0%;
    transition: width 0.5s ease-in-out;
}

.mentee-task-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mentee-task-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.task-comment-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.task-comment-indicator .comment-count {
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.mentee-task-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.mentee-task-item.completed {
    opacity: 0.8;
    background: var(--bg-main);
}

.mentee-task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: var(--transition);
    flex-shrink: 0;
}

.mentee-task-item.completed .checkbox-custom {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.locked-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-color);
}

.locked-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* --- Account Modal Tabs --- */
.account-modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    gap: 0;
    background: var(--bg-surface);
}

.account-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

.account-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.account-tab-pane {
    display: none;
}

.account-tab-pane.active {
    display: block;
}

.account-avatar-section {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.account-avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid var(--border-color);
}

.account-avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-avatar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.btn-link-danger {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* --- Modals --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 40;
    display: none;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 720px;
    height: calc(100dvh - 100px);
    background: var(--bg-surface);
    border-radius: 0;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: all 0.2s ease-in-out;
}

.modal.show {
    display: flex;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal-backdrop.show {
    display: block;
}

/* Dedicated backdrop for confirm dialog — sits above other modals */
#modal-confirm-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
}
#modal-confirm-backdrop.show {
    display: block;
}

/* Confirm dialog — compact, auto height, overrides the default tall modal */
#modal-confirm {
    height: auto !important;
    max-width: 500px;
    border-radius: 12px;
    z-index: 9999;
}
#modal-confirm .modal-header {
    border-bottom: none;
    padding-bottom: 0.25rem;
}
#modal-confirm .modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}
#modal-confirm .modal-body {
    padding-top: 0;
}
#modal-confirm #modal-confirm-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 1.5rem;
    line-height: 1.5;
}
#modal-confirm .modal-confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}
#modal-confirm-ok {
    background-color: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #fff !important;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.p-0 {
    padding: 0 !important;
}

.report-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}
.report-tab.active {
    background: var(--primary);
    color: #fff;
}
.report-tab:hover:not(.active) {
    background: var(--bg-surface);
}
@media (max-width: 600px) {
    #report-overview-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    position: sticky;
    bottom: -1.5rem;
    background: var(--bg-surface);
    padding-bottom: 1.5rem;
    margin-bottom: -1.5rem;
    z-index: 10;
}

.settings-group {
    background: var(--bg-main);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
}

.settings-group h4 {
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(100%);
    opacity: 0;
    animation: toast-in 0.3s forwards;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

@keyframes toast-in {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ── Mentee Inline Task View ─────────────────────────────────────────────── */
#view-mentee .scroll-area {
    background: var(--bg-surface);
}

#mentee-task-view {
    margin: -2rem;
}

.mentee-task-view-layout {
    display: flex;
    align-items: flex-start;
    min-height: 100dvh;
    position: relative;
}

.mentee-task-view-main {
    flex: 1;
    min-width: 0;
    display: flex;
    justify-content: center;
    padding: 2rem;
    margin-right: 84px;
}

.mentee-task-view-content {
    width: 100%;
    max-width: 720px;
}

.mentee-task-view-sidebar {
    width: 84px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    overflow: hidden;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 10;
    transition: width 0.25s ease;
    cursor: pointer;
    overflow-y: auto;
}

/* ── Task view: sidebar fixed (scroll happens inside the content column) ───── */
#view-mentee .scroll-area:has(#mentee-task-view.active) {
    overflow: hidden;
    padding: 0;
}

#view-mentee .scroll-area:has(#mentee-task-view.active) #mentee-task-view {
    margin: 0;
    height: 100%;
}

#view-mentee .scroll-area:has(#mentee-task-view.active) .mentee-task-view-layout {
    height: 100%;
    min-height: 0;
}

#view-mentee .scroll-area:has(#mentee-task-view.active) .mentee-task-view-main {
    overflow-y: auto;
    height: 100%;
}

#view-mentee .scroll-area:has(#mentee-task-view.active) .mentee-task-view-sidebar {
    position: absolute;
    height: 100%;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.mentee-task-view-sidebar:hover {
    width: min(252px, 35%);
}

/* Header: collapsed shows short label, expanded shows full label */
.mentee-task-view-sidebar-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 1.5rem 16px 20px;
    white-space: nowrap;
    overflow: hidden;
}

.mentee-task-view-sidebar-title .title-short {
    display: block;
}

.mentee-task-view-sidebar-title .title-full {
    display: none;
}

.mentee-task-view-sidebar:hover .mentee-task-view-sidebar-title .title-short {
    display: none;
}

.mentee-task-view-sidebar:hover .mentee-task-view-sidebar-title .title-full {
    display: block;
}

#mentee-task-view-tasklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 16px;
}

.mentee-taskview-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
}

.mentee-taskview-item:hover {
    background: var(--bg-surface-hover);
}

.mentee-taskview-item.active {
    background: var(--primary);
    font-weight: 600;
    border-color: var(--primary);
    color: white;
}

.mentee-taskview-item.active .checkbox-custom {
    border-color: var(--border-color);
    color: rgba(255, 255, 255, 0.8);
}

.mentee-taskview-item .checkbox-custom {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
    font-weight: 600;
}

.mentee-taskview-item.completed .checkbox-custom {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

/* Task label hidden when retracted, shown on hover */
.mentee-taskview-item .task-label {
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.15s ease 0.1s;
}

.mentee-task-view-sidebar:hover .mentee-taskview-item .task-label {
    opacity: 1;
}


@media (max-width: 768px) {
    .phase-banner-wrapper {
        margin: -1rem -1rem 0 -1rem;
    }

    .phase-banner {
        aspect-ratio: 3 / 1;
    }

    .mentee-task-view-layout {
        flex-direction: column;
        align-items: center;
    }

    .mentee-task-view-main {
        padding: 1.5rem 1rem;
        margin-right: 0 !important;
        width: 100%;
        max-width: 720px;
        align-self: center;
    }

    .mentee-task-view-sidebar {
        display: none;
        width: 100%;
        position: static;
        border-right: none;
        border-left: none;
        border-top: none;
        border-bottom: 1px solid var(--border-color);
        height: auto !important;
        /* Override absolute height */
        box-shadow: none !important;
    }

    .mentee-task-view-sidebar:hover {
        width: 100%;
        box-shadow: none;
    }

    /* Transform Task List into a Horizontal Scrollable Chips Row on Mobile */
    .mentee-task-view-sidebar-title {
        padding: 1rem 1rem 0.5rem;
    }

    .mentee-task-view-sidebar-title .title-full {
        display: block !important;
    }

    .mentee-task-view-sidebar-title .title-short {
        display: none !important;
    }

    #mentee-task-view-tasklist {
        flex-direction: row;
        overflow-x: auto;
        padding: 0 1rem 1rem;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Hide scrollbar for slick UI */
    }

    #mentee-task-view-tasklist::-webkit-scrollbar {
        display: none;
    }

    .mentee-taskview-item {
        padding: 0.5rem 1rem;
        border-radius: var(--radius-sm);
        /* Pill shape */
        flex-shrink: 0;
        background: var(--bg-surface);
    }

    .mentee-taskview-item .task-label {
        opacity: 1 !important;
        /* Force text to show */
    }

    /* Fix Chat Layout */
    .chat-layout-admin {
        flex-direction: column !important;
        height: auto !important;
        border: none !important;
        gap: 0 !important;
    }

    .chat-sidebar {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        max-height: 250px;
        /* Allow partial scrolling of thread list */
    }

    .chat-main {
        min-height: 500px;
    }
}

@keyframes spin-pulse {
    0% {
        transform: rotate(0deg);
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        transform: rotate(360deg);
        opacity: 1;
    }
}

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin: 0;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--danger);
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* --- Badges --- */
.badge {
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.15rem 0.4rem;
    border-radius: 12px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

/* --- Chat System --- */
.msg-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    position: relative;
    word-wrap: break-word;
    font-size: 0.875rem;
}

.msg-sent {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.msg-received {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.msg-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    gap: 1rem;
    opacity: 0.8;
}

.msg-task-link {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.9;
}

.msg-task-link:hover {
    color: inherit;
    opacity: 1;
}

.chat-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.chat-user-item:hover {
    background: var(--bg-surface-hover);
}

.chat-user-item.active {
    background: var(--primary-light);
    color: #000000;
}

.chat-user-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-user-item-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.chat-user-item-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Responsive */
/* Mobile Sidebar Backdrop (Hidden on Desktop) */
.mobile-sidebar-backdrop {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }

    /* Expose Mobile Interactions */
    #btn-mobile-menu,
    #btn-admin-mobile-menu,
    .btn-close-sidebar-mobile {
        display: flex !important;
    }

    .mobile-sidebar-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100dvh;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(2px);
        z-index: 9998;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .mobile-sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }

    .view {
        flex-direction: column;
    }

    /* Premium Drawer Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 90vw;
        height: 100dvh;
        z-index: 9999;
        border-right: 1px solid var(--border-color);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-nav {
        flex-direction: column !important;
        /* Overriding previous flex-row hack */
        overflow-x: hidden !important;
        overflow-y: auto !important;
        padding: 0 1rem;
    }

    .sidebar-footer {
        display: flex !important;
        /* Restore the user info and logout buttons */
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .task-comments-form {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .scroll-area {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

    .topbar {
        padding: 0 1rem;
        min-height: 60px;
    }

    #btn-mobile-menu,
    #btn-admin-mobile-menu {
        margin-left: -0.5rem;
    }

    .notifications-label {
        display: none;
    }

    .scroll-area {
        padding: 1rem;
    }

    .modal {
        width: 95vw;
        max-height: 85vh;
        margin: auto;
    }

    /* Mobile Logo (left-aligned and scalable) */
    .community-brand {
        justify-content: flex-start !important;
    }

    .community-brand img {
        margin: 0 !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain;
    }

    /* Mobile Breadcrumb Adjustments */
    .breadcrumb {
        flex-wrap: nowrap;
        overflow: hidden;
        min-width: 0;
    }

    #mentee-phase-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    #mentee-task-subtitle {
        display: none !important;
        /* Hide specific task path to save space */
    }
}

/* --- Quill Content Fixes --- */
.modal-quill-content ul,
.modal-quill-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.modal-quill-content li {
    margin-bottom: 0.25rem;
}

.modal-quill-content p:last-child,
.modal-quill-content ul:last-child,
.modal-quill-content ol:last-child {
    margin-bottom: 0;
}

.modal-quill-content a {
    color: var(--primary);
    text-decoration: underline;
}

/* --- Task Editor (Notion-like) --- */
.modal-editor {
    max-width: 1100px !important;
}

.task-editor-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: 100%;
}

.task-editor-sidebar {
    width: 200px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.draggable-sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: grab;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: background 0.2s;
}

.draggable-sidebar-item:hover {
    background: var(--bg-surface-hover);
}

.draggable-sidebar-item i {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.task-editor-main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--bg-surface);
}

.editor-canvas {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 4rem;
}

.editor-empty-state {
    color: var(--text-muted);
    padding: 3rem 2rem;
    text-align: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    max-width: 720px;
    width: 100%;
    margin: 0;
    font-size: 0.95rem;
    background: transparent;
}

.editor-block-wrapper {
    position: relative;
    width: 100%;
    max-width: 720px;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.editor-drag-handle {
    position: absolute;
    left: -2rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: grab;
    opacity: 0;
    color: var(--text-muted);
    font-size: 1.25rem;
    transition: opacity 0.2s;
    user-select: none;
    line-height: 1;
    padding: 0.25rem;
    border-radius: 4px;
}

.editor-drag-handle:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.editor-block-wrapper:hover .editor-drag-handle {
    opacity: 1;
}

.editor-block-content {
    flex: 1;
    min-height: 1.5rem;
    outline: none;
    padding: 0.25rem 0;
    word-break: break-word;
    width: 100%;
}

.editor-block-content[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
    display: block;
}

/* Video Progress UI */
.video-progress-area {
    width: 100%;
    padding: 2rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
}

.video-progress-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.video-progress-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.video-progress-track {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.video-progress-fill {
    height: 100%;
    background: #10B981;
    /* Default emerald green */
    width: 0%;
    transition: width 0.2s ease;
}

/* Floating Toolbar */
.floating-toolbar {
    position: fixed;
    z-index: 3000;
    background: var(--text-primary);
    color: white;
    padding: 0.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: opacity 0.2s, transform 0.2s;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) translateX(-50%);
}

.floating-toolbar.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) translateX(-50%);
}

.floating-toolbar button {
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-toolbar button:hover,
.floating-toolbar .color-picker-label:hover {
    background: rgba(255, 255, 255, 0.1);
}

.floating-toolbar button.active {
    background: var(--primary);
    color: #fff;
}

.floating-toolbar .divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.25rem;
}

.floating-toolbar .color-picker-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    color: white;
    transition: background 0.2s;
}

.floating-toolbar .color-picker-label input[type="color"],
.floating-toolbar .color-picker-label input.tb-coloris {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    cursor: pointer;
    padding: 0;
    border: 0;
    background: transparent;
}

/* ===== Premium color picker block (admin settings) ===== */
.pz-color-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 6px;
}

.pz-color-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(180deg, var(--bg-main) 0%, transparent 120%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.pz-color-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 18px -8px rgba(0,0,0,.18);
    transform: translateY(-1px);
}

.pz-color-card-head {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.pz-color-card-head i {
    font-size: 1rem;
    color: var(--primary);
    opacity: 0.85;
}

.pz-color-card-body {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pz-color-preview {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    box-shadow:
        inset 0 0 0 2px rgba(255,255,255,.75),
        0 1px 2px rgba(0,0,0,.08);
    background-image:
        linear-gradient(45deg, rgba(0,0,0,.06) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.06) 75%),
        linear-gradient(45deg, rgba(0,0,0,.06) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.06) 75%);
    background-size: 10px 10px;
    background-position: 0 0, 5px 5px;
    transition: transform .18s ease, box-shadow .18s ease;
}

[data-theme="dark"] .pz-color-preview {
    box-shadow:
        inset 0 0 0 2px rgba(255,255,255,.12),
        0 1px 2px rgba(0,0,0,.4);
}

.pz-color-card:hover .pz-color-preview {
    transform: scale(1.04);
}

.pz-color-panel .clr-field {
    flex: 1;
    min-width: 0;
}

.pz-color-panel .clr-field button {
    display: none !important;
}

.pz-color-panel input.pz-coloris {
    width: 100%;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card, var(--bg-main));
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.pz-color-panel input.pz-coloris:hover {
    border-color: var(--primary);
}

.pz-color-panel input.pz-coloris:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Coloris popup refinements */
.clr-picker {
    width: 300px !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 40px -8px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.04) !important;
}

.clr-picker .clr-gradient {
    height: 150px !important;
}

.clr-picker input.clr-color {
    font-family: 'SF Mono', Menlo, Consolas, monospace !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    text-transform: uppercase !important;
}

.floating-toolbar .toolbar-select {
    background: transparent;
    color: white;
    border: none;
    appearance: none;
    -webkit-appearance: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}

.floating-toolbar .toolbar-select:hover {
    background: rgba(255, 255, 255, 0.1);
}

.floating-toolbar .toolbar-select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* Styles for specific blocks */
.block-divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
    width: 100%;
}

.block-upload-area {
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    cursor: pointer;
}

.block-upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.block-upload-area i {
    font-size: 2rem;
    color: var(--text-muted);
}

.block-media {
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: block;
}

.block-file {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.block-file i {
    font-size: 1.5rem;
    color: var(--primary);
}

.block-file:hover {
    border-color: var(--primary);
}

/* Drop Indicator */
.drop-indicator {
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    margin: 0.25rem 0;
    display: none;
}

.drop-indicator.active {
    display: block;
}

/* --- Multi-Tenant Account Selector --- */
.tenant-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.tenant-card:hover {
    border-color: var(--primary);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tenant-card h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tenant-card .tenant-role {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.tenant-card .tenant-arrow {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: transform 0.2s ease, color 0.2s ease;
}

.tenant-card:hover .tenant-arrow {
    transform: translateY(-50%) translateX(4px);
    color: var(--primary);
}

/* ── Task comments redesign ────────────────────────────────────────────────── */
.task-comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.task-comments-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.task-comments-privacy {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.25rem 0.65rem;
    white-space: nowrap;
}

.task-comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    min-height: 60px;
}

.task-comment {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    position: relative;
}

.task-comment-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    overflow: hidden;
    user-select: none;
}

.task-comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.task-comment-body {
    flex: 1;
    min-width: 0;
    position: relative;
}

.task-comment-meta {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
}

.task-comment-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.task-comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.task-comment-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--primary);
    color: #fff;
    opacity: 0.85;
    vertical-align: middle;
    line-height: 1.6;
}

/* Admin chat context pill */
.admin-chat-context-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3px 10px 3px 8px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-chat-context-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.admin-chat-context-pill.active {
    border-color: var(--primary);
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
}

/* Context dropdown items */
.admin-chat-context-dropdown-phase {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-chat-context-dropdown-task {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 4px;
    margin: 0 0.25rem;
    color: var(--text-primary);
}

.admin-chat-context-dropdown-task:hover {
    background: var(--bg-surface);
}

.admin-chat-context-dropdown-task.selected {
    color: var(--primary);
    font-weight: 600;
}

.admin-chat-context-dropdown-task.selected::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* Per-task group reply button */
.chat-group-reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.5rem 0 0.25rem 0;
    padding: 0.35rem 0.875rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.chat-group-reply-btn:hover {
    opacity: 0.85;
}

/* Chat filter select */
.admin-chat-filter-select {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-app);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    max-width: 200px;
}

.admin-chat-filter-select:focus {
    border-color: var(--primary);
}

/* Reply quoted block — appears above the message text */
.chat-reply-block {
    display: flex;
    flex-direction: column;
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    padding: 0.35rem 0.65rem;
    margin-bottom: 0.4rem;
    overflow: hidden;
}

.chat-reply-block-sender {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.1rem;
}

.chat-reply-block-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Reply preview in the input area */
.chat-reply-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    padding: 0.35rem 0.5rem 0.35rem 0.65rem;
    margin-bottom: 0.5rem;
}

.chat-reply-preview-content {
    flex: 1;
    min-width: 0;
}

.chat-reply-preview-sender {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.1rem;
}

.chat-reply-preview-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-comment-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}

.task-comment-file {
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 6px);
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--text-primary);
}

.task-comment-file:hover {
    background: var(--bg-surface);
}

/* Inline reply button — always visible, low opacity, on all messages */
.task-comment-reply-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.2;
    transition: opacity 0.15s;
    margin-top: 2px;
    padding: 0 2px;
}

.task-comment:hover .task-comment-reply-btn {
    opacity: 1;
}

.task-comment-actions {
    display: none;
    gap: 0.25rem;
    position: absolute;
    right: 0;
    top: 0;
}

.task-comment:hover .task-comment-actions {
    display: flex;
}

.task-comment-actions .btn-icon {
    padding: 3px 6px;
    height: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.task-comment-actions .btn-icon:hover {
    color: var(--text-primary);
}

/* Mobile explore CTA — hidden on desktop */
.mentee-mobile-explore-cta {
    display: none;
}

@media (max-width: 768px) {
    .mentee-mobile-explore-cta {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-top: 1.5rem;
        padding: 1rem;
        background: var(--bg-surface-hover);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        color: var(--text-secondary);
        font-size: 0.875rem;
        font-weight: 500;
        cursor: pointer;
    }

    .mentee-mobile-explore-cta:active {
        background: var(--border-color);
    }

    .mentee-mobile-explore-cta i:first-child {
        font-size: 1.25rem;
    }
}

.task-comment-actions .btn-del {
    color: var(--danger) !important;
}

/* Input area */
.task-comments-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.task-comments-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.35rem 0.5rem 0.35rem 0.25rem;
    transition: border-color 0.15s;
}

.task-comments-input-row:focus-within {
    border-color: var(--primary);
}

.task-comments-attach-btn {
    color: var(--text-muted);
    flex-shrink: 0;
}

.task-comments-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0.3rem 0.25rem !important;
    font-size: 0.875rem;
    box-shadow: none !important;
}

.task-comments-send-btn {
    color: var(--primary);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM BLOCK — EDITOR (ADMIN)
   ═══════════════════════════════════════════════════════════════════ */
.form-builder-container {
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-surface);
}

.form-builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
}

.form-builder-fields {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-builder-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-builder-empty i {
    font-size: 1.5rem;
}

.form-field-row {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
    transition: background 0.15s;
}

.form-field-row:last-child {
    border-bottom: none;
}

.form-field-row:hover {
    background: var(--bg-surface-hover);
}

.form-field-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.1rem;
}

.form-field-type-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    background: var(--primary-light);
    padding: 2px 7px;
    border-radius: 99px;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM BLOCK — MENTEE VIEW
   ═══════════════════════════════════════════════════════════════════ */
.mentee-form-block {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.25rem;
    background: var(--bg-surface);
}

.mentee-form-block-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.mentee-form-block-header i {
    color: var(--primary);
    font-size: 1.1rem;
}

.mentee-form-fields {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mentee-form-field {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.mentee-form-field:last-child {
    border-bottom: none;
}

.mentee-form-field--error .mentee-form-input,
.mentee-form-field--error .mentee-file-upload-area,
.mentee-form-field--error .mentee-yes-no-group,
.mentee-form-field--error .mentee-scale-group {
    border-color: var(--danger) !important;
    outline: 1px solid var(--danger);
}

.mentee-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.mentee-form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.mentee-form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.mentee-form-input[readonly] {
    opacity: 0.7;
    cursor: default;
}

.mentee-form-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.mentee-form-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--text-primary);
}

.mentee-form-option input {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* Scale */
.mentee-scale-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.25rem 0;
}

.mentee-scale-btn {
    min-width: 36px;
    height: 36px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.mentee-scale-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.mentee-scale-btn.active {
    background: var(--primary);
    color: var(--bg-surface);
    border-color: var(--primary);
}

.mentee-scale-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

/* Yes / No */
.mentee-yes-no-group {
    display: flex;
    gap: 0.5rem;
}

.mentee-yes-no-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1.25rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.mentee-yes-no-btn:hover:not(:disabled) {
    border-color: var(--primary);
}

.mentee-yes-no-btn.active {
    background: var(--primary);
    color: var(--bg-surface);
    border-color: var(--primary);
}

.mentee-yes-no-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

/* File upload zone */
.mentee-file-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 1rem;
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: border-color 0.15s, color 0.15s;
}

.mentee-file-upload-area:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.mentee-file-upload-area i {
    font-size: 1.4rem;
}

.mentee-file-preview {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Form footer */
.mentee-form-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
}

.mentee-form-submitted-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--success);
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-main);
}

.mentee-form-submitted-notice i {
    font-size: 1.1rem;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM RESPONSES MODAL (ADMIN)
   ═══════════════════════════════════════════════════════════════════ */
.form-response-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1rem;
    background: var(--bg-surface);
}

.form-response-card-header {
    padding: 0.75rem 1rem;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-response-fields {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0;
}

.form-response-field {
    padding: 0.75rem 1rem;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.form-response-field:last-child {
    border-right: none;
}

.form-response-field-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.form-response-field-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    word-break: break-word;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM RESPONSE CARD — ADMIN CHAT
   ═══════════════════════════════════════════════════════════════════ */
.form-chat-response-card {
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    margin: 0.75rem 0 1rem;
    overflow: hidden;
    font-size: 0.875rem;
}

.form-chat-response-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-surface);
}

.form-chat-response-header i {
    color: var(--primary);
    flex-shrink: 0;
}

.form-chat-response-date {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.form-chat-fields {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.form-chat-field {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
}

.form-chat-field:last-child {
    border-bottom: none;
}

.form-chat-field-label {
    font-weight: 500;
    color: var(--text-muted);
    min-width: 110px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-chat-field-value {
    color: var(--text-primary);
    word-break: break-word;
}

/* ── Integrations sub-tabs ─────────────────────────────────────────────── */
.integ-tabs {
    margin-bottom: 1.5rem;
}

.integ-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.integ-tab:hover {
    color: var(--text-primary);
}

.integ-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ── Webhook status: segmented control ──────────────────────────────── */
.seg-control {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-surface);
}

.seg-btn {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.6rem 0.5rem;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.seg-btn i { font-size: 0.95rem; }

.seg-btn.active[data-status="test"] {
    background: rgba(210, 153, 34, 0.15);
    color: #d29922;
    font-weight: 600;
}
.seg-btn.active[data-status="active"] {
    background: rgba(26, 127, 55, 0.18);
    color: var(--success);
    font-weight: 600;
}
.seg-btn.active[data-status="inactive"] {
    background: rgba(125, 125, 125, 0.12);
    color: var(--text-primary);
    font-weight: 600;
}
.seg-btn.active[data-action-type="upsert"] {
    background: rgba(26, 127, 55, 0.18);
    color: var(--success);
    font-weight: 600;
}
.seg-btn.active[data-action-type="block"] {
    background: rgba(185, 28, 28, 0.15);
    color: var(--danger);
    font-weight: 600;
}

/* ── Path combobox (webhook field mapping) ──────────────────────────── */
.secret-input-wrapper {
    position: relative;
    display: block;
}
.secret-input-wrapper input {
    padding-right: 2.25rem;
    width: 100%;
    box-sizing: border-box;
}
.secret-toggle-btn {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.15s ease, background 0.15s ease;
}
.secret-toggle-btn:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
.secret-toggle-btn i { font-size: 1rem; }

.path-combo {
    position: relative;
}

.path-combo-trigger {
    width: 100%;
    text-align: left;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    transition: border-color 0.15s ease;
}

.path-combo-trigger:hover { border-color: var(--text-muted); }
.path-combo.is-open .path-combo-trigger { border-color: var(--primary); }

.path-combo-trigger .path-combo-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.82rem;
}

.path-combo-trigger .path-combo-value.is-placeholder {
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.88rem;
}

.path-combo-trigger .ph-caret-down {
    color: var(--text-muted);
    transition: transform 0.15s ease;
}

.path-combo.is-open .path-combo-trigger .ph-caret-down {
    transform: rotate(180deg);
}

.path-combo-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.path-combo-panel[hidden] {
    display: none;
}

.path-combo-search {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0.55rem 0.75rem;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
}

.path-combo-search::placeholder { color: var(--text-muted); }

.path-combo-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.path-combo-option {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    cursor: pointer;
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
}

.path-combo-option:hover,
.path-combo-option.is-highlighted {
    background: var(--bg-surface-hover);
}

.path-combo-option.is-selected {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.path-combo-option .preview {
    color: var(--text-muted);
    font-weight: normal;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 55%;
}

.path-combo-option .path {
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.path-combo-empty {
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-align: center;
}

/* ── Tracker calendar (mentee entry modal) ────────────────────────────────── */
.tracker-cal-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem;
    user-select: none;
}
.tracker-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.tracker-cal-month {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: capitalize;
    color: var(--text-primary);
}
.tracker-cal-nav {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
}
.tracker-cal-nav:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}
.tracker-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.tracker-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.tracker-cal-cell {
    background: transparent;
    border: 2px solid transparent;
    font-size: 0.82rem;
    padding: 0.4rem 0;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.12s, border-color 0.12s;
    text-align: center;
    font-family: inherit;
}
.tracker-cal-cell:hover {
    background: var(--bg-surface-hover);
}
.tracker-cal-outmonth {
    opacity: 0.3;
}
.tracker-cal-today {
    font-weight: 700;
}
.tracker-cal-cell.cell-filled {
    background: rgba(34, 197, 94, 0.18);
    color: #166534;
}
.tracker-cal-cell.cell-overdue {
    background: rgba(239, 68, 68, 0.18);
    color: #991b1b;
}
.tracker-cal-cell.cell-current {
    background: rgba(234, 179, 8, 0.25);
    color: #854d0e;
}
.tracker-cal-cell.cell-selected {
    border-color: var(--primary);
    font-weight: 700;
}
[data-theme="dark"] .tracker-cal-cell.cell-filled {
    background: rgba(34, 197, 94, 0.22);
    color: #86efac;
}
[data-theme="dark"] .tracker-cal-cell.cell-overdue {
    background: rgba(239, 68, 68, 0.22);
    color: #fca5a5;
}
[data-theme="dark"] .tracker-cal-cell.cell-current {
    background: rgba(234, 179, 8, 0.22);
    color: #fde68a;
}
.tracker-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border-color);
}
.tracker-cal-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.tracker-cal-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
}
.tracker-cal-legend-dot.dot-filled { background: rgba(34, 197, 94, 0.55); }
.tracker-cal-legend-dot.dot-overdue { background: rgba(239, 68, 68, 0.55); }
.tracker-cal-legend-dot.dot-current { background: rgba(234, 179, 8, 0.65); }
.tracker-cal-legend-dot.dot-selected {
    background: transparent;
    border: 2px solid var(--primary);
    width: 8px;
    height: 8px;
}
.tracker-cal-selected-label {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-primary);
    font-weight: 600;
}
.tracker-cal-selected-label strong {
    color: var(--primary);
}

/* ─── Ledger (mentee tracker detail) ───────────────────────────────────── */
.ledger-root {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ledger-header {
    padding: 0;
}
.ledger-description {
    margin: 0 0 0.35rem 0;
    color: var(--text-secondary);
    font-size: 0.92rem;
}
.ledger-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
}
.ledger-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background: var(--bg-surface);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.82rem;
    max-width: 100%;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.ledger-attachment:hover { border-color: var(--primary); transform: translateY(-1px); }
.ledger-attachment i { color: var(--primary); font-size: 0.95rem; flex-shrink: 0; }
.ledger-attachment-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}
.ledger-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.ledger-main {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.ledger-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1rem;
    align-items: stretch;
}
.ledger-evolution-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    height: 100%;
}
.ledger-evolution-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}
.ledger-range-slot { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; }
.ledger-metric-tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.ledger-metric-tab {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ledger-metric-tab:hover {
    background: var(--bg-surface-hover);
}
.ledger-metric-tab.active {
    background: var(--primary);
    color: var(--bg-surface);
    border-color: var(--primary);
}

/* Periods card (always visible, sits next to the chart) */
.ledger-periods-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}
.ledger-periods-card-head {
    background: #1e1e1e;
    color: #fff;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.ledger-periods-card-title { font-weight: 600; color: #fff; }
.ledger-periods-card .ledger-periods-container {
    padding: 0.75rem 1rem 1rem;
    overflow-y: auto;
}
.ledger-form-brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    display: inline-block;
}
.ledger-form-period-btn {
    appearance: none;
    background: #1e1e1e;
    color: #fff;
    border: none;
    padding: 0 1rem 0.9rem;
    margin: 0;
    text-align: left;
    font-size: 1.15rem;
    font-weight: 600;
    font-family: Georgia, "Times New Roman", serif;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.15s;
}
.ledger-form-period-btn:hover { opacity: 0.85; }
.ledger-form-period-btn i { font-size: 0.9rem; opacity: 0.75; }
.ledger-calendar-popover {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}
.ledger-periods-wrap {
    padding: 1rem 1.15rem 0;
}

/* Icon picker (subsection modal) */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 0.35rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-surface);
    max-height: 200px;
    overflow-y: auto;
}
.icon-picker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    transition: background 0.12s, border-color 0.12s;
}
.icon-picker-item:hover { background: var(--bg-surface-hover); }
.icon-picker-item.is-selected { border-color: var(--primary); background: rgba(79, 70, 229, 0.08); }
.icon-picker-item i { line-height: 1; }
.ledger-periods-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 280px;
    overflow-y: auto;
}
.ledger-period-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s, transform 0.12s;
    text-align: left;
}
.ledger-period-item:hover { border-color: var(--primary); transform: translateY(-1px); }
.ledger-period-item.is-selected { border-color: var(--primary); background: rgba(79, 70, 229, 0.06); }
.ledger-period-label { text-transform: capitalize; font-weight: 500; }
.ledger-period-status { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 1.05rem; flex-shrink: 0; }
.ledger-period-status.ledger-period-done { color: #16a34a; }
.ledger-period-status.ledger-period-pending { color: #ea580c; }
.ledger-period-status.ledger-period-current {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
}
.ledger-form-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.9rem;
    padding: 1rem 0 0;
}
.ledger-form-fields + .ledger-form-group { margin-top: 1rem; }
.ledger-form-group { margin: 0; padding: 0 1.15rem; }
.ledger-form-group + .ledger-form-group { margin-top: 0.9rem; }
.ledger-form-group:last-of-type { padding-bottom: 0; }
.ledger-form-group label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    display: block;
}
.ledger-form-group input,
.ledger-form-group textarea,
.ledger-form-group select {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-surface);
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-family: inherit;
    box-sizing: border-box;
}
.ledger-form-group input::placeholder,
.ledger-form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}
.ledger-form-group textarea {
    font-size: 0.9rem;
    resize: vertical;
    min-height: 70px;
}
.ledger-form-group input:focus,
.ledger-form-group textarea:focus,
.ledger-form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 79, 70, 229), 0.08);
}
.ledger-form-actions {
    display: flex;
    justify-content: stretch;
    gap: 0.5rem;
    padding: 1.15rem;
    margin-top: 0.75rem;
}
.ledger-form-submit {
    flex: 1;
    width: 100%;
    padding: 1rem 1.25rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #1e1e1e;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.ledger-form-submit:hover { opacity: 0.92; transform: translateY(-1px); }
.ledger-form-submit i { font-size: 1rem; }

/* When the ledger form lives inside the popup modal, the modal-body already
   has its own padding — strip the card-style horizontal padding. */
#ledger-form-modal-body .ledger-form-fields,
#ledger-form-modal-body .ledger-form-group,
#ledger-form-modal-body .ledger-form-actions {
    padding-left: 0;
    padding-right: 0;
}
#ledger-form-modal-body .ledger-form-actions {
    padding-top: 1rem;
    padding-bottom: 0;
}

/* Headline block */
.ledger-headline-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.ledger-headline-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.ledger-headline-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.ledger-headline-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.ledger-headline-hint {
    font-size: 0.8rem;
}

/* Generic delta pill */
.ledger-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.85rem;
    font-weight: 600;
}
.ledger-delta.up   { color: var(--success); }
.ledger-delta.down { color: var(--danger); }

/* Goal progress (now rendered inside evolution card, no own bg) */
.ledger-goal {
    padding: 0.25rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.25rem;
    padding-top: 0.85rem;
}
.ledger-goal:empty { display: none; }
.ledger-goal-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.ledger-goal-title {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ledger-goal-numbers {
    font-size: 0.9rem;
    color: var(--text-primary);
}
.ledger-goal-sep { color: var(--text-muted); margin: 0 0.25rem; }
.ledger-goal-bar {
    background: var(--bg-surface-hover);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}
.ledger-goal-fill {
    background: var(--primary);
    height: 100%;
    transition: width 0.35s ease-out;
}
.ledger-goal-pct {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

/* Chart (inside evolution card, no own bg) */
.ledger-chart:empty { display: none; }
.ledger-chart {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.ledger-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.ledger-range-group {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.ledger-range-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ledger-range-btn:hover { background: var(--bg-surface-hover); }
.ledger-range-btn.active {
    background: var(--primary);
    color: var(--bg-surface);
    border-color: var(--primary);
}
.ledger-range-custom {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.ledger-range-custom input[type="date"] {
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
}
.ledger-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.1rem;
    padding: 0 0 0.6rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.ledger-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.ledger-chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.ledger-chart-svg-wrap {
    width: 100%;
    height: 240px;
}
.ledger-chart-svg {
    width: 100%;
    height: 100%;
    display: block;
}
.ledger-chart-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 2rem 0;
}
.ledger-chart-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.ledger-chart-dot {
    fill: var(--primary);
    stroke: var(--bg-surface);
    stroke-width: 1.5;
}
.ledger-chart-goal-line {
    stroke: var(--success);
    stroke-width: 1.5;
    stroke-dasharray: 6 4;
    opacity: 0.85;
}
.ledger-chart-pending-line {
    stroke: var(--text-muted);
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
    opacity: 0.7;
}
.ledger-chart-pending-dot {
    fill: var(--bg-surface);
    stroke: var(--text-muted);
    stroke-width: 1.5;
    stroke-dasharray: 2 2;
}
.ledger-chart-gridline {
    stroke: var(--border-color);
    stroke-width: 0.5;
    opacity: 0.6;
}
.ledger-chart-ytick, .ledger-chart-xtick {
    fill: var(--text-muted);
    font-size: 10px;
    font-family: inherit;
}

/* Table */
.ledger-section-title {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.ledger-table-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem 1rem;
}
.ledger-table-scroll {
    overflow-x: auto;
}
.ledger-table {
    width: 100%;
    border-collapse: collapse;
}
.ledger-th, .ledger-td {
    padding: 0.85rem 0.75rem 0.7rem;
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.ledger-th {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-transform: uppercase;
}
.ledger-th-actions, .ledger-td-actions { width: 50px; text-align: right; }
.ledger-note-cell {
    white-space: normal;
    max-width: 220px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}
.ledger-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1.5rem !important;
}
.ledger-admin-badge {
    font-size: 0.7rem;
    color: var(--warning);
    margin-left: 0.35rem;
}
.ledger-locked {
    color: var(--text-muted);
    font-size: 1rem;
}
.ledger-edit-btn { }

/* Comments placeholder */
.ledger-comments:empty { display: none; }

/* Mentee ledger comment cards */
.ledger-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin: 1.25rem 0 0.5rem;
}
.ledger-comments-list { display: flex; flex-direction: column; gap: 0.5rem; }
.ledger-comment {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
}
.ledger-comment-head {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    flex-wrap: wrap;
}
.ledger-comment-author { color: var(--text-primary); font-weight: 600; }
.ledger-comment-anchor {
    margin-left: auto;
    font-size: 0.7rem;
    background: var(--bg-surface-hover, rgba(0,0,0,0.06));
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
}
.ledger-comment-body { font-size: 0.9rem; white-space: pre-wrap; }

/* ─── Ledger V2 layout ─────────────────────────────────────────────────── */
.ledger-v2 { display: flex; flex-direction: column; gap: 1.1rem; }

.ledger-metric-tabs-v2 {
    display: flex;
    gap: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding: 0 0.1rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.ledger-metric-tabs-v2::-webkit-scrollbar { display: none; }
.ledger-metric-tabs-v2[hidden] { display: none; }
.ledger-metric-tab-v2 {
    appearance: none;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.65rem 0.1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
    margin-bottom: -1px;
}
.ledger-metric-tab-v2:hover { color: var(--text-primary); }
.ledger-metric-tab-v2.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
    font-weight: 600;
}

.ledger-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.5rem;
    align-items: start;
    margin-top: 0.9rem;
}
.ledger-main-col { display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.ledger-side-col { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }
.ledger-side-block { display: flex; flex-direction: column; }
.ledger-side-description {
    margin: 0;
    padding: 0 0.1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

@media (max-width: 900px) {
    .ledger-layout { grid-template-columns: 1fr; }
}

/* ─── Entry card ─── */
.ledger-entry-card {
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.15rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}
.ledger-entry-card[hidden] { display: none; }
.ledger-entry-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.ledger-entry-head-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.ledger-entry-head-label i { font-size: 0.95rem; }
.ledger-entry-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: #b45309;
}
.ledger-entry-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}
.ledger-entry-body { display: flex; flex-direction: column; gap: 0.45rem; }
.ledger-entry-field { display: flex; flex-direction: column; gap: 0.2rem; }
.ledger-entry-field + .ledger-entry-field { margin-top: 0.6rem; }
.ledger-entry-col-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}
.ledger-entry-col-required { color: var(--danger, #dc2626); margin-left: 0.15rem; }
.ledger-entry-value-input {
    width: 100%;
    appearance: none;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    padding: 0.2rem 0 0.5rem;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.4rem;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease;
}
.ledger-entry-value-input::placeholder { color: var(--text-muted); opacity: 0.55; }
.ledger-entry-value-input:focus { border-bottom-color: var(--primary); }
.ledger-entry-note-label {
    font-size: 0.78rem;
    color: var(--text-primary);
    margin-top: 0.25rem;
    font-weight: 500;
}
.ledger-entry-note-optional { color: var(--text-muted); font-weight: 400; }
.ledger-entry-note-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-main, #fafafa);
    padding: 0.55rem 0.7rem;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text-primary);
    resize: vertical;
    min-height: 60px;
    outline: none;
    transition: border-color 0.15s ease;
}
.ledger-entry-note-input:focus { border-color: var(--primary); }
.ledger-entry-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.25rem;
}
.ledger-entry-foot-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.ledger-entry-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.ledger-entry-card--inline {
    width: 100%;
    margin: 0;
}
.ledger-history-item.is-editing {
    display: block;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-color);
}
.ledger-history-item.is-editing:last-child { border-bottom: none; }
.ledger-history-pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}
.ledger-history-value--muted {
    color: var(--text-muted);
    opacity: 0.7;
}

/* ─── History ─── */
.ledger-history {
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.ledger-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.ledger-history-title {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}
.ledger-history-toggle {
    display: inline-flex;
    gap: 0.25rem;
    background: var(--bg-surface, #f4f4f5);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.ledger-history-toggle-btn {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0.3rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.ledger-history-toggle-btn:hover { color: var(--text-primary); }
.ledger-history-toggle-btn.active {
    background: var(--bg-main, #fff);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.ledger-history-body { display: flex; flex-direction: column; }
.ledger-history-list { display: flex; flex-direction: column; }

.ledger-history-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.ledger-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.ledger-history-table thead th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    background: var(--bg-surface, #fafafa);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.ledger-history-table thead th:last-child { border-right: none; }
.ledger-history-table thead th.ledger-table-th-num { text-align: right; }
.ledger-history-table tbody td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    vertical-align: middle;
}
.ledger-history-table tbody td:last-child { border-right: none; }
.ledger-history-table tbody tr:last-child td { border-bottom: none; }
.ledger-table-period {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: nowrap;
    text-transform: capitalize;
}
.ledger-table-td-num {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.05rem;
    color: var(--text-primary);
    text-align: right;
    white-space: nowrap;
}
.ledger-table-td-num.is-empty {
    color: var(--text-muted);
    opacity: 0.6;
    font-family: inherit;
    font-size: 0.9rem;
}
.ledger-table-note {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 22ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ledger-table-actions {
    text-align: right;
    white-space: nowrap;
}
.ledger-table-actions .btn-icon { margin-left: 0.15rem; }
.ledger-table-row--pending td { background: transparent; }
.ledger-table-row--pending .ledger-table-td-num { color: var(--text-muted); opacity: 0.6; font-family: inherit; font-size: 0.9rem; }
.ledger-history-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-color);
}
.ledger-history-item:last-child { border-bottom: none; }
.ledger-history-item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.ledger-history-item-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: capitalize;
}
.ledger-history-period { font-weight: 500; }
.ledger-history-value-row { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.ledger-history-value-row + .ledger-history-value-row { margin-top: 0.1rem; }
.ledger-history-col-label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 6rem;
}
/* Calculated columns — surfaced with a purple accent so mentee/monitor can
   distinguish them from raw inputs at a glance. */
.ledger-history-col-calc {
    font-size: 0.85em;
    color: #7c3aed;
    margin-left: 0.2rem;
    vertical-align: middle;
}
.ledger-history-value-row--calc .ledger-history-col-label {
    color: #7c3aed;
}
.ledger-history-value-row--calc .ledger-history-value {
    color: #5b21b6;
}
.ledger-table-th--calc,
.ledger-table-td--calc {
    background: rgba(124, 58, 237, 0.04);
}
.ledger-table-th-calc {
    font-size: 0.85em;
    color: #7c3aed;
    margin-left: 0.2rem;
    vertical-align: middle;
}
.ledger-chart-line--calc {
    stroke-dasharray: 4 3;
}
.ledger-chart-legend-item--calc i {
    font-size: 0.85em;
    color: #7c3aed;
    margin-left: 0.1rem;
}
.ledger-history-value {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.2;
}
.ledger-history-delta {
    font-size: 0.8rem;
    font-weight: 600;
}
.ledger-history-delta.up   { color: var(--success, #16a34a); }
.ledger-history-delta.down { color: var(--danger,  #dc2626); }
.ledger-history-note {
    font-size: 0.85rem;
    color: var(--text-secondary, var(--text-muted));
    white-space: pre-wrap;
    margin-top: 0.15rem;
}
.ledger-history-item-aside {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    flex-shrink: 0;
}
.ledger-history-lock { font-size: 0.95rem; padding: 0.35rem; }
.ledger-history-delete:hover { color: var(--danger, #dc2626); }
.ledger-history-empty {
    padding: 1.2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.ledger-chart-block { display: flex; flex-direction: column; gap: 0.6rem; }
.ledger-chart-range { justify-content: flex-end; }

/* ─── Comments sidebar (task-comment style) ─── */
.ledger-side-title {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0 0.1rem 0.5rem;
}
.ledger-side-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 0.1rem;
}
.ledger-comments-list-v2 {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.25rem 0 0.75rem;
}
.ledger-comment-ref {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-surface-hover, rgba(0,0,0,0.04));
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: auto;
    white-space: nowrap;
}
.ledger-comment-ref i { font-size: 0.78rem; }

.ledger-comments-form {
    margin-top: 0.25rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
}
.ledger-comments-input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.4rem 0.45rem 0.4rem 0.6rem;
    transition: border-color 0.15s ease;
}
.ledger-comments-input-row:focus-within { border-color: var(--primary); }
.ledger-comments-input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    outline: none;
    resize: none;
    min-height: 1.5rem;
    max-height: 140px;
    font: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
    padding: 0.25rem 0;
}
.ledger-comments-send-btn {
    appearance: none;
    border: none;
    background: var(--primary);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    transition: opacity 0.15s ease;
}
.ledger-comments-send-btn:hover { opacity: 0.9; }
.ledger-comments-send-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ─── Tracker tabs (shown at /indicadores top level) ─── */
.ledger-tracker-tabs {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding: 0 0.1rem;
    overflow-x: auto;
    scrollbar-width: none;
    margin-bottom: 0.25rem;
}
.ledger-tracker-tabs::-webkit-scrollbar { display: none; }
.ledger-tracker-tab {
    appearance: none;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.85rem 0.15rem;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
    margin-bottom: -1px;
    text-decoration: none;
    display: inline-block;
}
.ledger-tracker-tab:hover { color: var(--text-primary); }
.ledger-tracker-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* Admin tracker comment UI */
.tracker-comment-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.tracker-admin-comments { padding: 0.75rem 1rem; }
.tracker-admin-comment-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.6rem; }
.tracker-admin-comment-empty { color: var(--text-muted); font-size: 0.85rem; padding: 0.3rem 0; }
.tracker-admin-comment {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
}
.tracker-admin-comment.from-admin { border-left: 3px solid var(--primary); }
.tracker-admin-comment.from-mentee { border-left: 3px solid var(--success, #4caf50); }
.tracker-admin-comment-head {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.tracker-admin-comment-date { margin-left: auto; }
.tracker-admin-comment-del {
    padding: 0.1rem 0.3rem;
    color: var(--danger);
    background: transparent;
    border: none;
    cursor: pointer;
}
.tracker-admin-comment-body { font-size: 0.88rem; white-space: pre-wrap; }
.tracker-admin-comment-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.tracker-admin-comment-form textarea {
    flex: 1;
    resize: vertical;
    min-height: 40px;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
}

/* Tracker overview (mentee home) */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.overview-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    outline: none;
}
.overview-card:hover,
.overview-card:focus-visible {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.overview-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}
.overview-card-title-wrap { flex: 1; min-width: 0; }
.overview-card-title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.overview-card-title i { color: var(--text-muted); font-size: 1.05rem; }
.overview-card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.72rem;
    color: var(--text-muted);
    align-items: center;
}
.overview-overdue {
    background: rgba(245,158,11,0.12);
    color: var(--warning);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}
.overview-card-new {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.overview-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
}
.overview-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.overview-headline { min-width: 0; flex: 1; }
.overview-headline-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}
.overview-headline-colname {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}
.overview-headline-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.overview-headline-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}
.overview-headline-empty {
    padding: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.overview-sparkline {
    width: 120px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.overview-spark-svg { width: 100%; height: 48px; }
.overview-spark-svg polyline { stroke: var(--primary); }
.overview-spark-svg circle { fill: var(--primary); }
.overview-spark-svg.up polyline { stroke: var(--success, #4caf50); }
.overview-spark-svg.up circle { fill: var(--success, #4caf50); }
.overview-spark-svg.down polyline { stroke: var(--danger, #f44336); }
.overview-spark-svg.down circle { fill: var(--danger, #f44336); }
.overview-sparkline-empty {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    text-align: center;
    opacity: 0.6;
}
.overview-sparkline-empty i { font-size: 1.4rem; }
.overview-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
}
.overview-card-open {
    color: var(--primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

/* Topbar pill: Acompanhamento quick access */
.topbar-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.topbar-pill:hover { border-color: var(--text-muted); }
.topbar-pill .pill-label { font-weight: 500; }
.topbar-pill .pill-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e07a20;
    animation: tpill-pulse 1.6s ease-in-out infinite;
}
.topbar-pill .pill-dot.muted {
    background: var(--text-muted);
    animation: none;
    opacity: 0.5;
}
.topbar-pill .pill-count {
    background: #111;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    line-height: 1.25;
}
.topbar-pill i { font-size: 0.85rem; color: var(--text-muted); }
@keyframes tpill-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.4); }
}

.topbar-pill-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 2rem);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.14);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.tpill-header {
    padding: 0.9rem 1rem 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.tpill-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.tpill-sub {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.tpill-cards {
    display: flex;
    flex-direction: column;
    max-height: 440px;
    overflow-y: auto;
}
.tpill-card {
    padding: 0.8rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.tpill-card.pending {
    background: rgba(224, 122, 32, 0.07);
}
.tpill-card.pending .tpill-card-title { color: #e07a20; }
.tpill-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.25;
}
.tpill-card-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.tpill-card-cta {
    font-size: 0.8rem;
    color: #e07a20;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.15rem;
}
.tpill-card-value {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-shrink: 0;
}
.tpill-card-number {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}
.tpill-delta {
    font-size: 0.78rem;
    font-weight: 600;
}
.tpill-delta.up   { color: var(--success, #16a34a); }
.tpill-delta.down { color: var(--danger, #dc2626); }
.tpill-quick {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.2rem;
}
.tpill-quick-input {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
}
.tpill-quick-input:focus {
    outline: none;
    border-color: #e07a20;
}
.tpill-quick-save {
    padding: 0.45rem 1rem;
    border: none;
    border-radius: 6px;
    background: #e07a20;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.15s;
}
.tpill-quick-save:hover { opacity: 0.9; }
.tpill-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}
.tpill-status { color: var(--text-muted); }
.tpill-see-all {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.tpill-see-all:hover { text-decoration: underline; }

@media (max-width: 720px) {
    .topbar-pill .pill-label { display: none; }
    .topbar-pill-dropdown { width: 320px; }
}

/* Responsive: collapse evolution+form grid to single column */
@media (max-width: 960px) {
    .ledger-top-grid { grid-template-columns: 1fr; }
    .ledger-inline-form { order: -1; }  /* form on top on mobile per user pref */
}

/* Mobile tweaks */
@media (max-width: 720px) {
    .ledger-headline-value { font-size: 2rem; }
    .ledger-form-fields { grid-template-columns: 1fr; }
    .tracker-admin-comment-form { flex-direction: column; }
    .tracker-admin-comment-form button { align-self: flex-end; }
    .overview-grid { grid-template-columns: 1fr; }
    .overview-card-body { flex-direction: column; align-items: stretch; }
    .overview-sparkline { width: 100%; }
    .ledger-evolution-head { flex-direction: column; align-items: flex-start; }
    .ledger-range-slot { align-items: flex-start; width: 100%; }
}
