/* LN2 Consult staff area (/espace/, /rapports/) — mobile first */
:root {
  --accent: #ff914c;
  --accent-dark: #e8752d;
  --ink: #2a2f35;
  --muted: #6b7178;
  --line: #e3e5e8;
  --bg: #f4f5f7;
  --card: #ffffff;
  --danger: #c62828;
  --danger-bg: #fdecea;
  --warning: #8a5300;
  --warning-bg: #fff4e0;
  --success: #1e7b34;
  --success-bg: #e8f5ea;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent-dark); }
h1 { font-size: 1.45rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .5rem 16px;
  background: var(--ink); color: #fff;
}
.topbar .brand { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-weight: 600; }
.topbar .brand img { height: 32px; width: auto; background: #fff; border-radius: 6px; padding: 2px 4px; }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: .9rem; opacity: .85; }
.topbar nav { display: none; }
.menu-toggle {
  background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px;
  font-size: 1.3rem; line-height: 1; padding: .35rem .6rem; cursor: pointer;
}
.drawer { display: none; background: var(--ink); padding: 0 16px 1rem; }
.drawer.open { display: block; }
.drawer a, .drawer button.linklike {
  display: block; width: 100%; text-align: left; color: #fff; text-decoration: none;
  padding: .8rem 0; border: 0; border-top: 1px solid rgba(255,255,255,.12); background: none; font: inherit; cursor: pointer;
}
.lang-switch { display: inline-flex; gap: .25rem; }
.lang-switch button {
  background: none; border: 1px solid rgba(255,255,255,.35); color: #fff; border-radius: 6px;
  padding: .2rem .45rem; font-size: .8rem; cursor: pointer;
}
.lang-switch button.active { background: var(--accent); border-color: var(--accent); }

@media (min-width: 860px) {
  .menu-toggle, .drawer, .drawer.open { display: none; }
  .topbar nav { display: flex; align-items: center; gap: 1rem; }
  .topbar nav a, .topbar nav button.linklike {
    color: #fff; text-decoration: none; font-size: .95rem; background: none; border: 0; font: inherit; cursor: pointer; padding: 0;
  }
  .topbar nav a:hover, .topbar nav button.linklike:hover { color: var(--accent); }
}

/* ---------- layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 1rem 16px 3rem; }
.container.narrow { max-width: 760px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}
.muted { color: var(--muted); font-size: .9rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li, .alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: .5rem; }
.messages .success, .alert-success { background: var(--success-bg); color: var(--success); }
.messages .error, .alert-error { background: var(--danger-bg); color: var(--danger); }
.messages .warning, .alert-warning { background: var(--warning-bg); color: var(--warning); }
.messages .info, .alert-info { background: #eaf2fb; color: #1b4f8a; }

/* ---------- home menu ---------- */
.menu-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 640px) { .menu-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .menu-grid { grid-template-columns: repeat(3, 1fr); } }
.menu-button {
  display: flex; align-items: center; gap: .9rem;
  min-height: 84px; padding: 1rem 1.2rem;
  background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--accent);
  border-radius: var(--radius); color: var(--ink); text-decoration: none; font-size: 1.1rem; font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.menu-button:hover, .menu-button:focus { border-color: var(--accent); background: #fffaf6; }
.menu-button .icon { font-size: 1.6rem; width: 2rem; text-align: center; }
.menu-button.secondary { border-left-color: var(--ink); }

/* client sections on /espace/ (one per client, Admin block on top) */
.home-greeting { padding-bottom: .75rem; margin-bottom: 1.25rem; border-bottom: 2px solid var(--line); }
.menu-section { margin-bottom: 1.75rem; }
.menu-section-admin { padding-bottom: 1.5rem; border-bottom: 2px solid var(--line); }
.menu-section-title {
  margin: 0 0 .75rem; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
}
.menu-button.admin { border-left-color: var(--ink); background: var(--ink); color: #fff; }
.menu-button.admin:hover, .menu-button.admin:focus { background: #3a4048; border-color: var(--ink); }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number],
input[type=month], select, textarea, .rte-area {
  width: 100%; padding: .65rem .7rem; font: inherit; color: inherit;
  border: 1px solid #c9cdd2; border-radius: 8px; background: #fff; min-height: 44px;
}
input:focus, select:focus, textarea:focus, .rte-area:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
/* date on its own row, then Début and Fin side by side at equal width */
.grid-times { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}
.errorlist { list-style: none; padding: 0; margin: .3rem 0 0; color: var(--danger); font-size: .88rem; }
.field.has-error input, .field.has-error select, .field.has-error .rte-area { border-color: var(--danger); }
.inline-add { display: flex; gap: .5rem; align-items: flex-end; }
.inline-add > :first-child { flex: 1; }
.helptext { color: var(--muted); font-size: .85rem; margin-top: .25rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: #fff; color: var(--ink); border-color: #c9cdd2; }
.btn-secondary:hover { border-color: var(--ink); }
.btn-danger { background: #fff; color: var(--danger); border-color: #e6b5b5; }
.btn-small { min-height: 36px; padding: .35rem .7rem; font-size: .9rem; }
.actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.25rem; }
.actions .btn { width: 100%; }
@media (min-width: 640px) {
  .actions { flex-direction: row; justify-content: flex-end; }
  .actions .btn { width: auto; }
}

/* ---------- rich text editor ---------- */
.rte-area { min-height: 180px; overflow-y: auto; }
.rte-area p { margin: 0 0 .75rem; }
.rte-area:empty::before { content: attr(data-placeholder); color: var(--muted); }

/* ---------- cancelled on site ---------- */
.cancel-box { border: 1px solid #f0c9c4; background: #fff7f6; border-radius: var(--radius); padding: .75rem; margin-bottom: 1rem; }
.cancel-box .checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: 1rem; margin: 0; }
.cancel-box .checkbox-label input { width: 20px; height: 20px; }
.cancel-box #cancellation-fields { margin-top: .75rem; }
.is-cancelled .worker-row .times { display: none; }
.badge-cancelled { background: #fde8e6; color: #b42318; }

/* ---------- worker rows ---------- */
.worker-row {
  border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin-bottom: .75rem; background: #fcfcfd;
}
.worker-row .worker-head { display: flex; gap: .5rem; align-items: flex-end; }
.worker-row .worker-head .field { flex: 1; margin-bottom: .6rem; }
.worker-row .times { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.worker-row .times .field { margin-bottom: .3rem; }
.worker-row .row-footer { display: flex; justify-content: space-between; align-items: center; font-size: .92rem; }
.worker-row .hours { font-weight: 700; }
.worker-row .window-warning { color: var(--warning); font-size: .85rem; margin-top: .3rem; }
.worker-row.removed { display: none; }
.remove-row { background: none; border: 0; color: var(--danger); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: .4rem; min-height: 44px; }
.total-line { text-align: right; font-size: 1.05rem; font-weight: 700; padding: .25rem 0; }

/* ---------- attachments ---------- */
.attachment-list { list-style: none; padding: 0; margin: 0 0 .75rem; }
.attachment-list li { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.attachment-list img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--bg); }
.attachment-list .name { flex: 1; word-break: break-all; font-size: .92rem; }
.file-drop { border: 2px dashed #c9cdd2; border-radius: var(--radius); padding: 1rem; text-align: center; background: #fff; }
.file-drop input { width: 100%; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; background: #fff; }
table.data th, table.data td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data th { background: #f8f9fa; font-weight: 600; }
table.data td.num, table.data th.num { text-align: right; }
table.data tr.subtotal td { font-weight: 700; background: #fbfbfc; }
table.data tr.grand-total td { font-weight: 700; background: #fff4ec; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge-submitted, .badge-sent { background: var(--success-bg); color: var(--success); }
.badge-draft { background: #eceef1; color: var(--muted); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-correction { background: var(--warning-bg); color: var(--warning); }

/* ---------- report cards (lists) ---------- */
.report-item { display: block; text-decoration: none; color: inherit; }
.report-item .card { margin-bottom: .6rem; }
.report-item .title { font-weight: 600; }

/* ---------- dashboard ---------- */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; align-items: end; }
.filters .field { margin-bottom: 0; }
@media (min-width: 860px) { .filters { grid-template-columns: repeat(6, 1fr); } }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1rem 0; }
@media (min-width: 860px) { .stats { grid-template-columns: repeat(4, 1fr); } .stats-money { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 860px) { .stats-money + .stats-money { grid-template-columns: repeat(4, 1fr); } }
.stats-money { margin-top: 0; }
.stat-pay { border-left: 4px solid var(--accent); }
.stat-margin { background: #fff8f2; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; }
.stat .label { color: var(--muted); font-size: .85rem; }
.split { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 860px) { .split { grid-template-columns: 1fr 1fr; } }
.chart-box { position: relative; height: 300px; }
.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px solid var(--line); }

/* ---------- detail ---------- */
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
dl.details dt { font-weight: 600; color: var(--muted); }
dl.details dd { margin: 0; }
.report-body p { margin: 0 0 .75rem; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 2rem 1.5rem; box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.login-box .logo { display: block; margin: 0 auto 1rem; max-width: 160px; height: auto; }
.login-box h1 { text-align: center; font-size: 1.3rem; }
.login-box .btn { width: 100%; }
.login-box .lang-switch { display: flex; justify-content: center; margin-top: 1rem; }
.login-box .lang-switch button { color: var(--ink); border-color: #c9cdd2; }
.login-box .lang-switch button.active { color: #fff; }

/* Tom Select tweaks */
.ts-wrapper .ts-control { min-height: 44px; border-radius: 8px; border-color: #c9cdd2; font-size: 16px; padding: .55rem .7rem; }
.ts-dropdown { font-size: 16px; }
