/* ===========================================
   Berlitz Way - ברליץ ישראל בעמ
   קובץ עיצוב מרכזי
   =========================================== */

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

:root {
    /* צבעי Berlitz Way */
    --primary: #5B6EC6;
    --primary-dark: #4A5AAF;
    --primary-darker: #3D4B96;
    --primary-light: #E8ECF8;

    /* ניטרליים */
    --bg: #f5f7fa;
    --surface: #ffffff;
    --border: #e5e7eb;
    --border-strong: #d1d5db;

    /* טקסט */
    --text: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;

    /* סטטוסים */
    --success: #10b981;
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
}

body {
    font-family: 'Heebo', 'Inter', Arial, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
    direction: rtl;
    display: flex;
    flex-direction: column;
}

/* =========================================== Header =========================================== */
.header {
    background: linear-gradient(135deg, #5B6EC6 0%, #4A5AAF 100%);
    color: white;
    padding: 18px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-title h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-version {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.85);
    margin-right: 8px;
    letter-spacing: 0;
    vertical-align: middle;
}

.header-data-date {
    font-size: 12px;
    font-weight: 400;
    color: rgba(255,255,255,0.75);
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.header-data-date:empty {
    display: none;
}

.chip {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-weight: 500;
}

.header-back-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.header-back-btn:hover {
    background: rgba(255,255,255,0.3);
}

.header-icon-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header-icon-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(30deg);
}

/* =========================================== App root + Footer =========================================== */
.app-root {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px;
}

.footer {
    text-align: center;
    padding: 16px;
    color: var(--text-light);
    font-size: 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* =========================================== Dashboard (מסך כניסה) =========================================== */
.dashboard-intro {
    text-align: center;
    margin-bottom: 32px;
}

.dashboard-intro h2 {
    font-size: 26px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.dashboard-intro p {
    font-size: 15px;
    color: var(--text-muted);
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    max-width: 1100px;
    margin: 0 auto;
}

.module-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.module-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.module-card.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.module-card.disabled:hover {
    border-color: var(--border);
    box-shadow: none;
    transform: none;
}

.module-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.module-card h3 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.module-card p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.module-card-tag {
    position: absolute;
    top: 14px;
    left: 14px;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--warning-bg);
    color: var(--warning-text);
    font-weight: 600;
}

.module-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 500;
    margin-top: 4px;
    align-self: flex-start;
}

.module-status.ready {
    background: var(--success-bg);
    color: var(--success-text);
}

.module-status.missing {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.module-status.partial {
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* =========================================== Missing data screen =========================================== */
.missing-data-card {
    text-align: center;
    padding: 36px 24px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
}

.missing-data-card > i {
    font-size: 42px;
    color: var(--text-light);
    margin-bottom: 14px;
    display: block;
}

.missing-data-card h3 {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 6px;
}

.missing-data-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 18px;
}

.missing-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
    margin: 0 auto 22px;
}

.missing-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
}

.missing-item i {
    color: var(--primary);
    font-size: 16px;
}

/* =========================================== Module screen =========================================== */
.module-screen {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
}

.module-header {
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.module-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.module-header p {
    font-size: 14px;
    color: var(--text-muted);
}

/* כותרת מודול עם כפתורי ייצוא באותה שורה */
.module-header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}
.module-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
@media (max-width: 600px) {
    .module-header-actions { width: 100%; }
    .module-header-actions .btn { flex: 1; }
}

/* =========================================== Section header (פנימי) =========================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.section-hint {
    font-size: 12px;
    color: var(--text-light);
}

/* =========================================== File slots (כרטיסי קבצים) =========================================== */
.file-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.file-slot {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--surface);
    transition: border-color 0.2s;
}

.file-slot:hover {
    border-color: var(--border-strong);
}

.file-slot.loaded {
    border-color: var(--success);
}

.file-slot-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.file-slot-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.file-slot-meta {
    flex: 1;
    min-width: 0;
}

.file-slot-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.file-slot-code {
    font-size: 11px;
    color: var(--text-light);
    font-family: monospace;
}

.file-slot-status {
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    min-height: 36px;
    gap: 8px;
}

.file-slot-status-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.file-loaded-at {
    font-size: 11px;
    opacity: 0.85;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.file-loaded-at i {
    font-size: 10px;
}

.file-slot-status.empty {
    background: var(--bg);
    border: 1px dashed var(--border-strong);
    color: var(--text-light);
    justify-content: center;
}

.file-slot-status.loaded {
    background: var(--success-bg);
    color: var(--success-text);
}

.file-slot-status.error {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.file-slot-status .file-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.file-slot-status .file-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 2px 6px;
    font-size: 12px;
}

.file-slot-status .file-remove:hover {
    color: var(--danger);
}

.file-slot-btn {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
    transition: all 0.2s;
}

.file-slot-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.file-slot-placeholder {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
    background: var(--bg);
    margin-bottom: 14px;
}

.file-slot-placeholder i {
    margin-left: 4px;
}

/* =========================================== Info banner =========================================== */
.info-banner {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.info-banner i {
    color: var(--primary);
}

/* =========================================== Buttons =========================================== */
.btn {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    background: var(--bg);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

.btn-large {
    padding: 11px 28px;
    font-size: 14px;
    font-weight: 600;
}

.btn-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding-top: 8px;
}

/* =========================================== Results screen =========================================== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.stat-card.stat-danger {
    background: var(--danger-bg);
}

.stat-card.stat-success {
    background: var(--success-bg);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-card.stat-danger .stat-label { color: var(--danger-text); }
.stat-card.stat-success .stat-label { color: var(--success-text); }

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
}

.stat-sublabel {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-card.stat-danger .stat-sublabel { color: var(--danger-text); opacity: 0.85; }

.stat-card.stat-danger .stat-value { color: var(--danger-text); }
.stat-card.stat-success .stat-value { color: var(--success-text); }

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.search-wrap i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 13px;
    pointer-events: none;
}

.search-wrap input {
    width: 100%;
    padding: 9px 36px 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    background: var(--surface);
    color: var(--text);
}

.search-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 110, 198, 0.15);
}

.select {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.results-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: auto;
    max-height: 65vh;
    min-width: 0;
    max-width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--surface);
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th {
    background: var(--bg);
    text-align: right;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

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

.data-table tbody tr {
    cursor: pointer;
    transition: background 0.1s;
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

.data-table .mono {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.data-table .cell-danger {
    color: var(--danger-text);
    font-weight: 500;
}

.empty-row {
    text-align: center !important;
    padding: 28px !important;
    color: var(--text-light) !important;
    cursor: default !important;
}

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

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    cursor: help;
}

/* =========================================== Module screen with sidebar =========================================== */
.module-screen-with-sidebar {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 20px;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.filter-sidebar {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px 18px;
    box-shadow: var(--shadow);
    align-self: start;
    position: sticky;
    top: 18px;
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.sidebar-title i {
    color: var(--primary);
}

.filter-group {
    margin-bottom: 16px;
}

.filter-group.filter-disabled {
    opacity: 0.55;
}

.filter-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.filter-control {
    width: 100%;
    font-size: 13px;
}

.filter-hint {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    padding: 5px 0;
    user-select: none;
}

.filter-checkbox input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-list {
    max-height: 180px;
    overflow-y: auto;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.filter-checkbox-compact {
    padding: 3px 0;
    font-size: 12px;
}

.filter-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.filter-label-row .filter-label {
    margin-bottom: 0;
}

.filter-mini-actions {
    display: flex;
    gap: 4px;
}

.filter-mini-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 8px;
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.filter-mini-btn:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
    background: var(--primary-light);
}

.filter-required {
    color: var(--primary);
    font-weight: 700;
}

.filter-clear-btn {
    width: 100%;
    font-size: 12px;
    margin-top: 8px;
    justify-content: center;
}

.results-area {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.results-empty-prompt {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
    font-size: 14px;
}

.results-empty-prompt i {
    font-size: 28px;
    color: var(--text-light);
    margin-bottom: 10px;
    display: block;
}

/* רספונסיביות לסיידבר */
@media (max-width: 900px) {
    .module-screen-with-sidebar {
        grid-template-columns: 1fr;
    }
    .filter-sidebar {
        position: static;
    }
}

/* =========================================== Student detail =========================================== */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.detail-identity {
    display: flex;
    align-items: center;
    gap: 14px;
}

.detail-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.detail-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.detail-cust-id {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
    margin-top: 2px;
}

.detail-info-box {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.detail-info-table {
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

.detail-info-table td {
    padding: 5px 0;
}

.detail-info-table td:first-child {
    color: var(--text-muted);
    width: 35%;
}

.detail-info-table td:last-child {
    font-weight: 500;
}

.detail-info-table .value-danger {
    color: var(--danger-text);
}

.detail-empty {
    text-align: center;
    padding: 32px 18px;
    background: var(--bg);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
}

.detail-empty i {
    font-size: 28px;
    color: var(--text-light);
    margin-bottom: 8px;
    display: block;
}

.table-summary-row td {
    background: var(--bg);
    border-top: 1px solid var(--border-strong) !important;
}

/* =========================================== DataHub - מאגר נתונים =========================================== */
.datahub-status {
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.datahub-status.empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.datahub-status.empty > i {
    font-size: 48px;
    color: var(--text-light);
    display: block;
    margin-bottom: 14px;
}

.datahub-status.empty strong {
    display: block;
    font-size: 16px;
    color: var(--text);
    margin-bottom: 8px;
}

.datahub-status.empty p {
    max-width: 520px;
    margin: 0 auto;
    font-size: 13px;
    line-height: 1.6;
}

.datahub-status.empty code {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    color: var(--primary-dark);
}

.datahub-status.loaded {
    border-color: var(--success);
}

.datahub-status-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.datahub-status-header > i {
    color: var(--success);
    font-size: 28px;
}

.datahub-status-header strong {
    display: block;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 3px;
}

.datahub-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.datahub-counts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.datahub-count {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    text-align: center;
}

.datahub-count-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
}

.datahub-count-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.datahub-sources {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.datahub-sources-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.datahub-source-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 12px;
}

.datahub-source-row i {
    color: var(--primary);
}

.datahub-source-time {
    margin-right: auto;
    color: var(--text-light);
    font-size: 11px;
}

.datahub-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-no-data {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    margin-bottom: 18px;
    color: var(--warning-text);
    font-size: 13px;
}

.dashboard-no-data > i {
    font-size: 24px;
    color: var(--warning);
}

.dashboard-no-data strong {
    display: block;
    margin-bottom: 2px;
}

/* =========================================== Settings (משופר) =========================================== */
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 18px;
}

.settings-section-header {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.settings-section-header h3 {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-section-header h3 i {
    color: var(--primary);
}

.settings-section-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

.settings-warning-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 14px;
}

.settings-warning-banner > i {
    font-size: 18px;
    color: var(--warning);
    flex-shrink: 0;
}

.settings-warning-body {
    flex: 1;
    color: var(--warning-text);
    font-size: 13px;
}

.settings-warning-body strong {
    display: block;
    margin-bottom: 2px;
}

.settings-warning-body div {
    font-size: 12px;
    opacity: 0.85;
}

.settings-lesstype-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 6px;
}

.settings-lesstype-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
}

.settings-lesstype-cell:hover {
    border-color: var(--primary);
}

.settings-lesstype-cell.is-excluded {
    background: var(--warning-bg);
    border-color: var(--warning);
}

.settings-lesstype-cell input[type="checkbox"] {
    accent-color: var(--primary);
}

.settings-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.settings-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
    font-size: 13px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.btn-mini {
    padding: 4px 10px;
    font-size: 11px;
}

/* =========================================== Students Browser =========================================== */

/* Radio group */
.filter-radio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.filter-radio:hover {
    background: var(--bg);
}

.filter-radio input[type="radio"] {
    accent-color: var(--primary);
}

/* Search bar */
.sb-search-bar {
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.sb-search-wrap {
    position: relative;
    flex: 1;
}

.sb-search-active-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    transition: all 0.15s;
    user-select: none;
}

.sb-search-active-toggle:hover {
    border-color: var(--primary);
}

.sb-search-active-toggle input[type="checkbox"] {
    accent-color: var(--primary);
    cursor: pointer;
}

.sb-search-wrap input {
    font-size: 14px;
    padding: 10px 38px;
}

.sb-search-clear {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
}

.sb-search-clear:hover {
    color: var(--danger);
}

/* Students list */
.sb-students-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.sb-student-row {
    display: grid;
    grid-template-columns: 140px 1fr 100px 24px;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}

.sb-student-row:last-child {
    border-bottom: none;
}

.sb-student-row:hover {
    background: var(--primary-light);
}

.sb-student-id {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted);
}

.sb-student-name {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.sb-student-status {
    text-align: left;
}

.sb-student-arrow {
    color: var(--text-light);
    font-size: 12px;
}

.sb-student-row:hover .sb-student-arrow {
    color: var(--primary);
}

.sb-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}

.sb-empty i {
    font-size: 36px;
    margin-bottom: 12px;
    display: block;
}

.badge-muted {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge-info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid var(--primary);
}

/* Profile */
.sb-profile {
    /* nothing special at root */
}

.sb-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.sb-profile-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sb-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.sb-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    transition: all 0.15s;
}

.sb-tile:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.sb-tile-wide {
    grid-column: span 2;
}

@media (max-width: 700px) {
    .sb-tile-wide {
        grid-column: span 1;
    }
}

.sb-tile-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sb-tile-header i {
    color: var(--primary);
}

.sb-tile-big-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.sb-tile-mid-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.tile-value-danger {
    color: var(--danger);
}

.tile-value-success {
    color: var(--success);
}

.sb-tile-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.sb-tile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 12px;
}

.sb-stat {
    text-align: center;
}

.sb-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.sb-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.sb-stat-highlight {
    color: var(--primary-dark);
}

/* =========================================== Tables Screen =========================================== */
.tables-screen {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 16px;
    min-height: 70vh;
}

.tables-sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 10px;
    height: fit-content;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.tables-sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    padding: 4px 8px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tables-sidebar-title i {
    color: var(--primary);
}

.tables-group {
    margin-bottom: 14px;
}

.tables-group-title {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 600;
    padding: 4px 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tables-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.tables-item:hover {
    background: var(--bg);
}

.tables-item.active {
    background: var(--primary-light);
}

.tables-item.active .tables-item-label {
    color: var(--primary-dark);
    font-weight: 600;
}

.tables-item > i {
    font-size: 14px;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
}

.tables-item.active > i {
    color: var(--primary-dark);
}

.tables-item-body {
    flex: 1;
    min-width: 0;
}

.tables-item-label {
    font-size: 13px;
    color: var(--text);
}

.tables-item-count {
    font-size: 10px;
    color: var(--text-light);
    margin-top: 1px;
}

.tables-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    overflow: hidden;
}

.tables-header {
    margin-bottom: 14px;
}

.tables-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.tables-title-row h2 {
    font-size: 18px;
    color: var(--text);
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tables-title-row h2 i {
    color: var(--primary);
}

.tables-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.tables-actions {
    display: flex;
    gap: 8px;
}

.tables-search-bar {
    margin-bottom: 12px;
}

.tables-column-picker {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
}

.tables-column-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
}

.tables-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.tables-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.tables-data-table th {
    background: var(--bg);
    padding: 8px 10px;
    text-align: right;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.tbl-sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.tbl-sortable:hover {
    background: var(--primary-light);
}

.sort-icon {
    margin-right: 4px;
    color: var(--primary);
    font-size: 10px;
}

.sort-icon-faded {
    margin-right: 4px;
    color: var(--text-light);
    font-size: 9px;
    opacity: 0.5;
}

.tables-data-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tables-data-table tr:hover td {
    background: var(--bg);
}

.tbl-null {
    color: var(--text-light);
    font-style: italic;
}

.tables-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 4px;
    gap: 12px;
}

.btn-pagination {
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    transition: all 0.15s;
}

.btn-pagination:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary);
}

.btn-pagination:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tables-pagination-info {
    font-size: 12px;
    color: var(--text-muted);
}

.tables-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}

.tables-empty i {
    font-size: 36px;
    margin-bottom: 12px;
    color: var(--text-light);
}

@media (max-width: 900px) {
    .tables-screen {
        grid-template-columns: 1fr;
    }
    .tables-sidebar {
        position: static;
        max-height: none;
    }
}

/* =========================================== Financial YTD Report =========================================== */
.ytd-controls {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 18px;
}

.ytd-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ytd-control label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.ytd-control select {
    min-width: 140px;
}

.ytd-report-header {
    background: linear-gradient(135deg, #5B6EC6 0%, #4A5AAF 100%);
    color: white;
    padding: 18px 24px;
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ytd-report-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ytd-report-period {
    font-size: 15px;
    opacity: 0.95;
}

.ytd-report-branch {
    font-size: 15px;
    font-weight: 600;
    opacity: 0.95;
}

.ytd-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    overflow-x: auto;
}

.ytd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    direction: ltr;
    text-align: left;
}

.ytd-table thead th {
    padding: 10px 12px;
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ytd-table thead .ytd-section-headers th {
    padding: 8px 12px;
    text-transform: none;
    font-size: 13px;
}

.ytd-section-mtd {
    text-align: center;
    background: rgba(91, 110, 198, 0.08) !important;
    color: var(--primary-dark) !important;
    border-right: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.ytd-section-ytd {
    text-align: center;
    background: rgba(91, 110, 198, 0.15) !important;
    color: var(--primary-dark) !important;
}

.ytd-table tbody td {
    padding: 7px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.ytd-table tbody td:nth-child(3),
.ytd-table tbody td:nth-child(4),
.ytd-table tbody td:nth-child(5),
.ytd-table tbody td:nth-child(6),
.ytd-table tbody td:nth-child(7),
.ytd-table tbody td:nth-child(8) {
    text-align: right;
    font-variant-numeric: tabular-nums;
    direction: rtl;
}

.ytd-table tbody td:nth-child(1) {
    font-weight: 600;
    color: var(--text);
    min-width: 120px;
}

.ytd-table tbody td:nth-child(2) {
    color: var(--text);
    min-width: 200px;
}

.ytd-cat-row td {
    background: var(--bg);
    font-weight: 700;
    color: var(--primary-dark);
    border-bottom: 2px solid var(--border) !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
}

.ytd-subtotal-row td {
    background: #fafafa;
    font-weight: 600;
    border-top: 1px dashed var(--border);
    border-bottom: 1px dashed var(--border) !important;
}

.ytd-total-row td {
    background: var(--bg);
    font-weight: 700;
    color: var(--text);
}

.ytd-grand-total-row td {
    background: linear-gradient(90deg, rgba(91, 110, 198, 0.15) 0%, rgba(91, 110, 198, 0.08) 100%);
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 14px;
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary) !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

.ytd-spacer td {
    height: 12px;
    background: transparent;
    border: none;
}

.ytd-empty {
    color: var(--text-light);
    font-style: italic;
    text-align: center;
}

/* =========================================== Sales Chart =========================================== */
.sales-chart-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 18px;
}

.sales-chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sales-chart {
    width: 100%;
    height: auto;
    display: block;
}

.filter-date-range {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-date-range label {
    font-size: 11px;
    color: var(--text-muted);
}

.filter-date-range input[type="date"] {
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
}

/* =========================================== Reps Table =========================================== */
.reps-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 18px;
    overflow-x: auto;
}

.reps-table-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reps-table-title i {
    color: #f59e0b;
}

.reps-pct-bar {
    position: relative;
    background: var(--bg);
    border-radius: 4px;
    height: 18px;
    min-width: 80px;
    overflow: hidden;
}

.reps-pct-fill {
    height: 100%;
    background: linear-gradient(90deg, #5B6EC6 0%, #4A5AAF 100%);
    border-radius: 4px;
    transition: width 0.3s;
}

.reps-pct-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    text-shadow: 0 0 2px rgba(255,255,255,0.7);
}

/* =========================================== Aging Chart =========================================== */
.aging-chart-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 8px;
}

.aging-chart {
    width: 100%;
    height: auto;
    display: block;
}

.cell-danger {
    color: var(--danger);
}

.cell-success {
    color: var(--success);
}

/* =========================================== Toast =========================================== */
.toast-container {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px 18px;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    border-right: 4px solid var(--primary);
    animation: slideIn 0.25s ease;
    min-width: 240px;
}

.toast.success { border-right-color: var(--success); }
.toast.error { border-right-color: var(--danger); }
.toast.warning { border-right-color: var(--warning); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* =========================================== Responsive =========================================== */
@media (max-width: 700px) {
    .header-container { padding: 0 16px; }
    .header-title h1 { font-size: 20px; }
    .chip { display: none; }
    .app-root { padding: 18px 14px; }
    .module-screen { padding: 18px; }
    .file-slots { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-wrap { min-width: 0; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }
}

/* =========================================================================
   LOGIN SCREEN
   ========================================================================= */
.login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #5B6EC6 0%, #4A5AAF 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header h1 {
    font-size: 28px;
    color: #4A5AAF;
    margin-bottom: 8px;
    font-weight: 700;
}

.login-header p {
    color: #888;
    font-size: 14px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-field { display: flex; flex-direction: column; gap: 6px; }

.login-field label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.login-field input,
.login-field select {
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    background: white;
    transition: border-color 0.15s;
}

.login-field input:focus,
.login-field select:focus {
    outline: none;
    border-color: #5B6EC6;
    box-shadow: 0 0 0 3px rgba(91,110,198,0.15);
}

.login-field input:disabled {
    background: #f3f4f6;
    color: #9ca3af;
}

.login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    border-right: 3px solid #ef4444;
}

.login-success {
    background: #dcfce7;
    color: #166534;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    border-right: 3px solid #10b981;
}

.login-notice {
    background: #dbeafe;
    color: #1e40af;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    border-right: 3px solid #3b82f6;
    margin-bottom: 16px;
}

.btn-block { width: 100%; justify-content: center; }
.btn-large { padding: 12px 20px; font-size: 15px; }

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.login-footer a {
    color: #5B6EC6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.login-footer a:hover { text-decoration: underline; }

/* =========================================================================
   USER HEADER
   ========================================================================= */
.header-user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    margin-left: 8px;
}

.header-user-name { white-space: nowrap; }

.header-logout {
    color: rgba(255,255,255,0.85) !important;
}

.header-logout:hover {
    background: rgba(239,68,68,0.3) !important;
    color: white !important;
}

/* =========================================================================
   MODALS (Generic)
   ========================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-card {
    background: white;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-card h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #4A5AAF;
}


/* =========================================================================
   TEACHER HOURS - דיווח שעות
   ========================================================================= */
.th-table th, .th-table td {
    padding: 6px 8px;
    font-size: 0.85rem;
}

.th-table input.th-input {
    box-sizing: border-box;
    font-size: 0.82rem;
}

.th-table .th-input.th-date {
    min-width: 100px;
}

.th-table td {
    vertical-align: middle;
}


/* =========================================================================
   AI ASSISTANT MODULE
   ========================================================================= */
.ai-chat-area {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.ai-chat-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.ai-chat-header h2 {
    margin: 0 0 0.25rem 0;
}

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

.ai-welcome {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.ai-welcome h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
}

.ai-suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
}

@media (max-width: 700px) {
    .ai-suggestions { grid-template-columns: 1fr; }
}

.ai-suggestion-btn {
    padding: 0.75rem 1rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    text-align: right;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
    color: var(--text-primary);
}

.ai-suggestion-btn:hover {
    border-color: var(--primary);
    background: #f0f7ff;
    transform: translateY(-1px);
}

.ai-message {
    display: flex;
    gap: 0.75rem;
    max-width: 90%;
    align-items: flex-start;
}

.ai-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-message-assistant {
    align-self: flex-start;
}

.ai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.ai-message-user .ai-message-avatar {
    background: var(--primary);
    color: white;
}

.ai-message-assistant .ai-message-avatar {
    background: #f3e8ff;
    color: #7c3aed;
}

.ai-message-content {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-message-user .ai-message-content {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.ai-message-user .ai-message-content code,
.ai-message-user .ai-message-content pre {
    background: rgba(255,255,255,0.2) !important;
    color: white !important;
}

.ai-message-text {
    word-wrap: break-word;
}

.ai-input-area {
    padding: 1rem 0 0 0;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.ai-input-area textarea {
    box-sizing: border-box;
}

.ai-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 110, 198, 0.15);
}

.ai-sidebar {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.ai-recent-chat {
    padding: 0.5rem 0.75rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-recent-chat:hover {
    border-color: var(--primary);
    background: #f0f7ff;
}

.ai-recent-chat.active {
    border-color: var(--primary);
    background: #e0e7ff;
}

.ai-chat-title {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-chat-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}


/* =========================================================================
   MODULES LIST - תצוגה רשימתית (במקום קלפים)
   ========================================================================= */
.modules-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    max-width: 900px;
    margin: 0 auto;
}

.module-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.12s;
}

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

.module-row:hover {
    background: #f8fafc;
}

.module-row.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.module-row.disabled:hover {
    background: transparent;
}

.module-row-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.module-row-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.module-row-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.module-row-desc {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.module-row-arrow {
    color: #cbd5e1;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.module-row:hover .module-row-arrow {
    color: var(--primary);
}

.module-row-tag {
    background: #f59e0b;
    color: white;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}


/* =========================================================================
   DASHBOARD CATEGORIES - כרטיסיות מתקפלות (accordion)
   ========================================================================= */
.dashboard-categories {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 900px;
    margin: 0 auto;
}

.dashboard-category {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.dashboard-category.is-open {
    box-shadow: 0 2px 8px rgba(91, 110, 198, 0.08);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: linear-gradient(90deg, #f5f7ff 0%, #eef0ff 100%);
    border: none;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
    text-align: right;
}

.category-header:hover {
    background: linear-gradient(90deg, #eef0ff 0%, #e0e3ff 100%);
}

.dashboard-category.is-open .category-header {
    border-bottom: 1px solid #e0e3f0;
}

.category-header .category-icon {
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.category-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    flex: 1;
    text-align: right;
}

.category-count {
    background: white;
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #d1d8f5;
}

.category-chevron {
    color: var(--primary);
    font-size: 0.85rem;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.dashboard-category.is-open .category-chevron {
    transform: rotate(180deg);
}

.category-modules {
    display: flex;
    flex-direction: column;
}

.category-modules .module-row {
    border-bottom: 1px solid #f0f0f0;
}

.category-modules .module-row:last-child {
    border-bottom: none;
}

/* =========================================================================
   AI BUTTON - בולט במיוחד בכותרת
   ========================================================================= */
.header-ai-btn {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

.header-ai-btn:hover {
    background: linear-gradient(135deg, #9333ea 0%, #6d28d9 100%) !important;
    transform: translateY(-1px);
}


/* =========================================================================
   AI - typing indicator + delete button
   ========================================================================= */
.ai-typing .ai-message-content {
    background: white !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.ai-typing-indicator {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 4px;
}

.ai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: ai-typing-bounce 1.4s infinite ease-in-out;
}

.ai-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

.ai-typing-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

@keyframes ai-typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* כפתור מחיקת שיחה */
.ai-recent-chat {
    display: flex !important;
    align-items: stretch;
    padding: 0 !important;
    overflow: hidden;
}

.ai-recent-chat-main {
    flex: 1;
    padding: 0.5rem 0.75rem;
    min-width: 0;
    cursor: pointer;
}

.ai-chat-delete-btn {
    background: transparent;
    border: none;
    border-right: 1px solid var(--border-color);
    color: #cbd5e1;
    cursor: pointer;
    padding: 0 0.75rem;
    transition: all 0.15s;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.ai-chat-delete-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}


/* =========================================================================
   CUST_NOTES - הערות תלמיד
   ========================================================================= */
.cust-notes-card {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 14px 0;
}

.cust-notes-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #92400e;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.cust-notes-header i {
    color: #d97706;
}

.cust-notes-body {
    color: #1f2937;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* אייקון אינדיקציה בשורות טבלה */
.cust-notes-indicator {
    color: #d97706;
    font-size: 0.85rem;
    margin-right: 6px;
    cursor: help;
}

.cust-notes-indicator:hover {
    color: #b45309;
}


/* =========================================================================
   Merge Employees Module
   ========================================================================= */
.filter-tab {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.filter-tab:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.filter-tab.active {
    background: #5B6EC6;
    color: white;
    border-color: #5B6EC6;
}
.badge-count {
    background: rgba(0,0,0,0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}
.filter-tab.active .badge-count {
    background: rgba(255,255,255,0.25);
}

.merge-pairs-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.merge-pair {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s;
}
.merge-pair.decided[data-decision="merged"] {
    border-color: #10b981;
    background: #f0fdf4;
}
.merge-pair.decided[data-decision="different"] {
    border-color: #d1d5db;
    opacity: 0.7;
}
.merge-pair.decided[data-decision="maybe"] {
    border-color: #f59e0b;
    background: #fffbeb;
}

.merge-pair-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    margin-bottom: 12px;
}

.emp-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
}
.emp-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 1.05rem;
    margin-bottom: 8px;
}
.emp-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: #6b7280;
}
.emp-details code {
    background: #e5e7eb;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: monospace;
    color: #1f2937;
}
.emp-details i {
    margin-left: 6px;
    width: 14px;
    color: #9ca3af;
}

.merge-vs {
    text-align: center;
    color: #9ca3af;
    padding: 0 16px;
}
.merge-vs i {
    font-size: 1.5rem;
}

.merge-pair-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}
.btn-merge-yes,
.btn-merge-no,
.btn-merge-maybe {
    padding: 8px 16px;
    border: 1px solid;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.15s;
}
.btn-merge-yes {
    background: white;
    color: #047857;
    border-color: #d1fae5;
}
.btn-merge-yes:hover {
    background: #d1fae5;
}
.btn-merge-no {
    background: white;
    color: #6b7280;
    border-color: #e5e7eb;
}
.btn-merge-no:hover {
    background: #f3f4f6;
}
.btn-merge-maybe {
    background: white;
    color: #b45309;
    border-color: #fed7aa;
}
.btn-merge-maybe:hover {
    background: #fed7aa;
}

.current-decision {
    color: #6b7280;
    font-size: 0.9rem;
}
.btn-link {
    background: none;
    border: none;
    color: #5B6EC6;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
    padding: 0;
    margin-right: 8px;
}
.btn-link:hover {
    color: #4A5AAF;
}


/* =========================================================================
   Merge Groups (UI חדש לקבוצות של נציגים דומים)
   ========================================================================= */
.tokens-editor-section {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
.tokens-list-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.token-chip {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 0.85rem;
    color: #4b5563;
    font-family: monospace;
}

.merge-groups-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.merge-group {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s;
}
.merge-group[data-decision="merged"] {
    border-color: #10b981;
    background: #f0fdf4;
}
.merge-group[data-decision="different"] {
    border-color: #d1d5db;
    opacity: 0.65;
}
.merge-group[data-decision="maybe"] {
    border-color: #f59e0b;
    background: #fffbeb;
}

.merge-group-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
    gap: 12px;
    flex-wrap: wrap;
}
.merge-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1f2937;
    font-weight: 600;
    flex-wrap: wrap;
}
.merge-group-title i {
    color: #5B6EC6;
}
.merge-group-tokens {
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: normal;
    margin-right: 12px;
}
.merge-group-tokens code {
    background: #ede9fe;
    color: #5B6EC6;
    padding: 1px 6px;
    border-radius: 3px;
    margin: 0 2px;
    font-family: monospace;
}
.merge-group-status {
    font-size: 0.9rem;
    color: #047857;
    font-weight: 600;
}

.merge-group-emps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.emp-group-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.emp-group-card:hover {
    background: #f3f4f6;
}
.emp-group-card input[type="checkbox"] {
    margin-top: 3px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.emp-group-card input[type="checkbox"]:disabled {
    cursor: default;
}
.emp-group-content {
    flex: 1;
}
.emp-group-content .emp-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
}
.emp-group-content .emp-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.82rem;
    color: #6b7280;
}
.emp-group-content .emp-details code {
    background: #e5e7eb;
    color: #1f2937;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85em;
}
.emp-group-content .emp-details i {
    margin-left: 5px;
    width: 12px;
    color: #9ca3af;
}

.merge-group-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
    flex-wrap: wrap;
}

/* =========================================================================
   Cross-merge dialog (מיזוג בין קבוצות)
   ========================================================================= */
.btn-merge-cross {
    background: white;
    color: #5B6EC6;
    border: 1px solid #c7d2fe;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-merge-cross:hover {
    background: #ede9fe;
}

.merge-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.merge-modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.merge-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.merge-modal-header h3 {
    margin: 0;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}
.merge-modal-header h3 i {
    color: #5B6EC6;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: #6b7280;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    line-height: 1;
    padding: 0;
}
.modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}
.merge-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.merge-modal-source {
    background: #ede9fe;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    padding: 12px 16px;
}

.cross-merge-search {
    margin-bottom: 12px;
}

.cross-merge-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 50vh;
    overflow-y: auto;
    padding-left: 4px;
}

.cross-merge-option {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.15s;
}
.cross-merge-option:hover {
    background: white;
    border-color: #5B6EC6;
}
.cross-merge-option-info {
    flex: 1;
}
.cross-merge-option-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}
.cross-merge-option-details {
    font-size: 0.85rem;
    color: #6b7280;
}
.cross-merge-option-tokens {
    margin: 6px 0;
}
.cross-merge-option-tokens code {
    background: #ede9fe;
    color: #5B6EC6;
    padding: 1px 6px;
    border-radius: 3px;
    margin: 0 2px;
    font-family: monospace;
}
.cross-merge-option-emps {
    margin-top: 6px;
    color: #4b5563;
    font-size: 0.8rem;
    padding: 6px 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #f3f4f6;
}

.merge-group-manual-badge {
    background: #ede9fe;
    color: #5B6EC6;
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}
.merge-group-manual-badge i {
    color: inherit;
}

.cross-merge-section-title {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 4px 0;
    margin-top: 8px;
}
.cross-merge-section-title:first-child {
    margin-top: 0;
}

/* רווח בין אייקון לשם נציג בטבלת ranking */
.reps-table td:first-child i {
    margin-left: 8px !important;
}

/* =========================================================================
   Standalone Employees Section (במסך איחוד הנציגים)
   ========================================================================= */
.standalone-emps-section {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 2px dashed #e5e7eb;
}

.standalone-emps-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.standalone-emps-header i {
    color: #5B6EC6;
    font-size: 1.2rem;
}
.standalone-emps-header h3 {
    margin: 0;
    color: #1f2937;
    font-size: 1.05rem;
}
.standalone-emps-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-right: auto;
}

.standalone-emps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.standalone-emp-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}
.standalone-emp-card:hover {
    border-color: #5B6EC6;
    box-shadow: 0 2px 8px rgba(91, 110, 198, 0.1);
}
.standalone-emp-info .emp-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 6px;
}
.standalone-emp-info .emp-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.82rem;
    color: #6b7280;
}
.standalone-emp-info .emp-details code {
    background: #e5e7eb;
    color: #1f2937;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85em;
}
.standalone-emp-info .emp-details i {
    margin-left: 5px;
    width: 12px;
    color: #9ca3af;
}
.btn-merge-cross.btn-mini {
    padding: 6px 12px;
    font-size: 0.85rem;
    width: 100%;
    justify-content: center;
}

/* מספר קבוצה גדול בכותרת */
.merge-group-number {
    background: #5B6EC6;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    padding: 4px 10px;
    border-radius: 6px;
    margin-left: 4px;
    min-width: 36px;
    text-align: center;
    display: inline-block;
    font-family: monospace;
}

/* שדה הצטרפות לקבוצה בנציג בודד */
.standalone-emp-join {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.join-group-input:focus {
    outline: none;
    border-color: #5B6EC6 !important;
    box-shadow: 0 0 0 2px rgba(91, 110, 198, 0.15);
}

/* מקרא קבוצות */
.groups-legend {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
}
.groups-legend summary {
    cursor: pointer;
    font-weight: 600;
    color: #1f2937;
    user-select: none;
}
.groups-legend summary:hover {
    color: #5B6EC6;
}
.groups-legend-list {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 6px;
}
.groups-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: white;
    border-radius: 4px;
    font-size: 0.9rem;
    border: 1px solid #f3f4f6;
}
.merge-group-number-small {
    background: #5B6EC6;
    color: white;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 28px;
    text-align: center;
    font-family: monospace;
}

/* שורה לחיצה במודול שיעורים מתוכננים */
.sl-clickable { transition: background-color 0.15s; }
.sl-clickable:hover { background-color: #f0f9ff !important; }
.sl-clickable:hover td:first-child strong { color: var(--primary); }

/* ===== מודול גיול: הקפאת עמודות שם+מספר בגלילה אופקית (דסקטופ בלבד) ===== */
@media (min-width: 601px) {
    .data-table.dbt-aging th.dbt-frz,
    .data-table.dbt-aging td.dbt-frz {
        position: sticky;
        right: 0;
        z-index: 2;
        width: 170px;
        min-width: 170px;
        max-width: 170px;
    }
    .data-table.dbt-aging th.dbt-frz2,
    .data-table.dbt-aging td.dbt-frz2 {
        position: sticky;
        right: 170px;
        z-index: 2;
        width: 110px;
        min-width: 110px;
        max-width: 110px;
    }
    /* רקעים אטומים כדי שתאים גלולים לא יזלגו מאחורי העמודות הקפואות */
    .data-table.dbt-aging tbody td.dbt-frz,
    .data-table.dbt-aging tbody td.dbt-frz2 {
        background: var(--surface);
    }
    .data-table.dbt-aging tbody tr:hover td.dbt-frz,
    .data-table.dbt-aging tbody tr:hover td.dbt-frz2 {
        background: var(--primary-light);
    }
    .data-table.dbt-aging thead th.dbt-frz,
    .data-table.dbt-aging thead th.dbt-frz2 {
        top: 0;
        z-index: 4; /* פינת כותרת קפואה - מעל הכל */
        background: var(--bg);
    }
    /* קו הפרדה עדין בקצה ההקפאה */
    .data-table.dbt-aging .dbt-frz2 {
        box-shadow: -1px 0 0 var(--border);
    }
}

/* ===== מודול ניהול מורים: הקפאת 4 עמודות הזיהוי בגלילה אופקית (דסקטופ בלבד) ===== */
@media (min-width: 601px) {
    .data-table.tm-freeze th.tm-frz,
    .data-table.tm-freeze td.tm-frz {
        position: sticky; right: 0; z-index: 2;
        width: 85px; min-width: 85px; max-width: 85px;
    }
    .data-table.tm-freeze th.tm-frz2,
    .data-table.tm-freeze td.tm-frz2 {
        position: sticky; right: 85px; z-index: 2;
        width: 90px; min-width: 90px; max-width: 90px;
    }
    .data-table.tm-freeze th.tm-frz3,
    .data-table.tm-freeze td.tm-frz3 {
        position: sticky; right: 175px; z-index: 2;
        width: 110px; min-width: 110px; max-width: 110px;
    }
    .data-table.tm-freeze th.tm-frz4,
    .data-table.tm-freeze td.tm-frz4 {
        position: sticky; right: 285px; z-index: 2;
        width: 130px; min-width: 130px; max-width: 130px;
    }
    /* רקעים אטומים כדי שתאים גלולים לא יזלגו מאחורי העמודות הקפואות */
    .data-table.tm-freeze tbody td.tm-frz,
    .data-table.tm-freeze tbody td.tm-frz2,
    .data-table.tm-freeze tbody td.tm-frz3,
    .data-table.tm-freeze tbody td.tm-frz4 {
        background: var(--surface);
    }
    .data-table.tm-freeze tbody tr:hover td.tm-frz,
    .data-table.tm-freeze tbody tr:hover td.tm-frz2,
    .data-table.tm-freeze tbody tr:hover td.tm-frz3,
    .data-table.tm-freeze tbody tr:hover td.tm-frz4 {
        background: var(--primary-light);
    }
    .data-table.tm-freeze thead th.tm-frz,
    .data-table.tm-freeze thead th.tm-frz2,
    .data-table.tm-freeze thead th.tm-frz3,
    .data-table.tm-freeze thead th.tm-frz4 {
        top: 0; z-index: 4; /* פינת כותרת קפואה - מעל הכל */
        background: var(--bg);
    }
    /* קו הפרדה עדין בקצה ההקפאה (העמודה החיצונית ביותר) */
    .data-table.tm-freeze .tm-frz4 {
        box-shadow: -1px 0 0 var(--border);
    }
}

/* =========================================================================
   טיפול כולל בתצוגת סמארטפון / טאבלט (Mobile responsiveness overhaul)
   נמצא בסוף הקובץ בכוונה כדי לגבור על בלוקים מוקדמים יותר באותה ספציפיות.
   ========================================================================= */
@media (max-width: 768px) {
    /* ---------- Shell: header / תוכן ---------- */
    .header { padding: 12px 0; }
    .header-container { padding: 0 14px; gap: 10px; }
    .header-title { gap: 8px; min-width: 0; }
    .header-title h1 { font-size: 18px; letter-spacing: 0; white-space: nowrap; }
    .header-version { font-size: 10px; padding: 2px 6px; margin-right: 6px; }
    #header-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
    .app-root { padding: 14px 12px; }
    .module-screen { padding: 16px 14px; }
    .module-header { margin-bottom: 16px; padding-bottom: 14px; }
    .module-header h2 { font-size: 19px; }

    /* ---------- כותרת מודול עם כפתורי פעולה ---------- */
    .module-header-with-actions { gap: 12px; }
    .module-header-actions { width: 100%; }
    .module-header-actions .btn { flex: 1; justify-content: center; }

    /* ---------- כרטיסי סטטיסטיקה: 2 בשורה ---------- */
    .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 19px; }

    /* ---------- מסכים עם סרגל-צד: ערימה אנכית ---------- */
    .module-screen-with-sidebar { grid-template-columns: 1fr; gap: 14px; }
    .filter-sidebar { position: static; top: auto; }
    .tables-screen { grid-template-columns: 1fr; }
    .tables-sidebar { position: static; max-height: none; }

    /* ---------- שורת פילטרים / חיפוש ---------- */
    .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; }
    .search-wrap { min-width: 0; width: 100%; }
    .select, .filter-control { width: 100%; }

    /* ---------- טבלאות: גלילה אופקית נוחה + צפיפות ---------- */
    .table-wrap { max-height: none; -webkit-overflow-scrolling: touch; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }

    /* ---------- מודאלים (כולל אינליין): רוחב מלא במקום min-width קבוע ---------- */
    .modal-overlay { padding: 12px; }
    .modal-overlay > div,
    .modal-card {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        overflow-y: auto;
    }

    /* ---------- dashboard / כניסה ---------- */
    .modules-grid { grid-template-columns: 1fr; gap: 14px; }
    .dashboard-intro h2 { font-size: 22px; }
    .dashboard-intro p { font-size: 14px; }

    /* ---------- יעד מגע נוח לכפתורים ---------- */
    .btn { min-height: 40px; }
}

@media (max-width: 460px) {
    /* טלפון צר: כרטיס בודד בשורה, פחות "רעש" בכותרת */
    .stat-cards { grid-template-columns: 1fr; }
    .header-data-date { display: none; }
    .module-screen { padding: 14px 12px; }
    .app-root { padding: 12px 10px; }
    .stat-value { font-size: 20px; }
}

/* =========================================================================
   תיקוני גלישה אופקית בטלפון (overflow fixes) - מודול תלמידים + מגן גלובלי
   ========================================================================= */
/* מגן: שום אלמנט בודד לא יגרום לכל העמוד לגלוש לרוחב (הטבלאות גוללות פנימית) */
html, body { overflow-x: clip; max-width: 100%; }

@media (max-width: 768px) {
    /* סרגל החיפוש של התלמידים: שבירה לשורות במקום גלישה */
    .sb-search-bar { flex-wrap: wrap; gap: 8px; }
    .sb-search-wrap { flex-basis: 100%; order: -1; }
    .sb-search-active-toggle { flex: 1 1 auto; justify-content: center; }

    /* שורת תלמיד: עמודות קבועות גדולות מדי לטלפון → פריסה קומפקטית */
    .sb-student-row {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "name status"
            "id   status";
        gap: 2px 10px;
        padding: 10px 14px;
    }
    .sb-student-name   { grid-area: name; }
    .sb-student-id     { grid-area: id; }
    .sb-student-status { grid-area: status; align-self: center; justify-self: end; }
    .sb-student-arrow  { display: none; }
}

/* מודול תלמידים בסמארטפון: סינונים מתחת לאזור החיפוש+ייצוא (במקום מעליו) */
@media (max-width: 768px) {
    .sb-browser-screen .results-area { order: 1; }
    .sb-browser-screen .filter-sidebar { order: 2; }
}

/* מודול ניהול מורים (teacherManagement) */
.loading-state { padding: 40px; text-align: center; color: var(--text-secondary); }
.module-subtitle { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; }
.btn-sm { padding: 5px 9px; font-size: 13px; min-height: 0; }
.tm-flabel { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--text); }
