:root {
  --brand: #714B67;
  --brand-ink: #fff;
  --accent: #714B67;
  --brand-soft: #f8f4f7;
  --brand-tint: #ebe0e8;
  --side-bg: #1e1b2e;
  --side-hover: rgba(255,255,255,.07);
  --side-text: #c9c6d6;
  --side-muted: #7d7990;
  --side-active: var(--brand);
  --grad-from: #2a2340;
  --grad-to: #714B67;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e4e6eb;
  --soft: #f8f9fb;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --warn: #a16207;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); display: flex; min-height: 100vh; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.right { text-align: right; }

/* Sidebar */
.sidebar { width: 228px; flex-shrink: 0; background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 16px; color: #fff; font-weight: 650; font-size: 15px; }
.logo:hover { text-decoration: none; }
.logo-img { padding: 14px 14px 8px; }
.logo-img img { display: block; width: 100%; max-height: 110px; object-fit: contain; border-radius: 10px; }
.company-logo-thumb { display: block; height: 28px; max-width: 60px; object-fit: contain; border-radius: 4px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 700; }
.sidebar nav { padding: 4px 10px 20px; display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a { color: var(--side-text); padding: 7px 10px; border-radius: 7px; display: flex; gap: 10px; align-items: center; }
.sidebar nav a i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
.sidebar nav a:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--side-active); color: var(--brand-ink); box-shadow: inset 3px 0 0 var(--accent); }
.nav-h { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--side-muted); padding: 14px 10px 4px; }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 20; }
.burger { display: none; border: 0; background: none; font-size: 20px; cursor: pointer; }
.crumbs { flex: 1; color: var(--muted); }
.top-right { display: flex; align-items: center; gap: 10px; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }
.company-pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 500; }
.company-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 600; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; min-width: 210px; display: flex; flex-direction: column; z-index: 50; }
.menu a, .menu .linklike, .menu span { padding: 8px 10px; border-radius: 6px; color: var(--ink); text-align: left; }
.menu a:hover, .menu .linklike:hover { background: var(--soft); text-decoration: none; }
.menu a.on { font-weight: 600; color: var(--brand); }
.linklike { border: 0; background: none; font: inherit; cursor: pointer; width: 100%; }
.content { padding: 22px 24px 48px; max-width: 1400px; width: 100%; }
.messages { padding: 14px 24px 0; display: flex; flex-direction: column; gap: 6px; }
.msg { padding: 10px 14px; border-radius: 8px; background: var(--info-bg); color: var(--info); }
.msg-success { background: var(--ok-bg); color: var(--ok); }
.msg-error { background: var(--bad-bg); color: var(--bad); }
.msg-warning { background: var(--warn-bg); color: var(--warn); }

/* Page header */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin-right: auto; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-danger { color: var(--bad); }
.btn-sm { padding: 4px 9px; font-size: 13px; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: 2fr 1fr; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: block; color: var(--ink); }
.kpi:hover { text-decoration: none; border-color: var(--brand); }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 24px; font-weight: 650; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* Tables */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: var(--soft); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #faf7fa; }
tfoot td { font-weight: 650; background: var(--soft); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
table.plain th { background: none; }
tr.sub td { background: var(--soft); font-weight: 600; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 13px; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip:hover { text-decoration: none; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; color: var(--muted); }

/* Forms */
input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid #d5d8de; border-radius: 7px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
input[type=color] { padding: 2px; height: 34px; width: 60px; }
textarea { width: 100%; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input:not([type=checkbox]), .field select { width: 100%; }
.field.check { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
.field.wide { grid-column: 1 / -1; }
.errorlist { color: var(--bad); margin: 0; padding: 0; list-style: none; font-size: 12px; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.st-posted, .st-sent { background: var(--info-bg); color: var(--info); }
.st-paid, .st-accepted, .st-invoiced { background: var(--ok-bg); color: var(--ok); }
.st-cancelled, .st-rejected, .st-overdue { background: var(--bad-bg); color: var(--bad); }
.st-draft { background: #eef0f3; color: #4b5563; }

/* Document lines */
.lines { min-width: 980px; }
.lines input, .lines select { width: 100%; padding: 6px 8px; }
.lines td { padding: 5px 6px; }
.lines .c-prod { width: 17%; } .lines .c-acc { width: 15%; } .lines .c-qty, .lines .c-price, .lines .c-disc { width: 9%; } .lines .c-tax { width: 9%; } .lines .c-sub { width: 10%; } .lines .c-del { width: 34px; }
.del-row { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; }
.del-row:hover { color: var(--bad); }
.totals { margin-left: auto; width: 320px; max-width: 100%; margin-top: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 2px solid var(--ink); font-size: 17px; font-weight: 700; padding-top: 8px; margin-top: 4px; }
.status-bar { display: flex; gap: 0; margin-left: auto; }
.status-bar span { padding: 6px 14px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; margin-left: -1px; }
.status-bar span:first-child { border-radius: 7px 0 0 7px; } .status-bar span:last-child { border-radius: 0 7px 7px 0; }
.status-bar span.on { background: var(--brand); color: #fff; border-color: var(--brand); }
dl.info { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
dl.info dt { color: var(--muted); } dl.info dd { margin: 0; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: #eceef2; border-radius: var(--radius); padding: 10px; min-height: 300px; }
.col.over { outline: 2px dashed var(--brand); }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 10px; }
.col-head b { font-size: 14px; }
.col-head a { font-size: 18px; }
.bar { height: 4px; border-radius: 4px; background: #d7dae0; margin: 0 4px 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); }
.lead-card { background: var(--panel); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); margin-bottom: 8px; cursor: grab; border-left: 3px solid transparent; display: block; color: var(--ink); }
.lead-card:hover { text-decoration: none; border-left-color: var(--brand); }
.lead-card.dragging { opacity: .5; }
.lead-card .t { font-weight: 600; }
.lead-card .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 6px; }
.stars { color: #f59e0b; letter-spacing: 1px; }

/* Chart */
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Login */
.login-wrap { flex: 1; display: grid; place-items: center; background: linear-gradient(135deg, var(--grad-from), var(--grad-to)); }
.login-card { width: 360px; max-width: calc(100vw - 32px); }
.login-card h1 { margin-bottom: 4px; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: -240px; z-index: 40; transition: left .2s; }
  body.nav-open .sidebar { left: 0; }
  .burger { display: block; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .status-bar { display: none; }
}
@media print {
  .sidebar, .topbar, .messages, .no-print { display: none !important; }
  body { background: #fff; }
}

/* Selector d'idioma */
.lang-switch { display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--panel); }
.lang-switch button { font: inherit; font-size: 12px; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.lang-switch button.on { background: var(--brand); color: #fff; }
.lang-switch.dark { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); }
.lang-switch.dark button { color: rgba(255,255,255,.8); }
.lang-switch.in-menu { margin: 4px 10px 8px; }
.login-wrap .login-lang { position: fixed; top: 16px; right: 16px; }
.page-head h1 { position: relative; }
.kpi { border-top: 3px solid var(--brand-tint); }
.kpi:hover { border-top-color: var(--accent); }

/* Desplegables amb cerca */
.combo { position: relative; width: 100%; }
.combo-input { width: 100%; padding-right: 26px !important; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat right 9px center; }
.combo-list { position: fixed; z-index: 100; max-height: 280px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); }
.combo-list li { padding: 7px 10px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-list li.active { background: var(--brand-tint); }
.combo-list li.sel { font-weight: 600; }
.combo-list li.none { color: var(--muted); cursor: default; }

.page-size label { display: flex; align-items: center; gap: 6px; }
.page-size select { padding: 4px 8px; }

/* Verificació en dos passos */
.steps-2fa li { margin-bottom: 16px; }
.qr-2fa svg { width: 200px; height: 200px; display: block; margin: 10px 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.secret-2fa { font-size: 15px; letter-spacing: .08em; user-select: all; }
.inline-2fa { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.inline-2fa input[name=code] { width: 140px; font-size: 18px; letter-spacing: .2em; text-align: center; }
.codes-2fa { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 24px; font-size: 16px; }
.right form { display: inline-block; margin-left: 4px; }
.box-aeat { display: inline-block; min-width: 30px; padding: 1px 6px; border-radius: 5px; background: var(--brand-tint); color: var(--brand); font-size: 11px; font-weight: 700; text-align: center; }

/* Personal: fitxar, registre de jornada i calendari d'absències */
.clock-card { text-align: center; padding: 28px 20px; }
.clock-time { font-size: 56px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 4px 0 10px; }
.clock-btn { font-size: 18px; padding: 14px 34px; }
.nowrap { white-space: nowrap; }
.report-table tfoot th { border-top: 2px solid var(--line); padding-top: 8px; }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 50px; }
.signatures div { border-top: 1px solid var(--line); padding-top: 6px; font-size: 12px; color: var(--muted); }
.cal { font-size: 12px; }
.cal th, .cal td { padding: 4px 3px; text-align: center; min-width: 22px; }
.cal th:first-child, .cal td:first-child { text-align: left; min-width: 140px; }
.cal th div { font-weight: 400; color: var(--muted); }
.cal .off { background: #f3f4f6; }
.cal-mark { display: block; height: 16px; border-radius: 4px; }
.cal-mark.pending, .pending-dot { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.55) 0 3px, transparent 3px 6px); }
.tdot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.pending-dot { background-color: #9ca3af; }
.leave-grid { grid-template-columns: minmax(260px, 1fr) 2fr; }
@media (max-width: 900px) { .leave-grid { grid-template-columns: 1fr; } }
.cal .holiday, .month-cal .holiday { background: #fdecec; color: #b42318; }
.month-cal { width: 100%; table-layout: fixed; border-collapse: collapse; }
.month-cal th { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 4px; }
.month-cal td { vertical-align: top; height: 74px; padding: 5px; border: 1px solid var(--line); font-size: 11.5px; }
.month-cal td.off { background: #f6f7f9; color: var(--muted); }
.month-cal td.today { box-shadow: inset 0 0 0 2px var(--brand); }
.month-cal td.empty-day { background: transparent; border-color: transparent; }
.mc-day { font-weight: 700; font-size: 13px; }
.mc-label { font-size: 11px; line-height: 1.2; }
.mc-leave { color: #fff; border-radius: 4px; padding: 1px 4px; font-size: 11px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-leave.pending { opacity: .6; }
.mc-done { color: var(--ok); font-size: 11px; margin-top: 2px; }
.task-closed { opacity: .55; }
.task-closed .t { text-decoration: line-through; }
.pin { text-decoration: none; font-size: 11px; }
@media print { .pin { display: none; } }
@media (max-width: 600px) { .clock-time { font-size: 64px; } .clock-btn { width: 100%; font-size: 20px; padding: 18px; } .kanban { grid-auto-columns: 82vw; } }
.neg { color: var(--bad); }
.bell { position: relative; text-decoration: none; font-size: 18px; padding: 4px 6px; }
.bell-n { position: absolute; top: -4px; right: -6px; background: var(--bad); color: #fff; border-radius: 999px; font-size: 10px; font-weight: 700; padding: 1px 5px; }
.pivot-form { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; }
.pivot-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.pivot td, .pivot th { white-space: nowrap; }
.pivot .bar-col { width: 18%; min-width: 80px; }
.pbar { display: block; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--brand)); }
@media print { .pivot-form { display: none; } }
.clock-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; font-weight: 600; }
.clock-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.clock-dot.off { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.18); }
.clock-dot.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); animation: clock-pulse 2s infinite; }
@keyframes clock-pulse { 50% { box-shadow: 0 0 0 6px rgba(22,163,74,.08); } }
.clock-menu { min-width: 230px; padding: 12px; }
.clock-menu p { margin: 0 0 8px; }
.clock-menu-btn { width: 100%; font-size: 15px; padding: 10px; }
@media (max-width: 600px) { .clock-pill-text { display: none; } .clock-pill { padding: 7px; } }
/* Fitxers adjunts */
.att-list { list-style: none; margin: 0 0 10px; padding: 0; }
.att-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.att-list li:last-child { border-bottom: 0; }
.att-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.att-icon { width: 44px; text-align: center; font-size: 24px; }
.att-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.att-dl { text-decoration: none; }
.att-drop { display: block; border: 2px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.att-drop:hover, .att-drop.over { border-color: var(--brand); color: var(--brand); }
.att-drop input { display: none; }
.att-clip summary b { font-weight: 700; }
.att-panel { width: min(420px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; padding: 12px; }
.att-head { margin-bottom: 6px; }
.code-tools { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.code-msg.ok { color: var(--ok); } .code-msg.bad { color: var(--bad); }
.lead-code-badge { font-variant-numeric: tabular-nums; background: var(--brand-soft, #eef); color: var(--brand); border-radius: 6px; padding: 0 6px; font-size: .9em; }
.title-edit { font-size: .7em; color: var(--muted); vertical-align: middle; cursor: pointer; }
.title-edit:hover { color: var(--brand); }
.title-form { display: inline-flex; gap: 6px; align-items: center; vertical-align: middle; }
.title-form input { font-size: 18px; font-weight: 600; min-width: min(420px, 60vw); }
.title-form[hidden], .title-edit.linklike[hidden], .title-text[hidden] { display: none; }
.title-edit.linklike { width: auto; display: inline; padding: 0 4px; }
.actions .att-clip { order: 99; }
@media (max-width: 1100px) { .att-panel { position: fixed; top: 64px; right: 16px; left: auto; } }
.hist-btn { order: 98; }
.hist-list { list-style: none; margin: 0; padding: 0; }
.hist-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hist-list li:last-child { border-bottom: 0; }
.hist-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hist-changes { margin: 4px 0 0; font-size: 13px; border-collapse: collapse; width: 100%; }
.hist-changes th { text-align: left; font-weight: 500; color: var(--muted); padding: 2px 8px 2px 0; vertical-align: top; width: 35%; }
.hist-changes td { padding: 2px 0; overflow-wrap: anywhere; }
.audit-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.audit-filters select, .audit-filters input { width: auto; flex: 1 1 150px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 12px; }
.period-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.period-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.period-bar .btn.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.period-custom { display: flex; gap: 6px; align-items: center; max-width: 100%; }
.period-custom input { width: auto; min-width: 0; flex: 1 1 130px; padding: 5px 8px; }
.kpi .sub span { white-space: nowrap; }
.kpi .sub .up { color: #15803d; }
.kpi .sub .down { color: #b91c1c; }
/* «Copias de seguridad»: a baix de tot del menú lateral */
.sidebar nav { flex: 1 0 auto; }
.sidebar nav a.nav-bottom { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 10px; border-radius: 0 0 7px 7px; }
.backup-state { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.backup-state .big { font-size: 28px; }
.restore-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.restore-form input { width: 120px; padding: 4px 8px; }
