/*
 * NoxusTime Mobile — Styles principaux (refonte premium v3)
 * Mobile-first, vanilla CSS. Palette premium 2025.
 */

/* ============================================
   Variables CSS
   ============================================ */
:root {
    /* Palette */
    --primary: #4A90D9;
    --primary-dark: #3A7BC8;
    --primary-light: #6BA3E0;
    --primary-glow: rgba(74, 144, 217, 0.35);
    --primary-pastel: rgba(74, 144, 217, 0.10);

    --success: #10B981;
    --success-dark: #059669;
    --success-light: #D1FAE5;
    --success-glow: rgba(16, 185, 129, 0.32);

    --danger: #EF4444;
    --danger-dark: #DC2626;
    --danger-glow: rgba(239, 68, 68, 0.28);
    --warning: #F59E0B;
    --info: #06B6D4;

    /* Surfaces */
    --bg: #EEF2F7;
    --bg-gradient: linear-gradient(180deg, #EEF2F7 0%, #FFFFFF 60%);
    --card: #FFFFFF;
    --surface-soft: #F1F5F9;

    /* Texte */
    --text: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-inverse: #FFFFFF;

    --border: #E2E8F0;
    --border-soft: rgba(226, 232, 240, 0.7);

    /* Radius */
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --radius-2xl: 28px;

    /* Shadows premium multi-couche */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 24px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.07);
    --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.16), 0 8px 16px rgba(15, 23, 42, 0.08);
    --shadow-up: 0 -6px 20px rgba(15, 23, 42, 0.06);
    --shadow-glow-primary: 0 8px 24px -4px rgba(74, 144, 217, 0.4), 0 4px 12px -2px rgba(74, 144, 217, 0.3);
    --shadow-glow-success: 0 8px 24px -4px rgba(16, 185, 129, 0.4), 0 4px 12px -2px rgba(16, 185, 129, 0.3);

    --nav-height: 72px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ============================================
   Reset / base
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display',
                 system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    overscroll-behavior-y: contain;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* ============================================
   Animations globales
   ============================================ */
@keyframes mt-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes mt-slideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes mt-scaleIn {
    from { opacity: 0; transform: scale(0.94) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes mt-pulseGlow {
    0%, 100% { box-shadow: var(--shadow-glow-success); }
    50%      { box-shadow: 0 20px 48px rgba(16, 185, 129, 0.5), 0 0 0 8px rgba(16, 185, 129, 0.08); }
}

@keyframes mt-spin {
    to { transform: rotate(360deg); }
}

@keyframes clock-tick {
    from { transform: rotate(0deg); transform-origin: 50px 50px; }
    to   { transform: rotate(360deg); transform-origin: 50px 50px; }
}

@keyframes mt-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.app, .login-wrap {
    animation: mt-fadeIn 0.22s ease both;
}

.main > * {
    animation: mt-slideUp var(--transition-spring) both;
}
.main > *:nth-child(1) { animation-delay: 0.02s; }
.main > *:nth-child(2) { animation-delay: 0.08s; }
.main > *:nth-child(3) { animation-delay: 0.14s; }
.main > *:nth-child(4) { animation-delay: 0.20s; }
.main > *:nth-child(5) { animation-delay: 0.26s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Layout principal
   ============================================ */
.app {
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0) + 20px);
    display: flex;
    flex-direction: column;
}

.header {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--border-soft);
    padding: 14px 18px;
    padding-top: calc(14px + env(safe-area-inset-top, 0));
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 12px;
}

.header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.header-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Avatar initiales dans le header */
.header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0;
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

.header-info {
    flex: 1;
    min-width: 0;
}

.header-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-greeting {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background var(--transition), transform var(--transition-fast), color var(--transition);
    background: var(--surface-soft);
    flex-shrink: 0;
}

.icon-btn:active {
    transform: scale(0.92);
    background: var(--border);
    color: var(--text);
}

.icon-btn .material-icons-round {
    font-size: 22px;
}

.main {
    flex: 1;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ============================================
   Cards premium
   ============================================ */
.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 20px;
    border: 1px solid var(--border-soft);
}

.card-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

/* ============================================
   Forms — floating label
   ============================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Floating label container */
.float-group {
    position: relative;
    margin-bottom: 16px;
}

.float-group .input {
    padding-top: 22px;
    padding-bottom: 10px;
    height: 64px;
}

.float-group .float-label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: top 0.2s ease, font-size 0.2s ease, color 0.2s ease, transform 0.2s ease;
    font-weight: 500;
}

.float-group .input:focus + .float-label,
.float-group .input:not(:placeholder-shown) + .float-label {
    top: 14px;
    transform: none;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.input {
    width: 100%;
    height: 60px;
    padding: 0 20px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input::placeholder {
    color: transparent;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(74, 144, 217, 0.12);
    background: #fff;
}

/* ============================================
   Boutons
   ============================================ */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 54px;
    padding: 0 24px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: transform var(--transition-fast), background var(--transition),
                box-shadow var(--transition), opacity var(--transition);
    will-change: transform;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

.btn[disabled] {
    opacity: 0.5;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-inverse);
    box-shadow: var(--shadow-glow-primary);
    min-height: 56px;
}

.btn-primary:hover {
    box-shadow: 0 10px 30px -4px rgba(74, 144, 217, 0.5), 0 6px 16px -2px rgba(74, 144, 217, 0.35);
}

.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
}

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

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: var(--text-inverse);
    box-shadow: var(--shadow-glow-success);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: var(--text-inverse);
    box-shadow: 0 8px 24px -4px rgba(239, 68, 68, 0.4), 0 4px 12px -2px rgba(239, 68, 68, 0.25);
}

.btn-ghost {
    background: var(--surface-soft);
    color: var(--text-secondary);
}

.btn-block {
    width: 100%;
}

/* Bouton BADGER géant */
.btn-giant {
    min-height: 80px;
    font-size: 1.4rem;
    font-weight: 700;
    border-radius: var(--radius-xl);
    letter-spacing: 0.04em;
    padding: 0 28px;
    gap: 14px;
}

.btn-giant .material-icons-round {
    font-size: 28px;
}

.btn-giant:active {
    transform: scale(0.97);
}

/* ENTRER = success (vert) */
.btn-giant {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: var(--text-inverse);
    box-shadow: var(--shadow-glow-success);
}

/* SORTIR = danger (rouge), quand classe .in est ajoutée */
.btn-giant.in {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    box-shadow: 0 8px 24px -4px rgba(239, 68, 68, 0.45), 0 4px 12px -2px rgba(239, 68, 68, 0.3);
}

.btn-link {
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 10px 14px;
    min-height: auto;
    border-radius: 10px;
    transition: background var(--transition), color var(--transition);
}

.btn-link:active {
    background: var(--surface-soft);
    color: var(--primary);
}

/* ============================================
   Bouton empreinte (login)
   ============================================ */
.btn-fingerprint {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-inverse);
    width: 100%;
    min-height: 72px;
    border-radius: var(--radius-xl);
    font-size: 1.05rem;
    font-weight: 700;
    box-shadow: var(--shadow-glow-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    line-height: 1.2;
    padding: 16px;
    transition: transform var(--transition-fast), box-shadow var(--transition);
}

.btn-fingerprint:active {
    transform: scale(0.97);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
}

.btn-fingerprint .material-icons-round {
    font-size: 2.4rem;
}

.btn-fingerprint .fp-sub {
    font-size: 0.76rem;
    font-weight: 500;
    opacity: 0.85;
    letter-spacing: 0.01em;
}

/* ============================================
   Page LOGIN — hero plein écran
   ============================================ */
.login-wrap {
    min-height: 100vh;                  /* fallback */
    min-height: 100dvh;                 /* dynamic vh - exclut la barre URL mobile */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 22px 16px;
    padding-top: calc(10px + env(safe-area-inset-top, 0));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    gap: 4px;
    text-align: center;
    background: linear-gradient(160deg, #EBF3FC 0%, #F8FBFF 35%, #FFFFFF 65%, #F4F7F9 100%);
    position: relative;
    overflow: hidden;
}

/* Blob décoratif en fond */
.login-wrap::before {
    content: '';
    position: absolute;
    top: -80px;
    right: -60px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 144, 217, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.login-wrap::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: -40px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* Logo SVG clock */
.login-logo {
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.login-logo svg {
    filter: drop-shadow(0 8px 24px rgba(74, 144, 217, 0.28));
}

.login-title {
    font-size: clamp(1.75rem, 7vw, 2.25rem);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.login-sub {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
    position: relative;
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 390px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    padding: 22px 22px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    animation: mt-scaleIn 0.38s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s both;
    position: relative;
    z-index: 1;
}

.login-form {
    width: 100%;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.login-footer {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

/* ============================================
   Status hero (home) — carte pleine largeur
   ============================================ */
.hero-status {
    position: relative;
    border-radius: var(--radius-2xl);
    padding: 28px 24px 24px;
    text-align: center;
    color: var(--text-inverse);
    overflow: hidden;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.hero-status::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 80% 5%, rgba(255, 255, 255, 0.20), transparent 50%),
        radial-gradient(circle at 5% 90%, rgba(0, 0, 0, 0.08), transparent 45%);
    pointer-events: none;
}

.hero-status.in {
    background: linear-gradient(140deg, #1AC87A 0%, #0E9E5E 50%, #076B41 100%);
    box-shadow: 0 16px 48px rgba(16, 185, 129, 0.35), 0 4px 12px rgba(16, 185, 129, 0.2);
}

.hero-status.in.pulse {
    animation: mt-pulseGlow 3s ease-in-out infinite;
}

.hero-status.out {
    background: linear-gradient(140deg, #64748B 0%, #475569 60%, #334155 100%);
    box-shadow: 0 12px 32px rgba(71, 85, 105, 0.25), 0 4px 10px rgba(71, 85, 105, 0.15);
}

.hero-status .hero-icon {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.20);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.hero-status .hero-icon .material-icons-round {
    font-size: 32px;
    color: #fff;
}

.hero-status .label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.78;
    margin-bottom: 6px;
    font-weight: 600;
}

.hero-status .value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.hero-status .since {
    font-size: 0.88rem;
    opacity: 0.88;
    margin-top: 10px;
    font-weight: 500;
}

/* ============================================
   Banner (info, ex: WebAuthn)
   ============================================ */
.banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #EEF4FB, #FAFCFF);
    border: 1px solid rgba(74, 144, 217, 0.2);
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow-xs);
}

.banner .banner-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.banner .banner-icon .material-icons-round { font-size: 20px; }

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

.banner .banner-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.banner .banner-sub {
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.banner .banner-action {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 10px;
    transition: background var(--transition);
    flex-shrink: 0;
}

.banner .banner-action:active {
    background: rgba(74, 144, 217, 0.12);
}

.banner-close {
    background: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.banner-close .material-icons-round { font-size: 18px; }

/* ============================================
   Liste timbrages du jour
   ============================================ */
.timbrage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timbrage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: var(--surface-soft);
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition);
}

.timbrage-row:active {
    background: #E8EDF5;
    border-color: var(--border);
}

.timbrage-row .time {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.01em;
    font-size: 0.95rem;
}

.timbrage-row .dur {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: var(--card);
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
}

/* ============================================
   Empty states
   ============================================ */
.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 12px;
    font-size: 0.88rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.empty .material-icons-round {
    font-size: 44px;
    color: #CBD5E1;
    opacity: 0.7;
}

.empty .empty-text {
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   Stats grid — rapport (premium cards)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat {
    background: var(--surface-soft);
    border-radius: var(--radius);
    padding: 16px 14px;
    border: 1px solid transparent;
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}

/* Icône colorée dans le coin haut-gauche */
.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.stat-icon .material-icons-round {
    font-size: 18px;
}

.stat-icon.icon-blue   { background: rgba(74, 144, 217, 0.14); color: var(--primary); }
.stat-icon.icon-purple { background: rgba(139, 92, 246, 0.12); color: #7C3AED; }
.stat-icon.icon-orange { background: rgba(245, 158, 11, 0.14); color: #D97706; }
.stat-icon.icon-cyan   { background: rgba(6, 182, 212, 0.12);  color: #0891B2; }

.stat .stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat .stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat .stat-value.pos { color: var(--success); }
.stat .stat-value.neg { color: var(--danger); }

/* ============================================
   Sélecteur de mois
   ============================================ */
.month-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 6px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-soft);
}

.month-picker .label {
    font-weight: 700;
    text-transform: capitalize;
    color: var(--text);
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.month-picker button {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), transform var(--transition-fast);
}

.month-picker button:active {
    background: var(--primary-pastel);
    transform: scale(0.9);
}

/* ============================================
   Congés (progress ring)
   ============================================ */
.progress-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 16px 0 20px;
}

.progress-wrap svg {
    overflow: visible;
}

.ring-bg {
    stroke: var(--border);
    opacity: 0.5;
}

.ring-fg {
    stroke: url(#mt-ring-gradient);
    transition: stroke-dashoffset 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
    filter: drop-shadow(0 4px 10px rgba(74, 144, 217, 0.35));
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-text .big {
    font-size: 2.6rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.04em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.progress-text .small {
    font-size: 0.68rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-top: 6px;
}

/* Card solde congés */
.conges-balance-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.conges-balance-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.3);
}

.conges-balance-icon .material-icons-round {
    font-size: 26px;
}

.conges-balance-info {
    flex: 1;
}

.conges-balance-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.04em;
    line-height: 1;
}

.conges-balance-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 4px;
}

.conge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: var(--surface-soft);
    border-radius: var(--radius);
    margin-bottom: 8px;
    gap: 12px;
}

.conge-row:last-child { margin-bottom: 0; }

.conge-row .conge-dates {
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-size: 0.92rem;
}

.conge-row .conge-type {
    font-size: 0.74rem;
    color: var(--text-secondary);
    background: var(--card);
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
    border: 1px solid var(--border);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================
   Bottom navigation
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(200%) blur(20px);
    -webkit-backdrop-filter: saturate(200%) blur(20px);
    border-top: 1px solid var(--border-soft);
    box-shadow: var(--shadow-up);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 20;
}

.bottom-nav a {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
    padding: 8px 0;
}

/* Barre supérieure animée pour l'item actif */
.bottom-nav a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--primary);
    transition: transform var(--transition-spring);
}

.bottom-nav a.active::before {
    transform: translateX(-50%) scaleX(1);
}

.bottom-nav a .nav-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 30px;
    border-radius: 16px;
    transition: background var(--transition);
}

.bottom-nav a .material-icons-round {
    font-size: 24px;
    transition: transform var(--transition-spring);
}

.bottom-nav a .lbl {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.bottom-nav a.active {
    color: var(--primary);
}

.bottom-nav a.active .nav-icon-wrap {
    background: var(--primary-pastel);
}

.bottom-nav a.active .material-icons-round {
    transform: translateY(-1px) scale(1.08);
}

.bottom-nav a:active .material-icons-round {
    transform: scale(0.88);
}

/* ============================================
   Toast
   ============================================ */
.toast-wrap {
    position: fixed;
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
    width: calc(100% - 32px);
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    pointer-events: auto;
    background: var(--text);
    color: var(--text-inverse);
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    transition: opacity var(--transition), transform var(--transition);
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.error   { background: linear-gradient(135deg, var(--danger), var(--danger-dark)); }
.toast.success { background: linear-gradient(135deg, var(--success), var(--success-dark)); }
.toast.info    { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }

/* ============================================
   Spinner
   ============================================ */
.spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mt-spin 0.75s linear infinite;
}

.spinner-dark {
    border-color: rgba(0, 0, 0, 0.08);
    border-top-color: var(--primary);
}

/* ============================================
   Mode kiosque
   ============================================ */
body.kiosque .kiosque-badge {
    display: inline-block !important;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #fff;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-left: 6px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
    vertical-align: middle;
}

.kiosque-badge { display: none; }

/* ============================================
   Utilitaires
   ============================================ */
.text-muted      { color: var(--text-muted); }
.text-secondary  { color: var(--text-secondary); }
.text-success    { color: var(--success); }
.text-danger     { color: var(--danger); }
.text-center     { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.row-flex { display: flex; align-items: center; gap: 8px; }
.flex-1  { flex: 1; }
.hidden  { display: none !important; }

/* ============================================
   PWA Install Banner — bandeau d'installation
   ============================================ */
.install-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 12px 14px;
    box-shadow: var(--shadow-lg);
    /* Animation d'entrée */
    transform: translateY(120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    will-change: transform, opacity;
}

.install-banner.show {
    transform: translateY(0);
    opacity: 1;
}

/* Page home — décalage pour ne pas chevaucher le bottom-nav */
.app .install-banner,
body.has-bottom-nav .install-banner {
    bottom: calc(var(--nav-height, 80px) + 12px + env(safe-area-inset-bottom, 0px));
}

.install-banner .install-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-glow-primary);
}

.install-banner .install-banner-icon .material-icons-round {
    font-size: 22px;
}

.install-banner .install-banner-body {
    flex: 1;
    min-width: 0;
}

.install-banner .install-banner-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.install-banner .install-banner-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    line-height: 1.3;
}

.install-banner-btn {
    flex-shrink: 0;
    height: 36px;
    padding: 0 14px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: var(--shadow-glow-primary);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.install-banner-btn:active {
    transform: scale(0.96);
    box-shadow: 0 4px 12px -2px rgba(74, 144, 217, 0.45);
}

.install-banner-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.install-banner-close:hover,
.install-banner-close:active {
    background: var(--surface-soft);
    color: var(--text-secondary);
}

.install-banner-close .material-icons-round {
    font-size: 18px;
}

@media (prefers-reduced-motion: reduce) {
    .install-banner {
        transition: none;
        transform: none;
        opacity: 1;
    }
    .install-banner.show {
        transform: none;
    }
}

/* ============================================
   PWA Install — modale iOS (instructions)
   ============================================ */
.install-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.install-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.install-modal.show .install-modal-backdrop {
    opacity: 1;
}

.install-modal-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    background: var(--card);
    border-radius: 20px;
    padding: 24px 22px 20px;
    box-shadow: var(--shadow-xl);
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    outline: none;
}

.install-modal.show .install-modal-card {
    transform: scale(1);
    opacity: 1;
}

.install-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--surface-soft);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.install-modal-close:active {
    background: var(--border);
}

.install-modal-close .material-icons-round {
    font-size: 18px;
}

.install-modal-emoji {
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 6px;
    line-height: 1;
}

.install-modal-title {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.install-modal-sub {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.install-steps {
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.install-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface-soft);
    border-radius: 14px;
}

.install-step-num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.install-step-text {
    flex: 1;
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.4;
}

.install-step-text strong {
    font-weight: 700;
    color: var(--primary-dark);
}

.install-step-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.install-modal-ok {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: var(--shadow-glow-primary);
    transition: transform var(--transition-fast);
}

.install-modal-ok:active {
    transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
    .install-modal-backdrop,
    .install-modal-card {
        transition: none;
    }
    .install-modal-card {
        transform: none;
        opacity: 1;
    }
}
