:root {
  --karago-green: #176b5d;
  --karago-green-dark: #0f4f45;
  --karago-orange: #e87924;
  --karago-white: #ffffff;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --line: #d9e1ec;
  --primary: var(--karago-green);
  --primary-dark: var(--karago-green-dark);
  --accent: #b45309;
  --danger: #b91c1c;
  --ok: #166534;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
a { color: var(--primary); text-decoration: none; overflow-wrap: anywhere; }
img, video, iframe { max-width: 100%; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 10px clamp(16px, 4vw, 48px); background: var(--surface); border-bottom: 2px solid #f0b386;
  position: sticky; top: 0; z-index: 3;
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-weight: 800; color: var(--primary-dark); }
.brand img { width: auto; height: 44px; flex: 0 0 auto; }
.brand-full img { height: 58px; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-name { font-size: 1.15rem; letter-spacing: .08em; }
.brand-slogan { margin-top: 4px; color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: 0; }
.brand-compact img { height: 36px; }
.nav { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.menu-toggle { display: none; }
.container { width: min(1120px, calc(100% - 32px)); margin: 28px auto; }
.hero { display: grid; gap: 20px; grid-template-columns: 1.2fr .8fr; align-items: center; min-height: 62vh; }
.hero-copy { grid-column: 1; grid-row: 1; align-self: end; }
.hero-actions { grid-column: 1; grid-row: 2; align-self: start; }
.hero > .home-publication { grid-column: 2; grid-row: 1 / span 2; }
.home-publication { display: grid; gap: 10px; min-width: 0; }
.whatsapp-button { width: 100%; max-width: 100%; background: #128c7e; }
.whatsapp-button:hover { background: #0d6f64; }
.panel, .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px;
}
.hero-art { min-height: 320px; background: linear-gradient(135deg, #dbeafe, #dcfce7 55%, #ffedd5); border-radius: 8px; display: grid; place-items: center; color: var(--primary-dark); font-size: clamp(34px, 6vw, 64px); font-weight: 700; text-align: center; padding: 20px; overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.15; }
h1 { font-size: clamp(32px, 5vw, 56px); }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font: inherit;
  min-height: 46px; min-width: 0; font-size: 16px;
}
textarea { min-height: 88px; resize: vertical; }
button, .button {
  border: 0; border-radius: 6px; padding: 11px 14px; background: var(--primary); color: #fff; font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; min-width: 44px; touch-action: manipulation; text-align: center;
}
button.secondary, .button.secondary { background: #e2e8f0; color: #1f2937; }
button.warning, .button.warning { background: var(--accent); color: #fff; }
button.danger { background: var(--danger); }
button:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions .danger, .actions button.danger { margin-left: 4px; }
.message { padding: 10px 12px; border-radius: 6px; display: none; }
.message.show { display: block; }
.message.error { background: #fee2e2; color: var(--danger); }
.message.success { background: #dcfce7; color: var(--ok); }
.message-formulaire {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  line-height: 1.5;
}
.message-formulaire.succes {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: var(--ok);
}
.message-formulaire.erreur {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: var(--danger);
}
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: #e2e8f0; font-size: 12px; font-weight: 700; }
.badge.pdf { background: #fee2e2; color: #991b1b; }
.badge.docx { background: #dbeafe; color: #1d4ed8; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f1f5f9; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pdf-viewer { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
img.pdf-viewer { object-fit: contain; padding: 10px; }
.hidden { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .55); }
.modal-content { width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 8px; padding: 20px; border: 1px solid var(--line); }
.publication-card { display: grid; gap: 12px; align-content: center; font-size: 1rem; }
.publication-card h2 { font-size: clamp(24px, 4vw, 36px); margin: 0; }
.publication-media { max-width: 100%; width: 100%; height: auto; max-height: 420px; object-fit: contain; border-radius: 8px; background: #fff; }
.publication-youtube { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #000; }
.login-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .85fr); gap: 20px; align-items: start; }
.login-layout.advertisement-empty { grid-template-columns: 1fr; }
.advertisement-slot { min-width: 0; }
.advertisement { display: grid; width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 8px 24px rgba(15, 23, 42, .08); }
.advertisement:hover { border-color: var(--primary); }
.advertisement img, .advertisement video { width: 100%; height: min(280px, 34vw); object-fit: cover; background: #f1f5f9; }
.advertisement-content { display: grid; gap: 8px; padding: 16px; }
.advertisement-content strong { font-size: 1.25rem; color: var(--primary-dark); }
.advertisement-content > span:not(.button) { color: var(--muted); }
.advertisement-button { justify-self: start; pointer-events: none; }
.advertisement-banner { grid-template-columns: minmax(180px, .4fr) 1fr; align-items: stretch; }
.advertisement-banner img, .advertisement-banner video { height: 100%; min-height: 150px; max-height: 230px; }
.advertisement-display-frame { align-self: start; min-width: 0; overflow: hidden; }
.advertisement-display-frame .advertisement-content { gap: 5px; padding: 10px 12px 12px; }
.advertisement-display-frame .advertisement-title { margin: 0; font-size: 1rem; line-height: 1.2; }
.advertisement-display-frame .advertisement-description { margin: 0; font-size: .85rem; line-height: 1.3; }
.advertisement-display-frame .advertisement-button {
  width: auto;
  min-height: 36px;
  min-width: 0;
  margin-top: 3px;
  padding: 6px 10px;
  font-size: .85rem;
}
#loginAdvertisement { margin-top: 0; padding-top: 0; }
.advertisement-display-frame .advertisement img,
.advertisement-display-frame .advertisement video {
  width: 100%;
  height: clamp(260px, 32vw, 360px);
  max-height: 360px;
  object-fit: contain;
  object-position: center;
}
.youtube-facade { background: #111827; color: #fff; min-height: 180px; font-size: 1.05rem; }
.notice { border-left: 4px solid var(--primary); background: #eff6ff; padding: 10px 12px; border-radius: 6px; color: #1e3a8a; }
.editor-panel { padding: 0; overflow: hidden; }
.editor-toolbar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.editor-toolbar button { min-width: 42px; min-height: 40px; padding: 8px; }
.docx-editor { min-height: 62vh; padding: 24px; overflow: auto; background: #fff; outline: none; }
.docx-editor:focus { box-shadow: inset 0 0 0 2px #bfdbfe; }
.docx-editor table { display: block; overflow-x: auto; max-width: 100%; }
.docx-editor img { max-width: 100%; height: auto; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px; border-top: 1px solid var(--line); background: #f8fafc; }
.compact-actions { align-items: flex-start; }
.help-page { display: grid; gap: 16px; }
.help-page .panel { scroll-margin-top: 96px; }
.help-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.help-summary a, .back-top {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; font-weight: 700; text-align: center;
}
.help-section ol, .help-section ul { padding-left: 24px; }
.help-section li + li { margin-top: 6px; }
.help-section .back-top { margin-top: 10px; }
.legal-page { display: grid; gap: 16px; }
.legal-list p { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.checkbox-line { display: flex; grid-template-columns: none; flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 600; }
.checkbox-line input { width: auto; min-width: 20px; min-height: 20px; margin-top: 2px; }
.legal-footer { margin-top: 32px; padding: 18px clamp(16px, 4vw, 48px); border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.legal-footer-inner { width: min(1120px, 100%); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.legal-footer p { margin: 0; }
.legal-footer nav { display: flex; flex-wrap: wrap; gap: 10px; }
.legal-footer a { min-height: 44px; display: inline-flex; align-items: center; }
.pricing-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pricing-card { display: grid; gap: 10px; align-content: start; }
.price { font-size: 2rem; font-weight: 700; color: var(--primary-dark); margin: 0; }
@media (max-width: 760px) {
  .hero, .grid, .grid3, .login-layout, .advertisement-banner { grid-template-columns: 1fr; }
  .advertisement img, .advertisement video, .advertisement-banner img, .advertisement-banner video { height: auto; max-height: 300px; }
  .login-layout { gap: 12px; align-items: start; }
  .login-layout > #loginAdvertisement { order: -1; width: 100%; margin: 0; }
  .advertisement-display-frame .advertisement img,
  .advertisement-display-frame .advertisement video {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
  }
  .topbar { align-items: stretch; flex-direction: column; gap: 10px; padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
  .topbar .brand { padding-right: 58px; line-height: 1.25; }
  .brand img, .brand-full img { height: 40px; }
  .brand-slogan { display: none; }
  .menu-toggle { display: inline-flex; position: absolute; right: max(12px, env(safe-area-inset-right)); top: 10px; background: #e2e8f0; color: #1f2937; }
  .topbar .nav { display: none; flex-direction: column; align-items: stretch; width: 100%; gap: 8px; }
  .topbar.menu-open .nav { display: flex; }
  .topbar .nav a, .topbar .nav button { width: 100%; justify-content: center; }
  .container { width: min(100% - 20px, 1120px); margin-top: 16px; margin-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .hero { min-height: auto; }
  .hero-copy, .hero-actions, .hero > .home-publication { grid-column: 1; grid-row: auto; }
  .hero > .home-publication { width: 100%; max-width: 100%; margin: 0; justify-self: center; }
  .hero-art { min-height: 180px; font-size: clamp(24px, 9vw, 38px); }
  h1 { font-size: clamp(26px, 9vw, 38px); }
  h2 { font-size: 1.35rem; }
  .panel, .card { padding: 14px; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions > * { width: 100%; }
  .actions .danger, .actions button.danger { margin-left: 0; margin-top: 8px; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap th, .table-wrap td { display: block; width: 100%; }
  .table-wrap table { border: 0; background: transparent; }
  .table-wrap tr { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
  .table-wrap th { display: none; }
  .table-wrap td { min-width: 0; border-bottom: 1px solid var(--line); padding: 9px 10px; }
  .table-wrap td::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted); font-size: .86rem; font-weight: 700; }
  .table-wrap td:last-child { border-bottom: 0; }
  .table-wrap td .actions { align-items: stretch; }
  .pdf-viewer { height: min(66vh, 520px); }
  .modal { padding: 12px; align-items: start; overflow-y: auto; }
  .modal-content { width: min(100% - 0px, 700px); max-height: calc(100dvh - 24px); padding: 14px; }
  .editor-toolbar { max-height: 35vh; overflow-y: auto; }
  .sticky-actions { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .docx-editor { padding: 14px; }
  .help-summary { grid-template-columns: 1fr; }
  .help-page .panel { scroll-margin-top: 72px; }
  .legal-footer-inner, .legal-footer nav { flex-direction: column; align-items: stretch; }
  .legal-footer a { justify-content: center; }
  .pricing-grid { grid-template-columns: 1fr; }
}

@media (min-width: 761px) {
  .topbar .nav { display: flex !important; }
}
