/* ===========================================================================
   LC REUNIONS — sistema de disseny
   Estètica editorial suïssa: cantonades rectes, verds bosc de LC PAPER,
   neutres càlids de paper, vidre esmerilat i microinteraccions sòbries.
   Tipografia: IBM Plex Sans.
   =========================================================================== */

:root {
  /* Verds corporatius */
  --forest-900: #0c1a12;
  --forest-800: #122a1d;
  --forest-700: #1a3a29;
  --forest-600: #245138;
  --brand:      #1c5d3f;   /* verd del logotip LC PAPER */
  --green:      #1f7a54;
  --green-bright: #2aa06b;

  /* Mentes / superfícies tènues */
  --mint-300: #aedcc1;
  --mint-200: #d4e9da;
  --mint-100: #e9f3ec;

  /* Neutres freds */
  --paper:    #e9edec;
  --paper-2:  #dce2e1;
  --surface:  #ffffff;
  --surface-2:#f3f6f6;

  /* Tinta */
  --ink:    #14241c;
  --ink-2:  #46544b;
  --ink-3:  #6b766e;

  --line:   rgba(18, 42, 29, 0.13);
  --line-2: rgba(18, 42, 29, 0.08);
  --glass:  rgba(255, 255, 255, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.9);

  --danger: #b03a2c;
  --amber:  #3f6680;

  --shadow-sm: 0 1px 2px rgba(12, 26, 18, 0.06), 0 1px 1px rgba(12, 26, 18, 0.04);
  --shadow-md: 0 18px 38px -26px rgba(12, 26, 18, 0.45);
  --shadow-lg: 0 36px 70px -34px rgba(12, 26, 18, 0.5);
  --ring: 0 0 0 3px rgba(31, 122, 84, 0.22);

  --tap: 44px;            /* mida mínima tàctil */
  --topbar-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; border-radius: 0; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(820px 560px at 8% -6%, rgba(174, 220, 193, 0.5), transparent 60%),
    radial-gradient(760px 540px at 100% 0%, rgba(31, 122, 84, 0.16), transparent 58%),
    var(--paper);
  background-attachment: fixed;
}

::selection { background: var(--mint-300); color: var(--forest-900); }

h1 { font-size: clamp(22px, 3.2vw, 28px); font-weight: 600; margin: 0; letter-spacing: -0.018em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 {
  font-size: 12px; font-weight: 600; margin: 0 0 9px; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--ink-3);
}
p { margin: 0 0 10px; }
a { color: var(--green); text-underline-offset: 2px; }

/* ===========================================================================
   MARCA — logotip LC PAPER + separador + "Reunions"
   =========================================================================== */
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-logo { display: block; height: 27px; width: auto; }
.brand-sep {
  width: 1px; height: 25px; background: var(--line);
  transform: skewX(-12deg);
}
.brand-sub {
  font-size: 15px; font-weight: 300; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--forest-700);
  padding-right: 0.26em;
}
.brand--inverse .brand-logo { filter: brightness(0) invert(1); }
.brand--inverse .brand-sep { background: rgba(255, 255, 255, 0.34); }
.brand--inverse .brand-sub { color: rgba(255, 255, 255, 0.92); }

/* ===========================================================================
   TOPBAR
   =========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 26px;
  height: var(--topbar-h);
  padding: 0 26px;
  padding-left: max(26px, env(safe-area-inset-left));
  padding-right: max(26px, env(safe-area-inset-right));
  background: var(--glass-strong);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { text-decoration: none; flex: none; }

.topnav { display: flex; gap: 2px; margin-right: auto; }
.topnav-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 13px; font-size: 14px; font-weight: 500;
  color: var(--ink-2); text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}
.topnav-link:hover { color: var(--forest-700); background: var(--mint-100); }
.topnav-link.is-active {
  color: var(--forest-800); font-weight: 600;
  border-bottom-color: var(--green);
}
.nav-ico { width: 18px; height: 18px; flex: none; }

.topbar-user { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 6px 5px 5px;
}
.user-name {
  font-size: 13px; font-weight: 600; color: var(--forest-800);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.avatar {
  width: 32px; height: 32px; flex: none; object-fit: cover;
  display: grid; place-items: center;
  background: var(--forest-700); color: #fff;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--line);
}
.btn-logout {
  display: grid; place-items: center;
  width: var(--tap); height: var(--tap);
  background: none; border: 1px solid transparent; cursor: pointer;
  color: var(--ink-3); transition: color 0.16s, background 0.16s, border-color 0.16s;
}
.btn-logout svg { width: 19px; height: 19px; }
.btn-logout:hover { color: var(--danger); background: var(--surface); border-color: var(--line); }

/* Hamburguesa (mòbil) */
.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  width: var(--tap); height: var(--tap); margin-right: -8px;
  background: none; border: none; cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px; background: var(--forest-800);
  transition: transform 0.22s var(--ease), opacity 0.18s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Calaix mòbil */
.mobile-drawer {
  position: sticky; top: var(--topbar-h); z-index: 39;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  padding: 14px; box-shadow: var(--shadow-md);
  animation: drawer-in 0.22s var(--ease);
}
@keyframes drawer-in { from { opacity: 0; transform: translateY(-10px); } }
.drawer-user {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 8px 14px; border-bottom: 1px solid var(--line-2); margin-bottom: 10px;
}
.drawer-user .avatar { width: 42px; height: 42px; font-size: 15px; }
.drawer-user strong { display: block; font-size: 14px; }
.drawer-user span { font-size: 12px; color: var(--ink-3); }
.drawer-nav { display: flex; flex-direction: column; gap: 2px; }
.drawer-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 12px; min-height: var(--tap);
  font-size: 15px; font-weight: 500; color: var(--ink-2); text-decoration: none;
  border-left: 3px solid transparent;
}
.drawer-link.is-active {
  color: var(--forest-800); font-weight: 600;
  background: var(--mint-100); border-left-color: var(--green);
}
.drawer-link .nav-ico { width: 20px; height: 20px; }
.drawer-logout { margin-top: 12px; }

/* ===========================================================================
   ESTRUCTURA
   =========================================================================== */
.page {
  max-width: 1080px; margin: 0 auto;
  padding: clamp(15px, 3vw, 26px) clamp(12px, 3.2vw, 22px) 54px;
}
.page > section, .page > .cat-block, .page > .calendar { animation: rise 0.4s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.appfoot {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 26px 16px calc(26px + env(safe-area-inset-bottom));
  color: var(--ink-3); font-size: 12px; letter-spacing: 0.04em;
  text-align: center;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px 24px; margin-bottom: 26px; flex-wrap: wrap;
}
.page-head h1 + .meeting-sub { margin-top: 4px; }
.crumb { margin: 0 0 16px; font-size: 13px; }
.crumb a {
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none; color: var(--ink-2); font-weight: 500;
}
.crumb a:hover { color: var(--green); }

/* ===========================================================================
   FLASH
   =========================================================================== */
.flash-stack {
  position: fixed; top: calc(var(--topbar-h) + 14px); right: 18px; z-index: 60;
  display: flex; flex-direction: column; gap: 8px;
  width: min(380px, calc(100vw - 36px));
}
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 15px; font-size: 14px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-left: 3px solid var(--green);
  box-shadow: var(--shadow-md);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.flash-dot {
  width: 8px; height: 8px; margin-top: 5px; flex: none;
  background: var(--green);
}
.flash-error { border-left-color: var(--danger); }
.flash-error .flash-dot { background: var(--danger); }
.flash-success { border-left-color: var(--green-bright); }
.flash-success .flash-dot { background: var(--green-bright); }
.flash-info { border-left-color: var(--brand); }
.flash-info .flash-dot { background: var(--brand); }
.flash-out { opacity: 0; transform: translateX(16px); }

/* ===========================================================================
   PANELS / TARGETES
   =========================================================================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: clamp(14px, 2.3vw, 19px);
  margin-bottom: 13px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; }

/* ===========================================================================
   BOTONS
   =========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; font: inherit; font-weight: 600; font-size: 14px;
  min-height: var(--tap); padding: 11px 20px;
  border: 1px solid transparent; text-decoration: none; text-align: center;
  transition: transform 0.12s var(--ease), box-shadow 0.16s var(--ease),
              background 0.16s var(--ease), border-color 0.16s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--forest-800); color: #fff; }
.btn-primary:hover { background: var(--forest-700); box-shadow: var(--shadow-md); }
.btn-accent { background: var(--green); color: #fff; }
.btn-accent:hover { background: var(--green-bright); box-shadow: var(--shadow-md); }
.btn-started {
  background: var(--mint-200); color: var(--forest-800);
  border-color: color-mix(in srgb, var(--green) 32%, var(--line));
}
.btn-started:hover { background: var(--mint-300); }
.btn-soft {
  background: var(--surface); color: var(--forest-700);
  border-color: var(--line);
}
.btn-soft:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: rgba(176,58,44,0.4); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-block { display: flex; width: 100%; }

.btn-link {
  background: none; border: none; color: var(--green);
  cursor: pointer; font: inherit; font-weight: 600; padding: 0;
  text-decoration: none; border-bottom: 1px solid transparent;
}
.btn-link:hover { border-bottom-color: currentColor; }

.btn-nav {
  background: var(--surface); border: 1px solid var(--line);
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center; font-size: 20px;
  text-decoration: none; color: var(--forest-700);
  transition: background 0.16s, border-color 0.16s;
}
.btn-nav:hover { background: var(--surface-2); border-color: var(--ink-3); }

.btn-icon {
  background: none; border: 1px solid transparent; cursor: pointer;
  color: var(--ink-3); font-size: 15px; line-height: 1;
  width: 32px; height: 32px; display: grid; place-items: center;
  transition: color 0.16s, background 0.16s, border-color 0.16s;
}
.btn-icon:hover { color: var(--danger); background: var(--surface-2); border-color: var(--line); }

.badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px;
  padding: 0 5px; background: var(--green); color: #fff;
  font-size: 11px; font-weight: 700;
}

/* ===========================================================================
   GOOGLE SIGN-IN
   =========================================================================== */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 52px; padding: 12px 18px;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--forest-800);
  border: 1px solid var(--line);
  transition: background 0.16s var(--ease), box-shadow 0.16s var(--ease),
              transform 0.12s var(--ease);
}
.btn-google:hover { background: var(--surface-2); box-shadow: var(--shadow-md); }
.btn-google:active { transform: translateY(1px); }
.btn-google:disabled { cursor: not-allowed; color: var(--ink-3); background: var(--surface-2); }
.btn-google-logo { display: grid; place-items: center; }

/* ===========================================================================
   FORMULARIS
   =========================================================================== */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=email], input[type=number], input[type=password],
input[type=url], input[type=datetime-local], input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  min-height: var(--tap); padding: 10px 12px; margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green); box-shadow: var(--ring);
}
input[readonly], textarea[readonly] {
  background: var(--surface-2); color: var(--ink-2); cursor: default;
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2); color: var(--ink-2);
}
textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2346544b' stroke-width='1.6' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}
input[type=color] {
  width: 52px; height: var(--tap); min-height: var(--tap);
  padding: 3px; cursor: pointer; border: 1px solid var(--line);
  background: var(--surface); margin-top: 6px;
}
.cb {
  display: flex; align-items: center; gap: 9px; font-size: 14px;
  color: var(--ink); font-weight: 400; cursor: pointer;
  padding: 7px 0; min-height: 38px;
}
.cb input[type=checkbox] {
  width: 19px; height: 19px; min-height: 0; margin: 0; flex: none;
  accent-color: var(--green); cursor: pointer;
}
fieldset {
  border: 1px solid var(--line); padding: 14px; margin: 16px 0 0;
  background: var(--surface-2);
}
legend {
  font-size: 11px; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em; padding: 0 7px;
}
.checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 2px 16px;
}
.hidden-form { display: none; }
.hint { font-size: 13.5px; color: var(--ink-3); margin: 8px 0 0; }

.row-form { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.row-form label { flex: 1; min-width: 170px; }
.row-form .cb { align-self: center; flex: none; }
.row-form .btn { flex: none; }

/* ===========================================================================
   ACCÉS (login / contribute)
   =========================================================================== */
.auth-page {
  min-height: 100vh; min-height: 100dvh;
  display: grid; padding: 0;
}
.auth-shell {
  display: grid; grid-template-columns: 1.05fr 1fr;
  width: 100%; min-height: 100vh; min-height: 100dvh;
}
.auth-aside {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 40px; padding: clamp(34px, 5vw, 60px);
  color: #fff;
  background:
    radial-gradient(640px 420px at 80% 0%, rgba(42, 160, 107, 0.4), transparent 62%),
    radial-gradient(720px 520px at 0% 100%, rgba(174, 220, 193, 0.22), transparent 60%),
    linear-gradient(160deg, var(--forest-900), var(--forest-700));
}
.auth-aside::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 44px 44px; pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside-body h2 {
  font-size: clamp(26px, 3.4vw, 38px); font-weight: 600;
  letter-spacing: -0.02em; line-height: 1.18; margin: 0 0 16px;
}
.auth-aside-body p { color: rgba(255,255,255,0.78); font-size: 15px; max-width: 42ch; }
.auth-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 11px; }
.auth-points li {
  position: relative; padding-left: 26px;
  color: rgba(255,255,255,0.9); font-size: 14px;
}
.auth-points li::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 14px; height: 8px;
  border-left: 2px solid var(--mint-300); border-bottom: 2px solid var(--mint-300);
  transform: rotate(-45deg);
}
.auth-aside-foot {
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255,255,255,0.55); margin: 0;
}

.auth-main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: clamp(28px, 5vw, 56px);
  background: var(--surface);
}
.auth-card { width: 100%; max-width: 392px; }
.auth-kicker {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--green);
  margin-bottom: 12px;
}
.auth-card h1 { font-size: 27px; margin-bottom: 8px; }
.auth-hint { color: var(--ink-2); font-size: 14.5px; margin: 0 0 26px; }
.auth-fineprint { font-size: 12px; color: var(--ink-3); margin: 16px 0 0; line-height: 1.5; }
.auth-help { font-size: 12.5px; color: var(--ink-3); text-align: center; margin: 0; }
.auth-notice {
  margin-top: 16px; padding: 13px 15px; font-size: 13px; line-height: 1.55;
  background: var(--mint-100); border: 1px solid var(--line);
  border-left: 3px solid var(--amber); color: var(--ink-2);
}
.auth-notice strong { display: block; color: var(--ink); margin-bottom: 3px; }
.auth-notice code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px;
  background: var(--surface); padding: 1px 5px; border: 1px solid var(--line);
}

/* Botó d'accés alternatiu (ereaders sense Gmail) — mateixa amplada i alçada
   que el botó de Google, però amb aspecte secundari. */
.btn-ereader {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 52px; padding: 12px 18px; margin-top: 12px;
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  text-align: center; text-decoration: none;
  background: var(--surface); color: var(--forest-800);
  border: 1px solid var(--line);
  transition: background 0.16s var(--ease), box-shadow 0.16s var(--ease),
              transform 0.12s var(--ease);
}
.btn-ereader:hover { background: var(--surface-2); box-shadow: var(--shadow-md); }
.btn-ereader:active { transform: translateY(1px); }
.btn-ereader-ico { display: grid; place-items: center; color: var(--ink-2); }
.btn-ereader--primary {
  background: var(--forest-800); color: #fff; border-color: var(--forest-800);
}
.btn-ereader--primary:hover { background: var(--forest-700); }
.auth-form { display: block; margin: 0 0 6px; }
.auth-form .auth-label { margin-bottom: 14px; }

/* Pàgina de configuració del login manual */
.page-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.manual-status { margin: 0 0 16px; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.manual-status--ok { color: var(--forest-700); }
.manual-note { margin-top: 18px; }

/* Targeta d'accés simple (contribute) */
.auth-simple {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 18px;
}
.auth-box {
  width: 100%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); padding: clamp(26px, 5vw, 40px);
}
.auth-box .brand { margin-bottom: 24px; }
.auth-box h1 { font-size: 23px; margin-bottom: 8px; }

/* ===========================================================================
   SELECTOR DE VISTA
   =========================================================================== */
.view-toggle { display: inline-flex; border: 1px solid var(--line); background: var(--surface); }
.view-toggle a {
  display: inline-flex; align-items: center; padding: 9px 16px; min-height: 40px;
  text-decoration: none; color: var(--ink-2); font-size: 13px; font-weight: 600;
  transition: background 0.16s, color 0.16s;
}
.view-toggle a + a { border-left: 1px solid var(--line); }
.view-toggle a:hover { background: var(--surface-2); }
.view-toggle a.is-active { background: var(--forest-800); color: #fff; }

/* Selector de vista dins la barra de navegació (escriptori) */
.nav-view-toggle { margin-left: 16px; align-self: center; }
.nav-view-toggle a { padding: 6px 13px; min-height: 32px; font-size: 12.5px; }

/* Selector de vista dins el calaix mòbil */
.drawer-view-toggle { display: flex; margin-top: 12px; }
.drawer-view-toggle a { flex: 1; justify-content: center; min-height: var(--tap); }

/* ===========================================================================
   ESTATS BUITS / TAGS / STATUS
   =========================================================================== */
.empty {
  color: var(--ink-2); padding: 48px 24px; text-align: center;
  background: var(--surface); border: 1px dashed var(--line);
}
.empty-row { color: var(--ink-3); font-size: 13px; padding: 14px 6px; }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 5px 10px; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; flex: none; }
.status-draft { background: var(--paper-2); color: var(--forest-700); }
.status-draft::before { background: var(--ink-3); }
.status-started { background: var(--mint-200); color: var(--forest-800); }
.status-started::before { background: var(--green-bright); box-shadow: 0 0 0 3px rgba(42,160,107,0.25); }
.status-finished { background: var(--surface-2); color: var(--ink-3); }
.status-finished::before { background: var(--ink-3); }

.tag {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 8px; background: var(--paper-2); color: var(--ink-2);
}
.tag-guest { background: var(--mint-200); color: var(--forest-800); }
.tag-req { background: var(--brand); color: #fff; }
.tag-adhoc { background: var(--amber); color: #fff; }
.tag-ok { background: var(--mint-200); color: var(--forest-800); }
.tag-off { background: rgba(176,58,44,0.13); color: var(--danger); }

/* ===========================================================================
   HOME — blocs de categoria
   =========================================================================== */
.cat-block {
  background: color-mix(in srgb, var(--cat-color, var(--green)) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--cat-color, var(--green)) 42%, var(--line));
  box-shadow: var(--shadow-sm); margin-bottom: 13px;
}
.cat-head {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 15px; border-bottom: 1px solid var(--line-2);
}
.cat-head h2 { margin: 0; font-size: 16px; }
.cat-dot {
  width: 11px; height: 11px; flex: none;
  background: var(--cat-color, var(--green));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cat-color, var(--green)) 18%, transparent);
}
.cat-count {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ink-3);
  text-transform: lowercase;
}

.meeting-list { padding: 6px; }
.meeting-row {
  display: flex; align-items: center; gap: 7px 18px; flex-wrap: wrap;
  padding: 10px 13px; text-decoration: none; color: var(--ink);
  border-left: 3px solid var(--cat-color, var(--green));
  transition: background 0.15s var(--ease), transform 0.12s var(--ease);
}
.meeting-row:hover { background: var(--surface); }
.meeting-row:active { transform: scale(0.997); }
.ui-ico { width: 15px; height: 15px; flex: none; }
.mr-cell { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.mr-cell .ui-ico { color: var(--ink-3); }
.mr-date { font-weight: 600; }
.mr-time, .mr-place { color: var(--ink-2); }
.mr-place { flex: 1; min-width: 130px; }
.mr-name { flex: 2; min-width: 150px; font-weight: 600; font-size: 14.5px; }
.meeting-row .status { margin-left: auto; }

/* Nova reunió (details) */
.new-meeting { border-top: 1px solid var(--line-2); }
.new-meeting summary {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px; cursor: pointer; font-weight: 600; font-size: 13.5px;
  color: var(--green); list-style: none;
  transition: background 0.15s;
}
.new-meeting summary:hover { background: var(--surface-2); }
.new-meeting summary::-webkit-details-marker { display: none; }
.new-meeting summary::before {
  content: "+"; display: grid; place-items: center;
  width: 20px; height: 20px; font-size: 17px; font-weight: 400;
  background: var(--mint-100); color: var(--green);
  transition: transform 0.2s var(--ease);
}
.new-meeting[open] summary::before { transform: rotate(45deg); }
.nm-form { padding: 4px 15px 18px; }
.nm-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 14px;
}
.nm-note {
  font-size: 13px; color: var(--ink-2); margin: 12px 0;
  padding: 10px 12px; background: var(--mint-100); border-left: 3px solid var(--brand);
}

/* ===========================================================================
   CALENDARI
   =========================================================================== */
.cal-head {
  display: flex; align-items: stretch; justify-content: center;
  width: max-content; max-width: 100%; margin: 0 auto 18px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.cal-head .btn-nav { border: 0; flex: none; }
.cal-head .btn-nav:first-of-type { border-right: 1px solid var(--line); }
.cal-head .btn-nav:last-of-type { border-left: 1px solid var(--line); }
.cal-head h2 {
  margin: 0; font-size: 18px; min-width: 220px; text-align: center;
  display: flex; align-items: center; justify-content: center; padding: 0 16px;
}
.calendar {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.cal-dow {
  background: var(--forest-800); color: var(--mint-200);
  text-align: center; padding: 10px 0; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
}
.cal-cell {
  background: var(--surface); min-height: 108px; padding: 7px;
  display: flex; flex-direction: column; gap: 4px;
  min-width: 0;
}
.cal-cell[data-date] { cursor: pointer; }
.cal-empty { background: var(--surface-2); }
.cal-weekend {
  background:
    repeating-linear-gradient(45deg,
      rgba(176, 58, 44, 0.085) 0, rgba(176, 58, 44, 0.085) 2px,
      transparent 2px, transparent 9px),
    var(--surface-2);
}
.cal-weekend .cal-num { color: var(--danger); }
.cal-dow-weekend { color: #e8a99f; }
.cal-today { background: var(--mint-100); }
.cal-num { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.cal-today .cal-num {
  color: #fff; background: var(--green);
  width: 21px; height: 21px; display: grid; place-items: center;
}
/* Reunió del sistema: color del grup, text en negreta i indicador «›» */
.cal-pill {
  display: block; position: relative;
  font-size: 11.5px; font-weight: 700; color: #fff;
  text-decoration: none; padding: 4px 16px 4px 7px;
  background: var(--cat-color, var(--green));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: filter 0.14s;
}
.cal-pill:hover { filter: brightness(1.12); }
.cal-pill-go {
  position: absolute; right: 2px; top: 0; bottom: 0;
  display: flex; align-items: center; font-size: 14px; font-weight: 700;
}
/* Esdeveniment de Google Calendar: tipografia normal, sense color de grup */
.cal-pill-gcal {
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line); font-weight: 400;
  padding-right: 7px;
}
.cal-pill-gcal:hover { filter: none; background: var(--surface-2); }

/* ===========================================================================
   ADMIN — categories / usuaris
   =========================================================================== */
.cat-admin-list, .user-list { display: flex; flex-direction: column; gap: 8px; }
.cat-admin-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--cat-color, var(--green));
}
.cat-admin-name { flex: 1; min-width: 160px; font-weight: 600; }
.cat-admin-name-input { flex: 1; min-width: 180px; }
.cat-admin-row input[type=color] { margin-top: 0; }

.user-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px; background: var(--surface-2); border: 1px solid var(--line-2);
}
.ur-fields { display: flex; gap: 10px; flex: 1; min-width: 250px; }
.ur-fields input { margin-top: 0; }
.ur-flags { display: flex; gap: 8px 16px; flex-wrap: wrap; }
.ur-actions { display: flex; gap: 8px; margin-left: auto; }

/* ===========================================================================
   FITXA DE REUNIÓ
   =========================================================================== */
.meeting-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 15px; padding: 14px 17px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--cat-color, var(--green));
  box-shadow: var(--shadow-sm);
}
.meeting-head .cat-dot { width: 13px; height: 13px; }
.meeting-head h1 { font-size: clamp(20px, 2.6vw, 24px); }
.meeting-sub { margin: 5px 0 0; color: var(--ink-2); font-size: 14px; }
.meeting-head .status { margin-left: auto; }

.meet-banner {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 14px 18px;
  background: var(--mint-100); border: 1px solid var(--line);
  border-left: 3px solid var(--green);
}
.meet-banner svg { width: 22px; height: 22px; flex: none; color: var(--green); }
.meet-banner-text { flex: 1; min-width: 160px; font-size: 13px; }
.meet-banner-text strong { display: block; font-size: 13px; }
.meet-banner-text span { color: var(--ink-3); font-size: 12px; word-break: break-all; }

.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.attendees-block { margin-top: 20px; }
.attendee-tags {
  list-style: none; display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 0;
}
.attendee-tags li {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 6px 11px; font-size: 13px;
}
.attendee-tags li::before {
  content: ""; width: 6px; height: 6px; background: var(--green); flex: none;
}

.pending-list {
  list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px;
}
.pending-list li {
  padding: 12px; background: var(--surface-2); border: 1px solid var(--line-2);
}
.pending-list .cb { align-items: flex-start; padding: 0; }
.pending-meta { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; }

.topic-card {
  border: 1px solid var(--line); background: var(--surface-2);
  padding: 13px; margin-bottom: 10px;
  transition: border-color 0.16s;
}
.topic-card:focus-within { border-color: var(--green); }
.topic-top { display: flex; align-items: center; gap: 10px; }
.topic-title { font-weight: 600; margin-top: 0 !important; }
.dev-label { display: block; margin-top: 13px; }
.topic-images {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px;
}
.topic-image { position: relative; }
.topic-image img {
  display: block; max-width: 240px; max-height: 180px; width: auto; height: auto;
  border: 1px solid var(--line); background: var(--paper-2);
}
.topic-image-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; padding: 0; line-height: 18px;
  font-size: 14px; font-weight: 700;
  background: rgba(0,0,0,0.72); color: #fff; border: none; cursor: pointer;
  border-radius: 0;
}
.topic-image-del:hover { background: var(--danger); }
.topic-image-add {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 96px; min-height: 88px;
  padding: 0 14px; border: 1px dashed var(--ink-3); color: var(--ink-3);
  cursor: pointer; font-size: 13px; font-weight: 600;
  background: var(--paper-2);
}
.topic-image-add:hover { border-color: var(--brand); color: var(--brand); }
.topic-image-add input[type="file"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden;
}
.steps-block {
  margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 13px;
}
.steps-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-3); margin-bottom: 10px;
}
.steps { display: flex; flex-direction: column; gap: 8px; }
.step-row { display: flex; gap: 8px; align-items: center; }
.step-row input, .step-row select { margin-top: 0; }
.step-desc { flex: 1; }
.step-resp { width: 210px; flex: none; }

.action-bar {
  display: flex; gap: 9px; flex-wrap: wrap; align-items: center;
  margin-top: 15px;
}
.action-bar form { display: inline; margin: 0; }

/* ===========================================================================
   PETICIONS / ORDRE DEL DIA
   =========================================================================== */
.request-row {
  display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap;
  padding: 16px; background: var(--surface-2);
  border: 1px solid var(--line-2); border-left: 3px solid var(--brand);
  margin-bottom: 10px;
}
.rr-body { flex: 1; min-width: 200px; }
.rr-text { margin: 7px 0; font-size: 14px; }
.rr-meta { font-size: 12px; color: var(--ink-3); }
.rr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rr-actions form { margin: 0; }
.request-history { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.agenda-list { padding-left: 22px; margin: 0 0 18px; }
.agenda-list li { padding: 5px 0; }

/* ===========================================================================
   RESPONSIVE
   =========================================================================== */
@media (max-width: 860px) {
  .topnav, .topbar-user { display: none; }
  .nav-toggle { display: flex; margin-left: auto; }
  .topbar { gap: 14px; }
  .brand-sub { letter-spacing: 0.2em; }
}
@media (min-width: 861px) {
  .mobile-drawer { display: none !important; }
}
@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside {
    flex-direction: row; flex-wrap: wrap;
    align-items: center; justify-content: center;
    gap: 16px; padding: 11px 20px;
  }
  .auth-aside-body, .auth-aside-foot { display: none; }
  .auth-main { padding: 32px 20px 44px; }
}
@media (max-width: 620px) {
  .page-head { margin-bottom: 20px; }
  .meeting-row { gap: 6px 14px; padding: 13px; }
  .mr-name { flex: 1 1 100%; }
  .mr-place { flex: 1 1 auto; }
  .cal-cell { min-height: 64px; padding: 4px; }
  .step-row { flex-wrap: wrap; }
  .step-desc { flex: 1 1 100%; }
  .step-resp { width: 100%; }
  .ur-actions { margin-left: 0; width: 100%; }
  .ur-actions .btn { flex: 1; }
  .flash-stack { left: 12px; right: 12px; width: auto; }
  .action-bar .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Mode app instal·lada */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .mobile-drawer { top: calc(var(--topbar-h) + env(safe-area-inset-top)); }
}

/* ===========================================================================
   UBICACIONS · ERROR DE CALENDARI · COLUMNES DE LA FITXA
   =========================================================================== */
.btn-back { margin-bottom: 18px; font-size: 15px; padding: 13px 22px; }

.cal-error {
  display: flex; flex-direction: column; gap: 4px;
  max-width: 760px; margin: 0 auto 18px; padding: 13px 16px;
  font-size: 13.5px; line-height: 1.5; color: var(--ink);
  background: rgba(63, 102, 128, 0.12);
  border: 1px solid rgba(63, 102, 128, 0.4);
  border-left: 3px solid var(--amber);
}
.cal-error strong { font-size: 14px; }

.meeting-loc {
  margin: 6px 0 0; font-size: 13.5px; font-weight: 600; color: var(--forest-700);
}

.meeting-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px;
}
.meeting-cols .attendees-block { margin-top: 0; }
.location-block { display: flex; flex-direction: column; gap: 13px; }
@media (max-width: 720px) {
  .meeting-cols { grid-template-columns: 1fr; gap: 18px; }
}

.loc-list { display: flex; flex-direction: column; gap: 14px; }
.loc-planta { border: 1px solid var(--line); background: var(--surface); }
.loc-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 15px;
}
.loc-row + .loc-row { border-top: 1px solid var(--line-2); }
.loc-sala { padding-left: 32px; background: var(--surface-2); }
.loc-name { flex: 1; min-width: 160px; font-weight: 600; font-size: 14.5px; }
.loc-level {
  display: inline-block; margin-right: 7px; padding: 2px 7px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; background: var(--mint-200); color: var(--forest-800);
}
.loc-sala .loc-level { background: var(--paper-2); color: var(--ink-2); }

.nm-end { margin: 12px 0 8px; font-size: 13.5px; color: var(--ink-2); }
.nm-end strong { color: var(--forest-700); }

.cat-admin-dur { width: 78px; flex: none; margin-top: 0; }
.cat-admin-unit { font-size: 13px; color: var(--ink-3); }

/* ===========================================================================
   MODAL — nova reunió des del calendari
   =========================================================================== */
.modal {
  display: flex; position: fixed; inset: 0; z-index: 100;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(12, 26, 18, 0.55);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal-box {
  position: relative; z-index: 1; width: 100%; max-width: 480px;
  max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); padding: 24px;
  animation: rise 0.22s var(--ease) both;
}
.modal-x {
  position: absolute; top: 9px; right: 9px;
  width: 34px; height: 34px; display: grid; place-items: center;
  background: none; border: 1px solid transparent; cursor: pointer;
  font-size: 15px; color: var(--ink-3);
}
.modal-x:hover { background: var(--surface-2); border-color: var(--line); }
.modal-box h2 { margin-bottom: 4px; }
.modal-sub { color: var(--ink-2); font-size: 13.5px; margin: 0 0 16px; }
.modal-hint { font-size: 13.5px; color: var(--ink-2); margin: 0 0 10px; }
.modal-cats { display: flex; flex-direction: column; gap: 8px; }
.modal-cat {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; min-height: var(--tap);
  background: var(--surface); cursor: pointer; text-align: left;
  font: inherit; font-size: 14.5px; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cat-color, var(--green));
  transition: background 0.15s var(--ease);
}
.modal-cat:hover { background: var(--surface-2); }
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.modal-back {
  align-self: flex-start;
  background: none; border: none; cursor: pointer; font: inherit;
  font-size: 13.5px; font-weight: 600; color: var(--green); padding: 0;
}
.modal-cat-name {
  display: flex; align-items: center; gap: 9px; margin: 0;
  font-size: 15px; font-weight: 700;
  border-left: 3px solid var(--cat-color, var(--green)); padding-left: 10px;
}

/* ===========================================================================
   BANNER D'INSTAL·LACIÓ (PWA)
   =========================================================================== */
.install-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px calc(11px + env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: var(--forest-800); color: #fff;
  box-shadow: 0 -10px 30px -14px rgba(0, 0, 0, 0.6);
  animation: rise 0.3s var(--ease) both;
}
.install-banner-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.install-banner-icon { flex: none; border: 1px solid rgba(255, 255, 255, 0.22); }
.install-banner-text { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.install-banner-text strong { font-size: 14px; }
.install-banner-text span { font-size: 12.5px; color: rgba(255, 255, 255, 0.82); line-height: 1.4; }
.install-banner .btn-primary { flex: none; min-height: 40px; padding: 9px 16px; }
.install-banner-x {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  background: none; border: 1px solid rgba(255, 255, 255, 0.28); cursor: pointer;
  color: rgba(255, 255, 255, 0.85); font-size: 14px;
}
.install-banner-x:hover { background: rgba(255, 255, 255, 0.12); }

/* ===========================================================================
   BOTÓ AFEGIR · SELECTOR D'ASSISTENTS (autocompletat)
   =========================================================================== */
.btn-add {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--green); cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 600; padding: 8px 13px;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn-add:hover { background: var(--mint-100); border-color: var(--green); }

.attendee-picker { position: relative; }
.ap-field {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: var(--tap); margin-top: 6px; padding: 5px 6px;
  background: var(--surface); border: 1px solid var(--line);
  cursor: text;
}
.ap-field:focus-within { border-color: var(--green); box-shadow: var(--ring); }
.ap-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 3px 3px 9px;
  background: var(--mint-100); border: 1px solid var(--mint-200);
  color: var(--forest-800); font-size: 13px; font-weight: 600;
}
.ap-chip-x {
  display: grid; place-items: center; width: 20px; height: 20px;
  background: none; border: none; cursor: pointer;
  color: var(--ink-3); font-size: 16px; line-height: 1;
}
.ap-chip-x:hover { color: var(--danger); }
input.ap-input {
  flex: 1; min-width: 150px;
  border: none; background: none; box-shadow: none;
  min-height: 30px; padding: 2px 4px; margin: 0; font-size: 14px;
}
input.ap-input:focus { border: none; box-shadow: none; }
.ap-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30;
  margin-top: 2px; max-height: 240px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.ap-option {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; font: inherit;
  font-size: 14px; padding: 9px 12px; color: var(--ink);
}
.ap-option:hover { background: var(--mint-100); }
.ap-empty { margin: 0; padding: 10px 12px; font-size: 13px; color: var(--ink-3); }

/* Documents adjunts */
.att-list { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 6px; }
.att-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line-2);
}
.att-row form { margin: 0; }
.att-name { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; color: var(--green); word-break: break-all; }
.att-size { flex: none; font-size: 12.5px; color: var(--ink-3); }
.att-upload { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
.att-upload input[type=file] {
  flex: 1; min-width: 200px; font-size: 13px;
  padding: 8px; border: 1px solid var(--line); background: var(--surface);
}

/* ===========================================================================
   CALENDARI RESPONSIVE — mes (escriptori) / setmana dl–dv / llista de dies
   =========================================================================== */
.cal-rotate-hint {
  display: none; margin: 0 0 10px; padding: 8px 12px;
  font-size: 12.5px; color: var(--ink-2); text-align: center;
  background: var(--surface-2); border: 1px solid var(--line-2);
}
.cal-week, .cal-list { display: none; }
.cal-week { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.cal-list { border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.cal-list-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 9px 11px; background: var(--surface);
}
.cal-list-row + .cal-list-row { border-top: 1px solid var(--line-2); }
.cal-list-row[data-date] { cursor: pointer; }
.cal-list-today { background: var(--mint-100); }
.cal-list-day { flex: none; width: 46px; text-align: center; }
.cal-list-dow {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3);
}
.cal-list-num { display: block; font-size: 19px; font-weight: 600; line-height: 1.15; }
.cal-list-today .cal-list-num { color: var(--green); }
.cal-list-pills {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  padding-top: 2px;
}
.cal-list-pills:empty::after { content: "—"; color: var(--ink-3); font-size: 13px; }
.cal-list-pills .cal-pill { font-size: 13px; }
.cal-list-row--weekend {
  padding: 2px 11px; align-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(176, 58, 44, 0.07) 0 2px, transparent 2px 9px),
    var(--surface-2);
}
.cal-list-row--weekend .cal-list-day {
  width: auto; display: flex; gap: 6px; align-items: baseline;
}
.cal-list-row--weekend .cal-list-num { font-size: 12px; font-weight: 600; color: var(--ink-3); }

@media (max-width: 820px) and (orientation: portrait) {
  .cal-month, .cal-week { display: none; }
  .cal-list { display: block; }
  .cal-rotate-hint { display: block; }
}
@media (orientation: landscape) and (max-height: 560px) {
  .cal-month, .cal-list { display: none; }
  .cal-week { display: grid; }
  .cal-week .cal-cell { min-height: 0; }
}

/* Impressió: desplegable a la barra d'accions */
.print-menu { position: relative; }
.print-menu summary { list-style: none; }
.print-menu summary::-webkit-details-marker { display: none; }
.print-caret { font-size: 11px; }
.print-menu[open] summary { border-color: var(--ink-3); }
.print-menu-pop {
  position: absolute; z-index: 40; left: 0; bottom: calc(100% + 5px);
  min-width: 210px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.print-menu-pop a {
  padding: 11px 15px; text-decoration: none;
  color: var(--ink); font-size: 14px; font-weight: 600;
}
.print-menu-pop a:hover { background: var(--surface-2); }

/* Reprogramar: llapis discret al costat de la data de la fitxa */
.reschedule-btn {
  background: none; border: none; cursor: pointer; padding: 2px;
  margin-left: 4px; color: var(--ink-3); vertical-align: middle;
  display: inline-grid; place-items: center;
  transition: color 0.15s;
}
.reschedule-btn:hover { color: var(--green); }
.reschedule-btn .ui-ico { width: 15px; height: 15px; }

/* Llistat de reunions: botó discret d'eliminació */
.meeting-row-wrap { display: flex; align-items: stretch; }
.meeting-row-wrap .meeting-row { flex: 1; min-width: 0; }
.mr-del {
  flex: none; width: 38px;
  background: none; border: none; cursor: pointer;
  color: var(--ink-3); font-size: 13px; line-height: 1;
  display: grid; place-items: center;
  transition: color 0.15s, background 0.15s;
}
.mr-del:hover { color: var(--danger); background: var(--surface); }

/* Enviament de l'ordre del dia amb adjunts */
.agenda-send {
  display: flex; flex-direction: column; gap: 8px;
  align-items: flex-start; margin-top: 14px;
}
.agenda-send .hint { margin: 0; }

/* ===========================================================================
   ESCRIPTURA A MÀ (HWR) + AUTOGUARDAT
   =========================================================================== */
/* Botó «Escriure a mà»: només visible en tauletes/ereaders en portrait
   (més amples que un mòbil, més estrets que un ordinador). Rang ajustable. */
.hw-open {
  display: none; align-items: center; gap: 6px; margin-top: 6px;
  padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--forest-700); border: 1px solid var(--line);
}
.hw-open:hover { background: var(--surface-2); border-color: var(--ink-3); }
.hw-open svg { width: 18px; height: 18px; }
/* El toc sempre ha d'arribar al <button>, no a la icona/text interiors
   (en alguns WebView, closest() sobre un node SVG falla). */
.hw-open > svg, .hw-open > span { pointer-events: none; }
@media (min-width: 640px) and (max-width: 1280px) and (orientation: portrait) {
  .hw-open { display: inline-flex; }
}

.hw-modal { padding: 0; }
/* Pantalla completa robusta: posició fixa amb els quatre costats a 0, sense
   dependre de inset/dvh ni del centrat flex del pare (WebView antics). */
.hw-box {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1;
  width: auto; height: auto;
  background: var(--surface); display: flex; flex-direction: column;
  animation: rise 0.18s var(--ease) both;
}
.hw-bar {
  flex: 0 0 6%; min-height: 44px; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.hw-title {
  flex: 1; font-weight: 600; color: var(--forest-800);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hw-lang { display: flex; border: 1px solid var(--line); }
.hw-lang button {
  font: inherit; font-size: 12px; font-weight: 600; padding: 6px 11px;
  background: var(--surface); color: var(--ink-2); border: none;
  border-left: 1px solid var(--line); cursor: pointer;
}
.hw-lang button:first-child { border-left: none; }
.hw-lang button.is-active { background: var(--forest-800); color: #fff; }
.hw-ok { min-height: 36px; padding: 7px 20px; }
.hw-write {
  flex: 1 1 47%; position: relative; background: #fff;
  border-bottom: 1px solid var(--line); overflow: hidden;
}
#hw-canvas {
  display: block; width: 100%; height: 100%;
  touch-action: none;                       /* el llapis no fa scroll */
  user-select: none; -webkit-user-select: none; cursor: crosshair; background: #fff;
}
.hw-write-tools { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.hw-write-tools .btn { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.hw-status { position: absolute; bottom: 6px; right: 10px; font-size: 12px; color: var(--ink-3); }
/* Part inferior: només lectura i insensible a qualsevol toc (dit o llapis) */
.hw-read {
  flex: 1 1 47%; overflow-y: auto; padding: 14px; white-space: pre-wrap;
  pointer-events: none; touch-action: none; user-select: none;
  background: var(--surface-2); color: var(--ink); font-size: 19px; line-height: 1.6;
}

.autosave-ind {
  position: fixed; bottom: 16px; left: 50%;
  transform: translateX(-50%) translateY(20px); z-index: 200;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  background: var(--forest-800); color: #fff; border: 1px solid var(--line);
  opacity: 0; transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  pointer-events: none;
}
.autosave-ind.show { opacity: 1; transform: translateX(-50%) translateY(0); }
