@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  src: url("/assets/fonts/barlow-600.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  src: url("/assets/fonts/barlow-700.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 800;
  src: url("/assets/fonts/barlow-800.woff2") format("woff2");
}

:root {
  --sidebar: #071525;
  --sidebar-2: #10243d;
  --paper: #e7edf3;
  --ink: #14202c;
  --line: #b7c2cc;
  --navy: #012243;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: flex;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--sidebar) 0%, #0c2744 100%);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  overflow: auto;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.side-brand img { width: 52px; height: 52px; object-fit: contain; }
.side-brand strong { display: block; font-size: 22px; letter-spacing: 0.08em; line-height: 1; }
.side-brand span { color: #b7c6d8; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; }
.side-label {
  margin: 16px 8px 8px;
  color: #8ea3bb;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
#nav { display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: #e8eef5;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 16px;
  font-weight: 700;
}
.nav-btn::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--navy);
  flex: 0 0 auto;
}
.nav-btn[data-theme="rouge"]::before { background: #d0121a; }
.nav-btn[data-theme="jaune"]::before { background: #c4962c; }
.nav-btn[data-theme="bleue"]::before { background: #1a5fad; }
.nav-btn[data-theme="verte"]::before { background: #1f7a3a; }
.nav-btn[data-theme="noire"]::before { background: #d9d9d9; }
.nav-btn[data-theme="orange"]::before { background: #ef7d1a; }
.nav-btn[data-theme="paie"]::before { background: #9d1c2f; }
.nav-btn[data-theme="salaire"]::before { background: #8a6a2f; }
.nav-btn:hover, .nav-btn.active { background: rgba(255, 255, 255, 0.08); }
.archive-btn { margin-top: auto; }
.archive-btn::before { background: #8eb4d4; }
#archive-count {
  margin-left: auto;
  min-width: 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  padding: 0 6px;
  font-size: 13px;
}
#archive-count:empty { display: none; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: white;
  border-bottom: 1px solid #d5dee7;
}
.toolbar h1 { margin: 0; font-size: 26px; letter-spacing: 0.02em; }
.toolbar p { margin: 2px 0 0; color: #5d6b7a; font-size: 15px; }
.actions { display: flex; gap: 8px; }
.btn {
  border: 1.5px solid var(--navy);
  background: white;
  color: var(--navy);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 16px;
}
.btn.primary { background: var(--navy); color: white; }
.btn:disabled { opacity: 0.55; cursor: wait; }

#work { flex: 1; overflow: auto; padding: 22px; }
.site-footer {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 22px 12px;
  border-top: 1px solid #d5dee6;
  background: #f7fafc;
  color: #5c6b7a;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.35;
}
#welcome {
  max-width: 640px;
  margin: 48px auto;
  background: white;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 8px 24px rgba(16, 32, 51, 0.06);
}
#welcome h2 { margin: 0 0 8px; font-size: 30px; }
#welcome p { margin: 0; font-size: 18px; line-height: 1.35; color: #314255; }
#sheet { width: max-content; margin: 0 auto; }
#sheet[hidden], #welcome[hidden], #archive[hidden], [hidden] { display: none !important; }

.doc {
  --accent: var(--navy);
  --card-border: #1c2836;
  width: 920px;
  background: white;
  color: #141c26;
  padding: 12px;
  box-shadow: 0 10px 28px rgba(16, 32, 51, 0.08);
}
.doc[data-theme="rouge"] { --accent: #d0121a; --card-border: #d0121a; }
.doc[data-theme="jaune"] { --accent: #a37b1f; --card-border: #a37b1f; }
.doc[data-theme="bleue"] { --accent: #1a5fad; --card-border: #1a5fad; }
.doc[data-theme="verte"] { --accent: #1b6b34; --card-border: #1b6b34; }
.doc[data-theme="noire"] { --accent: #1a1a1a; --card-border: #1a1a1a; }
.doc[data-theme="orange"] { --accent: #e86a00; --card-border: #e86a00; }
.doc[data-theme="paie"] {
  --accent: #12315f;
  --card-border: transparent;
  --line: #c5ced6;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  width: 860px;
  padding: 18px 22px 28px;
  font-family: Arial, Helvetica, sans-serif;
}
.doc[data-theme="paie"] input,
.doc[data-theme="paie"] textarea,
.doc[data-theme="paie"] button,
.doc[data-theme="salaire"] input,
.doc[data-theme="salaire"] select,
.doc[data-theme="salaire"] button { font-family: Arial, Helvetica, sans-serif; }
.doc:not([data-theme="navy"]):not([data-theme="paie"]):not([data-theme="salaire"]) {
  border: 2px solid var(--accent);
  border-radius: 12px;
}

.doc-head {
  display: grid;
  grid-template-columns: 92px 1fr 240px;
  gap: 10px;
  align-items: center;
  min-height: 98px;
  margin-bottom: 8px;
}
.seal { width: 88px; height: 88px; object-fit: contain; }
.brand {
  position: relative;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-left: 1px solid #d5dbe2;
}
.brand-map {
  position: absolute;
  inset: -10% 0 auto;
  width: 100%;
  height: 140%;
  object-fit: cover;
  opacity: 0.16;
  filter: grayscale(1);
  pointer-events: none;
}
.brand-text { position: relative; z-index: 1; text-align: center; width: 100%; }
.fib {
  margin: 0;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: 54px;
  line-height: 0.8;
  letter-spacing: -1px;
  color: #12315f;
}
.fib-sub {
  margin: 4px 0 0;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.11em;
  color: #12315f;
}
.fib-rule { height: 4px; width: 78%; margin: 6px auto 0; background: #e10600; }
.banner {
  min-height: 88px;
  background: var(--accent);
  color: white;
  clip-path: polygon(14% 0, 100% 0, 100% 100%, 0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 0.04em;
  line-height: 0.92;
  padding: 8px 8px 8px 34px;
}
.banner span { display: block; }
.banner.compact { font-size: 22px; }
.banner small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.dossier-box {
  border: 1.5px solid #1a2433;
  min-height: 92px;
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.dossier-box h2 {
  margin: 0 0 4px;
  text-align: center;
  font-size: 15px;
  letter-spacing: 0.05em;
}
.dossier-box .field { flex: 0 0 auto; min-height: 24px; }

.trio, .top, .duo, .trio-bottom, .bottom-std {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  align-items: stretch;
}
.trio { grid-template-columns: 158px 1fr 230px; }
.top { grid-template-columns: 168px 1fr; }
.duo { grid-template-columns: 1fr 1fr; }
.duo.inner { margin-top: 0; }
.trio-bottom { grid-template-columns: 1.2fr 0.8fr 1fr; }
.bottom-std { grid-template-columns: 230px 220px 1fr; }
.sign-row { margin-top: 8px; display: grid; grid-template-columns: 280px; }
.meta-stack { display: flex; flex-direction: column; gap: 8px; }

.card {
  border: 1.5px solid var(--card-border);
  background: white;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.card h3 {
  margin: 0;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 8px;
}
.body { display: flex; flex-direction: column; flex: 1; padding: 3px 8px 6px; min-height: 0; }
.identity .field { flex: 1 1 auto; }

.field {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}
.lbl { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.lbl.space { margin-left: 10px; }
.field input[type="text"], .field .print-value, .short, .dates input, .dates .print-value, .check-line input[type="text"], .check-line .print-value {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  appearance: none;
  background: transparent;
  font-weight: 650;
  font-size: 15px;
  padding: 0;
  outline: none;
  box-shadow: none;
}
.short { flex: 0 0 54px; width: 54px; }
.unit { font-weight: 700; font-size: 13.5px; }
.dates { display: flex; align-items: flex-end; gap: 4px; flex: 1; }
.dates .d, .dates .print-value.d { width: 28px; flex: 0 0 28px; text-align: center; }
.dates .y, .dates .print-value.y { width: 42px; flex: 0 0 42px; text-align: center; }
.sep { font-weight: 700; }
.block-label { font-weight: 700; font-size: 13.5px; padding-top: 5px; }
.ruled {
  width: 100%;
  border: 0;
  resize: none;
  outline: none;
  background-color: transparent;
  background-image: linear-gradient(transparent 21px, var(--line) 21px);
  background-size: 100% 22px;
  background-attachment: local;
  line-height: 22px;
  font-size: 15px;
  font-weight: 650;
  padding: 0;
  min-height: 66px;
  flex: 1;
}
.date-body { justify-content: center; min-height: 46px; }
.date-body .dates { flex: 0 0 auto; align-items: center; }
.dates { align-items: center; }
.dates input { height: 22px; }

.stack { display: flex; flex-direction: column; gap: 3px; padding: 6px 8px 8px; }
.check, .check-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13.5px;
  min-height: 18px;
}
.check input, .check-line input[type="checkbox"], .check-line input[type="radio"] {
  appearance: none;
  width: 12px;
  height: 12px;
  border: 1.4px solid #1b2836;
  background: white center / 78% no-repeat;
  margin: 0;
  flex: 0 0 auto;
}
.check input:checked, .check-line input:checked, .print-box.on {
  background-color: #fff;
  border-color: #111;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='%23111' stroke-width='2.6' stroke-linecap='round' d='M4 4l8 8M12 4l-8 8'/></svg>");
}
.print-box {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.4px solid #1b2836;
  background: #fff center / 78% no-repeat;
  flex: 0 0 auto;
}
.inline-checks { display: flex; flex-wrap: wrap; gap: 12px; padding-bottom: 1px; }
.check-line { width: 100%; }
.check-line input[type="text"] {
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  outline: none;
  font-weight: 650;
  font-size: 15px;
  padding: 0;
}
.chip-row { width: 100%; }
.chip { width: 34px; height: 10px; border-radius: 2px; margin-left: auto; }

.photo {
  position: relative;
  border: 1px solid #c5ced6;
  background: #f7f8fa;
  min-height: 210px;
  height: 100%;
  overflow: hidden;
}
.photo.drag { outline: 2px dashed var(--accent); }
.silhouette { position: absolute; left: 50%; bottom: 0; width: 78%; height: 92%; transform: translateX(-50%); }
.silhouette circle, .silhouette path { fill: #b0b6ba; }
.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.photo-btn, .photo-clear, .sign-clear {
  position: absolute;
  z-index: 2;
  border: 0;
  background: rgba(7, 21, 37, 0.88);
  color: white;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
}
.photo-btn { left: 8px; bottom: 8px; }
.photo-clear { right: 8px; bottom: 8px; }
.photo-recrop {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  border: 0;
  background: rgba(7, 21, 37, 0.88);
  color: white;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
}

.cropper {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(7, 16, 28, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.cropper-panel {
  width: min(560px, 100%);
  background: white;
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}
.cropper-panel h2 { margin: 0; font-size: 26px; }
.cropper-hint { margin: 4px 0 12px; color: #526273; font-size: 16px; }
.cropper-canvas {
  display: block;
  margin: 0 auto;
  background: #111;
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
}
.cropper-canvas:active { cursor: grabbing; }
.cropper-controls, .cropper-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.cropper-zoom { flex: 1; }
.cropper-zoom-label { min-width: 92px; font-weight: 700; }
.cropper-actions { justify-content: flex-end; }
.photo-btn input { display: none; }
.corner { position: absolute; width: 14px; height: 14px; z-index: 2; }
.corner::before, .corner::after { content: ""; position: absolute; background: #2c3846; }
.corner::before { width: 100%; height: 2px; }
.corner::after { width: 2px; height: 100%; }
.tl { top: 7px; left: 7px; }
.tr { top: 7px; right: 7px; }
.bl { bottom: 7px; left: 7px; }
.br { bottom: 7px; right: 7px; }
.tr::after, .br::after { right: 0; }
.bl::before, .br::before { bottom: 0; }

.sign-body { min-height: 120px; position: relative; padding: 6px 8px 8px; }
.sign-box {
  position: relative;
  flex: 1;
  min-height: 108px;
  background: #f7f8fa;
  border: 1px dashed #c5ced6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sign-box.drag { outline: 2px dashed var(--accent); }
.sign-img { max-width: 100%; max-height: 120px; object-fit: contain; }
.sign-btn, .sign-clear {
  position: absolute;
  z-index: 2;
  border: 0;
  background: rgba(7, 21, 37, 0.88);
  color: white;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 700;
}
.sign-btn { left: 8px; bottom: 8px; }
.sign-clear { right: 8px; bottom: 8px; }
.sign-btn input { display: none; }

.map { position: relative; min-height: 150px; height: 100%; overflow: hidden; }
.map-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.42;
  filter: grayscale(1);
}
.ribbon {
  position: absolute;
  right: -4px;
  bottom: -6px;
  width: 26px;
  height: 86px;
  background: linear-gradient(90deg, #e10600 0 44%, #fff 44% 54%, #012243 54% 100%);
  transform: rotate(28deg);
}

.archive-group { margin-bottom: 22px; }
.archive-group h2 { margin: 0 0 10px; font-size: 22px; letter-spacing: 0.02em; }
.archive-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.archive-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #d5dee7;
  padding: 12px;
}
.archive-card img, .archive-fallback {
  width: 72px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef2f6;
}
.archive-fallback { display: grid; place-items: center; color: #8ea0b3; font-weight: 800; font-size: 12px; text-align: center; }
.archive-card h3 { margin: 0; font-size: 18px; }
.archive-card p { margin: 2px 0 8px; color: #5d6b7a; font-size: 14px; }
.archive-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.archive-actions button, .linkish {
  border: 1px solid #c5d0db;
  background: white;
  border-radius: 6px;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 14px;
}
.archive-actions .danger { color: #a32020; border-color: #efc2c2; }
.empty-archive { color: #5d6b7a; font-size: 18px; }

.paie-head { display: grid; grid-template-columns: 168px 1fr; min-height: 78px; }
.paie-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #102a4c;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 40px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.paie-bureau {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 0 18px;
  background: #16375f;
  color: white;
}
.paie-bureau strong { font-size: 18px; font-weight: 700; letter-spacing: 0.03em; }
.paie-bureau span { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; }
.paie-title {
  margin: 22px 0 0;
  text-align: center;
  color: #c0392b;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.paie-sub { margin: 4px 0 18px; text-align: center; color: #8aa0b8; font-size: 15px; font-style: italic; font-weight: 400; }
.paie-lines { border: 1px solid #d5dde6; }
.paie-line { display: grid; grid-template-columns: 240px 1fr; align-items: center; min-height: 42px; border-bottom: 1px solid #e3e8ee; }
.paie-line:last-child { border-bottom: 0; }
.paie-line > span:first-child {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: #f4f7fb;
  color: #6d7d90;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.paie-line input, .paie-line .print-value {
  width: calc(100% - 28px);
  margin: 0 14px;
  border: 0;
  background: transparent;
  outline: none;
  color: #111;
  font-size: 18px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.paie-line input::placeholder { color: #111; opacity: 1; font-weight: 700; }
.paie-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; margin-top: 16px; }
.paie-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 108px; padding: 14px 8px 16px; color: white; }
.paie-stat.navy { background: #16324f; }
.paie-stat.red { background: #9d1c2f; }
.paie-stat > span:first-child { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
.paie-stat input, .paie-stat .print-value {
  width: 92%;
  border: 0;
  background: transparent;
  color: white;
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  outline: none;
}
.paie-line .print-value, .paie-date .print-value { display: inline-block; }
.paie-stat .print-value { display: block; }
.paie-stat input::placeholder { color: white; opacity: 1; }
.paie-h { margin: 18px 0 8px; font-size: 14px; font-weight: 700; letter-spacing: 0.03em; }
.paie-status-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.paie-status { display: flex; align-items: center; justify-content: center; min-height: 58px; padding: 8px 12px; background: #f4f7fb; }
.paie-status .check { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: #243044; }
.paie-status.done { flex-direction: column; justify-content: center; gap: 2px; background: #e7f3ea; }
.paie-done-label { color: #1f7a3a; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-decoration: underline; text-underline-offset: 2px; }
.paie-status.done .check { color: #1f7a3a; font-weight: 700; }
.paie-notes { border: 1px solid #e6ebf0; background: #fbfcfd; padding: 10px 12px 6px; }
.paie-notes .ruled { min-height: 72px; color: #1a1a1a; font-size: 15px; font-weight: 500; }
.paie-cert { margin: 0 0 16px; font-size: 14px; font-weight: 400; line-height: 1.35; color: #1a1a1a; }
.paie-sign-row { display: grid; grid-template-columns: 1fr 1fr; align-items: baseline; margin-top: 8px; }
.paie-sign-row > span, .paie-date > span, .paie-direction > span { font-weight: 700; font-size: 15px; color: #111; }
.paie-sign { margin: 8px 0 0; border: 0; background: transparent; box-shadow: none; width: 263px; }
.paie-sign h3 { display: none; }
.paie-sign .body, .paie-sign .sign-body { min-height: 130px; padding: 0; }
.paie-sign .sign-box {
  width: 263px;
  height: 130px;
  min-height: 130px;
  background: #f7f8fa;
  border: 1px dashed #c5ced6;
  overflow: hidden;
}
.paie-sign .sign-btn {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(7, 21, 37, 0.88);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}
.paie-sign .sign-img { max-width: 240px; max-height: 100px; width: auto; height: auto; object-fit: contain; }
.paie-date { display: flex; align-items: baseline; gap: 8px; }
.paie-date input, .paie-date .print-value {
  width: 140px;
  border: 0;
  background: transparent;
  outline: none;
  color: #111;
  font-size: 16px;
  font-weight: 700;
}
.paie-direction { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 36px; }
.paie-direction .check { font-size: 15px; font-weight: 500; }

.doc[data-theme="salaire"] {
  --accent: #8a6a2f;
  --card-border: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  width: 860px;
  padding: 18px 22px 28px;
  font-family: Arial, Helvetica, sans-serif;
}
.sal-head {
  display: grid;
  grid-template-columns: 120px 1fr;
  min-height: 72px;
  background: #102a4c;
  color: white;
}
.sal-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c2344;
  font-size: 32px;
  font-weight: 700;
}
.sal-head div:last-child { display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 0 16px; }
.sal-head strong { font-size: 16px; letter-spacing: 0.03em; }
.sal-head span { font-size: 11px; letter-spacing: 0.05em; }
.sal-title { margin: 18px 0 6px; text-align: center; font-size: 26px; letter-spacing: 0.03em; }
.sal-note { margin: 0 0 16px; text-align: center; color: #5d6b7a; font-size: 14px; line-height: 1.35; }
.sal-period { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; margin-bottom: 14px; }
.sal-period span, .sal-field span, .sal-time span, .sal-facts span, .sal-due > span, .sal-sum span { font-size: 13px; font-weight: 700; color: #5d6b7a; }
.sal-period input, .sal-field input, .sal-field select, .sal-time input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #c5ced6;
  background: transparent;
  outline: none;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 0;
}
.sal-list { display: flex; flex-direction: column; gap: 12px; }
.sal-row { border: 1px solid #e1e7ee; border-left: 4px solid #8a6a2f; padding: 10px 12px 12px; background: #fff; }
.sal-row-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sal-num { font-size: 15px; letter-spacing: 0.04em; }
.sal-del, .sal-add, .sal-fiches {
  border: 1px solid #c5d0db;
  background: white;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 700;
}
.sal-del { color: #a32020; }
.sal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sal-fiches { background: #102a4c; color: white; border-color: #102a4c; }
.sal-field { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; margin-top: 6px; }
.sal-facts, .sal-time { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 10px; }
.sal-facts p, .sal-time p, .sal-time label, .sal-due, .sal-sum { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sal-facts strong, .sal-time strong { font-size: 16px; color: #14202c; }
.sal-time input { max-width: 90px; }
.sal-due { flex-direction: row; align-items: baseline; gap: 10px; margin-top: 10px; }
.sal-due strong, .sal-sum strong { font-size: 22px; color: #102a4c; }
.sal-flag { color: #8a6a2f; font-style: normal; font-size: 13px; font-weight: 700; }
.sal-add { margin-top: 0; }
.sal-sum {
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
  padding-top: 10px;
  border-top: 2px solid #102a4c;
}
.sal-field .print-value, .sal-period .print-value { font-size: 16px; font-weight: 700; }

.sal-print { color: #14202c; }
.sal-print-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  border-bottom: 2px solid #102a4c;
  margin-bottom: 1.5mm;
  padding-bottom: 1mm;
}
.sal-print-head strong { font-size: 13px; letter-spacing: 0.03em; }
.sal-print-head span { font-size: 11px; font-weight: 700; }
.sal-print table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.sal-print .c-num { width: 8mm; }
.sal-print .c-nom { width: 24%; }
.sal-print .c-hm { width: 16mm; }
.sal-print .c-hours { width: 22mm; }
.sal-print .c-pay { width: 36mm; }
.sal-print th, .sal-print td { padding: 0 1.5mm; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sal-print th { font-size: 8px; font-weight: 700; color: #5d6b7a; border-bottom: 1px solid #9aabbc; }
.sal-print td { border-bottom: 1px solid #e6ebf0; }
.sal-print .hours, .sal-print .pay { text-align: right; }
.sal-print tfoot td { border-bottom: 0; border-top: 1.5px solid #102a4c; font-weight: 700; font-size: 11px; height: 7mm; }

.paie-ask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 21, 37, 0.55);
}
.paie-ask-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: white;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.paie-ask-card h2 { margin: 0; font-size: 24px; }
.paie-ask-card p { margin: 0; color: #5d6b7a; font-size: 15px; }
.paie-ask-card label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; }
.paie-ask-card input[type="text"], .paie-ask-card input[type="password"], .paie-ask-card textarea {
  border: 1px solid #c5d0db;
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  font-weight: 600;
}
.paie-ask-checks { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.paie-ask-file { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
.paie-ask-import {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 6px;
  background: #102a4c;
  color: white;
  cursor: pointer;
}
.paie-ask-import input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.paie-ask-file-name { color: #5d6b7a; font-size: 13px; font-weight: 600; }
.paie-ask-actions { display: flex; justify-content: flex-end; gap: 8px; }
.paie-ask-actions button {
  border: 1px solid #c5d0db;
  background: white;
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 700;
}
.paie-ask-actions button[type="submit"] { background: #102a4c; color: white; border-color: #102a4c; }

#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 30;
  font-weight: 700;
}

.print-body { display: block; background: white; }
.print-body #sheet { width: auto; margin: 0; }
@media print {
  body { background: white; }
  .sidebar, .toolbar, .no-print, #toast, .paie-ask { display: none !important; }
  main, #work { display: block; height: auto; overflow: visible; padding: 0; }
  .doc, .doc[data-theme="paie"], .doc[data-theme="salaire"] { width: 194mm; max-width: 194mm; box-shadow: none; }
  .doc[data-theme="paie"], .doc[data-theme="salaire"] { padding: 0; }
  .doc[data-theme="salaire"] {
    height: 272mm;
    max-height: 272mm;
    overflow: hidden;
    break-inside: avoid;
    page-break-inside: avoid;
    break-after: avoid;
  }
  .card, .doc-head, .photo, .paie-head, .paie-stats, .paie-sign { break-inside: avoid; }
  .sign-box, .paie-sign .sign-box { overflow: hidden; }
  .sign-img, .paie-sign .sign-img {
    max-width: 240px !important;
    max-height: 100px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@page { size: A4 portrait; margin: 8mm; }
