:root {
  /* Colors corporatius d'OrgInt: taronja i turquesa, oposats al cercle cromàtic. */
  --brand: #ff6d24;        /* taronja: botons i fons */
  --brand-hover: #ff8540;
  --brand-dark: #e2550c;   /* taronja per a xifres grans sobre blanc */
  --brand-ink: #c94d0c;    /* taronja per a text sobre blanc (contrast AA) */
  --brand-soft: #fff1e8;
  --on-brand: #15171c;     /* text sobre el taronja */
  --accent: #18c9dc;       /* turquesa: detalls i fons foscos */
  --accent-ink: #0b7f8c;   /* turquesa per a text sobre blanc (contrast AA) */
  --accent-soft: #e3f8fb;
  --ink: #17191e;
  --ink-soft: #4a5568;
  --muted: #6b7686;
  --line: #e3e8ef;
  --bg: #ffffff;
  /* Fons fosc antracita (to fred, ~225°) i el seu oposat, l'ambre (~40°): fons càlids que l'equilibren. */
  --dark: #15171c;         /* fons fosc: capçalera, portada, peu i blocs destacats */
  --dark-glow: #2a2e36;    /* lluentor del fons fosc de la portada */
  --dark-deep: #0f1114;    /* pantalla de la il·lustració */
  --dark-bar: #1c1f25;
  --dark-line: #2c3038;    /* línies sobre fons fosc */
  --dark-mid: #4a505c;     /* elements intermedis sobre fons fosc */
  --on-dark: #cfd3da;      /* text secundari sobre fons fosc */
  --on-dark-muted: #959ba6;
  --amber: #f2ae36;        /* oposat del fons fosc: detalls */
  --amber-soft: #fbf5e9;   /* fons alternatiu càlid */
  --amber-line: #efe3cc;
  --bg-alt: var(--amber-soft);
  --ok: #0f9d58;
  --warn: #d97706;
  --danger: #d93025;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 6px 20px rgba(15, 27, 45, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.6; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }
a { color: var(--brand-ink); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--bg-alt); padding: .1em .35em; border-radius: 4px; word-break: break-all; }

.wrap { width: min(1140px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(460px, 100% - 32px); }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.inline { display: inline; margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* --- Capçalera --- */
.site-header { background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 10; }
.nav { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.nav { min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand-mark { display: block; filter: drop-shadow(0 3px 8px rgba(255, 109, 36, .4)); transition: transform .2s; }
.brand:hover .brand-mark { transform: rotate(-8deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
/* "Org" taronja i "Int" turquesa: tons oposats al cercle cromàtic (16° i 186°). */
.brand-name { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; color: var(--brand); }
.brand-name em { font-style: normal; color: var(--accent); }
.brand-tag { margin-top: 4px; font-size: .62rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--on-dark-muted); }
@media (max-width: 480px) { .brand-tag { display: none; } .brand-name { font-size: 1.5rem; } }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav-links > a:not(.btn) { color: var(--on-dark); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav-links > a:not(.btn):hover, .nav-links > a.active { color: #fff; background: rgba(255, 255, 255, .08); }
.nav-user { color: var(--on-dark); padding: 0 8px; font-size: .9rem; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }

/* --- Botons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border-radius: 8px;
  border: 1px solid transparent; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-sm { padding: 6px 12px; font-size: .875rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-alt); }
.site-header .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .25); }
.site-header .btn-ghost:hover { background: rgba(255, 255, 255, .08); }
.btn-ghost-light { color: #fff; border-color: rgba(255, 255, 255, .35); background: transparent; }
.btn-ghost-light:hover { background: rgba(255, 255, 255, .08); }
.btn-danger { background: transparent; color: var(--danger); border-color: #f3c4c0; }
.btn-danger:hover { background: #fdecea; }

/* --- Portada --- */
.hero { background: radial-gradient(900px 420px at 0% 100%, rgba(242, 174, 54, .14) 0%, transparent 60%),
  radial-gradient(1200px 500px at 80% 0%, var(--dark-glow) 0%, var(--dark) 60%); color: #fff; padding: 72px 0 88px; }
.hero-inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; color: var(--accent-ink); margin: 0 0 .75em; }
.hero .eyebrow { color: var(--accent); }
.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 62ch; }
.hero .lead { color: var(--on-dark); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.screen { background: var(--dark-deep); border: 1px solid var(--dark-line); border-radius: 14px; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); overflow: hidden; }
.screen-bar { display: flex; gap: 6px; padding: 10px 12px; background: var(--dark-bar); }
.screen-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--dark-mid); }
.screen-body { display: grid; grid-template-columns: 70px 1fr; grid-template-rows: 110px 70px; gap: 16px; padding: 20px; }
.tank { grid-row: 1; border: 2px solid var(--dark-mid); border-radius: 8px; position: relative; overflow: hidden; }
.level { position: absolute; inset: auto 0 0; height: 62%; background: linear-gradient(#4fdcec, #18c9dc); animation: level 6s ease-in-out infinite alternate; }
@keyframes level { to { height: 38%; } }
.pipe { align-self: center; height: 10px; border-radius: 5px; background: repeating-linear-gradient(90deg, var(--dark-mid) 0 18px, #ff6d24 18px 26px);
  background-size: 52px 10px; animation: flow 1.2s linear infinite; }
@keyframes flow { to { background-position: 52px 0; } }
.gauges { display: flex; gap: 10px; align-items: center; }
.gauges i { width: 46px; height: 46px; border-radius: 50%; border: 4px solid var(--dark-line); border-top-color: var(--accent); border-right-color: var(--accent); }
.trend svg { width: 100%; height: 70px; }
.trend polyline { fill: none; stroke: var(--brand); stroke-width: 2.5; vector-effect: non-scaling-stroke; }

/* --- Seccions --- */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: 1.9rem; }
.section-lead { color: var(--ink-soft); max-width: 70ch; margin-bottom: 32px; }
.page-head { background: var(--bg-alt); border-bottom: 1px solid var(--amber-line); padding: 48px 0 36px; }
.page-head-admin { padding: 32px 0 0; }
.badge { display: inline-block; background: var(--brand-soft); color: var(--brand-ink); padding: 6px 12px; border-radius: 999px; font-size: .9rem; }

.cards, .features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card-icon { font-size: 1.8rem; margin-bottom: 8px; }
.card p, .feature p { color: var(--ink-soft); margin: 0; }
.feature { padding: 20px 0 20px 18px; border-left: 3px solid var(--brand); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; text-align: center; }
.stats strong { display: block; font-size: 2.4rem; color: var(--brand-dark); }
.stats span { color: var(--ink-soft); }

.cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  background: var(--dark); color: #fff; border-radius: 16px; padding: 36px 40px; }
.cta p { color: var(--on-dark); margin: 0; }
.cta-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
.two-col-wide { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.checklist { padding: 0; list-style: none; }
.checklist li { padding: 6px 0 6px 28px; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }

.contact-info dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; }
.contact-info dt { font-weight: 600; color: var(--muted); }
.contact-info dd { margin: 0; }

/* --- Formularis --- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .95rem; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], textarea, select {
  font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid #cbd3df; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-ink); outline-offset: 1px; border-color: var(--accent-ink); }
input[type=file] { font: inherit; font-weight: 400; }

.alert { padding: 12px 16px; border-radius: 8px; margin: 16px 0; border: 1px solid; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: #e8f7ef; border-color: #b7e4cb; color: #0b5d34; }
.alert-error { background: #fdecea; border-color: #f5c2bd; color: #8c1d14; }
.alert-info { background: var(--accent-soft); border-color: #a8e9f1; color: #0b6670; }
.secret { font-size: 1.05rem; background: #fff; border: 1px dashed #7fbf9c; user-select: all; }

/* --- Descàrregues i versions --- */
.release { margin-bottom: 20px; }
.release-latest { border-color: #ffc9a8; box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.release-draft { background: #fbfcfe; border-style: dashed; }
.release-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.release-head h2, .release-head h3 { margin-bottom: 2px; }
.release-head p { margin: 0; }
.notes { white-space: pre-line; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-soft); }
.checksum { margin-top: 12px; font-size: .9rem; }
.checksum summary { cursor: pointer; color: var(--muted); }
.tag { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); vertical-align: middle; }
.tag-ok { background: #e8f7ef; color: #0b5d34; }
.tag-warn { background: #fff4e5; color: #92400e; }
.tag-dark { background: var(--dark); color: #fff; }
.empty { text-align: center; color: var(--muted); }

/* --- Administració --- */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 16px; }
.subnav a { padding: 10px 14px; text-decoration: none; color: var(--ink-soft); border-bottom: 3px solid transparent; font-weight: 600; }
.subnav a.active { color: var(--brand-ink); border-bottom-color: var(--brand); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 40px; }
.stat { text-decoration: none; color: inherit; }
.stat strong { display: block; font-size: 2rem; color: var(--brand-dark); }
.stat span { color: var(--muted); font-size: .9rem; }
.stat-warn strong { color: var(--warn); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; background: #fff; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--bg-alt); font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.row-off td { color: var(--muted); }
.plan-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.plan-form select { width: auto; padding: 4px 8px; font-size: .875rem; }
.devices-input { width: 70px; padding: 4px 8px; font: inherit; font-size: .875rem; border: 1px solid #cbd3df; border-radius: 8px; }
input[type=number], input[type=date] { font: inherit; font-weight: 400; padding: 10px 12px; border: 1px solid #cbd3df; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
.plan-form input[type=number] { width: 70px; padding: 4px 8px; }
.tag-danger { background: #fdecea; color: #8c1d14; }
.mt { margin-top: 40px; }
.key-card p { margin: 0 0 8px; }
.approve-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.approve-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.reject-form { flex-direction: row; align-items: end; gap: 12px; }
.reject-form label { flex: 1; }
.help { margin-top: 24px; }
.help summary { cursor: pointer; }
.help ol { padding-left: 20px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.message { margin-bottom: 16px; }
.message-read { opacity: .75; }

/* --- Peu --- */
.site-footer { background: var(--dark); color: var(--on-dark); padding: 18px 0 12px; font-size: .88rem; }
.site-footer { border-top: 4px solid; border-image: linear-gradient(90deg, var(--brand), var(--amber), var(--accent)) 1; }
.site-footer a { color: #fff; }
.site-footer p { margin: 2px 0; }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr; gap: 12px 24px; align-items: center; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: flex-end; }
.copyright { border-top: 1px solid var(--dark-line); margin-top: 12px; padding-top: 8px; color: var(--on-dark-muted); font-size: .82rem; }

/* --- Productes (portada) --- */
html { scroll-behavior: smooth; }
.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.product { background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; align-items: flex-start; }
.product + .product { border-top-color: var(--accent); }
.product:nth-child(3) { border-top-color: var(--amber); }
.product h3 { font-size: 1.4rem; margin: 0 0 .5em; }
.product p:not(.eyebrow) { color: var(--muted); flex: 1; margin: 0 0 20px; }

/* --- Catàleg d'eines --- */
.catalog { display: grid; gap: 40px; }
.catalog-title { font-size: 1.3rem; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
.catalog .card h3 { margin-top: 0; }
.catalog .card p { color: var(--muted); margin-bottom: 0; }

/* --- Responsive --- */
@media (max-width: 860px) {
  .hero-inner, .two-col, .two-col-wide, .footer-grid { grid-template-columns: 1fr; }
  .footer-links { justify-content: flex-start; }
  .hero-visual { display: none; }
  .nav-toggle { display: block; }
  .nav { flex-wrap: wrap; }
  .nav-links { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
  .nav-open .nav-links { display: flex; }
  .nav-links .btn, .nav-links form { margin-top: 6px; }
  .nav-links form .btn { width: 100%; }
  .cta { padding: 28px; }
}

/* Missatges i departaments */
.filters { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
.filters select, .message-actions select { width: auto; padding: 6px 10px; font-size: .9rem; }
.message-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-narrow { max-width: 560px; }
.input-xs { width: 5.5em !important; }
.dept-table input[type=text], .dept-table input[type=email] { padding: 6px 8px; font-size: .9rem; }
.dept-table td { vertical-align: top; }
