:root {
  /* Identitat La Unió */
  --gold:        #EFC03A;
  --gold-dark:   #d4a82e;
  --gold-light:  rgba(239,192,58,.12);

  /* Sidebar */
  --sidebar-bg:  #161616;
  --sidebar-w:   224px;

  /* Superfícies */
  --color-bg:      #f4f5f7;
  --color-surface: #ffffff;
  --color-border:  #e4e6ea;

  /* Text */
  --color-text:    #111111;
  --color-muted:   #6b7280;
  --color-subtle:  #9ca3af;

  /* Semàfors */
  --color-success: #15803d;
  --color-warning: #b45309;
  --color-error:   #dc2626;

  /* Misc */
  --radius:  7px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.16);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout app ── */
body:not(.login-page) {
  min-height: 100vh;
}

/* ──────────────────────────────
   SIDEBAR
────────────────────────────── */
.sidebar {
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-logo {
  width: 34px; height: 34px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .1px;
}

.sidebar-sub {
  font-size: 10.5px;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-top: 1px;
}

/* Nav */
.nav-menu { list-style: none; padding: 10px 0; flex: 1; }
.nav-menu li { margin: 2px 10px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.55);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.9);
}

.nav-link.active {
  background: var(--gold-light);
  color: var(--gold);
  border-left-color: var(--gold);
  font-weight: 600;
}

/* Footer sidebar */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-info {
  font-size: 12px;
  color: rgba(255,255,255,.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ──────────────────────────────
   MAIN CONTENT
────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 36px 40px;
  min-height: 100vh;
}

/* ──────────────────────────────
   BUTTONS
────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s, opacity .15s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: .1px;
}

.btn-primary {
  background: var(--gold);
  color: #111;
}
.btn-primary:hover {
  background: var(--gold-dark);
  box-shadow: 0 2px 8px rgba(239,192,58,.35);
}

.btn-ghost {
  background: transparent;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}
.btn-ghost:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
}
.btn-danger:hover { opacity: .88; }

.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover { opacity: .88; }

.btn-sm      { padding: 5px 11px; font-size: 12px; }
.btn-block   { width: 100%; justify-content: center; margin-top: 10px; }

/* ──────────────────────────────
   FORMS
────────────────────────────── */
label {
  display: block;
  font-weight: 500;
  margin: 14px 0 5px;
  font-size: 13px;
  color: var(--color-text);
}

input[type=email],
input[type=password],
input[type=text],
input[type=date],
input[type=time],
input[type=tel],
input[type=number],
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color .15s, box-shadow .15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(239,192,58,.18);
}

textarea { resize: vertical; min-height: 72px; }

.error-msg {
  color: var(--color-error);
  font-size: 13px;
  margin-top: 8px;
  font-weight: 500;
}

/* ──────────────────────────────
   LOGIN PAGE
────────────────────────────── */
.login-page {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: center;
  min-height: 100vh;
  background: var(--color-bg);
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 380px;
  max-width: 95vw;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-logo    { width: 68px; margin-bottom: 14px; }
.login-card h1 { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.login-subtitle {
  color: var(--color-muted);
  font-size: 13px;
  margin-bottom: 28px;
}
.login-card form { text-align: left; }

.login-card .btn-primary {
  margin-top: 20px;
  padding: 10px 18px;
  font-size: 14px;
}

/* ──────────────────────────────
   BADGES
────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .45px;
}
.badge-success { background: #dcfce7; color: var(--color-success); }
.badge-warning { background: #fef3c7; color: var(--color-warning); }
.badge-muted   { background: #f1f3f5; color: var(--color-muted); }
.badge-error,
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-gold    { background: #fef9e7; color: #92680a; }

/* ──────────────────────────────
   PAGE HEADERS
────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 26px;
}

.page-header h2 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.2px;
}

/* ──────────────────────────────
   SEARCH / FILTER BAR
────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.search-bar input { flex: 1; }
