/* Pointeuse (time clock) and Pointages (timesheet management). Same look as the original time clock:
   sober, square corners, Entrée in green and Sortie in red, the manager's additions tinted red. */

.ts-page { max-width: 1320px; margin: 0 auto; }
.ts-page > .page-head { margin-bottom: .5rem; }
.ts-page > .page-head .muted { max-width: 60ch; }
.ts-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 1rem; align-items: start; }
.ts-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.ts-col > .panel + .panel { margin-top: 0; }
.ts-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; align-items: start; margin: 1rem 0; }
.ts-narrow { max-width: 760px; }
.ts-narrow .panel + .panel, .ts-narrow form + .panel { margin-top: 1rem; }
.ts-note { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }

/* ---------- punch zone */
.ts-punchp { padding: .8rem; }
.ts-punch { display: flex; gap: .7rem; }
.ts-punch button { flex: 1; justify-content: center; padding: 1.05rem .5rem; font-size: 1.15rem; font-weight: 700; border-width: 2px; letter-spacing: .02em; }
.ts-punch .ts-in { background: var(--ok); color: #fff; border-color: var(--ok); }
.ts-punch .ts-in:hover:not(:disabled) { filter: brightness(1.1); background: var(--ok); }
.ts-punch .ts-out { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.ts-punch .ts-out:hover:not(:disabled) { background: var(--danger); color: #fff; }
.ts-punch button:disabled { opacity: .35; }
:root[data-theme="dark"] .ts-punch .ts-in { color: #06160d; }
.ts-status { text-align: center; color: var(--muted); font-size: .92rem; margin: .7rem 0 .6rem; min-height: 1.3em; }
.ts-todayrow { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; justify-content: space-between; border-top: 1px dashed var(--line); padding-top: .6rem; }
.ts-pairs { display: flex; flex-wrap: wrap; gap: .3rem; }
.ts-pair { border: 1px solid var(--line); background: var(--surface-2); padding: .1rem .45rem; font-size: .85rem; white-space: nowrap; }
.ts-mode { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); }
.ts-mode select { color: var(--text); font-size: .9rem; }

/* ---------- calendar */
.ts-calhead { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.ts-calhead h3 { flex: 1; text-align: center; text-transform: capitalize; }
.ts-calhead button.icon { width: 2.2rem; height: 2.2rem; font-size: 1.2rem; }
.ts-dow, .ts-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(56px, .9fr); gap: 4px; }
.ts-dow { margin-bottom: .35rem; }
.ts-dow div { text-align: center; font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.ts-day { min-height: 62px; border: 1px solid var(--line); padding: 3px 5px; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; gap: 1px; background: var(--surface); text-align: left; font-size: .85rem; min-width: 0; overflow: hidden; }
.ts-day:hover { border-color: var(--line-strong); background: var(--surface); }
.ts-day .n { font-size: .85rem; line-height: 1.1; }
.ts-day .b { display: flex; flex-direction: column; min-width: 0; }
.ts-day .b > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.ts-day .t { font-size: .74rem; color: var(--ok); font-weight: 700; }
.ts-day .f { font-size: .66rem; color: var(--warn); font-weight: 600; }
.ts-day.live .f { color: var(--ok); }
.ts-day .a { font-size: .66rem; color: var(--accent); font-weight: 700; }
.ts-day.we { background: var(--surface-2); }
.ts-day.other { opacity: .42; }
.ts-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.ts-day.today .n { font-weight: 700; color: var(--accent); }
.ts-day.sel { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.ts-day.inc { border-bottom: 3px solid var(--warn); }
.ts-wk { display: flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; font-weight: 700; min-width: 0; }
.ts-wk.zero { color: var(--muted); font-weight: 400; }
.ts-total { margin: .7rem 0 0; font-size: .9rem; text-align: right; color: var(--muted); }
.ts-total strong { color: var(--text); }
hr.ts-sep { border: 0; border-top: 1px dashed var(--line); margin: 1rem 0; }

/* ---------- day detail */
.ts-dayhead { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.ts-dayhead h3::first-letter { text-transform: uppercase; }
table.ts-entries td { padding: .32rem .45rem; }
table.ts-entries td.ts-time { font-size: 1rem; font-weight: 700; width: 5.5rem; }
.ts-type { display: inline-flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.ts-in-l { color: var(--ok); font-weight: 700; font-size: .85rem; }
.ts-out-l { color: var(--danger); font-weight: 700; font-size: .85rem; }
table.ts-entries tr.manager, .ts-team tr.manager { background: color-mix(in srgb, var(--danger) 9%, transparent); }
table.ts-entries tr.manager:hover, .ts-team tr.manager:hover { background: color-mix(in srgb, var(--danger) 16%, transparent); }
table.ts-entries tr.corrected td, .ts-team tr.corrected td { font-style: italic; }
table.ts-entries tr.editing { background: var(--accent-soft); }
table.ts-entries tr.editing td { font-style: normal; }
.ts-edit { display: flex; gap: .5rem .8rem; flex-wrap: wrap; align-items: flex-end; }
.ts-edit .ts-type { align-self: center; min-width: 5.5rem; }
.ts-editf { display: flex; flex-direction: column; gap: .15rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.ts-editf input { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); }
.ts-edit .ts-acts { margin-left: auto; }
tr.editing .ts-note { margin: .4rem 0 0; }
.ts-acts { display: inline-flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.ts-none { margin: .3rem 0; }
button.ts-add { width: 100%; justify-content: center; margin-top: .5rem; border: 1px dashed var(--line-strong); background: none; }
button.ts-add:hover { background: var(--surface-2); }
.ts-dayabs { list-style: none; margin: .6rem 0 0; padding: 0; }
.ts-dayabs li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .3rem .5rem; border-left: 4px solid var(--accent); background: var(--accent-soft); margin-bottom: 3px; font-size: .9rem; }
.ts-dayfoot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.ts-dayfoot .ts-total { margin: 0; }

/* ---------- balance and recap */
.ts-bal { display: flex; justify-content: space-between; gap: .8rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.ts-bal:last-child { border-bottom: 0; }
.ts-bal .hint { display: block; font-size: .78rem; color: var(--muted); }
.ts-bal .val { font-weight: 700; white-space: nowrap; }
.ts-gauge { height: 6px; background: var(--surface-2); overflow: hidden; margin: .1rem 0 .4rem; border: 1px solid var(--line); }
.ts-gauge > span { display: block; height: 100%; width: 0; background: var(--accent); }
.ts-rh { font-size: .95rem; margin-bottom: .3rem; }
.ts-rh::first-letter { text-transform: uppercase; }
ul.ts-weeks { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
ul.ts-weeks li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 .6rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
ul.ts-weeks .ts-wt { font-weight: 700; }
ul.ts-weeks li.sum { font-weight: 700; }
ul.ts-weeks li.first { border-top: 1px solid var(--line-strong); margin-top: .4rem; }
ul.ts-weeks li:last-child { border-bottom: 0; }
.ts-sub { flex-basis: 100%; font-size: .78rem; color: var(--muted); margin-top: 2px; white-space: pre-wrap; }
.ts-trip-h { font-size: .78rem; color: var(--muted); margin: 1rem 0 .2rem; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- leave */
.ts-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .7rem; }
.ts-card { border: 1px solid var(--line-strong); padding: .7rem .8rem; background: var(--surface); min-width: 0; }
.ts-card h4 { margin: 0 0 .4rem; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ts-card .big { font-size: 1.45rem; font-weight: 700; line-height: 1.15; }
.ts-card .sub { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.ts-absfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 .7rem; }
.ts-absfields input, .ts-absfields select { width: 100%; }
tr.past td { color: var(--muted); }
.ts-setgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; margin-top: .6rem; }
.ts-setgrid input, .ts-setgrid select { width: 100%; }

/* ---------- settings */
.ts-settings .panel + .panel { margin-top: 1rem; }
.ts-line { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin: .3rem 0 .6rem; font-size: .92rem; }
.ts-line label { display: inline-flex; align-items: center; gap: .4rem; }
.ts-line input[type=number] { width: 5.5rem; }
.ts-savebar { margin-top: 1rem; position: sticky; bottom: 0; background: var(--bg); padding: .6rem 0; border-top: 1px solid var(--line); z-index: 2; }

/* ---------- timesheet management (Pointages) */
.ts-team .toolbar { gap: .5rem .7rem; }
.ts-team .seg { flex-wrap: wrap; }
.ts-period { font-size: .9rem; }
.ts-period b::first-letter { text-transform: uppercase; }
.ts-custom { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.ts-team .stats { margin-bottom: 1rem; background: var(--surface); }
.ts-team .stat b { font-size: 1.35rem; }
.ts-team table td.num, .ts-team table th.num { white-space: nowrap; }
.ts-team tbody tr.clickable td:first-child button { text-align: left; }
.ts-team tr.zero td { color: var(--muted); }
.ts-team tr.dayoff td { color: var(--muted); }
.ts-team tr.we td { background: var(--surface-2); }
.ts-team .ts-who { white-space: nowrap; display: inline-flex; gap: .4rem; align-items: center; }
.ts-flags { display: inline-flex; gap: .25rem; flex-wrap: wrap; }
.ts-ctx { border: 1px solid var(--line); background: var(--surface-2); padding: .5rem .6rem; font-size: .88rem; margin: .2rem 0 .7rem; min-height: 2.4rem; }

@media (max-width: 1100px) {
  .ts-grid { grid-template-columns: 1fr; }
  /* One column: punch zone first, then the balance, the calendar and the recap. */
  .ts-col { display: contents; }
  .ts-punchp { order: 1; } .ts-balp { order: 2; } .ts-calp { order: 3; } .ts-recapp { order: 4; }
}
@media (max-width: 700px) {
  .ts-page > .page-head .muted { display: none; }
  .ts-punch button { padding: 1.2rem .4rem; font-size: 1.2rem; }
  .ts-dow, .ts-cal { grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 1.15fr); gap: 2px; }
  .ts-dow div { font-size: .62rem; letter-spacing: 0; }
  .ts-day { min-height: 50px; padding: 2px 3px; min-height: 50px; }
  .ts-day .n { font-size: .78rem; }
  .ts-day .t { font-size: .64rem; letter-spacing: -.02em; }
  .ts-day .f { display: none; }
  .ts-day .a { font-size: .58rem; }
  .ts-wk { font-size: .64rem; letter-spacing: -.02em; }
  .ts-calp > .pb, .ts-recapp > .pb { padding: .6rem .5rem; }
  table.ts-entries td.ts-time { width: auto; }
  .ts-edit .ts-acts { margin-left: 0; }
  .ts-cards { grid-template-columns: 1fr 1fr; }
  .ts-card .big { font-size: 1.2rem; }
}
.ts-note.pad { padding: .5rem .8rem .7rem; margin: 0; }
.ts-grid2 > .panel + .panel { margin-top: 0; }
.ts-setgrid { align-items: end; }
.ts-setgrid .field .hint { min-height: 1.1em; }
table.ts-entries tr.corrected td button { font-style: normal; }
.ts-team tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-strong); border-bottom: 0; }
/* The visually hidden "Actions" headers are absolutely positioned: keep them inside the scrolling table. */
.ts-page .tw, .ts-team .tw { position: relative; }
.ts-pairs-cell { display: flex; flex-wrap: wrap; gap: 0 .6rem; }
.ts-pairs-cell span { white-space: nowrap; }
