/* ══════════════════════════════════════════════════════════════
   MARBELTILE — PREMIUM CSS  v2.0
   ══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    --bg-app: #f4f6f8;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    --radius: 12px;
    --sidebar-w: 280px;
    --mob-nav-h: 64px;
}

[data-theme="dark"] {
    --bg-app: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.2);
}

/* ── RTL Support (Arabic) ── */
[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .plan-day-card { border-left: none; border-right: 4px solid var(--day-accent, var(--primary)); }
[dir="rtl"] .db-card::before { left: auto; right: 0; }
[dir="rtl"] .logo { flex-direction: row-reverse; }
[dir="rtl"] .nav-item { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .topbar { flex-direction: row-reverse; }
[dir="rtl"] .pane-header { flex-direction: row-reverse; }
[dir="rtl"] .measure-row { flex-direction: row-reverse; }
[dir="rtl"] .calep-chute-qty { text-align: left; }
[dir="rtl"] * { font-family: 'Noto Sans Arabic', 'Inter', sans-serif; }

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Noto Sans Arabic', sans-serif;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100dvh;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════════════════════ */
.app-container {
    display: flex;
    height: 100%;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    transition: transform 0.3s ease;
    z-index: 200;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Mobile sidebar backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }

/* ── Logo ── */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 8px;
    flex-shrink: 0;
}

.app-logo-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pro-badge {
    margin-left: auto;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 2px 7px;
    border-radius: 20px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    text-transform: uppercase;
}

/* ── Nav ── */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}

.nav-item:hover {
    background: rgba(59,130,246,0.08);
    color: var(--primary);
    transform: translateX(2px);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}

/* ── Global Settings ── */
.global-settings {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.global-settings h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    letter-spacing: 0.7px;
    font-weight: 700;
}

.tut-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--border);
    transition: background 0.2s, transform 0.2s;
}
.tut-dot.active {
    background: var(--primary);
    transform: scale(1.3);
}


/* ── Main Content ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Topbar ── */
.topbar {
    height: 64px;
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.topbar h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-menu-btn {
    display: none;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    flex-shrink: 0;
}

/* ── Language Switcher ── */
.lang-switcher {
    display: flex;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    gap: 0;
}

.lang-btn {
    background: transparent;
    border: none;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}

.lang-btn.active, .lang-btn:hover {
    background: var(--primary);
    color: white;
}

/* ── Pro Upgrade Button ── */
.pro-upgrade-btn {
    background: linear-gradient(135deg, #f59e0b20, #ef444420) !important;
    border-color: #f59e0b60 !important;
    color: #f59e0b !important;
}

.pro-upgrade-btn:hover {
    background: linear-gradient(135deg, #f59e0b, #ef4444) !important;
    color: white !important;
    border-color: transparent !important;
}

/* ── Tab Content ── */
.tab-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 32px 40px 100px; /* bottom padding for mobile nav */
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.tab-content::-webkit-scrollbar { width: 6px; }
.tab-content::-webkit-scrollbar-track { background: transparent; }
.tab-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }

/* Horizontal scrollbar at very bottom for wide tables */
.tab-content::-webkit-scrollbar:horizontal { height: 8px; }

.tab-pane {
    display: none;
    animation: fadeIn 0.35s ease forwards;
    max-width: 1200px;
    margin: 0 auto;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Pane Header ── */
.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.sticky-pane-header {
    position: sticky;
    top: -32px; /* Compensate for tab-content padding */
    z-index: 10;
    background: var(--bg-app);
    padding: 32px 0 12px 0;
    margin-top: -32px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.pane-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.pane-header p { color: var(--text-muted); font-size: 0.9rem; }

/* ══════════════════════════════════════════════════════════════
   SHARED COMPONENTS
   ══════════════════════════════════════════════════════════════ */

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 11px 22px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59,130,246,0.4);
}

.btn-secondary {
    background: var(--bg-app);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 8px;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59,130,246,0.05);
}

.btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239,68,68,0.4);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.btn-danger:hover { background: #ef4444; color: white; }

/* Input Group */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.input-group label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.input-group input, .input-group select {
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-app);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus, .input-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* Measure Row */
.measure-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.measure-row input {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-app);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.measure-row input:focus { border-color: var(--primary); }

/* Result Box */
.result-box {
    margin-top: 14px;
    padding: 12px 16px;
    background: rgba(59,130,246,0.08);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 0.95rem;
    border-left: 3px solid var(--primary);
}

/* Topbar Buttons */
.topbar-action-btn {
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s, border-color 0.2s;
    color: var(--text-main);
    padding: 0;
    flex-shrink: 0;
}

.topbar-action-btn:hover {
    background: rgba(59,130,246,0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.theme-toggle {
    cursor: pointer;
    font-size: 1.3rem;
    user-select: none;
    transition: transform 0.2s;
}

.theme-toggle:hover { transform: rotate(20deg) scale(1.1); }

/* Toast */
@keyframes toastIn  { from { opacity:0; transform:translateY(16px) scale(0.95); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0) scale(1); }        to { opacity:0; transform:translateY(16px) scale(0.95); } }

/* ══════════════════════════════════════════════════════════════
   FICHE 1 — UNITS / MESURES
   ══════════════════════════════════════════════════════════════ */
.units-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.unit-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.unit-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.08); }

.unit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

.unit-header input.unit-name {
    font-size: 1.15rem;
    font-weight: 700;
    background: transparent;
    border: none;
    border-bottom: 1px dashed var(--border);
    color: var(--text-main);
    outline: none;
    padding-bottom: 2px;
    transition: border-color 0.2s;
}

.unit-header input.unit-name:focus { border-bottom-color: var(--primary); }

.unit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.section-title {
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ══════════════════════════════════════════════════════════════
   FICHE 2 — MATERIALS
   ══════════════════════════════════════════════════════════════ */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
}

.material-item {
    background: var(--bg-app);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.material-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.material-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 8px;
}

/* ══════════════════════════════════════════════════════════════
   FICHE 3 — CALEPINAGE (Simplified)
   ══════════════════════════════════════════════════════════════ */
.calep-unit-block { margin-bottom: 36px; }

.calep-unit-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.calep-unit-title::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* Surface card (floor / wall) */
.calep-card {
    display: flex;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.calep-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }

.calep-card-left {
    flex: 1;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.calep-card-right {
    width: 240px;
    min-width: 240px;
    background: var(--bg-app);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    gap: 6px;
}

.calep-preview-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.calep-svg {
    width: 100%;
    height: auto;
    border-radius: 6px;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.12));
}

.calep-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.calep-badge {
    font-size: 0.78rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calep-tile-ref { font-size: 0.82rem; color: var(--text-muted); }

.calep-pose-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(139,92,246,0.1);
    color: #8b5cf6;
    margin-left: auto;
}

.calep-dims {
    font-size: 0.82rem;
    color: var(--text-muted);
    background: var(--bg-app);
    padding: 7px 10px;
    border-radius: 6px;
}

.calep-dims strong { color: var(--text-main); }

.calep-stats {
    display: flex;
    align-items: center;
    background: var(--bg-app);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.calep-stat {
    flex: 1;
    text-align: center;
    padding: 12px 10px;
}

.calep-stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    line-height: 1.3;
}

.calep-stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.calep-stat-sub { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; }

.calep-stat-divider { width: 1px; height: 48px; background: var(--border); flex-shrink: 0; }

.calep-empty {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-muted);
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 2px dashed var(--border);
}

.calep-empty strong { color: var(--primary); }

/* ── Chutes inline ── */
.calep-chutes-inline {
    background: rgba(239,68,68,0.05);
    border: 1px solid rgba(239,68,68,0.18);
    border-radius: 8px;
    padding: 10px 14px;
}

.calep-chutes-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ef4444;
    margin-bottom: 8px;
}

.calep-chute-piece {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(239,68,68,0.1);
}

.calep-chute-piece:last-child { border-bottom: none; }

.calep-chute-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.calep-chute-lbl { flex: 1; color: var(--text-muted); }

.calep-chute-size {
    font-weight: 700;
    color: var(--text-main);
    background: var(--bg-app);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.78rem;
}

.calep-chute-qty {
    font-weight: 800;
    color: #ef4444;
    min-width: 50px;
    text-align: right;
}

.calep-chute-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 6px 10px;
    background: var(--bg-app);
    border-radius: 6px;
    border-left: 3px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   FICHE 3 — PLINTH SUMMARY (simplified)
   ══════════════════════════════════════════════════════════════ */
.calep-plinth-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 16px;
    box-shadow: var(--shadow);
}

.calep-plinth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(59,130,246,0.06);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.95rem;
    gap: 12px;
    flex-wrap: wrap;
}

.calep-plinth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0;
    padding: 0;
}

.calep-plinth-stat {
    padding: 16px 20px;
    text-align: center;
    border-right: 1px solid var(--border);
}

.calep-plinth-stat:last-child { border-right: none; }

.calep-plinth-val {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}

.calep-plinth-lbl {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════
   FICHE 4 — FINANCE
   ══════════════════════════════════════════════════════════════ */
.finance-container { display: flex; flex-direction: column; gap: 16px; }

/* ══════════════════════════════════════════════════════════════
   FICHE 5 — PLANNING
   ══════════════════════════════════════════════════════════════ */
.plan-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.plan-add-day-btn { white-space: nowrap; flex-shrink: 0; }

.plan-summary {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 0;
}

.plan-summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 20px;
}

.plan-summary-val { font-size: 1.5rem; font-weight: 800; color: var(--primary); line-height: 1; }
.plan-summary-lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-top: 4px; }
.plan-summary-divider { width: 1px; height: 36px; background: var(--border); flex-shrink: 0; }

.plan-days-list { display: flex; flex-direction: column; gap: 14px; }

.plan-empty-state {
    text-align: center;
    padding: 72px 40px;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: 16px;
    color: var(--text-muted);
}

.plan-empty-icon { font-size: 3rem; margin-bottom: 14px; }
.plan-empty-state h3 { font-size: 1.2rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }
.plan-empty-state strong { color: var(--primary); }

/* Day Card */
.plan-day-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--day-accent, var(--primary));
    transition: box-shadow 0.2s, transform 0.2s;
}

.plan-day-card:hover { box-shadow: 0 8px 28px rgba(0,0,0,0.1); transform: translateY(-1px); }

.plan-day-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    flex-wrap: wrap;
}

.plan-day-header:hover { background: rgba(59,130,246,0.03); }

.plan-day-number {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.plan-day-info { flex: 1; min-width: 140px; }
.plan-day-title { margin-bottom: 4px; }

.plan-day-label-input {
    font-size: 1rem;
    font-weight: 700;
    background: transparent;
    border: none;
    border-bottom: 1px dashed transparent;
    color: var(--text-main);
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
    padding: 2px 0;
}

.plan-day-label-input:focus { border-bottom-color: var(--day-accent, var(--primary)); }

.plan-day-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.plan-day-date-input {
    font-size: 0.8rem;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    padding: 3px 7px;
    outline: none;
    cursor: pointer;
}

.plan-day-date-input:focus { border-color: var(--day-accent, var(--primary)); }
.plan-day-readable { font-size: 0.78rem; color: var(--text-muted); font-style: italic; text-transform: capitalize; }

.plan-day-stats { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.plan-day-stat { display: flex; flex-direction: column; align-items: center; min-width: 36px; }
.plan-stat-val { font-size: 1.1rem; font-weight: 700; line-height: 1; }
.plan-stat-lbl { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-top: 2px; }

.plan-day-ring { width: 40px; height: 40px; flex-shrink: 0; }
.plan-ring-svg { width: 100%; height: 100%; }

.plan-day-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.plan-day-add-worker {
    background: rgba(59,130,246,0.08);
    color: var(--primary);
    border: 1px solid rgba(59,130,246,0.25);
    padding: 5px 12px;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.plan-day-add-worker:hover { background: var(--primary); color: white; transform: translateY(-1px); }

.plan-day-delete {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.25);
    color: #ef4444;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.plan-day-delete:hover { background: #ef4444; color: white; }

.plan-day-chevron { color: var(--text-muted); transition: transform 0.25s; display: flex; align-items: center; }
.plan-day-chevron.collapsed { transform: rotate(-90deg); }

.plan-day-body {
    padding: 0 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    max-height: 9999px;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.plan-day-body.plan-collapsed { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }

.plan-empty-workers {
    text-align: center;
    padding: 18px;
    color: var(--text-muted);
    font-size: 0.88rem;
    background: var(--bg-app);
    border-radius: 8px;
    border: 1px dashed var(--border);
}

.plan-empty-workers strong { color: var(--primary); }

.plan-worker-card {
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.plan-worker-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.07); }

.plan-worker-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.plan-worker-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.plan-worker-name-input {
    flex: 1;
    min-width: 100px;
    font-size: 0.9rem;
    font-weight: 700;
    background: transparent;
    border: none;
    border-bottom: 1px dashed transparent;
    color: var(--text-main);
    outline: none;
    padding: 2px 0;
    transition: border-color 0.2s;
}

.plan-worker-name-input:focus { border-bottom-color: var(--primary); }

.plan-worker-progress { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.plan-progress-bar {
    width: 72px;
    height: 5px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.plan-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #3b82f6);
    border-radius: 99px;
    transition: width 0.4s ease;
}

.plan-progress-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; min-width: 26px; text-align: right; }

.plan-worker-del {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.2);
    color: #ef4444;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.plan-worker-del:hover { background: #ef4444; color: white; }

.plan-tasks-list { padding: 8px 14px 4px; display: flex; flex-direction: column; gap: 3px; }

.plan-no-tasks { color: var(--text-muted); font-size: 0.8rem; font-style: italic; padding: 6px 0; }

.plan-task-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    border-radius: 6px;
    transition: background 0.15s;
}

.plan-task-row:hover { background: rgba(59,130,246,0.04); }

.plan-task-check {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 800;
    color: transparent;
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plan-task-check:hover { border-color: #10b981; }
.plan-task-check.done { background: #10b981; border-color: #10b981; color: white; }

.plan-task-input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    padding: 2px 4px;
    transition: border-color 0.2s;
}

.plan-task-input:focus { border-bottom-color: var(--primary); }
.plan-task-input.task-done-text { text-decoration: line-through; color: var(--text-muted); }
.plan-task-input::placeholder { color: var(--text-muted); font-style: italic; }

.plan-task-del {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}

.plan-task-del:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

.plan-add-task-btn {
    margin: 5px 14px 10px;
    background: transparent;
    border: 1px dashed var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    display: inline-block;
    width: calc(100% - 28px);
    text-align: center;
}

.plan-add-task-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(59,130,246,0.05); }

/* Finance card in planning */
.plan-finance-card {
    background: linear-gradient(135deg, rgba(59,130,246,0.07) 0%, rgba(139,92,246,0.07) 100%);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    align-items: stretch;
    overflow: hidden;
    position: relative;
}

.plan-finance-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #10b981);
}

.plan-finance-title {
    width: 100%;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-finance-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.plan-finance-stat {
    flex: 1;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    text-align: center;
    position: relative;
}

.plan-finance-stat + .plan-finance-stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10%; height: 80%;
    width: 1px;
    background: var(--border);
}

.plan-finance-stat-val { font-size: 1.35rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.plan-finance-stat-lbl { font-size: 0.67rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }

.plan-finance-team-breakdown {
    width: 100%;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.plan-finance-team-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.76rem;
}

.plan-finance-team-chip-name { font-weight: 700; color: var(--text-main); }
.plan-finance-team-chip-rate { color: var(--text-muted); font-size: 0.72rem; }
.plan-finance-team-chip-total { font-weight: 800; color: var(--primary); }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════════════════ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.db-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.db-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }

.db-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--db-accent, var(--primary));
}

.db-card-icon {
    font-size: 1.75rem;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(59,130,246,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.db-card-info { display: flex; flex-direction: column; gap: 2px; }
.db-card-value { font-size: 1.5rem; font-weight: 800; color: var(--text-main); line-height: 1.1; }
.db-card-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }

.db-details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 22px;
    margin-bottom: 36px;
}

.db-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}

.db-panel h3 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.db-unit-list { display: flex; flex-direction: column; gap: 10px; }

.db-unit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-app);
    border: 1px solid var(--border);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.db-unit-name { font-weight: 700; font-size: 0.9rem; }
.db-unit-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.db-badge-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(59,130,246,0.08);
    color: var(--primary);
}

/* Dashboard progress bar */
.db-progress-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 22px;
    box-shadow: var(--shadow);
}

.db-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.db-progress-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-main);
}

.db-progress-pct {
    font-size: 1.25rem;
    font-weight: 800;
    transition: color 0.3s;
}

.db-progress-bar-outer {
    width: 100%;
    height: 10px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.db-progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
    min-width: 2px;
}

.db-progress-meta {
    font-size: 0.73rem;
    color: var(--text-muted);
    text-align: right;
}



/* ══════════════════════════════════════════════════════════════
   RECENT PROJECTS & TEAM
   ══════════════════════════════════════════════════════════════ */
.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
}

.project-item:hover { background: rgba(59,130,246,0.07); border-color: var(--primary); }

.project-item-info { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.project-item-name { font-size: 0.82rem; font-weight: 700; color: var(--text-main); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.project-item-date { font-size: 0.68rem; color: var(--text-muted); }

.project-item-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.project-item-delete:hover { color: #ef4444; background: rgba(239,68,68,0.08); }

/* ══════════════════════════════════════════════════════════════
   SUBSCRIPTION / PAYWALL
   ══════════════════════════════════════════════════════════════ */
.paywall-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.paywall-modal {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 36px;
    max-width: 640px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    max-height: 90dvh;
    overflow-y: auto;
}

.paywall-modal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #f59e0b);
}

.paywall-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 800;
}

.paywall-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 8px;
}

.paywall-badge {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 2px;
    padding: 3px 12px;
    border-radius: 20px;
    text-transform: uppercase;
}

.paywall-title { font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
.paywall-sub { font-size: 0.95rem; color: var(--text-muted); max-width: 480px; line-height: 1.5; }

.paywall-plans {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    width: 100%;
    margin: 4px 0;
}

.paywall-plan {
    background: var(--bg-app);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 20px 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    text-align: left;
    overflow: hidden;
}

.paywall-plan:hover { border-color: var(--primary); transform: translateY(-2px); }

.paywall-plan.recommended {
    border-color: var(--primary);
    background: rgba(59,130,246,0.04);
}

.paywall-plan.selected-plan {
    border-color: var(--primary);
    background: rgba(59,130,246,0.08);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.plan-ribbon {
    position: absolute;
    top: 10px; right: -18px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 3px 22px;
    transform: rotate(35deg);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.plan-period { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px; }

.plan-price {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 4px;
}

.plan-price span { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.plan-sub { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 12px; }

.plan-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.plan-features li { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.paywall-cta {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s, transform 0.2s;
    box-shadow: 0 4px 20px rgba(59,130,246,0.35);
}

.paywall-cta:hover { opacity: 0.92; transform: translateY(-1px); }

.paywall-skip {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px;
    transition: color 0.2s;
}

.paywall-skip:hover { color: var(--text-main); }

/* ══════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION
   ══════════════════════════════════════@media print {
    body { background: #fff !important; color: #000 !important; height: auto !important; overflow: visible !important; }
    .sidebar, .topbar, .mobile-bottom-nav, .paywall-overlay,
    .btn-primary, .btn-secondary, .topbar-action-btn, .theme-toggle, .lang-switcher,
    .plan-toolbar, .plan-add-task-btn, .plan-day-actions, .plan-task-del, .plan-worker-del,
    .units-container, .tiles-container, .nav-menu, .global-settings,
    .pane-header button, .pro-upgrade-btn, .pro-badge, .mobile-menu-btn { display: none !important; }

    .app-container { display: block !important; }
    .main-content { overflow: visible !important; margin: 0 !important; padding: 0 !important; }
    .tab-content { padding: 0 !important; max-width: 100% !important; width: 100% !important; overflow: visible !important; }
    .tab-pane { display: none !important; }
    #fiche2.tab-pane { display: block !important; }

    .materials-card { border: none !important; box-shadow: none !important; background: #fff !important; color: #000 !important; padding: 0 !important; }
    
    #fiche2::before {
        content: "LISTE DES MATÉRIAUX - ZELLIJ";
        display: block;
        font-size: 1.5rem;
        font-weight: 800;
        text-align: center;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid #000;
    }
}ONSIVE — TABLET & MOBILE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .db-details-grid { grid-template-columns: 1fr; }

    .calep-card { flex-direction: column; }
    .calep-card-right { width: 100%; min-width: 0; border-left: none; border-top: 1px solid var(--border); }
}

@media (max-width: 768px) {
    #install-popup {
        bottom: calc(var(--mob-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
    }
    /* Show mobile nav, hide sidebar */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 300;
        height: calc(var(--mob-nav-h) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--bg-sidebar);
        border-top: 1px solid var(--border);
        box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    }
    .mob-nav-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        background: none;
        border: none;
        padding: 6px 2px;
        min-height: 48px;
        color: var(--text-muted);
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    .mob-nav-btn.active { color: var(--primary); }
    .mob-nav-icon { font-size: 1.25rem; line-height: 1; }
    .mob-nav-lbl { font-size: 0.65rem; font-weight: 600; }
    .mobile-menu-btn { display: flex; }
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 200; transform: translateX(-100%); padding-bottom: calc(var(--mob-nav-h) + env(safe-area-inset-bottom, 0px) + 20px); }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.2); }

    /* Content adjustments */
    .tab-content { padding: 20px 16px calc(var(--mob-nav-h) + env(safe-area-inset-bottom, 0px) + 16px); }

    .topbar { padding: 0 14px; height: 56px; }
    .topbar h2 { font-size: 0.9rem; }

    /* Unit grid stacks on mobile */
    .unit-grid { grid-template-columns: 1fr; gap: 16px; }

    /* Pane header stacks */
    .pane-header { flex-direction: column; align-items: flex-start; }
    .pane-header h2 { font-size: 1.3rem; }
    
    .sticky-pane-header {
        top: -20px;
        padding-top: 20px;
        margin-top: -20px;
    }

    /* Planning adjustments */
    .plan-day-header { padding: 12px 14px; gap: 10px; }
    .plan-day-stats { display: none; } /* hidden on very small screens, shown in header */
    .plan-finance-stat { min-width: 80px; }

    /* Dashboard */
    .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .db-card-value { font-size: 1.2rem; }

    /* Paywall */
    .paywall-plans { grid-template-columns: 1fr; }
    .paywall-modal { padding: 24px 18px; }

    /* Comfortable tap targets & readable text on mobile (Android 48dp guideline) */
    .input-group input, .input-group select, .measure-row input { font-size: 16px; min-height: 44px; }
    .btn-primary, .btn-secondary, .btn-danger { min-height: 44px; }
    button { touch-action: manipulation; }

    /* Language switcher compact */
    .lang-btn { padding: 5px 7px; font-size: 0.7rem; }
}

@media (max-width: 480px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .plan-summary { padding: 10px 12px; }
    .plan-summary-stat { padding: 0 10px; }
    .plan-summary-val { font-size: 1.2rem; }
    .calep-stats { flex-wrap: wrap; }
    .calep-stat { min-width: 80px; }

    /* Topbar compresses more, but language switcher must stay reachable */
    .lang-switcher { gap: 2px; }
    .lang-btn { padding: 4px 5px; font-size: 0.62rem; }
}

/* ══════════════════════════════════════════════════════════════
   PRINT
   ══════════════════════════════════════════════════════════════ */
@media print {
    body { background: #fff !important; color: #000 !important; height: auto !important; overflow: visible !important; }
    .sidebar, .topbar, .mobile-bottom-nav, .paywall-overlay,
    .btn-primary, .btn-secondary, .topbar-action-btn, .theme-toggle, .lang-switcher,
    .plan-toolbar, .plan-add-task-btn, .plan-day-actions, .plan-task-del, .plan-worker-del,
    .units-container, .tiles-container, .nav-menu, .global-settings,
    .pane-header button, .pro-upgrade-btn, .pro-badge, .mobile-menu-btn { display: none !important; }

    .app-container { display: block !important; }
    .main-content { overflow: visible !important; margin: 0 !important; padding: 0 !important; }
    .tab-content { padding: 0 !important; max-width: 100% !important; width: 100% !important; overflow: visible !important; }
    .tab-pane { display: none !important; }
    #fiche2.tab-pane { display: block !important; }

    .materials-card { border: none !important; box-shadow: none !important; background: #fff !important; color: #000 !important; padding: 0 !important; }

    #fiche2::before {
        content: "LISTE DES MATÉRIAUX - ZELLIJ";
        display: block;
        font-size: 1.5rem;
        font-weight: 800;
        text-align: center;
        margin-bottom: 24px;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }
}

/* ══════════════════════════════════════════════════════════════
   SPLASH SCREEN
   ══════════════════════════════════════════════════════════════ */
.splash-screen {
    position: fixed;
    inset: 0;
    background-color: var(--bg-app);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

.splash-content {
    text-align: center;
    animation: fadeInSplash 1s ease-out;
}

.splash-logo {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.splash-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.splash-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInSplash {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
