:root {
  --color-primary: #5a7a6a;
  --color-primary-dark: #3f5a4d;
  --color-primary-light: #e8f0ec;
  --color-white: #ffffff;
  --color-text: #22302a;
  --color-text-muted: #667873;
  --color-border: #d9e3de;
  --color-danger: #b3432b;
  --color-danger-light: #fbeae6;
  --color-success: #2f7a4f;
  /* Separate from --color-primary-dark: that one is also used as text on
     permanently-light surfaces (badges, banners) that don't invert with the
     theme, so it can't itself become a light color in dark mode. Headings
     sit directly on the page/card background, so they get their own token. */
  --color-heading: var(--color-primary-dark);
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: #f4f7f5;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: 4rem;
}

h1,
h2,
h3 {
  color: var(--color-heading);
  margin: 0 0 0.5rem;
}

.app-header {
  background: var(--color-primary);
  color: var(--color-white);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.1rem;
}

.app-header .brand .logo-ek {
  background: var(--color-white);
  color: var(--color-primary-dark);
  border-radius: 6px;
  padding: 0.15rem 0.4rem;
  font-weight: 800;
  font-size: 0.85rem;
}

.app-header button.link-button {
  color: var(--color-white);
  text-decoration: underline;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem;
}

.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1.05rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.75rem;
}

.card h2 .zone-index {
  color: var(--color-text-muted);
  font-weight: 400;
  margin-right: 0.3rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0.6rem 0 0.25rem;
}

select,
input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--color-white);
  color: var(--color-text);
}

select:focus,
input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.field-row .field-label {
  font-size: 0.95rem;
  flex: 1;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.stepper button {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid var(--color-primary);
  background: var(--color-white);
  color: var(--color-primary);
  font-size: 1.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper button:active {
  background: var(--color-primary-light);
}

.stepper .stepper-value {
  min-width: 1.6rem;
  text-align: center;
  font-weight: 600;
  font-size: 1.05rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
}

.checkbox-row input[type="checkbox"] {
  width: 1.3rem;
  height: 1.3rem;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.radio-option input {
  width: 1.2rem;
  height: 1.2rem;
}

.lodging-line,
.centrale-line,
.probe-line {
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.6rem;
  position: relative;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
  box-sizing: border-box;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn-primary:active {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-white);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-danger {
  background: var(--color-white);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.btn-small {
  width: auto;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-add {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border: 1px dashed var(--color-primary);
}

.remove-line {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--color-danger);
  font-size: 1.1rem;
  cursor: pointer;
  width: auto;
}

.hidden {
  display: none !important;
}

.error-banner {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.success-banner {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.recap-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recap-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.recap-list li:last-child {
  border-bottom: none;
}

.recap-section-title {
  font-weight: 700;
  color: var(--color-heading);
  margin-top: 0.75rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-soumis {
  background: #fff3d6;
  color: #8a6100;
}

.badge-approuve {
  background: #dceeff;
  color: #1a5da0;
}

.badge-cree {
  background: #dcf3e3;
  color: var(--color-success);
}

.badge-rejete {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.badge-pending {
  background: #fff3d6;
  color: #8a6100;
}

.badge-active {
  background: #dcf3e3;
  color: var(--color-success);
}

.request-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.request-card .meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.center-text {
  text-align: center;
}

.mt-1 {
  margin-top: 1rem;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-card .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.login-card .brand .logo-ek {
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-weight: 800;
  font-size: 1.3rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* --color-heading (h2 titles, zone index numbers, recap section titles)
       and --color-text-muted (labels, meta text) sit directly on the
       page/card background — their light-mode values are a dark green
       meant for a white card, unreadable on a dark one. --color-primary-dark
       itself is deliberately left untouched: it's also used as text on
       permanently-light badges/banners (.btn-add, .success-banner, the
       header logo badge) that don't invert with the theme. */
    --color-heading: #a9d4bc;
    --color-text-muted: #a9bdb6;
  }

  html,
  body {
    background: #14201b;
    color: #e7efe9;
  }

  .card,
  select,
  input[type="text"],
  input[type="email"],
  input[type="password"] {
    background: #1c2b24;
    color: #e7efe9;
    border-color: #2d4038;
  }

  .radio-option,
  .lodging-line,
  .centrale-line,
  .probe-line {
    border-color: #2d4038;
  }

  .stepper button {
    background: #1c2b24;
  }

  .recap-list li {
    border-color: #2d4038;
  }
}
