/* ═══════════════════════════════════════════════════════════════
   TASK ENGINE — CSS Light Mode · MMI V3 Charte Client
   Utilise --client-primary (#E0A000) + conventions Bootstrap/MMI
   ═══════════════════════════════════════════════════════════════ */

:root {
    --te-primary: var(--client-primary, #E0A000);
    --te-primary-hover: #c88e00;
    --te-primary-light: rgba(224, 160, 0, 0.1);
    --te-primary-border: rgba(224, 160, 0, 0.3);
    --te-success: #198754;
    --te-success-light: rgba(25, 135, 84, 0.1);
    --te-warning: #fd7e14;
    --te-warning-light: rgba(253, 126, 20, 0.1);
    --te-danger: #dc3545;
    --te-danger-light: rgba(220, 53, 69, 0.1);
    --te-info: #0d6efd;
    --te-info-light: rgba(13, 110, 253, 0.08);
    --te-nc: #d63384;
    --te-nc-light: rgba(214, 51, 132, 0.1);
    --te-bg: #f5f5f5;
    --te-bg-card: #fff;
    --te-bg-elevated: #f8f9fa;
    --te-bg-hover: #f0f0f0;
    --te-border: var(--border-color, #dee2e6);
    --te-border-focus: var(--te-primary);
    --te-text: var(--body-color, #333);
    --te-text-secondary: #6c757d;
    --te-text-muted: #adb5bd;
    --te-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --te-shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --te-radius: var(--border-radius, 0.375rem);
    --te-radius-sm: var(--border-radius-sm, 0.25rem);
    --te-transition: all 0.2s ease;
}

/* ─── Base ─────────────────────────────────────────────────── */
.te-page-container {
    color: var(--te-text);
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    width: 100%;
}
.te-page-container .icon { width: 20px; height: 20px; fill: currentColor; }

/* ─── Animations ──────────────────────────────────────────── */
@keyframes te-fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@keyframes te-slideIn { from { opacity:0; transform:translateX(16px); } to { opacity:1; transform:translateX(0); } }
@keyframes te-spin { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }
@keyframes te-pulse { 0%,100% { transform:scale(1); } 50% { transform:scale(1.05); } }
.te-spin { animation: te-spin 1s linear infinite; }
.te-fade-in { animation: te-fadeIn 0.25s ease-out forwards; }

/* ═══════════════════════════════════════════════════════════
   LOGIN SCREEN — Prise de poste
   ═══════════════════════════════════════════════════════════ */
.te-login-screen { display:flex; align-items:center; justify-content:center; min-height:calc(100vh - 120px); padding:2rem; }

.te-login-card {
    background: var(--te-bg-card);
    border: 1px solid var(--te-border);
    border-radius: var(--te-radius);
    padding: 2.5rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: var(--te-shadow-lg);
    animation: te-fadeIn 0.4s ease-out;
}
.te-login-icon {
    width: 72px; height: 72px; border-radius: var(--te-radius);
    background: var(--te-primary); display:flex; align-items:center; justify-content:center;
    margin: 0 auto 1.25rem;
}
.te-login-icon .icon { width: 32px; height: 32px; fill: #fff; }
.te-login-title { font-size:1.35rem; font-weight:700; margin-bottom:0.4rem; }
.te-login-subtitle { color:var(--te-text-secondary); margin-bottom:1.75rem; font-size:0.875rem; }
.te-login-form { text-align:left; }

/* OF Preview on login */
.te-of-preview {
    display:flex; flex-direction:column; gap:0.5rem;
}
.te-of-badge {
    display:flex; align-items:center; gap:0.5rem;
    padding:0.5rem 0.75rem; background:var(--te-bg-elevated);
    border:1px solid var(--te-border); border-radius:var(--te-radius-sm);
    font-size:0.8125rem;
}
.te-of-badge.te-of-none { color:var(--te-text-muted); font-style:italic; }
.te-of-number { font-weight:700; color:var(--te-primary); min-width:70px; }
.te-of-product { flex:1; color:var(--te-text); }
.te-of-progress {
    width:60px; height:6px; background:var(--te-bg-hover);
    border-radius:3px; overflow:hidden; flex-shrink:0;
}
.te-of-progress-bar { height:100%; background:var(--te-success); border-radius:3px; transition:width 0.3s ease; }
.te-of-pct { font-weight:600; font-size:0.75rem; color:var(--te-text-secondary); min-width:32px; text-align:right; }

.te-field-group { margin-bottom:1.25rem; }
.te-field-group label {
    display:block; font-size:0.75rem; font-weight:600; color:var(--te-text-secondary);
    margin-bottom:0.4rem; text-transform:uppercase; letter-spacing:0.4px;
}

.te-select, .te-input {
    width:100%; padding:0.6rem 0.85rem; background:#ffffff;
    border:1px solid #cbd5e1; border-radius:8px;
    color:#1e293b; font-size:0.875rem; transition:all 0.2s; outline:none;
}
.te-select:focus, .te-input:focus { border-color:#E5A000; box-shadow:0 0 0 3px rgba(229, 160, 0, 0.15); }

.te-input[type="color"] {
    padding:0; border:none; border-radius:8px; overflow:hidden; cursor:pointer; height:42px;
}
.te-input[type="color"]::-webkit-color-swatch-wrapper { padding:0; }
.te-input[type="color"]::-webkit-color-swatch { border:none; border-radius:8px; }

/* ─── Icon Picker ─────────────────────────────────────────── */
.te-icon-picker-btn {
    display:flex; align-items:center; gap:0.5rem; cursor:pointer; text-align:left;
}
.te-icon-picker-btn .icon { width:18px; height:18px; fill:currentColor; opacity:0.8; }
.te-icon-picker-dropdown {
    position:absolute; top:calc(100% + 5px); left:0; width:100%; min-width:260px; background:#ffffff;
    border:1px solid #e2e8f0; border-radius:12px; box-shadow:0 10px 25px -5px rgba(0,0,0,0.15);
    z-index:100; padding:1rem; max-height:240px; overflow-y:auto;
}
.te-icon-grid {
    display:grid; grid-template-columns:repeat(auto-fill, minmax(36px, 1fr)); gap:0.4rem;
}
.te-icon-option {
    display:flex; align-items:center; justify-content:center; width:36px; height:36px;
    border-radius:8px; cursor:pointer; border:1px solid transparent; transition:all 0.2s;
    color:#64748b;
}
.te-icon-option .icon { width:20px; height:20px; }
.te-icon-option:hover { background:#f8fafc; color:#0f172a; border-color:#e2e8f0; transform:scale(1.1); }
.te-icon-option.active { background:rgba(229, 160, 0, 0.1); color:#E5A000; border-color:#E5A000; }

/* ─── Buttons (MMI V3 Standard: FLAT, action à DROITE) ────── */
.te-btn {
    display:inline-flex; align-items:center; gap:0.4rem; padding:0.6rem 1.25rem;
    border-radius:8px; border:1px solid transparent;
    font-size:0.875rem; font-weight:600; cursor:pointer; transition:all 0.2s;
    white-space:nowrap; text-decoration:none; box-shadow:none !important;
}
.te-btn .icon { width:16px; height:16px; }
.te-btn-primary { background:var(--te-primary); color:#fff; border-color:var(--te-primary); }
.te-btn-primary:hover { background:var(--te-primary-hover); border-color:var(--te-primary-hover); }
.te-btn-success { background:var(--te-success); color:#fff; border-color:var(--te-success); }
.te-btn-success:hover { opacity:0.9; }
.te-btn-danger { background:var(--te-danger); color:#fff; border-color:var(--te-danger); }
.te-btn-nc { background:var(--te-nc); color:#fff; border-color:var(--te-nc); }
.te-btn-nc:hover { opacity:0.9; }
.te-btn-ghost { background:transparent; color:var(--te-text-secondary); border:1px solid var(--te-border); }
.te-btn-ghost:hover { background:var(--te-bg-hover); color:var(--te-text); }
.te-btn-danger-outline { background:transparent; color:var(--te-danger); border:1px solid var(--te-danger); }
.te-btn-danger-outline:hover { background:var(--te-danger-light); }
.te-btn-lg { padding:0.7rem 1.25rem; font-size:0.9375rem; width:100%; justify-content:center; margin-top:0.5rem; }
.te-btn-sm { padding:0.3rem 0.6rem; font-size:0.75rem; }

/* ═══════════════════════════════════════════════════════════
   SESSION HEADER
   ═══════════════════════════════════════════════════════════ */
.te-session-header {
    display:flex; align-items:center; justify-content:space-between;
    padding:0.75rem 1.25rem; background:var(--te-bg-card);
    border-bottom:1px solid var(--te-border); gap:1rem; flex-wrap:wrap;
}
.te-session-info { display:flex; align-items:center; gap:1.25rem; }
.te-session-badge {
    display:flex; align-items:center; gap:0.4rem; padding:0.35rem 0.75rem;
    background:var(--te-primary-light); border:1px solid var(--te-primary-border);
    border-radius:var(--te-radius-sm); color:var(--te-primary-hover); font-weight:600; font-size:0.8125rem;
}
.te-session-time { display:flex; align-items:center; gap:0.3rem; color:var(--te-text-secondary); font-size:0.8125rem; font-variant-numeric:tabular-nums; }
.te-session-actions { display:flex; align-items:center; gap:0.5rem; }

/* Line switcher in header */
.te-line-switcher { display:flex; align-items:center; }
.te-select-inline {
    width:auto; padding:0.25rem 2rem 0.25rem 0.5rem; font-size:0.8125rem; font-weight:600;
    background:var(--te-bg-elevated); border:1px solid var(--te-border);
    border-radius:var(--te-radius-sm); color:var(--te-text); cursor:pointer;
    transition:var(--te-transition);
}
.te-select-inline:focus { border-color:var(--te-primary); box-shadow:0 0 0 2px var(--te-primary-light); }

/* OF info inline in session header */
.te-session-of {
    display:flex; align-items:center; gap:0.5rem;
    padding:0.3rem 0.65rem; background:var(--te-success-light);
    border:1px solid rgba(25, 135, 84, 0.25); border-radius:var(--te-radius-sm);
    font-size:0.8125rem; animation: te-fadeIn 0.3s ease-out;
}
.te-session-of .te-of-label { font-weight:700; color:var(--te-success); font-size:0.6875rem; text-transform:uppercase; letter-spacing:0.5px; }
.te-session-of .te-of-number { font-weight:600; color:var(--te-text); }
.te-session-of .te-of-product { color:var(--te-text-secondary); }
.te-session-of .te-of-pct { font-weight:700; color:var(--te-success); }

/* ─── Notification Bell ──────────────────────────────────── */
.te-notification-bell { position:relative; cursor:pointer; padding:0.4rem; border-radius:var(--te-radius-sm); transition:var(--te-transition); color:var(--te-text-secondary); }
.te-notification-bell:hover { background:var(--te-bg-hover); color:var(--te-text); }
.te-notification-bell .icon { width:20px; height:20px; }
.te-notif-badge {
    position:absolute; top:0; right:-2px; background:var(--te-danger); color:#fff;
    font-size:0.6rem; font-weight:700; min-width:16px; height:16px;
    display:flex; align-items:center; justify-content:center; border-radius:10px; padding:0 3px;
}

/* ═══════════════════════════════════════════════════════════
   KPI BAR
   ═══════════════════════════════════════════════════════════ */
.te-kpi-bar {
    display:grid; grid-template-columns:repeat(auto-fit, minmax(110px, 1fr));
    gap:0.5rem; padding:0.75rem 1.25rem; background:var(--te-bg-card);
    border-bottom:1px solid var(--te-border);
}
.te-kpi { text-align:center; padding:0.5rem; border-radius:var(--te-radius-sm); background:var(--te-bg-elevated); transition:var(--te-transition); }
.te-kpi:hover { background:var(--te-bg-hover); }
.te-kpi-value { font-size:1.35rem; font-weight:700; font-variant-numeric:tabular-nums; line-height:1.2; }
.te-kpi-label { font-size:0.65rem; text-transform:uppercase; letter-spacing:0.4px; color:var(--te-text-muted); margin-top:0.15rem; }
.te-kpi[data-kpi="pending"] .te-kpi-value { color:var(--te-info); }
.te-kpi[data-kpi="overdue"] .te-kpi-value { color:var(--te-danger); }
.te-kpi[data-kpi="completed"] .te-kpi-value { color:var(--te-success); }
.te-kpi[data-kpi="nc"] .te-kpi-value { color:var(--te-nc); }
.te-kpi-highlight { background:var(--te-primary-light); border:1px solid var(--te-primary-border); }
.te-kpi-highlight .te-kpi-value { color:var(--te-primary-hover); }

/* ═══════════════════════════════════════════════════════════
   TASKS LIST
   ═══════════════════════════════════════════════════════════ */
.te-tasks-container { padding:1.25rem; }
.te-loading { display:flex; align-items:center; justify-content:center; gap:0.6rem; padding:3rem; color:var(--te-text-secondary); }
.te-tasks-empty { text-align:center; padding:3rem 2rem; color:var(--te-text-muted); }
.te-tasks-empty .icon { width:40px; height:40px; margin-bottom:0.75rem; opacity:0.3; }

/* ─── Task Card ──────────────────────────────────────────── */
.te-task-card {
    background:var(--te-bg-card); border:1px solid var(--te-border); border-radius:var(--te-radius);
    margin-bottom:0.5rem; overflow:hidden; transition:var(--te-transition); animation:te-fadeIn 0.25s ease-out;
}
.te-task-card:hover { box-shadow:var(--te-shadow); }
.te-task-card {
    border-left: none !important;
}
.te-task-card[data-status="warning"] {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.08) 0%, rgba(245, 158, 11, 0.01) 25%, var(--te-bg-card) 100%);
}
.te-task-card[data-status="overdue"] {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.01) 25%, var(--te-bg-card) 100%);
}
.te-task-card[data-status="non_conformity"] {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.08) 0%, rgba(220, 38, 38, 0.01) 25%, var(--te-bg-card) 100%);
}
.te-task-card[data-status="in_progress"] {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.06) 0%, rgba(59, 130, 246, 0.01) 20%, var(--te-bg-card) 100%);
}
.te-task-card[data-status="completed"] {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.01) 20%, var(--te-bg-card) 100%);
    opacity: 0.85;
}
.te-task-card[data-status="pending"] {
    background: var(--te-bg-card);
}

/* Highlight target task card from notification link */
.te-task-card.te-task-highlight {
    animation: te-pulse-highlight 1.5s ease-in-out infinite alternate !important;
    border-color: #6366f1 !important;
}
@keyframes te-pulse-highlight {
    0% {
        box-shadow: 0 0 0 0px rgba(99, 102, 241, 0.4);
        background-color: rgba(99, 102, 241, 0.02);
    }
    100% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
        background-color: rgba(99, 102, 241, 0.12);
    }
}

.te-task-main { display:flex; align-items:center; padding:0.75rem 1rem; gap:0.75rem; cursor:pointer; }
.te-task-category-icon { width:36px; height:36px; border-radius:var(--te-radius-sm); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.te-task-category-icon .icon { width:18px; height:18px; fill:#fff; }

.te-task-info { flex:1; min-width:0; }
.te-task-name { font-weight:600; font-size:0.875rem; margin-bottom:0.1rem; }
.te-task-meta { display:flex; align-items:center; gap:0.6rem; font-size:0.75rem; color:var(--te-text-muted); }
.te-task-meta-item { display:flex; align-items:center; gap:0.2rem; }
.te-task-meta-item .icon { width:13px; height:13px; }

.te-task-status-badge {
    padding:0.2rem 0.6rem; border-radius:20px; font-size:0.6875rem;
    font-weight:600; text-transform:uppercase; letter-spacing:0.4px; white-space:nowrap;
}
.te-status-pending { background:var(--te-bg-elevated); color:var(--te-text-muted); }
.te-status-in_progress { background:var(--te-info-light); color:var(--te-info); }
.te-status-warning { background:var(--te-warning-light); color:var(--te-warning); }
.te-status-overdue { background:var(--te-danger-light); color:var(--te-danger); }
.te-status-completed { background:var(--te-success-light); color:var(--te-success); }
.te-status-non_conformity { background:var(--te-nc-light); color:var(--te-nc); }
.te-status-cancelled { background:var(--te-bg-elevated); color:var(--te-text-muted); text-decoration:line-through; }

.te-task-toggle { transition:var(--te-transition); color:var(--te-text-muted); }
.te-task-toggle.open { transform:rotate(90deg); }
.te-task-toggle .icon { width:14px; height:14px; }

/* ─── Task Detail ────────────────────────────────────────── */
.te-task-detail { display:none; padding:0 1rem 1rem; border-top:1px solid var(--te-border); }
.te-task-detail.open { display:block; animation:te-fadeIn 0.2s ease-out; }
.te-task-desc { padding:0.6rem 0.75rem; background:var(--te-bg-elevated); border-radius:var(--te-radius-sm); font-size:0.8125rem; line-height:1.6; color:var(--te-text-secondary); margin:0.75rem 0; }
.te-task-desc strong { color:var(--te-text); }
.te-task-actions { display:flex; gap:0.4rem; flex-wrap:wrap; }
.te-task-comment { margin-top:0.6rem; display:flex; gap:0.4rem; }
.te-task-comment input { flex:1; padding:0.4rem 0.6rem; background:var(--te-bg-card); border:1px solid var(--te-border); border-radius:var(--te-radius-sm); color:var(--te-text); font-size:0.8125rem; outline:none; }
.te-task-comment input:focus { border-color:var(--te-border-focus); }

/* ─── Children ───────────────────────────────────────────── */
.te-children-list { margin-top:0.6rem; padding-left:0.75rem; border-left:2px solid var(--te-border); }
.te-children-list .te-task-card { margin-bottom:0.35rem; }
.te-children-list .te-task-main { padding:0.5rem 0.75rem; }
.te-children-list .te-task-category-icon { width:28px; height:28px; }
.te-children-list .te-task-category-icon .icon { width:14px; height:14px; }
.te-children-list .te-task-name { font-size:0.8125rem; }

/* ═══════════════════════════════════════════════════════════
   NOTIFICATION PANEL
   ═══════════════════════════════════════════════════════════ */
.te-notif-panel {
    position:fixed; top:0; right:-380px; width:360px; height:100vh;
    background:var(--te-bg-card); border-left:1px solid var(--te-border);
    box-shadow:var(--te-shadow-lg); z-index:1050; transition:right 0.3s ease;
    display:flex; flex-direction:column;
}
.te-notif-panel.open { right:0; }
.te-notif-header { display:flex; align-items:center; justify-content:space-between; padding:1rem 1.25rem; border-bottom:1px solid var(--te-border); }
.te-notif-header h3 { margin:0; font-size:0.9375rem; font-weight:600; flex:1; }
.te-notif-list { flex:1; overflow-y:auto; padding:0.5rem; }
.te-notif-item { padding:0.6rem 0.75rem; border-radius:var(--te-radius-sm); margin-bottom:0.35rem; background:var(--te-bg-elevated); cursor:pointer; transition:var(--te-transition); }
.te-notif-item:hover { background:var(--te-bg-hover); }
.te-notif-item.unread { border-left:3px solid var(--te-primary); }
.te-notif-title { font-size:0.8125rem; font-weight:600; margin-bottom:0.15rem; }
.te-notif-time { font-size:0.6875rem; color:var(--te-text-muted); }
.te-notif-empty { text-align:center; padding:2.5rem 1rem; color:var(--te-text-muted); }

/* ═══════════════════════════════════════════════════════════
   ADMIN PAGE
   ═══════════════════════════════════════════════════════════ */
.te-admin-header { display:flex; align-items:flex-start; justify-content:space-between; padding:1.25rem; gap:1rem; flex-wrap:wrap; }
.te-admin-header h1 { display:flex; align-items:center; gap:0.6rem; font-size:1.25rem; font-weight:700; margin:0; }
.te-admin-subtitle { color:var(--te-text-muted); font-size:0.8125rem; margin-top:0.2rem; }

.te-admin-filters { display:flex; gap:0.5rem; padding:0 1.25rem 0.75rem; flex-wrap:wrap; align-items:center; }
.te-search-box { position:relative; width:280px; }
.te-search-box .icon { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--te-text-muted); }
.te-search-box .te-input { padding-left:2.25rem; }
.te-admin-filters .te-select { width:200px; }

.te-admin-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; padding: 0 1.25rem 1.25rem; }

/* Layout View Toggle */
.te-view-toggle {
    display: flex;
    background: var(--te-bg-elevated);
    border: 1px solid var(--te-border);
    border-radius: var(--te-radius);
    padding: 2px;
    gap: 2px;
    margin-left: auto;
}
.te-toggle-btn {
    border: none;
    background: transparent;
    padding: 0.35rem 0.6rem;
    border-radius: calc(var(--te-radius) - 2px);
    color: var(--te-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--te-transition);
}
.te-toggle-btn:hover {
    color: var(--te-text);
    background: var(--te-bg-hover);
}
.te-toggle-btn.active {
    background: var(--te-primary);
    color: #fff;
}
.te-toggle-btn .icon {
    width: 16px;
    height: 16px;
}

/* Collapsible Card Group */
.te-admin-card-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
}
.te-admin-card-group.expanded {
    height: auto;
}
.te-parent-card {
    cursor: pointer;
    flex: 1;
}
.te-admin-card-group.expanded .te-parent-card {
    flex: 0 0 auto;
    height: auto;
}
#teAdminGrid:has(.te-admin-card-group.expanded) .te-admin-card-group:not(.expanded) {
    height: auto;
}
#teAdminGrid:has(.te-admin-card-group.expanded) .te-admin-card-group:not(.expanded) .te-parent-card {
    flex: 0 0 auto;
    height: auto;
}
.te-expand-btn {
    border: none;
    background: transparent;
    color: var(--te-text-secondary);
    cursor: pointer;
    padding: 0.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--te-radius-sm);
    transition: var(--te-transition);
    margin-right: 0.25rem;
}
.te-expand-btn:hover {
    background: var(--te-bg-hover);
    color: var(--te-text);
}
.te-expand-btn .icon {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}
.te-admin-card-group.expanded .te-expand-btn .icon {
    transform: rotate(180deg);
}

.te-admin-card-children {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    padding-left: 1.5rem;
    border-left: 2px dashed var(--te-border);
    margin-left: 1.25rem;
}
.te-admin-card-group.expanded .te-admin-card-children {
    display: flex;
    animation: te-fadeIn 0.25s ease-out forwards;
}

.te-child-card {
    border-left: 3px solid var(--te-primary-border);
}

/* Badge for Child Task Count */
.te-card-badge-children {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Flat (Grid) View Mode Surcharge - Keep hierarchical logic, only change layout to multi-column grid */
#teTaskAdmin.te-view-flat #teAdminGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.te-admin-card { background:var(--te-bg-card); border:1px solid var(--te-border); border-radius:var(--te-radius); overflow:hidden; transition:var(--te-transition); display:flex; flex-direction:column; height:100%; }
.te-admin-card:hover { box-shadow:var(--te-shadow); }
.te-admin-card-header { display:flex; align-items:center; gap:0.6rem; padding:0.75rem 1rem; }
.te-admin-card-icon { width:38px; height:38px; border-radius:var(--te-radius-sm); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.te-admin-card-icon .icon { width:20px; height:20px; fill:#fff; }
.te-admin-card-info { flex:1; min-width:0; }
.te-admin-card-name { font-weight:600; font-size:0.8125rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.te-admin-card-cat { font-size:0.6875rem; color:var(--te-text-muted); }
.te-admin-card-body { padding:0 1rem 0.5rem; flex:1; display:flex; flex-direction:column; }
.te-admin-card-meta { display:flex; align-items:center; gap:0.75rem; font-size:0.75rem; color:var(--te-text-secondary); }
.te-admin-card-meta span { display:flex; align-items:center; gap:0.2rem; }
.te-admin-card-meta .icon { width:13px; height:13px; }
.te-card-badge-form {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--te-primary-light);
    color: var(--te-primary);
    border: 1px solid var(--te-primary-border);
    transition: var(--te-transition);
}
.te-card-badge-form:hover {
    background: var(--te-primary);
    color: #fff;
    border-color: var(--te-primary);
    transform: scale(1.08);
}
.te-card-badge-form .icon {
    width: 14px !important;
    height: 14px !important;
}
.te-card-badge-teams {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f3f4fc;
    color: #4b53bc;
    border: 1px solid rgba(75, 83, 188, 0.25);
    transition: var(--te-transition);
}
.te-card-badge-teams:hover {
    background: #4b53bc;
    color: #fff;
    border-color: #4b53bc;
    transform: scale(1.08);
}
.te-card-badge-teams .icon {
    width: 14px !important;
    height: 14px !important;
    fill: currentColor;
}
.te-admin-card-actions { display:flex; justify-content:flex-end; gap:0.4rem; padding:0.5rem 1rem; border-top:1px solid var(--te-border); background:var(--te-bg-elevated); }

/* Priority */
.te-priority-low { color:var(--te-text-muted); }
.te-priority-normal { color:var(--te-info); }
.te-priority-high { color:var(--te-warning); font-weight:600; }
.te-priority-critical { color:var(--te-danger); font-weight:700; text-transform:uppercase; }

/* Toggle Switch */
.te-switch { position:relative; display:inline-block; width:36px; height:20px; }
.te-switch input { opacity:0; width:0; height:0; }
.te-switch-slider { position:absolute; cursor:pointer; inset:0; background:var(--te-bg-elevated); border:1px solid var(--te-border); border-radius:20px; transition:var(--te-transition); }
.te-switch-slider:before { content:""; position:absolute; width:14px; height:14px; left:2px; top:2px; background:var(--te-text-muted); border-radius:50%; transition:var(--te-transition); }
.te-switch input:checked + .te-switch-slider { background:var(--te-primary); border-color:var(--te-primary); }
.te-switch input:checked + .te-switch-slider:before { transform:translateX(16px); background:#fff; }

/* ═══════════════════════════════════════════════════════════
   BOARD / DASHBOARD
   ═══════════════════════════════════════════════════════════ */
.te-board-kpis { display:grid; grid-template-columns:repeat(auto-fill, minmax(170px, 1fr)); gap:0.75rem; padding:0 1.25rem 1.25rem; }
.te-board-kpi-card { background:var(--te-bg-card); border:1px solid var(--te-border); border-radius:var(--te-radius); padding:1rem; display:flex; align-items:center; gap:0.75rem; transition:var(--te-transition); }
.te-board-kpi-card:hover { box-shadow:var(--te-shadow); }
.te-board-kpi-highlight { background:var(--te-primary-light); border-color:var(--te-primary-border); }
.te-board-kpi-icon { width:44px; height:44px; border-radius:var(--te-radius-sm); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.te-board-kpi-icon .icon { width:22px; height:22px; }
.te-board-kpi-value { font-size:1.5rem; font-weight:700; font-variant-numeric:tabular-nums; line-height:1.2; }
.te-board-kpi-label { font-size:0.6875rem; color:var(--te-text-muted); text-transform:uppercase; letter-spacing:0.4px; }

.te-board-section { padding:0 1.25rem 1.25rem; }
.te-board-section h2 { font-size:1rem; font-weight:600; margin:0 0 0.75rem; }

/* Activity feed */
.te-board-activity { background:var(--te-bg-card); border:1px solid var(--te-border); border-radius:var(--te-radius); overflow:hidden; }
.te-activity-item { display:flex; align-items:center; gap:0.6rem; padding:0.6rem 1rem; border-bottom:1px solid var(--te-border); transition:var(--te-transition); }
.te-activity-item:last-child { border-bottom:none; }
.te-activity-item:hover { background:var(--te-bg-hover); }
.te-activity-icon { width:28px; height:28px; border-radius:var(--te-radius-sm); background:var(--te-bg-elevated); display:flex; align-items:center; justify-content:center; flex-shrink:0; color:var(--te-text-secondary); }
.te-activity-icon .icon { width:14px; height:14px; }
.te-activity-content { flex:1; font-size:0.8125rem; color:var(--te-text-secondary); }
.te-activity-action { font-weight:600; color:var(--te-text); margin-right:0.2rem; }
.te-activity-task { color:var(--te-primary-hover); }
.te-activity-user { color:var(--te-text-muted); }
.te-activity-time { font-size:0.6875rem; color:var(--te-text-muted); white-space:nowrap; font-variant-numeric:tabular-nums; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .te-login-card { padding:1.75rem 1.25rem; }
    .te-session-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    .te-session-info {
        flex-wrap: wrap;
        gap: 0.5rem 0.75rem;
        width: 100%;
    }
    .te-session-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .te-kpi-bar { grid-template-columns:repeat(3, 1fr); padding:0.5rem; }
    .te-tasks-container { padding:0.5rem; }
    .te-task-main { padding:0.5rem; }
    .te-task-meta { flex-wrap: wrap; gap: 0.4rem 0.6rem; }
    .te-task-actions { flex-direction:column; }
    .te-task-actions .te-btn { width:100%; justify-content:center; }
    .te-notif-panel { width:100%; right:-100%; }
    .te-cq-status-bar { flex-wrap: wrap; gap: 0.5rem; }

    /* Prevent auto-zoom on iOS */
    .te-select, .te-input, .te-cq-input, .te-textarea {
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .te-login-screen { padding: 1rem; }
    .te-kpi-bar { grid-template-columns: repeat(2, 1fr); }
    .te-kpi-value { font-size: 1.15rem; }
    .te-session-info { flex-direction: column; align-items: stretch; }
    .te-line-switcher, .te-select-inline { width: 100%; }
    .te-session-actions .te-btn { flex: 1; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════
   MODAL EDITOR (Premium MMI V3)
   ═══════════════════════════════════════════════════════════ */
.te-modal-overlay {
    position:fixed; inset:0; background:rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px); z-index:1060;
    display:flex; align-items:center; justify-content:center; padding:1.5rem;
}
.te-modal {
    background:#ffffff; border:none; border-radius:16px;
    width:100%; max-width:900px; max-height:90vh; display:flex; flex-direction:column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation:te-modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
@keyframes te-modalSlideUp {
    from { opacity:0; transform:translateY(20px) scale(0.98); }
    to { opacity:1; transform:translateY(0) scale(1); }
}
.te-modal-header {
    display:flex; align-items:center; justify-content:space-between;
    padding:1.25rem 1.75rem; background:#E5A000;
}
.te-modal-header h2 { margin:0; font-size:1.25rem; font-weight:700; color:#ffffff; letter-spacing:-0.01em; }
.te-modal-close { 
    background:rgba(255, 255, 255, 0.2); border:none; width:32px; height:32px; border-radius:50%; 
    display:flex; align-items:center; justify-content:center;
    font-size:1.2rem; cursor:pointer; color:#ffffff; transition:all 0.2s; 
}
.te-modal-close:hover { background:rgba(255, 255, 255, 0.3); color:#ffffff; }
.te-modal form { display:flex; flex-direction:column; flex:1; min-height:0; }
.te-modal-body { padding:1.75rem; overflow-y:auto; flex:1; min-height:0; }
.te-modal-footer {
    display:flex; justify-content:flex-end; gap:0.75rem;
    padding:1.25rem 1.75rem; border-top:1px solid #f1f5f9; background:#fcfcfc;
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

/* ─── Tabs ────────────────────────────────────────────────── */
.te-tabs { display:flex; gap:1.5rem; border-bottom:2px solid #e2e8f0; margin-bottom:1.5rem; }
.te-tab {
    display:flex; align-items:center; gap:0.4rem; padding:0.75rem 0; border:none;
    background:transparent; color:#64748b; font-size:0.875rem;
    font-weight:600; cursor:pointer; border-bottom:2px solid transparent;
    margin-bottom:-2px; transition:all 0.2s;
}
.te-tab .icon { width:18px; height:18px; opacity:0.7; }
.te-tab:hover { color:#334155; }
.te-tab:hover .icon { opacity:1; }
.te-tab.active { color:#E5A000; border-bottom-color:#E5A000; }
.te-tab.active .icon { opacity:1; }
.te-tab-panel { display:none; }
.te-tab-panel.active { display:block; animation:te-fadeIn 0.15s ease-out; }

/* ─── Form layout ─────────────────────────────────────────── */
.te-form-row { display:flex; gap:0.75rem; margin-bottom:0; }
.te-form-row .te-field-group { flex:1; }
.te-field-grow { flex:2 !important; }
.te-textarea { resize:vertical; min-height:80px; font-family:inherit; }
.te-section-title { font-size:0.8125rem; font-weight:700; color:var(--te-text); margin:1.25rem 0 0.5rem; padding-bottom:0.35rem; border-bottom:1px solid var(--te-border); }
.te-help-text { font-size:0.8125rem; color:var(--te-text-muted); margin-bottom:1rem; line-height:1.5; }
.te-checkbox-label { display:flex; align-items:center; gap:0.4rem; font-size:0.8125rem; cursor:pointer; padding:0.35rem 0; }
.te-checkbox-label input[type="checkbox"] { accent-color:var(--te-primary); width:16px; height:16px; }

/* ─── Trigger rows ────────────────────────────────────────── */
.te-trigger-row {
    display:flex; align-items:center; gap:0.5rem; padding:0.5rem; margin-bottom:0.4rem;
    background:var(--te-bg-elevated); border:1px solid var(--te-border);
    border-radius:var(--te-radius-sm);
}
.te-trigger-row .te-select, .te-trigger-row .te-input { font-size:0.8125rem; padding:0.35rem 0.5rem; }

/* ═══════════════════════════════════════════════════════════
   TRIGGERS PAGE
   ═══════════════════════════════════════════════════════════ */
.te-triggers-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:0.75rem; padding:0 1.25rem 1.25rem; }
.te-trigger-card {
    background:var(--te-bg-card); border:1px solid var(--te-border);
    border-radius:var(--te-radius); padding:1rem; transition:var(--te-transition);
    display: flex;
    flex-direction: column;
    min-height: 200px;
}
.te-trigger-card:hover { box-shadow:var(--te-shadow); }
.te-trigger-card-header { display:flex; align-items:center; gap:0.6rem; margin-bottom:0.6rem; }
.te-trigger-card-icon {
    width:36px; height:36px; border-radius:var(--te-radius-sm);
    display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.te-trigger-card-icon .icon { width:18px; height:18px; fill:#fff; }
.te-trigger-card-name { font-weight:600; font-size:0.875rem; }
.te-trigger-card-type { font-size:0.6875rem; color:var(--te-text-muted); text-transform:uppercase; letter-spacing:0.5px; }
.te-trigger-card-body { font-size:0.8125rem; color:var(--te-text-secondary); line-height:1.5; }
.te-trigger-card-tasks { margin-top:0.6rem; padding-top:0.5rem; border-top:1px solid var(--te-border); }
.te-trigger-card-tasks .te-tag {
    display:inline-flex; align-items:center; gap:0.2rem; padding:0.15rem 0.5rem;
    background:var(--te-primary-light); border:1px solid var(--te-primary-border);
    border-radius:12px; font-size:0.6875rem; color:var(--te-primary-hover); margin:0.15rem;
}
.te-type-badge {
    display:inline-flex; align-items:center; padding:0.15rem 0.5rem;
    border-radius:12px; font-size:0.6875rem; font-weight:600; text-transform:uppercase; letter-spacing:0.3px;
}
.te-type-schedule { background:var(--te-info-light); color:var(--te-info); }
.te-type-event { background:var(--te-warning-light); color:var(--te-warning); }
.te-type-business { background:var(--te-nc-light); color:var(--te-nc); }
.te-type-manual { background:var(--te-bg-elevated); color:var(--te-text-secondary); }

/* ═══════════════════════════════════════════════════════════
   JOURNAL / LOGS PAGE
   ═══════════════════════════════════════════════════════════ */
.te-logs-filters { display:flex; gap:0.5rem; padding:0 1.25rem 0.75rem; flex-wrap:wrap; align-items:flex-end; }
.te-logs-filters .te-field-group { margin-bottom:0; }
.te-logs-filters .te-field-group label { font-size:0.6875rem; margin-bottom:0.2rem; }

.te-logs-table-wrap { padding:0 1.25rem 1.25rem; overflow-x:auto; }
.te-logs-table { width:100%; border-collapse:collapse; font-size:0.8125rem; }
.te-logs-table th {
    text-align:left; padding:0.5rem 0.75rem; font-size:0.6875rem; font-weight:600;
    color:var(--te-text-muted); text-transform:uppercase; letter-spacing:0.5px;
    border-bottom:2px solid var(--te-border); background:var(--te-bg-elevated);
}
.te-logs-table td { padding:0.5rem 0.75rem; border-bottom:1px solid var(--te-border); vertical-align:middle; }
.te-logs-table tr:hover td { background:var(--te-bg-hover); }
.te-log-action-badge {
    display:inline-flex; align-items:center; gap:0.2rem; padding:0.15rem 0.5rem;
    border-radius:12px; font-size:0.6875rem; font-weight:600;
}
.te-log-start { background:var(--te-info-light); color:var(--te-info); }
.te-log-confirm { background:var(--te-success-light); color:var(--te-success); }
.te-log-nc { background:var(--te-nc-light); color:var(--te-nc); }
.te-log-comment { background:var(--te-bg-elevated); color:var(--te-text-secondary); }
.te-log-cancel { background:var(--te-danger-light); color:var(--te-danger); }

.te-logs-pagination { display:flex; justify-content:center; gap:0.35rem; padding:0.75rem 1.25rem; }
.te-logs-pagination button { padding:0.3rem 0.6rem; border:1px solid var(--te-border); background:var(--te-bg-card); border-radius:var(--te-radius-sm); cursor:pointer; font-size:0.75rem; }
.te-logs-pagination button.active { background:var(--te-primary); color:#fff; border-color:var(--te-primary); }

@media (max-width:768px) {
    .te-modal { max-width:100%; margin:0; border-radius:0; max-height:100vh; }
    .te-form-row { flex-direction:column; gap:0; }
    .te-triggers-grid { grid-template-columns:1fr; }
    .te-trigger-row { flex-wrap:wrap; }
    .te-logs-filters { flex-direction:column; }
    .te-admin-grid { grid-template-columns:1fr; }
}

@media (max-width:576px) {
    .te-search-box { width: 100%; }
    .te-admin-filters .te-select { width: 100%; }
    .te-view-toggle { margin-left: 0; width: 100%; justify-content: center; }
    .te-toggle-btn { flex: 1; text-align: center; }
    .te-admin-counter { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════
   QUALITY CONTROL FORMS (CQ INLINE)
   ═══════════════════════════════════════════════════════════ */
.te-cq-form-container {
    background: var(--te-bg-elevated, #f8fafc);
    border: 1px solid var(--te-border, #e2e8f0);
    border-radius: 12px;
    padding: 1.25rem;
    margin: 0.75rem 0;
    transition: all 0.25s ease;
}
.te-cq-form-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--te-text-primary, #1e293b);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.te-cq-form-title svg {
    width: 16px;
    height: 16px;
    color: var(--te-primary, #6366f1);
}
.te-cq-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.te-cq-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.te-cq-row label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--te-text-secondary, #475569);
}
.te-cq-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--te-border, #cbd5e1);
    background: var(--te-bg-card, #ffffff);
    color: var(--te-text-primary, #1f2937);
    font-size: 0.8125rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.te-cq-input:focus {
    border-color: var(--te-primary, #6366f1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    outline: none;
}
.te-cq-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
    background: var(--te-bg-card, #ffffff);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--te-border, #e2e8f0);
}
.te-cq-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--te-text-secondary, #475569);
}
.te-cq-checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--te-border, #cbd5e1);
    cursor: pointer;
}
.te-cq-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    background: var(--te-bg-card, #ffffff);
    border: 1px solid var(--te-border, #e2e8f0);
    border-radius: 8px;
    margin-bottom: 1rem;
}
.te-cq-status-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--te-text-secondary, #475569);
}
.te-cq-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.2s ease;
}
.te-cq-status-badge.status-waiting {
    background: #f1f5f9;
    color: #64748b;
}
.te-cq-status-badge.status-compliant {
    background: #d1fae5;
    color: #065f46;
}
.te-cq-status-badge.status-non-compliant {
    background: #fee2e2;
    color: #991b1b;
}

/* ═══════════════════════════════════════════════════════════
   CAMERA SIMULATOR FOR SWEETALERT
   ═══════════════════════════════════════════════════════════ */
.te-camera-sim-container {
    width: 100%;
    margin-top: 0.5rem;
}
.te-camera-viewport-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--te-border, #e2e8f0);
}
.te-camera-fallback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.te-camera-svg-grid {
    width: 100%;
    height: 100%;
}
@keyframes te-scanline-anim {
    0% { transform: translateY(-120px); }
    100% { transform: translateY(120px); }
}
.te-scanline {
    animation: te-scanline-anim 3s linear infinite;
    transform-origin: center;
}
@keyframes te-pulse-anim {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}
.te-pulse {
    animation: te-pulse-anim 2s infinite;
}

/* Warning state for custom forms */
.te-cq-status-badge.status-warning {
    background: #fef3c7;
    color: #92400e;
}
.te-btn-warning {
    background: #f59e0b;
    color: #fff;
    border-color: #f59e0b;
}
.te-btn-warning:hover {
    opacity: 0.9;
}

/* Custom Checkpop Form Rendering Styles */
.te-cq-grid.flex-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.te-cq-group-row {
    border: 1px solid var(--te-border, #cbd5e1);
    border-radius: 8px;
    padding: 0.75rem;
    background: var(--te-bg-card, #ffffff);
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.te-cq-row-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--te-text-primary, #1e293b);
    border-bottom: 1px solid var(--te-border, #e2e8f0);
    padding-bottom: 0.25rem;
}
.te-cq-row-children {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.te-cq-header h5 {
    margin: 0.5rem 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--te-text-primary, #1e293b);
    border-bottom: 2px solid var(--te-border, #e2e8f0);
    padding-bottom: 0.25rem;
}
.te-cq-signature-box:hover {
    border-color: var(--te-primary, #6366f1) !important;
    color: var(--te-primary, #6366f1) !important;
    background: rgba(99, 102, 241, 0.05) !important;
}



/* Card Trigger Badges */
.te-card-triggers {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 0.5rem;
}
.te-card-trigger-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--te-bg-elevated, #f8fafc);
    color: var(--te-text-secondary, #475569);
    border: 1px solid var(--te-border, #e2e8f0);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}
.te-card-trigger-tag .icon {
    width: 12px;
    height: 12px;
    color: var(--te-warning, #eab308);
}



