/* =============================================================
   Foxbox · Fiches clients — thème clair, accessible (cible 60+)
   ============================================================= */
:root {
    --bg: #fbf7f1;
    --bg-elev: #f4eee3;
    --bg-card: #ffffff;
    --fg: #1e1c19;
    --fg-soft: #3d3a35;
    --fg-muted: #6e665b;

    --accent: #ee6f1c;
    --accent-dark: #c2540a;
    --accent-hover: #d35d12;
    --accent-soft: #fef0e1;

    --success-bg: #e8f5ea;
    --success-fg: #1f6b3a;
    --success-border: #b9dec4;

    --danger: #c4302b;
    --danger-hover: #a4231e;
    --danger-soft: #fbe7e6;

    --border: #e3dcce;
    --border-strong: #cdc4b3;
    --shadow-sm: 0 1px 2px rgba(60, 40, 10, 0.06);
    --shadow: 0 2px 6px rgba(60, 40, 10, 0.07), 0 8px 24px rgba(60, 40, 10, 0.06);
    --radius: 10px;
    --focus: 0 0 0 3px rgba(238, 111, 28, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.55;
    color: var(--fg);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: none;
    box-shadow: var(--focus);
    border-radius: 6px;
}

/* ===== Top bar ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 32px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.topbar .brand a {
    color: var(--fg);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.01em;
}
.topbar .brand a:hover { text-decoration: none; color: var(--accent-dark); }
.topbar .user {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 16px;
}
.topbar .who { color: var(--fg-soft); font-weight: 500; }

/* ===== Layout ===== */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 28px 64px;
}

h1 { font-size: 32px; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 24px; margin: 0 0 18px; letter-spacing: -0.005em; }
.subtitle { color: var(--fg-muted); font-size: 17px; margin: 0 0 28px; }

/* ===== Card ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ===== Flash messages ===== */
.flash {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 16px;
    border: 1px solid transparent;
}
.flash-ok {
    background: var(--success-bg);
    color: var(--success-fg);
    border-color: var(--success-border);
    font-weight: 500;
}
.flash-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #f0bcbc;
}
.flash-error ul { margin: 4px 0 0; padding-left: 22px; }
.error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #f0bcbc;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 15px;
}

/* ===== Form fields ===== */
label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 15px;
    font-weight: 500;
    color: var(--fg-soft);
}

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=date], select, textarea {
    background: var(--bg-card);
    color: var(--fg);
    border: 1.5px solid var(--border-strong);
    border-radius: 8px;
    padding: 13px 14px;
    font-size: 17px;
    font-family: inherit;
    min-height: 48px;
    transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--fg-muted); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus);
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236e665b' d='M6 8 0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* ===== Buttons (≥44px tall for accessibility) ===== */
.btn, button {
    cursor: pointer;
    border: 1.5px solid transparent;
    border-radius: 8px;
    padding: 12px 22px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    transition: background .15s, border-color .15s, color .15s, transform .05s;
    line-height: 1.2;
}
.btn:active, button:active { transform: translateY(1px); }
.btn:hover { text-decoration: none; }

.btn-primary, button[type=submit] {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 2px 4px rgba(238, 111, 28, 0.25);
}
.btn-primary:hover, button[type=submit]:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--fg);
    border-color: var(--border-strong);
}
.btn-secondary:hover {
    background: var(--bg-elev);
    border-color: var(--fg-muted);
    color: var(--fg);
}

.btn-danger {
    background: var(--bg-card);
    color: var(--danger);
    border-color: #e7b8b6;
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-large { font-size: 17px; padding: 14px 26px; min-height: 52px; }
.btn-small { font-size: 14px; padding: 8px 14px; min-height: 38px; }

.btn-link {
    background: none;
    border: none;
    color: var(--accent-dark);
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    font-family: inherit;
    text-decoration: underline;
    min-height: auto;
}
.btn-link:hover { color: var(--accent-hover); }

/* ===== Login page ===== */
.login-wrap {
    max-width: 460px;
    margin: 80px auto;
    text-align: center;
}
.login-wrap h1 { margin-bottom: 8px; }
.login-wrap .card { text-align: left; margin-top: 24px; }

/* ===== Dashboard ===== */
.dashboard { display: flex; flex-direction: column; gap: 24px; }

.week-header {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow-sm);
}
.week-eyebrow {
    margin: 0;
    color: var(--fg-muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.week-title {
    margin: 6px 0 0;
    font-size: 26px;
    color: var(--fg);
}
.back-today {
    display: inline-block;
    margin-top: 10px;
    color: var(--accent-dark);
    font-size: 15px;
}

.assign-form {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    text-align: center;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}
.assign-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--fg-soft);
    margin-bottom: 8px;
}
.assign-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    justify-content: center;
}
.assign-select {
    flex: 1 1 320px;
    min-width: 220px;
    max-width: 420px;
    font-size: 17px;
    font-weight: 500;
}
.assign-current {
    margin: 12px 0 0;
    font-size: 15px;
    color: var(--fg-soft);
}

.week-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 70px;
    padding: 10px 8px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
    font-family: inherit;
    text-align: center;
}
.nav-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--fg);
    text-decoration: none;
}
.nav-btn:active { transform: translateY(1px); }
.nav-btn .arrow {
    font-size: 22px;
    color: var(--accent);
    line-height: 1;
    font-weight: 400;
}
.nav-btn .lbl { font-size: 14px; }
.nav-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.nav-btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}
.nav-btn-primary .lbl { font-size: 15px; }

.nav-btn-wrap {
    display: block;
    width: 100%;
}
.nav-btn-wrap .nav-btn { width: 100%; }
.nav-btn-wrap input[data-input] {
    position: absolute;
    width: 0; height: 0; padding: 0; margin: 0;
    border: 0; opacity: 0; pointer-events: none;
}

.actions-bar {
    display: flex;
    justify-content: flex-end;
}

/* ===== Table ===== */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
table.fiches {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 16px;
}
table.fiches th, table.fiches td {
    padding: 16px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.fiches th {
    background: var(--bg-elev);
    color: var(--fg-soft);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
table.fiches tbody tr:hover { background: #fffaf2; }
table.fiches tbody tr:last-child td { border-bottom: none; }
table.fiches .notes-row td {
    background: var(--bg-elev);
    padding-top: 10px;
    padding-bottom: 14px;
    font-size: 15px;
    border-bottom: 1px solid var(--border);
}
table.fiches .notes-row td:first-child { background: var(--bg-card); }
table.fiches td.actions { white-space: nowrap; text-align: right; }
table.fiches td.actions .btn { margin-left: 6px; }
table.fiches .th-actions { text-align: right; }
.cell-date { color: var(--accent-dark); white-space: nowrap; }
.client-name { font-weight: 600; font-size: 17px; color: var(--fg); }
.badge-veille {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-dark);
    background: rgba(255, 165, 0, 0.18);
    border: 1px solid var(--accent-dark);
    border-radius: 10px;
    vertical-align: middle;
}
.checkbox-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
}
.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}
.checkbox-row span { user-select: none; }

.muted { color: var(--fg-muted); }
.small { font-size: 14px; }

.empty {
    text-align: center;
    padding: 80px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}
.empty-title { font-size: 19px; margin: 0 0 8px; color: var(--fg); font-weight: 600; }

/* ===== Form layout ===== */
.form-wrap { max-width: 760px; margin: 0 auto; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}
.form-actions .btn { flex: 0 0 auto; }

/* ===== Flatpickr — légères retouches pour s'aligner avec le thème ===== */
.flatpickr-calendar {
    box-shadow: var(--shadow) !important;
    border-radius: var(--radius) !important;
    border: 1px solid var(--border) !important;
    font-size: 15px !important;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}
.flatpickr-day.today {
    border-color: var(--accent) !important;
}
.flatpickr-day:hover { background: var(--accent-soft) !important; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .week-nav { grid-template-columns: repeat(2, 1fr); }
    .nav-btn-wrap { grid-column: span 2; }
}
@media (max-width: 640px) {
    body { font-size: 16px; }
    .topbar { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }
    .container { padding: 18px 14px 40px; }
    .grid-2 { grid-template-columns: 1fr; }
    .week-title { font-size: 21px; }
    .nav-btn { min-height: 60px; font-size: 14px; }
    .nav-btn .arrow { font-size: 18px; }
    table.fiches { font-size: 15px; }
    table.fiches th, table.fiches td { padding: 12px 12px; }
    table.fiches td.actions { white-space: normal; }
    table.fiches td.actions .btn { margin: 4px 0 0 4px; }
}
