:root {
  --bg: #f6f1ea;
  --surface: #ffffff;
  --surface-2: #fbf7f2;
  --ink: #23201d;
  --ink-soft: #6d655c;
  --line: #e4dbd0;
  --accent: #a8452c;
  --accent-soft: #f6e6e1;
  --green: #1f7a4d;
  --green-soft: #e2f2e9;
  --amber: #9a6a00;
  --amber-soft: #fbf0d6;
  --red: #a11f1f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(35, 32, 29, .06), 0 8px 24px rgba(35, 32, 29, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 18px 16px 56px; }
.wrap--wide { max-width: 1100px; }

/* ---------------------------------------------------------------- entête */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 700;
}
.brand span { color: var(--ink-soft); font-size: .85rem; letter-spacing: .04em; }

.link {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--surface);
}
.link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------------------------------------------------------- cartes */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 {
  margin: 0 0 12px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--ink-soft);
  font-weight: 700;
}

.clock { text-align: center; padding: 26px 18px; }
.clock .time {
  font-size: clamp(3rem, 16vw, 4.6rem);
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.clock .date { color: var(--ink-soft); margin-top: 8px; text-transform: capitalize; }

.status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.status .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.status small { display: block; font-weight: 400; color: inherit; opacity: .8; }
.status--off { background: var(--surface-2); border-color: var(--line); color: var(--ink-soft); }
.status--off .dot { background: #b7ada2; }
.status--work { background: var(--green-soft); border-color: #bfe0ce; color: var(--green); }
.status--work .dot { background: var(--green); animation: pulse 2s infinite; }
.status--break { background: var(--amber-soft); border-color: #ecd9a8; color: var(--amber); }
.status--break .dot { background: var(--amber); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ---------------------------------------------------------------- boutons */

.actions { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.actions .full { grid-column: 1 / -1; }

button, .btn {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }

.big {
  min-height: 88px;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.big em { font-style: normal; font-size: 1.5rem; }
.big--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.big--primary:disabled { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--red); border-color: #e6c9c9; background: #fdf3f3; }
.btn--accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--sm { padding: 6px 10px; font-size: .85rem; }

/* ---------------------------------------------------------------- listes */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.timeline li:last-child { border-bottom: 0; }
.timeline .t { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 62px; }
.timeline .lbl { flex: 1; }
.timeline .tag {
  font-size: .72rem;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

.totals { display: flex; gap: 10px; flex-wrap: wrap; }
.total {
  flex: 1 1 140px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.total .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.total .v { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- tableau */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  font-weight: 700;
}
tbody tr:hover { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-bottom: 0; }

/* ---------------------------------------------------------------- formulaires */

label { display: block; font-size: .8rem; color: var(--ink-soft); margin-bottom: 4px; }
input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 150px; }
.row > .fit { flex: 0 0 auto; }

.badge {
  display: inline-block;
  font-size: .72rem;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
}
.badge--open { background: var(--amber-soft); border-color: #ecd9a8; color: var(--amber); }
.badge--warn { background: #fdf0ee; border-color: #eccec6; color: var(--accent); }
.badge--ok { background: var(--green-soft); border-color: #bfe0ce; color: var(--green); }

.msg { border-radius: var(--radius); padding: 11px 14px; margin-bottom: 14px; font-size: .92rem; }
.msg--err { background: #fdf0ee; border: 1px solid #eccec6; color: var(--accent); }
.msg--ok { background: var(--green-soft); border: 1px solid #bfe0ce; color: var(--green); }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.right { text-align: right; }
.stack > * + * { margin-top: 12px; }

/* ---------------------------------------------------------------- modale */

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  width: min(640px, calc(100vw - 24px));
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(35, 32, 29, .25);
}
dialog::backdrop { background: rgba(35, 32, 29, .45); }
.dialog-head, .dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}
.dialog-head { border-bottom: 1px solid var(--line); }
.dialog-foot { border-top: 1px solid var(--line); background: var(--surface-2); }
.dialog-body { padding: 18px; max-height: 62vh; overflow-y: auto; }
.dialog-head h3 { margin: 0; font-size: 1.05rem; }

.punch-row {
  display: grid;
  grid-template-columns: 1fr 190px auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.punch-row select, .punch-row input { margin: 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border-radius: 999px; padding: 7px 14px; font-size: .9rem; }
.tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

@media (max-width: 560px) {
  .punch-row { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
}
