body { font-family: 'Inter', 'Cairo', system-ui, sans-serif; }
.ar { font-family: 'Cairo', 'Inter', sans-serif; direction: rtl; unicode-bidi: plaintext; }
.bidi { unicode-bidi: plaintext; }
.sidebar-link { display:flex; align-items:center; gap:.75rem; padding:.5rem .75rem; border-radius:.5rem; color:#cbd5e1; font-size:.875rem; transition:.15s; }
.sidebar-link:hover { background:#334155; color:#fff; }
.sidebar-link.active { background: #1d4ed8; color: #fff; }
.sidebar-link { min-height:40px; line-height:1.5; margin-block:2px; }
.sidebar-link span { min-width:0; }
.sidebar-section { border-top:1px solid #273449; margin-top:8px; padding-top:4px; }
.sidebar-section summary { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:9px 12px; color:#94a3b8; font-size:.75rem; font-weight:700; cursor:pointer; list-style:none; border-radius:6px; }
.sidebar-section summary::-webkit-details-marker { display:none; }
.sidebar-section summary:hover { background:#1e293b; color:#e2e8f0; }
.sidebar-section.has-active summary { color:#93c5fd; }
.sidebar-chevron { font-size:.65rem; transition:transform .15s; }
.sidebar-section[open] > summary .sidebar-chevron { transform:rotate(180deg); }
.sidebar-section-links { padding-bottom:4px; }
.sidebar-link:focus-visible,.sidebar-section summary:focus-visible { outline:2px solid #93c5fd; outline-offset:-2px; }
.card { background: #fff; border-radius: .75rem; border: 1px solid #e2e8f0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border-radius: .5rem; font-size: .875rem; font-weight: 500; transition: .15s; white-space: nowrap; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: #1550c4; color: #fff; } .btn-primary:hover { background: #0f3f9e; }
.btn-secondary { background: #fff; color: #334155; border-color: #cbd5e1; } .btn-secondary:hover { background: #f1f5f9; }
.btn-danger { background: #fee2e2; color: #b91c1c; } .btn-danger:hover { background: #fecaca; }
.btn-success { background: #16a34a; color: #fff; } .btn-success:hover { background: #15803d; }
.btn-wa { background: #25d366; color: #fff; } .btn-wa:hover { background: #1ebe5b; }
.btn-sm { padding: .25rem .6rem; font-size: .78rem; }
.btn-xs { padding: .15rem .45rem; font-size: .72rem; border-radius: .375rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input, .select, .textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: .5rem; padding: .45rem .7rem; font-size: .875rem; background: #fff; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.label { display: block; font-size: .75rem; font-weight: 600; color: #64748b; margin-bottom: .25rem; text-transform: uppercase; letter-spacing: .02em; }
.badge { display: inline-flex; align-items: center; padding: .15rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.badge-slate { background: #f1f5f9; color: #475569; } .badge-green { background: #dcfce7; color: #15803d; } .badge-red { background: #fee2e2; color: #b91c1c; }
.badge-amber { background: #fef3c7; color: #b45309; } .badge-orange { background: #ffedd5; color: #c2410c; } .badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-violet { background: #ede9fe; color: #6d28d9; } .badge-teal { background: #ccfbf1; color: #0f766e; } .badge-pink { background: #fce7f3; color: #be185d; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .85rem; }
table.data th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: #64748b; padding: .6rem .75rem; background: #f8fafc; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; white-space: nowrap; cursor: pointer; user-select: none; }
table.data td { padding: .55rem .75rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.data tr:hover td { background: #f8fafc; }
table.data tr.clickable { cursor: pointer; }
.kpi { background:#fff; border-radius:.75rem; border:1px solid #e2e8f0; box-shadow:0 1px 2px rgba(0,0,0,.04); padding:1rem; display:flex; align-items:flex-start; justify-content:space-between; }
.kpi .v { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kpi .l { font-size: .75rem; color: #64748b; font-weight: 500; margin-top: .2rem; }
.kpi .ic { width: 2.5rem; height: 2.5rem; border-radius: .75rem; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; }
.modal { background: #fff; border-radius: 1rem; width: 100%; max-width: 640px; box-shadow: 0 25px 50px rgba(0,0,0,.25); animation: pop .15s ease-out; }
.modal.wide { max-width: 960px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }
.toast { padding: .7rem 1rem; border-radius: .6rem; color: #fff; font-size: .85rem; box-shadow: 0 8px 20px rgba(0,0,0,.15); animation: pop .2s; max-width: 380px; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid #e2e8f0; margin-bottom: 1rem; overflow-x: auto; }
.tab { padding: .5rem .9rem; font-size: .85rem; font-weight: 500; color: #64748b; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.active { color: #1d4ed8; border-color: #1d4ed8; }
.timeline-item { position: relative; padding-left: 1.5rem; padding-bottom: .9rem; border-left: 2px solid #e2e8f0; margin-left: .4rem; }
.timeline-item::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #2563eb; border: 2px solid #fff; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.kcol { background: #f1f5f9; border-radius: .75rem; padding: .6rem; max-height: 72vh; display: flex; flex-direction: column; }
.kcard { background: #fff; border-radius: .5rem; padding: .55rem .7rem; margin-bottom: .5rem; border: 1px solid #e2e8f0; cursor: pointer; font-size: .8rem; }
.kcard:hover { border-color: #93c5fd; }
.spinner { width: 2rem; height: 2rem; border: 3px solid #e2e8f0; border-top-color: #2563eb; border-radius: 50%; animation: spin .7s linear infinite; margin: 3rem auto; }
@keyframes spin { to { transform: rotate(360deg) } }
.att-btn { width: 2rem; height: 2rem; border-radius: .5rem; border: 1px solid #e2e8f0; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; cursor: pointer; background: #fff; color: #94a3b8; }
.att-btn.on-present { background: #16a34a; color: #fff; border-color: #16a34a; }
.att-btn.on-absent { background: #dc2626; color: #fff; border-color: #dc2626; }
.att-btn.on-late { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.att-btn.on-excused { background: #6366f1; color: #fff; border-color: #6366f1; }
@media (max-width: 1023px) { #sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.4); } #sidebar.open { transform: none; } }
.sidebar-link.active { background: #1550c4; }
#layout > div.flex-1 { height: 100vh; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dropdown { position: absolute; right: 0; top: 100%; margin-top: .25rem; background: #fff; border: 1px solid #e2e8f0; border-radius: .6rem; box-shadow: 0 10px 30px rgba(0,0,0,.12); min-width: 200px; z-index: 50; padding: .3rem; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: .45rem .7rem; font-size: .85rem; border-radius: .4rem; color: #334155; }
.dropdown a:hover, .dropdown button:hover { background: #f1f5f9; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; box-shadow: 0 15px 40px rgba(0,0,0,.15); z-index: 70; max-height: 70vh; overflow-y: auto; }
.progress { height: .5rem; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: #2563eb; }

/* Language direction is a per-user preference; data fields retain their values. */
.language-picker { width: auto; min-width: 6.5rem; flex-shrink: 0; }
html[dir="rtl"] body { font-family: 'Cairo', 'Inter', system-ui, sans-serif; }
table.data th, .dropdown a, .dropdown button { text-align: start; }
html[dir="rtl"] .label, html[dir="rtl"] table.data th { letter-spacing: normal; }
html[dir="rtl"] .dropdown { left: 0; right: auto; }
html[dir="rtl"] #gsearch { padding-right: 2.25rem; padding-left: .7rem; }
html[dir="rtl"] #gsearch + .search-results { text-align: right; }
html[dir="rtl"] .text-left { text-align: right; }
html[dir="rtl"] .text-right { text-align: left; }
html[dir="rtl"] .timeline-item { padding-right: 1.5rem; padding-left: 0; border-left: 0; border-right: 2px solid #e2e8f0; margin-right: .4rem; margin-left: 0; }
html[dir="rtl"] .timeline-item::before { right: -7px; left: auto; }
html[dir="rtl"] #toast-root { right: auto; left: 1rem; }
html[dir="rtl"] .fa-chevron-left, html[dir="rtl"] .fa-chevron-right, html[dir="rtl"] .fa-arrow-left, html[dir="rtl"] .fa-arrow-right { transform: scaleX(-1); }
input[type="email"], input[type="url"], input[type="tel"], input[type="number"], input[type="date"], input[type="month"], input[type="time"], input[type="datetime-local"], input[type="password"], a[href^="https://wa.me/"] { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .ml-auto { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .mr-auto { margin-right: 0; margin-left: auto; }
html[dir="rtl"] .left-3 { left: auto; right: .75rem; }
html[dir="rtl"] .pl-9 { padding-left: 0; padding-right: 2.25rem; }
@media (max-width: 1023px) { html[dir="rtl"] #sidebar { right: 0; left: auto; transform: translateX(100%); } html[dir="rtl"] #sidebar.open { transform: none; } }
@media (max-width: 480px) { .language-picker { min-width: 5.7rem; font-size: .75rem; padding: .4rem; } header { gap: .4rem !important; } }

/* Compact groups: keep the name visible in both writing directions. */
.group-table-wrap{overflow-x:auto;isolation:isolate}
.group-table{min-width:760px}
.group-table th,.group-table td{padding:.8rem .65rem;vertical-align:top}
.group-table .group-name-cell{position:sticky;inset-inline-start:0;background:#fff;z-index:2;min-width:170px;max-width:230px;white-space:normal;box-shadow:0 0 0 1px #e2e8f0}
.group-table thead .group-name-cell{background:#f8fafc;z-index:3}
.group-table td{max-width:210px;white-space:normal;overflow-wrap:anywhere}
.daily-row{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.8rem 0;border-bottom:1px solid #f1f5f9}
.daily-row:last-child{border-bottom:0}
.daily-row:hover{background:#f8fafc}
.daily-action:hover{border-color:#2563eb}
@media(max-width:600px){.group-table .group-name-cell{min-width:130px;max-width:150px}.daily-action .v{font-size:1.6rem}}

/* Cohort conversion report: keep identity and totals readable while scrolling. */
.team-kpi { width:100%; font-variant-numeric: tabular-nums; }
.team-kpi th,.team-kpi td { text-align:center; }
.team-kpi th:first-child,.team-kpi td:first-child { position:sticky; inset-inline-start:0; background:#fff; text-align:start; min-width:170px; z-index:1; }
.team-kpi .kpi-trials { background:#fff8cf; font-weight:700; }
.team-kpi .kpi-paid { color:#166534; font-weight:700; }
.team-kpi tfoot td,.team-kpi tfoot th:first-child { background:#dcfce7; font-weight:700; border-top:2px solid #86efac; }

.team-kpi [hidden] { display:none !important; }
table.data.team-kpi th { white-space:normal; min-width:85px; }
.kpi-columns summary { cursor:pointer; font-weight:600; }
