:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --border: #e2e5e3;
  --text: #1c1f1d;
  --text-secondary: #5a635d;
  --accent: #1f9d5c;
  --accent-dark: #14532d;
  --accent-soft: #eaf3ee;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(28, 31, 29, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Inter, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Coquille applicative (utilisateur connecté) ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 56px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
  transition: width .15s ease;
}
.sidebar:hover,
.sidebar:focus-within { width: 200px; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 15px 14px; }
.sidebar-brand img { width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0; }
.sidebar-brand .brand { font-weight: 700; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  margin: 0 8px;
  border: 0;
  background: none;
  font: inherit;
  width: calc(100% - 16px);
  text-align: left;
  cursor: pointer;
}
.nav-link .nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.nav-link:not(.is-disabled):hover { background: var(--accent-soft); text-decoration: none; }
.nav-link.is-disabled { opacity: .45; cursor: default; }
.nav-link.is-disabled .nav-soon {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: auto;
}

.nav-spacer { flex: 1; }

.app-main { flex: 1; min-width: 0; }

.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.topbar-title { font-weight: 700; font-size: 15px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.container { max-width: 1440px; margin: 0 auto; padding: 24px; }

/* ===== Visiteur (login) ===== */
.guest-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }

/* ===== Composants ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { margin: 0 0 4px; font-size: 20px; }
.small { font-size: 12px; color: var(--text-secondary); margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13px; cursor: pointer;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 14px;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.error { background: var(--danger-soft); border: 1px solid #f3c2bc; color: #8a291f; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13px; }

/* ===== Formulaires multi-colonnes (create/edit) ===== */
.form-section-title {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .02em;
  margin: 24px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.form-section-title:first-child { margin-top: 0; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-2 .form-span-2 { grid-column: 1 / -1; }

.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { color: var(--text-secondary); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .02em; }
.table tr.row-link { cursor: pointer; }
.table tr.row-link:hover { background: var(--accent-soft); }

/* ===== Badges (statut/priorité ticket) ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
