/* Mobile-first, hand-written (deliberate fallback from the Tailwind v4
   standalone-CLI option the plan allows — see the task report: cross-
   platform binary + CI wiring is pure tooling risk for a scaffold whose
   DoD never touches styling; a small stylesheet gets the actual brief
   "mobile-first, single column, large tap targets, simple bottom nav,
   status badges" without it). Single column always; nothing here assumes
   JS. */

:root {
  --color-bg: #fbfaf7;
  --color-text: #1a1a1a;
  --color-muted: #6b6b6b;
  --color-border: #ddd6c8;
  --color-brand: #836732;
  --color-brand-dark: #5f4a22;
  --color-danger: #b3261e;
  --status-nouvelle: #6b7280;
  --status-en-cours: #b45309;
  --status-done: #15803d;
  --status-cancelled: #b91c1c;
  --tap-target: 44px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 0 72px 0; /* leave room for the fixed bottom nav */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

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

h1 {
  font-size: 1.5rem;
  color: var(--color-brand-dark);
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

a {
  color: var(--color-brand);
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1rem 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.95rem;
}

input,
textarea,
select {
  min-height: var(--tap-target);
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background: #fff;
  color: var(--color-text);
}

textarea {
  min-height: calc(var(--tap-target) * 2);
  resize: vertical;
}

button,
.btn {
  min-height: var(--tap-target);
  padding: 0.5rem 1.25rem;
  font-size: 1rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--color-brand);
  color: #fff;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

button:hover,
.btn:hover {
  background: var(--color-brand-dark);
}

button.secondary,
.btn.secondary {
  background: #fff;
  color: var(--color-brand);
  border: 1px solid var(--color-brand);
}

[role="alert"] {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: #fdecea;
  color: var(--color-danger);
  border: 1px solid #f3c6c2;
}

[role="status"] {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: #eef6ec;
  color: var(--status-done);
  border: 1px solid #cfe8c9;
}

/* Status badges — one class per DB status value (demandes/ordres_service). */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.badge-nouvelle,
.badge-emis {
  background: var(--status-nouvelle);
}
.badge-devis_recu,
.badge-en_cours {
  background: var(--status-en-cours);
}
.badge-validee,
.badge-termine {
  background: var(--status-done);
}
.badge-annulee,
.badge-annule {
  background: var(--status-cancelled);
}
.badge-pending {
  background: var(--status-nouvelle);
}
.badge-converted {
  background: var(--status-done);
}
.badge-rejected {
  background: var(--status-cancelled);
}
/* Parse-anomaly indicator on an otherwise-pending intake row — amber,
   deliberately distinct from the red `.badge-rejected` status badge: this
   is a warning to look closer, not a terminal state. */
.badge-warning {
  background: var(--status-en-cours);
}

/* Intake review queue: raw email body, whitespace preserved but wrapped
   (mobile-first — never let a long line force horizontal scroll). */
.intake-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  font-family: inherit;
}

.intake-attachments {
  list-style: none;
  margin: 0;
  padding: 0;
}
.intake-attachments li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}
.intake-attachments li:last-child {
  border-bottom: none;
}

.card {
  display: block;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background: #fff;
  text-decoration: none;
  color: inherit;
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.card-meta {
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.muted {
  color: var(--color-muted);
}

.section {
  margin-top: 1.5rem;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

/* Fixed bottom nav — three large tap targets, always reachable on mobile. */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  border-top: 1px solid var(--color-border);
  background: #fff;
}

.bottom-nav a {
  flex: 1;
  min-height: var(--tap-target);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem;
  text-decoration: none;
  color: var(--color-text);
  font-size: 0.85rem;
  text-align: center;
}

.bottom-nav a:hover {
  background: var(--color-bg);
}

.bottom-nav form {
  flex: 1;
  margin: 0;
}

.bottom-nav button {
  width: 100%;
  height: 100%;
  min-height: var(--tap-target);
  border-radius: 0;
  background: none;
  color: var(--color-text);
  font-size: 0.85rem;
}

.bottom-nav button:hover {
  background: var(--color-bg);
}
