/* Panel · mateix llenguatge visual que la comptabilitat d'IDROX: fons blau-negre, superfícies planes, números en monoespai. */
:root {
  --bg: #0B0E14; --bg-2: #0F141C; --surface: #151B25; --surface-2: #1A212D;
  --line: #27303E; --line-soft: #1F2733;
  --txt: #E7ECF3; --txt-2: #9AA6B8; --txt-3: #646F80;
  --in: #3DD68C; --in-dim: #163027; --out: #F2727C; --out-dim: #301A1D;
  --iva: #F5A623; --iva-dim: #2E2412; --blue: #0A84FF; --blue-dim: #10243E; --purple: #9B7DF0;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  /* àlies que fa servir el codi */
  --ink: var(--txt); --mute: var(--txt-2); --faint: var(--txt-3); --hair: var(--line-soft);
  --pos: var(--in); --neg: var(--out); --accent: var(--blue); --accent-2: var(--blue);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --side: 226px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body {
  margin: 0; background: radial-gradient(1200px 600px at 70% -10%, #121A26 0%, var(--bg) 55%) fixed; color: var(--txt);
  font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; min-height: 100vh;
}
body.lock { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
::placeholder { color: var(--txt-3); }

/* ---------- Estructura ---------- */
.shell { position: relative; max-width: 1000px; margin: 0 auto; padding: calc(var(--safe-t) + 20px) 16px calc(96px + var(--safe-b)); min-height: 100vh; }
.top { display: flex; align-items: flex-end; gap: 10px; padding: 4px 0 20px; }
.top .ttl { flex: 1; min-width: 0; }
.top h1 { font-size: 23px; line-height: 1.15; margin: 0; font-weight: 650; letter-spacing: -.5px; }
.top .avail { margin: 3px 0 0; color: var(--txt-3); font-size: 13px; }
.top .avail b { color: var(--txt); font-weight: 600; }
.iconbtn {
  width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--surface); border: 1px solid var(--line-soft);
  color: var(--txt-2); transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--surface-2); color: var(--txt); }
.iconbtn:active { transform: scale(.94); }
.nav-month { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.nav-month .lbl { flex: 1; text-align: center; font-weight: 600; font-size: 14.5px; text-transform: capitalize; cursor: pointer; }
.nav-month button { border: 0; background: transparent; width: 40px; height: 34px; border-radius: 9px; font-size: 22px; line-height: 1; color: var(--txt-2); }
.nav-month button:hover { background: var(--surface-2); color: var(--txt); }
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 17px; margin-bottom: 14px; }
.card h2 { font-size: 11px; margin: 0 0 8px; color: var(--txt-3); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.muted { color: var(--txt-3); }
.empty { text-align: center; color: var(--txt-3); padding: 38px 12px; }
.grp-h { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 4px 8px; color: var(--txt-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.grp-h .num { color: var(--txt); font-size: 13px; }

/* ---------- Resum del mes ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.kpi small { display: block; color: var(--txt-3); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.kpi b { display: block; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 600; white-space: nowrap; }
.kpi .in, .in { color: var(--in); }
.kpi .neg, .neg { color: var(--out); }

/* ---------- Filtres ---------- */
.filters { display: flex; gap: 8px; margin-bottom: 6px; }
.filters select, .filters input { background-color: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; min-width: 0; outline: none; }
.filters select { flex: 0 0 auto; max-width: 56%; }
.filters input { flex: 1; }

/* ---------- Llista de moviments ---------- */
.day { margin-bottom: 6px; }
.day-h { display: flex; justify-content: space-between; padding: 14px 4px 8px; color: var(--txt-3); font-size: 11.5px; font-weight: 600; }
.rows { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 13px; padding: 10px 14px; width: 100%; border: 0; background: transparent; text-align: left; border-bottom: 1px solid var(--line-soft); transition: background .15s; }
.row:last-child { border-bottom: 0; }
.row:hover, .acc:hover { background: var(--bg-2); }
.dot { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; }
.dot svg { display: block; }
.dot.sm { width: 28px; height: 28px; border-radius: 9px; }
.dot.sm svg { width: 15px; height: 15px; }
.dot.md { width: 34px; height: 34px; border-radius: 10px; }
.dot.md svg { width: 18px; height: 18px; }
.row .t { flex: 1; min-width: 0; }
.row .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t small { display: block; color: var(--txt-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .a { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.row .a.in { color: var(--in); }
.row .a.tr { color: var(--txt-2); }

/* ---------- Anell i barres de categories ---------- */
.ring { position: relative; width: min(100%, 250px); margin: 4px auto 6px; aspect-ratio: 1; }
.ringsvg { width: 100%; height: 100%; display: block; overflow: visible; }
.ring-track { fill: none; stroke: rgba(255, 255, 255, .06); stroke-width: 15; }
.ring-seg { fill: none; stroke: currentColor; stroke-width: 14; animation: ringin 1.1s var(--ease) both; }
.ring.still .ring-seg { animation: none; }
@keyframes ringin { from { stroke-dasharray: 0 1000; } }
.ring-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.ring-c small { color: var(--txt-3); font-size: 12px; }
.big, .total { font-family: var(--mono); font-size: 34px; line-height: 1.1; font-weight: 600; letter-spacing: -1px; }
.ring-c .big { font-size: 26px; }
.bars { display: grid; gap: 2px; }
.bar { display: block; width: 100%; border: 0; background: transparent; text-align: left; padding: 9px 0; }
.bar .h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar .h span:first-child { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.bar .h span:last-child { color: var(--txt-2); font-family: var(--mono); font-size: 13px; }
.bar .track { height: 6px; background: rgba(255, 255, 255, .06); border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 99px; }
.sub { margin: 2px 0 8px 44px; display: grid; gap: 8px; padding-left: 12px; border-left: 1px solid var(--line); }
.sub div { display: flex; justify-content: space-between; color: var(--txt-2); font-size: 13.5px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--txt-3); font-size: 10px; }
.chart .grid { stroke: rgba(255, 255, 255, .06); stroke-width: 1; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--txt-3); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Comptes i categories ---------- */
.acc { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line-soft); width: 100%; background: transparent; text-align: left; transition: background .15s; }
.acc:last-child { border-bottom: 0; }
.acc .t { flex: 1; min-width: 0; }
.acc .t b { font-weight: 600; }
.acc small { color: var(--txt-3); display: block; font-size: 12.5px; }
.acc .a { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 11px; padding: 3px; margin-bottom: 14px; }
.seg button { border: 0; background: transparent; padding: 8px 6px; border-radius: 8px; font-weight: 600; color: var(--txt-2); transition: background .15s, color .15s; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--txt); box-shadow: inset 0 0 0 1px var(--line); }
.catp { padding: 12px 14px 14px; border-bottom: 1px solid var(--line-soft); }
.catp:last-child { border-bottom: 0; }
.catp .ph { display: flex; align-items: center; gap: 12px; }
.catp .ph b { flex: 1; font-weight: 600; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; margin: 8px 6px 0 0; transition: background .15s; }
.chip:hover { background: #222b39; }
.chip.add { color: var(--blue); border-style: dashed; background: transparent; }
.linkbtn { border: 0; background: transparent; color: var(--blue); font-weight: 600; padding: 6px 4px; }

/* ---------- Navegació: barra inferior al mòbil, lateral a l'escriptori ---------- */
.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; background: var(--bg-2); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b)); }
.tabbar .brand { display: none; border: 0; background: transparent; text-align: left; color: var(--txt); }
.tabbar nav { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; max-width: 560px; margin: 0 auto; }
.tabbar button { border: 0; background: transparent; height: 52px; padding: 0; color: var(--txt-2); font-size: 10.5px; font-weight: 500; display: grid; gap: 3px; justify-items: center; align-content: center; border-radius: 10px; transition: color .15s, background .15s; }
.tabbar button svg { display: block; width: 20px; height: 20px; }
.tabbar button[aria-current="page"] { color: var(--txt); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.tabbar button.plus { width: 46px; height: 46px; border-radius: 50%; margin: 0 auto; background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(10, 132, 255, .35); }
.tabbar button.plus span { display: none; }
.tabbar button.plus:hover { background: #0a76e0; }

@media (min-width: 860px) {
  .shell { max-width: 1100px; margin: 0 0 0 var(--side); padding: 28px 36px 60px; }
  .tabbar { top: 0; bottom: 0; right: auto; width: var(--side); padding: 22px 16px; display: flex; flex-direction: column; gap: 5px; border-top: 0; border-right: 1px solid var(--line-soft); }
  .tabbar .brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 18px; cursor: pointer; }
  .tabbar .brand span { font-size: 11px; color: var(--txt-3); font-weight: 500; letter-spacing: .3px; line-height: 1.25; }
  .tabbar nav { display: flex; flex-direction: column; gap: 5px; max-width: none; margin: 0; width: 100%; }
  .tabbar button { width: 100%; height: auto; display: grid; grid-template-columns: 18px 1fr; justify-items: start; align-items: center; gap: 11px; padding: 10px 12px; font-size: 13.5px; font-weight: 500; text-align: left; }
  .tabbar button svg { width: 17px; height: 17px; opacity: .85; }
  .tabbar button:hover { background: var(--surface); color: var(--txt); }
  .tabbar button[aria-current="page"] { background: var(--surface-2); }
  .tabbar button.plus { order: -1; width: 100%; border-radius: 9px; margin: 0 0 8px; background: var(--blue); box-shadow: none; font-weight: 650; }
  .tabbar button.plus:hover { background: #0a76e0; }
  .tabbar button.plus span { display: inline; }
  #toast { bottom: 28px !important; }
  .iconbtn { width: 34px; height: 34px; }
}

/* ---------- Fulls modals ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(5, 8, 12, .66); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease-out; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 20px 20px calc(20px + var(--safe-b)); box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: up .3s var(--ease); }
@media (min-width: 640px) { .backdrop { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet h3 { margin: 0 0 14px; font-size: 16px; font-weight: 650; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--txt-2); font-weight: 500; }
.field input, .field select {
  background-color: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; width: 100%; min-width: 0; min-height: 42px;
  -webkit-appearance: none; appearance: none; outline: none; transition: border-color .15s, box-shadow .15s;
}
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px !important;
  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 d='M1 1.5 6 6.5l5-5' fill='none' stroke='%239AA6B8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.field input:focus, .field select:focus, .filters select:focus, .filters input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(10, 132, 255, .15); }
.field input[type="date"] { text-align: left; }
.field input.amount { font-family: var(--mono); font-size: 40px; font-weight: 600; text-align: center; padding: 8px !important; letter-spacing: -1px; background: transparent; border-color: transparent; caret-color: var(--blue); min-height: 70px; }
.field input.amount:focus { background: transparent; border-color: transparent; box-shadow: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btns { display: flex; gap: 10px; margin-top: 8px; }
.btn { flex: 1; border: 0; border-radius: 9px; padding: 10px 14px; font-weight: 600; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: background .15s; }
.btn:hover { background: #222b39; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--blue); box-shadow: none; color: #fff; }
.btn.primary:hover { background: #0a76e0; }
.btn.danger { background: transparent; box-shadow: none; color: var(--out); flex: 0 0 auto; }
.btn:disabled { opacity: .5; }
.check { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.hint { color: var(--txt-3); font-size: 12.5px; margin: -6px 0 14px; }

/* ---------- Login ---------- */
.login { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px 26px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.login .plate { margin-bottom: 18px; }
.login h1 { margin: 0 0 4px; font-size: 23px; font-weight: 650; letter-spacing: -.5px; }
.login p { margin: 0 0 20px; color: var(--txt-2); }
.err { color: var(--out); font-size: 13px; min-height: 20px; margin: 0 0 8px; }

#toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); transform: translate(-50%, 12px); z-index: 60; max-width: 90vw; text-align: center;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0, 0, 0, .4);
  color: var(--txt); padding: 10px 16px; border-radius: 11px; font-weight: 500; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
.spin { position: relative; display: grid; justify-items: center; gap: 14px; color: var(--txt-3); padding: 40vh 0 0; }
.spin i { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .1); border-top-color: var(--blue); animation: turn .8s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Inici ---------- */
.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mini small { display: block; color: var(--txt-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.mini b { font-family: var(--mono); font-size: 24px; font-weight: 600; letter-spacing: -.5px; white-space: nowrap; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 13px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px 17px; min-height: 140px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left; color: var(--txt); transition: background .15s, border-color .15s; }
.tile:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line); }
.tile b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.tile small { display: block; color: var(--txt-3); font-size: 12.5px; margin-top: 2px; }
.tile.soon { opacity: .5; cursor: default; }
.tile .badge { position: absolute; top: 14px; right: 14px; font-size: 10.5px; color: var(--txt-3); border: 1px solid var(--line); border-radius: 99px; padding: 2px 9px; }
.shell.home { max-width: 1000px; margin: 0 auto; padding-top: calc(var(--safe-t) + 28px); padding-bottom: 60px; }

/* ---------- Taules (Hores) ---------- */
.section { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.section-h { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); gap: 12px; flex-wrap: wrap; }
.section-h h2 { font-size: 15px; font-weight: 600; margin: 0; }
.section-h .hint { font-size: 12px; color: var(--txt-3); margin: 0; }
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { font-size: 11px; color: var(--txt-3); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; font-family: var(--sans); white-space: normal; min-width: 180px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-2); }
th.today, td.today { background: rgba(10, 132, 255, .07); }
th.today { color: #6CB2FF; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; background: var(--bg-2); }
td.tot, th.tot { font-weight: 700; }
td a { color: inherit; text-decoration: none; }
td a:hover { text-decoration: underline; }
.dotlive { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--out); margin-right: 8px; }
.summbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.summbar > div { background: var(--surface); padding: 12px 14px; }
.summbar .k { font-size: 10.5px; color: var(--txt-3); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.summbar .v { font-size: 18px; font-weight: 600; margin-top: 5px; font-family: var(--mono); }
.daybars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 120px; padding: 6px 4px 0; }
.daybars > div { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; font-size: 11px; color: var(--txt-3); }
.daybars i { display: block; width: 100%; max-width: 38px; border-radius: 6px 6px 2px 2px; background: var(--blue); min-height: 2px; }
.daybars .on i { background: #5aa9ff; }
.daybars span { font-family: var(--mono); font-size: 10.5px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .btn { flex: 0 0 auto; padding: 8px 14px; }
.toolbar .grow { flex: 1; }

/* ---------- Logo IDROX (el PNG és per fons clar: va sobre una placa blanca) ---------- */
.plate { display: inline-flex; align-items: center; background: #fff; border-radius: 9px; padding: 5px 9px; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.plate img { display: block; width: auto; }
.plate.lg { border-radius: 10px; padding: 7px 12px; margin-bottom: 10px; }

/* ---------- Comptabilitat IDROX incrustada ---------- */
.embed { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; background: #0B0E14; }
.embed iframe { flex: 1; width: 100%; border: 0; background: #0B0E14; }

/* Estat de desat de la comptabilitat */
.embed .spin { flex: 1; padding-top: 0; align-content: center; }
.syncst { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .05); color: var(--mute); font: inherit; font-size: 12px; cursor: default; }
.syncst:empty, .syncst[data-st=idle] { visibility: hidden; }
.syncst i { width: 7px; height: 7px; border-radius: 50%; background: #5b6275; }
.syncst[data-st=ok] i { background: #3DD68C; }
.syncst[data-st=busy] i { background: #0A84FF; animation: pulse 1s ease-in-out infinite; }
.syncst[data-st=pending] i, .syncst[data-st=off] i { background: #F5A623; }
.syncst[data-st=err] i, .syncst[data-st=conflict] i { background: #F2727C; }
.syncst[data-st=conflict], .syncst[data-st=err], .syncst[data-st=off], .syncst[data-st=pending] { cursor: pointer; color: var(--txt); }
@keyframes pulse { 50% { opacity: .35; } }
.syncst { white-space: nowrap; flex: none; }
@media (max-width: 480px) { .kpi { padding: 11px 10px; } .kpi b { font-size: 13.5px; } }

/* ---------- Capçalera comuna ---------- */
:root { --bar-h: calc(54px + var(--safe-t)); }
.appbar { position: fixed; top: 0; left: 0; right: 0; z-index: 35; height: var(--bar-h); padding: var(--safe-t) 14px 0; display: flex; align-items: center; gap: 12px; background: rgba(21, 27, 37, .94); border-bottom: 1px solid var(--line-soft); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.appbar.flow { position: static; flex: none; }
.appbar b { font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.appbar-r { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.appbar .iconbtn { background: var(--bg-2); }
.shell.hasbar { padding-top: calc(var(--bar-h) + 18px); }
@media (min-width: 860px) {
  .tabbar { top: var(--bar-h); }
}
.embed .appbar { padding-top: calc(var(--safe-t)); height: var(--bar-h); }

/* ---------- Calendari ---------- */
.field textarea { background-color: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; width: 100%; min-width: 0; outline: none; resize: vertical; font: inherit; }
.field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(10, 132, 255, .15); }
.fchips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.fchip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-soft); background: var(--surface); color: var(--txt-2); border-radius: 99px; padding: 6px 13px; font-weight: 550; font-size: 13px; transition: background .15s, color .15s, border-color .15s; }
.fchip i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.fchip:hover { background: var(--surface-2); color: var(--txt); }
.fchip[aria-pressed="true"] { background: var(--surface-2); color: var(--txt); border-color: var(--line); box-shadow: inset 0 0 0 1px var(--line); }
.badge2 { min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; display: inline-grid; place-items: center; background: var(--bg-2); color: var(--txt-2); font-size: 11px; font-family: var(--mono); }
.cgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cdow { font-size: 11px; color: var(--txt-3); font-weight: 600; text-align: center; padding: 4px 0; text-transform: uppercase; letter-spacing: .4px; }
.cday { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px; min-height: 104px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; transition: border-color .15s, background .15s; }
.cday:hover { border-color: var(--line); background: var(--surface); }
.cday.wknd { background: #10131b; }
.cday.out { opacity: .45; }
.cday.today { box-shadow: inset 0 0 0 1px var(--blue); }
.cnum { font-size: 11.5px; color: var(--txt-3); font-weight: 600; }
.cday.today .cnum { color: #6CB2FF; }
.cpills { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cpill { border: 0; text-align: left; font-size: 11.5px; font-weight: 550; line-height: 1.25; padding: 2px 6px; border-radius: 5px; color: var(--txt); background: color-mix(in srgb, var(--c) 22%, transparent); box-shadow: inset 2px 0 0 var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.cpill:hover { background: color-mix(in srgb, var(--c) 36%, transparent); }
.cpill.done { text-decoration: line-through; opacity: .55; }
.cpill.span { box-shadow: none; background: color-mix(in srgb, var(--c) 34%, transparent); }
.cpill.span.f { border-radius: 5px 0 0 5px; box-shadow: inset 2px 0 0 var(--c); }
.cpill.span:not(.f) { border-radius: 0; margin-left: -7px; width: calc(100% + 7px); }
.cpill.span.l { border-radius: 0 5px 5px 0; }
.cpill.span.f.l { border-radius: 5px; }
.cmore { color: var(--txt-3); font-size: 11px; padding-left: 4px; }
.cdots { display: none; gap: 3px; flex-wrap: wrap; }
.cdots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
@media (max-width: 640px) {
  .cgrid { gap: 3px; }
  .cday { min-height: 58px; padding: 4px; align-items: center; }
  .cpills { display: none; }
  .cdots { display: flex; justify-content: center; }
  .cnum { font-size: 12.5px; }
}
.evrow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.evrow:last-child { border-bottom: 0; }
.evrow input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--in); flex: none; }
.evbar { flex: none; width: 4px; align-self: stretch; min-height: 30px; border-radius: 3px; }
.evmain { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; padding: 0; }
.evmain b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evmain small { display: block; color: var(--txt-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evrow.done .evmain b { text-decoration: line-through; color: var(--txt-3); }
.swatch { flex: none; width: 22px; height: 22px; border-radius: 7px; display: inline-block; border: 0; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch.pick { width: 30px; height: 30px; border-radius: 9px; box-shadow: inset 0 0 0 2px transparent; }
.swatch.pick[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--bg), 0 0 0 2px var(--txt); }
.sheet .rows { margin-bottom: 4px; }

/* ---------- Calendari: setmana, any, festius ---------- */
.cday.hol .cnum, .wday.hol .whead b, .yd.hol { color: #F2727C; }
.cday.hol { background: rgba(242, 114, 124, .07); }
.wgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: start; }
.wday { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 12px; min-width: 0; overflow: hidden; }
.wday.wknd { background: #10131b; }
.wday.hol { background: rgba(242, 114, 124, .07); }
.wday.today { box-shadow: inset 0 0 0 1px var(--blue); }
.whead { width: 100%; display: flex; align-items: baseline; gap: 8px; border: 0; background: transparent; color: var(--txt-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; padding: 9px 10px 7px; text-align: left; }
.whead b { font-size: 17px; color: var(--txt); letter-spacing: 0; }
.wday.today .whead b { color: #6CB2FF; }
.wday .rows { border: 0; border-radius: 0; background: transparent; }
.wday .evrow { padding: 7px 9px; gap: 8px; }
.wday .evrow small { white-space: normal; }
.wempty { margin: 0; padding: 4px 10px 12px; color: var(--txt-3); font-size: 12px; }
@media (max-width: 860px) {
  .wgrid { grid-template-columns: 1fr; gap: 6px; }
  .wday { display: flex; align-items: flex-start; }
  .whead { width: 58px; flex: none; flex-direction: column; gap: 0; align-items: center; padding: 10px 0; }
  .wday .rows, .wday .wempty { flex: 1; min-width: 0; }
  .wday .wempty { padding: 14px 10px; }
}
.ygrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .ygrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .ygrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.ymonth { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 10px 12px; min-width: 0; }
.ytitle { border: 0; background: transparent; color: var(--txt); font-weight: 650; font-size: 13.5px; padding: 0 0 8px; text-transform: capitalize; }
.ytitle:hover { color: #6CB2FF; }
.ycells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ycells i, .yd { font-style: normal; text-align: center; font-size: 11px; line-height: 1; padding: 5px 0; border-radius: 6px; }
.ydow { color: var(--txt-3); font-weight: 600; }
.yd { border: 0; background: transparent; color: var(--txt-2); font-variant-numeric: tabular-nums; }
.yd:hover { background: var(--surface-2); }
.yd.has { background: color-mix(in srgb, var(--c) 28%, transparent); color: var(--txt); font-weight: 650; }
.yd.hol { background: rgba(242, 114, 124, .2); font-weight: 650; }
.yd.today { box-shadow: inset 0 0 0 1px var(--blue); color: #6CB2FF; }
@media (max-width: 700px) { .ycells i, .yd { font-size: 10px; padding: 4px 0; } }

/* ---------- Home: dashboard ---------- */
.dgrid { display: grid; gap: 12px; margin-bottom: 12px; }
.dgrid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dgrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dgrid.hc { grid-template-columns: minmax(0, 5fr) minmax(0, 8fr); }
.dgrid.up5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .dgrid.hc { grid-template-columns: 1fr; } .dgrid.up5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .dgrid.three, .dgrid.up5 { grid-template-columns: 1fr; } .dgrid.two { gap: 10px; } }
.dcard { margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dcard h2 { display: flex; align-items: center; gap: 8px; }
.dcard .big { font-size: 26px; font-weight: 600; letter-spacing: -.6px; line-height: 1.15; white-space: nowrap; }
@media (max-width: 480px) { .dgrid.two .dcard .big { font-size: 20px; } .dcard { padding: 14px; } }
.am { color: var(--amber, #F5A623); }
.sm { font-size: 12.5px; margin: 2px 0 0; }
.toplist { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; font-size: 12.5px; color: var(--txt-2); }
.toplist > div { display: flex; justify-content: space-between; gap: 10px; }
.toplist span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daybars.sm { height: 84px; gap: 5px; padding: 8px 0 0; }
.daybars.sm > div { gap: 4px; }
.dcard .daybars i { max-width: 26px; }
.chead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chead h2 { margin: 0; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--txt-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.lg-in, .b-in { background: #0A84FF; fill: #0A84FF; }
.lg-out, .b-out { background: #F5A623; fill: #F5A623; }
svg.chart { width: 100%; height: auto; display: block; margin-top: 6px; overflow: visible; }
svg.chart .gl { stroke: var(--line-soft); stroke-width: 1; }
svg.chart .ax { fill: var(--txt-3); font-size: 10px; font-family: var(--mono); }
svg.chart .ax.cur { fill: var(--txt); font-weight: 700; }
svg.chart .mg:hover rect:first-of-type { fill: rgba(255, 255, 255, .04); }
.dotc { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.uplist { display: flex; flex-direction: column; margin-top: 4px; }
.upitem { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; text-align: left; border: 0; background: transparent; padding: 9px 0; border-top: 1px solid var(--line-soft); color: var(--txt); }
.upitem:first-child { border-top: 0; }
.upitem b { font-size: 13.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upitem small { grid-column: 1; color: var(--txt-3); font-size: 12px; }
.upitem .when { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 11px; color: var(--txt-2); background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.upitem:hover b { color: #6CB2FF; }
.kpi em { display: block; font-style: normal; color: var(--txt-3); font-size: 11px; margin-top: 2px; }

@media (max-width: 640px) {
  .dgrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .dgrid.three .dcard { padding: 12px 10px; }
  .dgrid.three .dcard .big { font-size: 14.5px; letter-spacing: -.3px; }
  .dgrid.three .dcard h2 { font-size: 9.5px; letter-spacing: .3px; }
  .dgrid.three .dcard .sm { display: none; }
  .toplist > div { flex-direction: column; gap: 0; }
  .dgrid.hc .dcard { padding: 14px; }
}
