/* Vigia (inventari d'equips de CSI): full d'estil propi. Colors de la marca: #26215C (fons), #534AB7, #AFA9EC, #5DCAA5 */
:root {
  --dark: #26215C; --blue: #534AB7; --ink: #0f172a; --text: #334155; --muted: #475569; --soft: #64748b;
  --line: #e2e8f0; --bg: #f1f5f9; --bg-blue: #eff6ff; --card: #fff;
  --green: #047857; --green-bg: #ecfdf5; --red: #b91c1c; --red-bg: #fef2f2; --amber: #b45309; --amber-bg: #fffbeb;
  --radius: 14px; --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 4px 12px rgb(15 23 42 / .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--blue); }
h1 { font-size: clamp(1.4rem, 3vw, 1.8rem); font-weight: 800; color: var(--ink); line-height: 1.2; margin-bottom: 6px; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; font-weight: 800; color: var(--ink); margin-bottom: 12px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

/* Capçalera */
.top { background: var(--dark); color: #fff; }
.top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; min-height: 60px; gap: 8px 12px; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.15rem; }
.brand img { display: block; border-radius: 8px; }
.sub-in { padding-bottom: 8px; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; }
.nav a { color: #e2e8f0; text-decoration: none; font-weight: 700; font-size: 15px; padding: 7px 12px; border-radius: 9px; }
.nav a:hover { background: rgb(255 255 255 / .1); }
.nav a[aria-current] { background: rgb(255 255 255 / .18); color: #fff; }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 14px; color: #cbd5e1; }
.who a { color: #fff; font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tabs a { text-decoration: none; font-weight: 700; font-size: 14px; color: var(--muted); background: var(--card); border: 1px solid var(--line); padding: 7px 13px; border-radius: 999px; }
.tabs a[aria-current] { background: var(--dark); border-color: var(--dark); color: #fff; }

/* Contingut */
.main { flex: 1; padding: 24px 0 48px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
@media (min-width: 640px) { .card { padding: 24px; } }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.login h1, .login .sub { text-align: center; }
.login-ic { display: flex; justify-content: center; margin-bottom: 10px; }
.sub { color: var(--muted); margin-bottom: 16px; }
.muted { color: var(--soft); }
.small, .small td, .small th { font-size: 13px; }
.empty { color: var(--muted); padding: 18px; background: var(--bg); border-radius: 12px; text-align: center; }
.mt { margin-top: 12px; }
.head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.head .sub { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grid2 { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.steps { padding-left: 22px; margin-bottom: 14px; }
.steps li { margin-bottom: 6px; }
.code { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.code code { flex: 1 1 300px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; color: var(--ink); }

/* Xifres del tauler */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; text-decoration: none; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat:hover { border-color: var(--blue); }
.stat-alert { border-color: #fecaca; background: var(--red-bg); }
.stat-alert b { color: var(--red); }

/* Missatges */
.msg-ok, .msg-err, .msg-warn { border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.msg-ok { background: var(--green-bg); color: var(--green); border: 1px solid #a7f3d0; }
.msg-err { background: var(--red-bg); color: var(--red); border: 1px solid #fecaca; }
.msg-warn { background: var(--amber-bg); color: var(--amber); border: 1px solid #fde68a; }
.msg-warn a { color: inherit; }

/* Formularis */
.field { margin-bottom: 12px; min-width: 0; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; color: var(--ink); }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgb(83 74 183 / .18); }
.input-small { width: 170px; padding: 6px 9px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin: 4px 0 12px; }
.check input { width: auto; }
.row2 { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.filters { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.filters .check, .filters .actions { grid-column: 1 / -1; }
form.inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 15px; line-height: 1.2; text-decoration: none; padding: 11px 17px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--dark); }
.btn-ghost { background: #fff; color: var(--dark); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--blue); }
.btn-danger { background: #fff; color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red-bg); }
.btn-small { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }

/* Taules i fitxes */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--soft); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.tbl td:first-child { min-width: 160px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; background: var(--bg); color: var(--muted); border-radius: 999px; padding: 2px 9px; margin: 0 2px 2px 0; white-space: nowrap; }
.b-ok { background: var(--green-bg); color: var(--green); }
.b-err { background: var(--red-bg); color: var(--red); }
.b-warn { background: var(--amber-bg); color: var(--amber); }
.b-off { background: #e2e8f0; color: var(--muted); }
.dl { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 6px 14px; font-size: 14.5px; }
.dl dt { color: var(--soft); }
.dl dd { color: var(--ink); overflow-wrap: anywhere; }
.foot { border-top: 1px solid var(--line); background: #fff; padding: 16px 0; font-size: 13.5px; color: var(--soft); text-align: center; }
