:root {
  --guot-green: #007a3d;
  --guot-green-dark: #00572b;
  --guot-yellow: #f9d616;
  --guot-red: #be1e2d;
  --bs-primary: var(--guot-green);
  --bs-primary-rgb: 0, 122, 61;
  --bs-danger: var(--guot-red);
  --bs-danger-rgb: 190, 30, 45;
  --bs-link-color: var(--guot-green-dark);
  --bs-link-hover-color: var(--guot-green);
  --app-ink: #1e2d3b;
  --app-muted: #607181;
  --app-bg: #f3f7f4;
  --app-border: #dce4ea;
  --app-shadow: 0 0.35rem 1.2rem rgba(0, 87, 43, 0.07);
}

body.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--app-bg);
  color: var(--app-ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.app-container { width: min(100% - 2rem, 1440px); margin-inline: auto; }
.app-navbar { min-height: 76px; background: var(--guot-green-dark); padding-block: .65rem; }
.site-header::after {
  display: block;
  height: 3px;
  background: linear-gradient(90deg, #009344 0 42%, #f9d616 42% 72%, #be1e2d 72%);
  content: "";
}
.navbar-brand { white-space: normal; }
.brand-logo { display: block; width: 4.5rem; max-width: 4.5rem; height: auto; flex: 0 0 4.5rem; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy strong { font-size: 1.12rem; }
.brand-copy small { margin-top: .28rem; color: rgba(255,255,255,.78); font-size: .82rem; }
.navbar-nav { gap: .15rem; }
.navbar-nav .nav-link {
  padding: .58rem .8rem !important;
  border-radius: .4rem;
  color: rgba(255,255,255,.84);
  font-size: .92rem;
}
.navbar-nav .nav-link:hover, .navbar-nav .nav-link:focus {
  background: rgba(255,255,255,.1);
  color: white;
}
.user-menu { padding-left: 1rem; border-left: 1px solid rgba(255,255,255,.2); }
.user-label { display: flex; flex-direction: column; color: #fff; font-size: .86rem; }
.user-label-caption { color: rgba(255,255,255,.66); font-size: .72rem; }
.app-main { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }

h1, h2, h3 { color: var(--guot-green-dark); letter-spacing: -.025em; }
h1 { margin-bottom: .4rem; font-size: clamp(1.55rem, 2.8vw, 2.15rem); font-weight: 720; }
h2 { font-size: 1.18rem; font-weight: 700; }
.page-heading { margin-bottom: 1.4rem; }
.page-heading p, .page-intro { margin-bottom: 0; color: var(--app-muted); }
.eyebrow {
  margin-bottom: .35rem;
  color: var(--guot-green);
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.card, .panel {
  border: 1px solid var(--app-border);
  border-radius: .75rem;
  background: #fff;
  box-shadow: var(--app-shadow);
}
.card-header { border-bottom-color: var(--app-border); background: #fff; font-weight: 700; }
.panel { margin-block: 1rem; padding: 1.35rem; }
.narrow { max-width: 40rem; margin-inline: auto; }
.login-panel { max-width: 30rem; margin: clamp(1rem, 6vh, 4rem) auto; }

.btn-primary { --bs-btn-bg: var(--guot-green); --bs-btn-border-color: var(--guot-green); --bs-btn-hover-bg: var(--guot-green-dark); --bs-btn-hover-border-color: var(--guot-green-dark); }
.btn-outline-primary { --bs-btn-color: var(--guot-green-dark); --bs-btn-border-color: var(--guot-green); --bs-btn-hover-bg: var(--guot-green); --bs-btn-hover-border-color: var(--guot-green); }
.btn { border-radius: .45rem; font-weight: 600; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--guot-green-dark);
  outline-offset: 2px;
}

label, .form-label { color: #34495a; font-weight: 650; }
.form-control, .form-select, input:not([type=checkbox]):not([type=hidden]):not([type=submit]),
select, textarea {
  border-color: #c9d4dd;
  border-radius: .45rem;
}
.form-control:focus, .form-select:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--guot-green);
  box-shadow: 0 0 0 .2rem rgba(0,122,61,.14);
}
.helptext, .help-text, .form-text { color: var(--app-muted); font-size: .84rem; }
.errorlist { margin: .35rem 0; padding-left: 1rem; color: #a52834; font-size: .88rem; }
.invalid-feedback { display: block; }

.filter-card { margin-bottom: 1.25rem; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .75rem 1rem; }
.filter-grid p { margin: 0; }
.filter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1rem; }
.results-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
.table-card { overflow: hidden; }
.table-responsive { border-radius: inherit; }
.table { margin-bottom: 0; --bs-table-bg: transparent; }
.table thead th {
  padding: .85rem .8rem;
  border-bottom-width: 1px;
  background: #f0f4f7;
  color: #385446;
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table tbody td { padding: .8rem; border-color: #e7edf1; vertical-align: middle; }
.table tbody tr:hover { --bs-table-bg: #f8fafb; }
.table a { font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.empty-state { padding: 2.5rem 1.25rem !important; color: var(--app-muted); text-align: center; }
.table-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.table-icon-button { display: inline-flex; width: 2.1rem; height: 2.1rem; align-items: center; justify-content: center; padding: .25rem; }

.badge { font-weight: 650; letter-spacing: .01em; }
.status-badge, .status-unknown { background: #e8edf1; color: #35495a; }
.status-brouillon { background: #e8edf1; color: #35495a; }
.status-soumis { background: #e1f1e7; color: #00572b; }
.status-a-completer { background: #fff1cd; color: #634900; }
.status-complet { background: #e1f1e7; color: #00572b; }
.status-valide { background: #dcefe3; color: #1a5932; }
.completeness { color: var(--app-muted); font-size: .86rem; }
.empty-ministry { --bs-table-bg: #fffbea; }
.empty-ministry td:first-child { border-left: 3px solid var(--guot-yellow); }
.completion-progress {
  display: block;
  width: 100%;
  height: .75rem;
  appearance: none;
  border: 0;
  border-radius: var(--bs-progress-border-radius);
  background-color: var(--bs-progress-bg);
  overflow: hidden;
}
.completion-progress::-webkit-progress-bar { background-color: var(--bs-progress-bg); }
.completion-progress::-webkit-progress-value { background-color: var(--bs-success); }
.completion-progress::-moz-progress-bar { background-color: var(--bs-success); }

.feedback-stack { display: grid; gap: .55rem; margin-bottom: 1.25rem; }
.alert { margin-bottom: 0; border-radius: .55rem; }
.alert strong { font-size: .92rem; }
.pagination { margin-top: 1.25rem; }
.details-grid { display: grid; grid-template-columns: minmax(10rem, .8fr) 2fr; }
.details-grid dt, .details-grid dd { padding: .8rem 1rem; border-bottom: 1px solid #e8edf1; }
.details-grid dt { color: #496072; font-weight: 650; }
.details-grid dd { margin: 0; }
.service-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.service-form-field { min-width: 0; margin: 0; }
.service-modal-details { display: grid; grid-template-columns: minmax(9rem, .7fr) minmax(0, 2fr); }
.service-modal-details dt, .service-modal-details dd { margin: 0; padding: .7rem .75rem; border-bottom: 1px solid #e8edf1; }
.service-modal-details dt { color: #496072; font-weight: 650; }
.service-modal-details dd { overflow-wrap: anywhere; white-space: pre-wrap; }
.credential-value {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .8rem 1rem;
  border: 1px solid var(--app-border);
  border-radius: .5rem;
  background: #f6f8fa;
}
.credential-value code { overflow-wrap: anywhere; color: var(--guot-green-dark); font-size: 1rem; }

.site-footer {
  padding: 1.1rem 0;
  border-top: 1px solid var(--app-border);
  background: #fff;
  color: var(--app-muted);
  font-size: .82rem;
}

@media (max-width: 991.98px) {
  .user-menu { align-items: flex-start !important; padding: .75rem 0 0; border-top: 1px solid rgba(255,255,255,.18); border-left: 0; }
  .navbar-nav .nav-link { padding-inline: .5rem !important; }
}
@media (max-width: 575.98px) {
  .app-container { width: min(100% - 1.25rem, 1440px); }
  .app-main { padding-top: 1.25rem; padding-bottom: 2rem; }
  .brand-copy strong { max-width: 11rem; font-size: 1rem; }
  .brand-copy small { display: none; }
  .brand-logo { width: 4rem; max-width: 4rem; flex-basis: 4rem; }
  .panel { padding: 1rem; }
  .details-grid { grid-template-columns: 1fr; }
  .details-grid dt { padding-bottom: .15rem; border-bottom: 0; }
  .details-grid dd { padding-top: .15rem; }
  .service-modal-details { grid-template-columns: 1fr; }
  .service-modal-details dt { padding-bottom: .15rem; border-bottom: 0; }
  .service-modal-details dd { padding-top: .15rem; }
  .results-toolbar { align-items: stretch; }
  .results-toolbar .btn-group { width: 100%; }
}
