/* ELITSE Cockpit — sistema visual (mateixos tokens que el web públic).
   Sense Tailwind: CSS propi + fonts auto-allotjades. */

/* ---- Fonts (mateixos assets variables que el web) ---- */
@font-face {
  font-family: 'Montserrat Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url('/static/fonts/montserrat-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212;
}
@font-face {
  font-family: 'Montserrat Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url('/static/fonts/montserrat-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Literata Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 600;
  src: url('/static/fonts/literata-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212;
}
@font-face {
  font-family: 'Literata Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 600;
  src: url('/static/fonts/literata-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Tokens (idèntics al web) ---- */
:root {
  --green: #4e8072;
  --green-dark: #2f4d44;
  --blue: #3d6588;
  --graphite: #34373d;
  --ink: #1d1d1b;
  --paper: #f3f6f4;
  --surface: #ffffff;
  --warm-gray: #6b7b76;

  --font-sans: 'Montserrat Variable', ui-sans-serif, system-ui, sans-serif;
  --font-serif: 'Literata Variable', ui-serif, Georgia, serif;

  --radius: 14px;
  --shadow-sm: 0 1px 3px rgba(29, 29, 27, 0.06), 0 1px 2px rgba(29, 29, 27, 0.04);
}

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ========================================================================
   LOGIN 60/40
   ======================================================================== */
.login {
  display: grid;
  grid-template-columns: 60% 40%;
  min-height: 100vh;
}

/* 60% — panell de marca */
.login__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem;
  background: var(--green);
  color: #fff;
  overflow: hidden;
}
.login__brand-logo { height: 34px; width: auto; }
.login__brand-voice {
  max-width: 26rem;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.4;
}
.login__brand-foot {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}
/* Marca d'aigua discreta */
.login__brand::after {
  content: '';
  position: absolute;
  right: -8%;
  bottom: -12%;
  width: 55%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--green-dark);
  opacity: 0.35;
  pointer-events: none;
}
.login__brand > * { position: relative; z-index: 1; }

/* 40% — panell de formulari */
.login__panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  background: var(--surface);
}
.login__form { width: 100%; max-width: 22rem; }
.login__title {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
  font-weight: 600;
}
.login__subtitle {
  margin: 0 0 1.75rem;
  color: var(--warm-gray);
  font-size: 0.95rem;
}

/* ---- Formularis (compartit login/reset/canvi) ---- */
.field { margin-bottom: 1rem; }
.field > label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
}
.field input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid rgba(29, 29, 27, 0.15);
  border-radius: 12px;
}
.field input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(78, 128, 114, 0.18);
}
.field input[type="checkbox"] { width: auto; box-shadow: none; }
.field .helptext,
.field ul { font-size: 0.78rem; color: var(--warm-gray); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--green);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.15s;
}
.btn:hover { background: var(--green-dark); }

.form-error {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  color: #8a1c1c;
  background: #fdecec;
  border-radius: 10px;
}

.login__forgot {
  display: block;
  margin-top: 1.1rem;
  font-size: 0.85rem;
  text-decoration: none;
}
.login__forgot:hover { text-decoration: underline; }

/* ---- Responsive: apila i amaga el panell de marca en mòbil ---- */
@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login__brand {
    min-height: auto;
    padding: 2rem 1.5rem;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
  }
  .login__brand-voice,
  .login__brand-foot { display: none; }
}

/* ========================================================================
   SHELL (interfície interna autenticada)
   ======================================================================== */
.app {
  display: grid;
  grid-template-columns: 244px 1fr;
  min-height: 100vh;
}

/* Menú lateral */
.app__side {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 1rem;
  background: var(--surface);
  border-right: 1px solid rgba(29, 29, 27, 0.08);
}
.app__brand { padding: 0.25rem 0.5rem; }
.app__brand img { height: 28px; width: auto; }

.app__nav { display: flex; flex-direction: column; gap: 0.15rem; }
.app__nav-label {
  padding: 0 0.75rem;
  margin-bottom: 0.4rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--warm-gray);
}
.app__nav a,
.app__nav span {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
}
.app__nav a:hover { background: var(--paper); }
.app__nav a.is-active { background: rgba(78, 128, 114, 0.1); color: var(--green); }
.app__nav .is-disabled { color: rgba(107, 123, 118, 0.65); cursor: default; }
.app__nav .tag {
  margin-left: auto;
  padding: 0.05rem 0.4rem;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--warm-gray);
  background: var(--paper);
  border-radius: 999px;
}

/* Àrea principal */
.app__main { display: flex; flex-direction: column; min-width: 0; }
.app__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.75rem;
  background: var(--surface);
  border-bottom: 1px solid rgba(29, 29, 27, 0.08);
}
.app__user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--warm-gray);
}
.app__content { padding: 1.75rem; }
.page-title { margin: 0 0 1.25rem; font-size: 1.4rem; font-weight: 600; }

/* Botó secundari (contorn) */
.btn--ghost {
  width: auto;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(29, 29, 27, 0.15);
}
.btn--ghost:hover { background: var(--paper); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .app__side {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    overflow-x: auto;
  }
  .app__nav { flex-direction: row; }
  .app__nav-label { display: none; }
}

/* ---- Mòdul: toolbar, taula, badges ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.toolbar .page-title { margin-bottom: 0; }

.btn--inline { width: auto; padding: 0.5rem 1rem; text-decoration: none; }

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.25rem;
  background: var(--surface);
  border: 1px solid rgba(29, 29, 27, 0.08);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th,
.table td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(29, 29, 27, 0.06);
}
.table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--warm-gray);
  background: var(--paper);
}
.table tbody tr:last-child td { border-bottom: 0; }
.table__actions a { font-weight: 500; text-decoration: none; }
.muted { color: var(--warm-gray); }

.badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}
.badge--superadmin { background: rgba(78, 128, 114, 0.15); color: var(--green-dark); }
.badge--admin { background: rgba(61, 101, 136, 0.15); color: var(--blue); }
.badge--editor { background: rgba(52, 55, 61, 0.12); color: var(--graphite); }

/* ---- Formulari de mòdul ---- */
.form-card { max-width: 26rem; margin-top: 0.5rem; }
.form-card select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid rgba(29, 29, 27, 0.15);
  border-radius: 12px;
}
.form-card select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(78, 128, 114, 0.18);
}
.field-error { margin-top: 0.3rem; font-size: 0.8rem; color: #8a1c1c; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }

/* ---- Flash / missatges ---- */
.flash {
  margin-bottom: 1rem;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  border-radius: 10px;
  background: rgba(78, 128, 114, 0.12);
  color: var(--green-dark);
}
.flash--error { background: #fdecec; color: #8a1c1c; }

