/* =====================================================================
   Pivox Boussole — feuille de style (mobile-first, identité Pivox).
   ===================================================================== */

@font-face {
    font-family: 'Ubuntu Sans';
    src: url('/assets/fonts/ubuntu-sans-var.woff2') format('woff2');
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --violet: #5d5bea;
    --violet-dark: #4a28c6;
    --magenta: #c558e8;
    --navy: #1b1033;
    --navy-2: #2a1a52;

    --bg: #f5f4fb;
    --surface: #ffffff;
    --surface-2: #faf9fe;
    --border: #e7e4f3;
    --text: #201b30;
    --text-soft: #6d6a84;
    --text-faint: #9a97ad;
    --ok: #2a7a3f;
    --ok-bg: #e7f6ec;
    --warn: #b45309;
    --warn-bg: #fff3e6;
    --danger: #c0392b;
    --danger-bg: #fdecea;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px -18px rgba(40, 20, 90, .45);
    --shadow-lg: 0 18px 44px -22px rgba(40, 20, 90, .5);
    --font: 'Ubuntu Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --nav-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--violet-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.22; letter-spacing: -.015em; }
button { font-family: inherit; }

/* ---- Marque ---- */
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.brand-pivox { color: var(--violet); }
.brand-prod { color: var(--navy); }

/* =========================== Auth (public) =========================== */
.auth-body {
    min-height: 100vh; margin: 0;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(1200px 500px at 50% -10%, #3b2270 0%, transparent 60%),
                linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 70%);
    padding: 24px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
    background: var(--surface); border-radius: 20px;
    padding: 34px 30px; box-shadow: var(--shadow-lg);
}
.auth-card .brand { display: inline-block; margin-bottom: 22px; font-size: 1.35rem; }
.auth-card h1 { font-size: 1.4rem; margin: 0 0 4px; }
.auth-card .sub { color: var(--text-soft); margin: 0 0 22px; font-size: .95rem; }
.auth-foot { text-align: center; color: rgba(255,255,255,.55); font-size: .82rem; margin-top: 18px; }
.auth-alt { margin-top: 16px; font-size: .9rem; color: var(--text-soft); text-align: center; }

/* =========================== Formulaires =========================== */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > .form-group { flex: 1; min-width: 140px; }
.form-group label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 12px 14px; font: inherit; color: var(--text);
    background: var(--surface-2); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(93,91,234,.12); }
textarea.form-control { min-height: 84px; resize: vertical; }
.form-hint { color: var(--text-soft); font-size: .82rem; margin-top: 4px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 18px; font: inherit; font-weight: 600; line-height: 1;
    border: none; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
    transition: transform .05s, filter .15s, background .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--violet), var(--violet-dark)); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-block { width: 100%; }
.btn-light { background: #efedfa; color: var(--violet-dark); }
.btn-light:hover { background: #e6e3f8; }
.btn-ghost { background: transparent; color: var(--text-soft); border: 1.5px solid var(--border); }
.btn-danger-soft { background: var(--danger-bg); color: var(--danger); }
.btn-sm { padding: 8px 12px; font-size: .88rem; border-radius: 9px; }
.btn-link { background: none; border: none; color: var(--text-soft); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.inline-form { display: inline; margin: 0; }

.remember { display: flex; align-items: center; gap: 9px; margin: -2px 0 18px; font-size: .9rem; color: var(--text-soft); cursor: pointer; }
.remember input { width: 17px; height: 17px; accent-color: var(--violet); }

.form-error {
    background: var(--danger-bg); border: 1px solid #f5c6c0; color: var(--danger);
    border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: .9rem;
}
.form-error ul { margin: 6px 0 0; padding-left: 18px; }
.form-notice {
    background: var(--ok-bg); border: 1px solid #bfe4cb; color: var(--ok);
    border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: .9rem;
}

/* =========================== App shell =========================== */
.app-body { background: var(--bg); min-height: 100vh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
.app-header {
    position: sticky; top: 0; z-index: 20;
    background: rgba(246,245,251,.9); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.app-header-in, .app-main-in { max-width: 680px; margin: 0 auto; padding: 0 16px; }
.app-header-in { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.app-user { display: flex; align-items: center; gap: 12px; }
.app-user-name { font-weight: 600; font-size: .9rem; color: var(--text-soft); }
.app-main { padding: 20px 0 30px; }
.app-flash { background: var(--ok-bg); border-bottom: 1px solid #bfe4cb; }
.app-flash .app-main-in { padding-top: 10px; padding-bottom: 10px; color: var(--ok); font-size: .9rem; }

/* ---- Barre de navigation basse (mobile-first) ---- */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    display: flex; align-items: stretch;
}
.tabbar-in { max-width: 680px; margin: 0 auto; width: 100%; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
.tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--text-faint); font-size: .68rem; font-weight: 600; text-decoration: none; height: var(--nav-h);
}
.tab:hover { text-decoration: none; color: var(--text-soft); }
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--violet-dark); }
.tab-fab { position: relative; }
.tab-fab .fab {
    width: 52px; height: 52px; margin-top: -22px; border-radius: 50%;
    background: linear-gradient(135deg, var(--violet), var(--violet-dark)); color: #fff;
    display: grid; place-items: center; box-shadow: 0 10px 22px -8px rgba(74,40,198,.7);
}
.tab-fab .fab svg { width: 26px; height: 26px; }

/* ---- Titre de page ---- */
.page-head { margin: 2px 0 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head .page-sub { color: var(--text-soft); margin: 4px 0 0; font-size: .95rem; }

/* ---- Blocs / cartes ---- */
.block { margin-bottom: 24px; }
.block-title {
    display: flex; align-items: center; gap: 8px;
    font-size: .78rem; text-transform: uppercase; letter-spacing: .07em;
    color: var(--text-soft); font-weight: 700; margin: 0 0 10px;
}
.block-title .count { background: #ece9f9; color: var(--violet-dark); border-radius: 20px; padding: 1px 9px; font-size: .78rem; letter-spacing: 0; }
.block-title .link { margin-left: auto; font-size: .78rem; letter-spacing: 0; text-transform: none; font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }

/* ---- Listes d'items ---- */
.item-list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: none; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 600; word-break: break-word; }
.item-title.done { text-decoration: line-through; color: var(--text-faint); }
.item-meta { color: var(--text-soft); font-size: .85rem; margin-top: 3px; }
.item-meta .dot { margin: 0 6px; opacity: .5; }
.item-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* Case ronde (cocher / terminer) */
.check {
    appearance: none; -webkit-appearance: none;
    width: 28px; height: 28px; border-radius: 50%; border: 2px solid #d7d3ea; cursor: pointer;
    flex-shrink: 0; display: inline-grid; place-content: center; background: #fff;
    transition: border-color .1s, background .1s; padding: 0;
}
.check:hover { border-color: var(--violet); }
.check:checked, .check.is-done { background: var(--ok); border-color: var(--ok); }
.check:checked::after, .check.is-done::after { content: '✓'; color: #fff; font-size: .95rem; font-weight: 700; }

/* Pastilles / badges */
.streak { display: inline-flex; align-items: center; gap: 4px; background: var(--warn-bg); color: var(--warn); border-radius: 20px; padding: 2px 10px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.badge { display: inline-block; background: #ece9f9; color: var(--violet-dark); border-radius: 6px; padding: 1px 8px; font-size: .75rem; font-weight: 600; }
.badge-due { background: var(--danger-bg); color: var(--danger); }
.badge-size { background: #eef7ef; color: var(--ok); }
.badge-wait { background: var(--warn-bg); color: var(--warn); }
.badge-soft { background: #f0eefb; color: var(--text-soft); }

.btn-today { background: #efedfa; color: var(--violet-dark); border: none; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; line-height: 1; }
.btn-today.on { background: var(--violet); color: #fff; }

/* État vide */
.empty { color: var(--text-soft); font-size: .92rem; padding: 16px; text-align: center; }
.empty-lg { padding: 40px 20px; }
.empty-lg .emoji { font-size: 1.8rem; display: block; margin-bottom: 8px; }

/* ---- Projets ---- */
.proj-card { display: block; padding: 16px; border-bottom: 1px solid var(--border); color: inherit; }
.proj-card:last-child { border-bottom: none; }
.proj-card:hover { background: var(--surface-2); text-decoration: none; }
.proj-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.proj-title { font-weight: 700; }
.proj-meta { color: var(--text-soft); font-size: .85rem; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.proj-obj { color: var(--violet-dark); font-size: .8rem; font-weight: 600; }

/* ---- Filtres segmentés ---- */
.segmented { display: inline-flex; background: #efedf8; border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented a { padding: 6px 12px; border-radius: 8px; font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.segmented a.active { background: #fff; color: var(--violet-dark); box-shadow: var(--shadow); }
.segmented a:hover { text-decoration: none; }

/* ---- Sections de réglages ---- */
.settings-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.settings-section { margin-bottom: 26px; }
.day-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.day-chip { position: relative; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span { display: inline-flex; padding: 9px 13px; border: 1.5px solid var(--border); border-radius: 10px; font-size: .88rem; cursor: pointer; background: #fff; }
.day-chip input:checked + span { background: var(--violet); color: #fff; border-color: var(--violet); }

/* ---- Détails dépliables ---- */
details.collapse { margin-top: 12px; }
details.collapse > summary { cursor: pointer; font-weight: 600; color: var(--text-soft); font-size: .9rem; padding: 6px 0; list-style: none; }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > summary::before { content: '▸ '; }
details.collapse[open] > summary::before { content: '▾ '; }

/* ---- Pause ---- */
.pause-screen { text-align: center; padding: 70px 20px; }
.pause-screen .emoji { font-size: 2.6rem; }
.pause-screen h1 { font-size: 1.6rem; margin: 14px 0 6px; }
.pause-screen p { color: var(--text-soft); }
.pause-screen .discreet { display: inline-block; margin-top: 22px; font-size: .9rem; }

.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack-sm > * + * { margin-top: 10px; }
.muted { color: var(--text-soft); }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

@media (min-width: 620px) {
    .page-head h1 { font-size: 1.75rem; }
}
