/* ==========================================================================
   MECSA — feuille de style unique, écrite à la main.
   Identité du site boston.com.pe : en-tête bleu marine, accent rouge,
   Montserrat (auto-hébergée, servie par /fonts), arrondis de 3 px,
   boutons de 45 px en gras 13 px, menu en majuscules 13 px.
   ========================================================================== */

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/montserrat-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/montserrat-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --navy: #1a266a;
  --navy-hover: #0e195c;
  --red: #e02128;
  --red-hover: #b0171f;
  --text: #262625;
  --muted: #6f6c6c;
  --bg: #ffffff;
  --footer-bg: #f1f1f1;
  --line: #e2e2e2;
  --input-line: #b9b9b9;
  --ok-bg: #eaf5ec;
  --ok-text: #1d6631;
  --error-bg: #fdeced;
  --error-text: #b0171f;
  --radius: 3px;
  --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
}

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

a:hover {
  color: var(--red);
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.main {
  flex: 1 0 auto;
  padding-top: 32px;
  padding-bottom: 56px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- En-tête --------------------------------------------------------------- */

.site-header {
  background: var(--navy);
  color: #fff;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 28px;
  min-height: 68px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  text-decoration: none;
}

.brand:hover {
  color: #fff;
}

.brand img {
  display: block;
  height: 30px;
  width: auto;
}

.brand-app {
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.45);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 26px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav a,
.nav-button {
  display: inline-block;
  padding: 6px 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.main-nav a:hover,
.nav-button:hover,
.main-nav a[aria-current='page'] {
  border-bottom-color: var(--red);
  color: #fff;
}

.nav-form {
  margin: 0;
}

/* --- Titres, cartes ----------------------------------------------------------- */

.page-title {
  margin: 0 0 22px;
  color: var(--navy);
  font-size: 26px;
  font-weight: 700;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 22px;
}

.page-head .page-title {
  margin: 0;
}

.breadcrumb {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--red);
}

.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.card-title {
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
}

.form-card {
  max-width: 560px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 24px;
  align-items: start;
}

.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin: 0;
}

.details dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

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

.empty-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

/* --- Messages ------------------------------------------------------------------ */

.alert {
  margin: 0 0 20px;
  padding: 12px 16px;
  border-left: 4px solid;
  border-radius: var(--radius);
  font-weight: 500;
}

.alert-success {
  border-color: var(--ok-text);
  background: var(--ok-bg);
  color: var(--ok-text);
}

.alert-error {
  border-color: var(--red);
  background: var(--error-bg);
  color: var(--error-text);
}

/* --- Formulaires --------------------------------------------------------------- */

.form {
  margin: 0;
}

.field {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field > label,
.field > legend {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
}

input[type='text'],
input[type='password'],
input[type='email'] {
  display: block;
  width: 100%;
  min-height: 45px;
  padding: 10px 12px;
  border: 1px solid var(--input-line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}

input[type='text']:focus,
input[type='password']:focus,
input[type='email']:focus {
  border-color: var(--navy);
  outline: 2px solid var(--navy);
  outline-offset: 0;
}

.field-invalid input[type='text'],
.field-invalid input[type='password'] {
  border-color: var(--red);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0;
  font-weight: 500;
  cursor: pointer;
}

.checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--navy);
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.field-error {
  margin: 6px 0 0;
  color: var(--error-text);
  font-size: 13px;
  font-weight: 600;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

/* --- Boutons -------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 45px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-primary,
.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-primary:hover,
.btn-danger:hover {
  background: var(--red-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--navy);
  color: #fff;
}

.btn-secondary:hover {
  background: var(--navy-hover);
  color: #fff;
}

.btn-ghost {
  border-color: var(--navy);
  background: #fff;
  color: var(--navy);
}

.btn-ghost:hover {
  background: var(--navy);
  color: #fff;
}

.btn-block {
  width: 100%;
}

/* --- Tableau des utilisateurs ----------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  padding: 12px 14px;
  border-bottom: 2px solid var(--line);
  background: #fafafa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.username {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.actions {
  text-align: right;
  white-space: nowrap;
}

.actions a {
  margin-left: 14px;
  font-size: 13px;
  font-weight: 600;
}

.danger-link {
  color: var(--red);
}

.badge,
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
}

.badge-on {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.badge-off {
  background: #efefef;
  color: var(--muted);
}

.tag {
  background: #e8eaf4;
  color: var(--navy);
}

@media (max-width: 720px) {
  .table-wrap {
    border: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 14px;
    text-align: right;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    text-transform: uppercase;
  }

  .data-table tbody tr:last-child td {
    border-bottom: 1px solid var(--line);
  }

  .data-table td.actions {
    justify-content: flex-end;
    border-bottom: 0;
  }

  .data-table td.actions::before {
    content: none;
  }
}

/* --- Connexion ------------------------------------------------------------------- */

.page-login .main {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 56px;
}

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

.login-logo {
  display: block;
  width: 220px;
  height: auto;
  margin: 0 auto 28px;
}

.login-title {
  margin: 0;
  color: var(--navy);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}

.login-subtitle {
  margin: 4px 0 26px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* --- Pages de texte et d'erreur ------------------------------------------------------ */

.prose {
  max-width: 760px;
}

.prose h2 {
  margin: 28px 0 8px;
  color: var(--navy);
  font-size: 17px;
  font-weight: 700;
}

.prose p,
.prose li {
  color: var(--text);
}

.lead {
  font-size: 16px;
  font-weight: 500;
}

.error-page {
  max-width: 560px;
  margin: 24px auto;
  text-align: center;
}

.error-code {
  margin: 0;
  color: var(--red);
  font-size: 56px;
  font-weight: 800;
  line-height: 1;
}

/* --- Pied de page -------------------------------------------------------------------- */

.site-footer {
  padding: 28px 0;
  background: var(--footer-bg);
  color: var(--muted);
  font-size: 12px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.footer-inner p {
  margin: 0;
}

.footer-logo {
  display: block;
  height: 30px;
  width: auto;
  margin-bottom: 6px;
}

.site-footer a {
  color: var(--muted);
  font-weight: 600;
}

.site-footer a:hover {
  color: var(--text);
}

@media (max-width: 600px) {
  body {
    font-size: 14px;
  }

  .page-title {
    font-size: 21px;
  }

  .card {
    padding: 18px;
  }

  .page-login .main {
    padding-top: 32px;
  }
}
