:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede6;
  --text: #0d0802;
  --muted: #6b685c;
  --line: #dedbd0;
  --accent: #f3e624;
  --accent-ink: #0d0802;
  --ok: #2f8a4c;
  --warn: #c7741a;
  --bad: #c2392f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0802;
    --surface: #1a1612;
    --surface-2: #262321;
    --text: #f1efe6;
    --muted: #a19d8e;
    --line: #34322b;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.carregant { padding: 40vh 0; text-align: center; color: var(--muted); }

/* Layout */
.top {
  position: sticky; top: 0; z-index: 10;
  background: #0d0802; color: #f6f5f1; border-bottom: 1px solid #262321;
  display: flex; align-items: center; gap: 16px; padding: 0 16px; height: 56px;
}
.logo { font-weight: 800; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo img { height: 30px; width: auto; display: block; }
.logo span { color: var(--accent); }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a {
  text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; opacity: .75;
}
.nav a:hover { opacity: 1; background: rgba(255,255,255,.08); }
.nav a.actiu { opacity: 1; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.usuari { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13px; }
.usuari button { background: none; border: 1px solid rgba(255,255,255,.3); color: inherit; border-radius: 8px; padding: 4px 10px; cursor: pointer; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 80px; }
@media (max-width: 700px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .usuari .nom { display: none; }
}

h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0; }
.sub { color: var(--muted); margin: 0 0 20px; }
.cap { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* Components */
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: var(--muted); }
.btn.prim { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.prim:hover { filter: brightness(.95); }
.btn.petit { padding: 4px 10px; font-size: 13px; }
.btn.perill { color: var(--bad); }
.btn.link { border: none; background: none; padding: 4px 6px; color: var(--muted); }
.btn.link:hover { color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.buit { color: var(--muted); padding: 16px 0; text-align: center; }

.filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filtres select, .filtres input { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }

.llista { display: flex; flex-direction: column; gap: 8px; }
.fila {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start;
}
.fila .cos { flex: 1; min-width: 0; }
.fila .cos p { margin: 4px 0 0; color: var(--muted); white-space: pre-wrap; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--muted); align-items: center; }
.accions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.fila.fet h3 { text-decoration: line-through; color: var(--muted); }
.clicable { cursor: pointer; }
.clicable:hover h3 { text-decoration: underline; }

.xip { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); font-size: 12px; color: var(--text); }
.xip.alta { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.xip.baixa { opacity: .7; }
.xip.vencuda { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); font-weight: 600; }
.xip.aviat { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.xip.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }

.estat-sel { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--surface); font-size: 13px; }
.check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; flex-shrink: 0; margin-top: 1px; display: grid; place-items: center; padding: 0; }
.check.on { background: var(--ok); border-color: var(--ok); color: white; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 800px) { .kanban { grid-template-columns: 1fr; } }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col > h3 { padding: 4px 4px 10px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.col .llista .fila { box-shadow: var(--shadow); }

.tabs { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; }
.tabs button { border: none; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* Vots */
.vot { display: flex; flex-direction: column; align-items: center; min-width: 48px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; cursor: pointer; background: var(--surface); }
.vot b { font-size: 17px; }
.vot span { font-size: 11px; color: var(--muted); }
.vot.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.vot.on span { color: var(--accent-ink); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { font-size: 26px; display: block; }
.stat span { color: var(--muted); font-size: 13px; }

/* Reunió */
.reunio-cap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.data-gran { background: #0d0802; color: var(--accent); border-radius: 10px; padding: 8px 14px; text-align: center; min-width: 72px; }
.data-gran b { display: block; font-size: 24px; line-height: 1.1; }
.data-gran span { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.punt-num { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.conclusio { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--ok); background: var(--surface-2); border-radius: 0 6px 6px 0; white-space: pre-wrap; }
.acta { white-space: pre-wrap; font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 14px; border-radius: 8px; max-height: 50vh; overflow: auto; }

/* Forms / modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.dialeg { background: var(--surface); border-radius: 14px; padding: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.dialeg h2 { margin-bottom: 16px; }
form .camp { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
form .camp label { font-size: 13px; color: var(--muted); font-weight: 500; }
form input, form select, form textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--bg); width: 100%;
}
form textarea { min-height: 90px; resize: vertical; }
form input:focus, form select:focus, form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.dues { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .dues { grid-template-columns: 1fr; } }
.peu { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }
.peu .dreta { display: flex; gap: 8px; margin-left: auto; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login .logo { font-size: 22px; margin-bottom: 4px; }
.login .logo { background: #0d0802; color: #f6f5f1; margin: -28px -28px 20px; padding: 22px 28px; border-radius: var(--radius) var(--radius) 0 0; }
.login .logo img { height: 40px; }
.login p { color: var(--muted); margin: 0 0 20px; }
.login .btn.prim { width: 100%; padding: 10px; }
.login .alt { text-align: center; margin-top: 14px; font-size: 13px; }
.error { color: var(--bad); font-size: 13px; margin: 8px 0; }
.info { color: var(--ok); font-size: 13px; margin: 8px 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); }
.toast[hidden] { display: none; }

table.taula { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.taula th, .taula td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.taula th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); }
.taula tr:last-child td { border-bottom: none; }
