/* Portal CAE · Can Pipa — estil */
@font-face { font-family: Raleway; src: url(fonts/raleway-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: Raleway; src: url(fonts/raleway-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: Raleway; src: url(fonts/raleway-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: Raleway; src: url(fonts/raleway-latin-800-normal.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --yellow: #FED03D; --ink: #333; --ink2: #555; --muted: #5E5E5E; --line: #E2E2E2; --bg: #F5F5F5;
  --ok-bg: #E3F2E7; --ok: #1E6B34; --warn-bg: #FFF1D6; --warn: #6E4600; --bad-bg: #FDE7E5; --bad: #A8221A;
  --pend-bg: #E4E9F2; --pend: #2C4268; --none-bg: #EFEFEF; --none: #4A4A4A;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Raleway, Arial, Helvetica, sans-serif; font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: #1F4E8C; } a:hover { color: #0F2F5A; }
h1 { font-size: 28px; font-weight: 800; margin: 0 0 6px; line-height: 1.2; }
h2 { font-size: 20px; font-weight: 700; margin: 0 0 12px; }
.h3 { font-size: 17px; font-weight: 700; margin: 20px 0 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.skip { position: absolute; left: -9999px; } .skip:focus { left: 16px; top: 8px; background: #fff; padding: 8px 12px; z-index: 99; }
:focus-visible { outline: 3px solid #1F4E8C; outline-offset: 2px; }

/* Capçalera */
.top { background: #fff; border-bottom: 1px solid var(--line); }
.top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.brand img { height: 46px; width: auto; display: block; }
.brand-txt { display: flex; flex-direction: column; padding-left: 14px; border-left: 1px solid #D0D0D0; line-height: 1.25; }
.brand-txt strong { font-size: 18px; } .brand-txt span { font-size: 13px; color: var(--muted); }
.top-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.langs { display: flex; gap: 4px; margin-right: 6px; }
.lang { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 40px; padding: 4px 10px; border: 1px solid #8A8A8A; border-radius: 4px; font-weight: 700; font-size: 13px; color: var(--ink); text-decoration: none; }
.lang.on { background: var(--yellow); border-color: var(--yellow); }
.bar { background: #333; color: #E8E8E8; font-size: 13px; }
.bar-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 6px; padding-bottom: 6px; }
.bar-warn { color: var(--yellow); font-weight: 700; }

/* Pestanyes */
.tabs { background: #fff; border-bottom: 1px solid var(--line); }
.tabs-in { display: flex; overflow-x: auto; }
.tabs a, .subtabs a { display: inline-flex; align-items: center; min-height: 52px; padding: 12px 16px; color: var(--ink); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 4px solid transparent; }
.tabs a:hover, .subtabs a:hover { background: #FAFAFA; }
.tabs a.on, .subtabs a.on { font-weight: 800; border-bottom-color: var(--yellow); }
.subtabs { background: #FFFBEA; border-bottom: 1px solid #EFE3B0; }
.subtabs a { min-height: 44px; padding: 8px 14px; }
.sub-title { padding-top: 10px; font-size: 14px; }

.main { padding-top: 28px; padding-bottom: 56px; display: flex; flex-direction: column; gap: 20px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.block { display: flex; flex-direction: column; gap: 10px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 20px; }
.card > h1:first-child, .card > h2:first-child { margin-top: 0; }
.ok-card { font-weight: 700; color: var(--ok); }
.muted { color: var(--muted); } .small { font-size: 14px; } .strong { font-weight: 700; } .nowrap { white-space: nowrap; } .center { text-align: center; }
.pre { white-space: pre-wrap; }
.inline { display: inline; }
.end { display: flex; align-items: flex-end; }

/* Botons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 15px; font-weight: 700; min-height: 44px; padding: 8px 16px; border-radius: 4px; border: 1px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F3F3F3; color: var(--ink); }
.btn-p { background: var(--yellow); border-color: #E9B900; color: #222; } .btn-p:hover { background: #F5C21A; }
.btn-d { border-color: var(--bad); color: var(--bad); } .btn-d:hover { background: var(--bad-bg); color: var(--bad); }
.btn-ghost { border-color: #B5B5B5; }
.btn-sm { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; }
summary.btn { list-style: none; } summary.btn::-webkit-details-marker { display: none; }

/* Formularis */
.form { display: flex; flex-direction: column; gap: 10px; }
.grid2, .grid3 { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: 1 / -1; }
.lbl { display: block; font-size: 14px; font-weight: 700; margin: 0 0 6px; }
.fld { font: inherit; font-size: 16px; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid #8A8A8A; border-radius: 4px; background: #fff; color: var(--ink); }
textarea.fld { min-height: 64px; resize: vertical; }
.fld:disabled { background: #F2F2F2; }
.fld-num { max-width: 90px; }
.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
fieldset { border: 0; padding: 0; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.check input { width: 20px; height: 20px; flex: none; }
.role-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
details.card > summary { cursor: pointer; }
details.add > form, details.add > p { margin-top: 16px; }
details.add { background: transparent; border: 0; padding: 0; }
details.add[open] { background: #fff; border: 1px solid var(--line); padding: 20px; }

/* Avisos */
.flash { padding: 12px 14px; border-radius: 6px; font-weight: 600; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-ok { background: var(--ok-bg); color: var(--ok); } .flash-err { background: var(--bad-bg); color: var(--bad); }
.flash-info { background: var(--pend-bg); color: var(--pend); } .flash-warn { background: var(--warn-bg); color: var(--warn); }

/* Taules */
.scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink2); padding: 10px 12px; border-bottom: 2px solid var(--ink); white-space: nowrap; background: #fff; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #EAEAEA; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl-sm td, .tbl-sm th { padding: 6px 10px; font-size: 14px; }
.tbl-edit td { vertical-align: top; } .tbl-edit .fld { font-size: 14px; min-height: 40px; }
.doc-name { font-weight: 600; min-width: 220px; }
.actions { white-space: nowrap; } .actions .btn + .btn, .actions .btn + form { margin-left: 6px; }
.note { font-size: 13px; font-weight: 500; color: var(--pend); margin-top: 4px; }
.note-bad { font-size: 13px; font-weight: 500; color: var(--bad); margin-top: 4px; }
.obsolete summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

/* Estats */
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill-ok { background: var(--ok-bg); color: var(--ok); } .pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); } .pill-pend { background: var(--pend-bg); color: var(--pend); }
.pill-none { background: var(--none-bg); color: var(--none); }

.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-top: 5px solid; border-radius: 6px; padding: 16px; }
.kpi-bad { border-top-color: var(--bad); } .kpi-pend { border-top-color: var(--pend); } .kpi-warn { border-top-color: #E0A100; }
.kpi-n { font-size: 34px; font-weight: 800; line-height: 1; } .kpi-l { font-size: 14px; font-weight: 600; margin-top: 6px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters a { padding: 8px 12px; border: 1px solid #B5B5B5; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: 14px; min-height: 40px; display: inline-flex; align-items: center; }
.filters a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; } .filters-form .fld { max-width: 340px; } .filters-form .lbl { margin: 0; }

/* Pujada i revisió */
.upload { max-width: 640px; }
.infobox { background: var(--bg); border-radius: 6px; padding: 12px 14px; margin: 8px 0 12px; }
.result { border: 2px solid var(--yellow); border-radius: 6px; padding: 12px 14px; margin: 6px 0; }
.result-l { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink2); }
.result-v { font-size: 24px; font-weight: 800; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.review { display: grid; gap: 20px; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); align-items: start; }
.preview iframe { width: 100%; height: 78vh; border: 0; }
.preview img { max-width: 100%; height: auto; display: block; }
.dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; margin: 12px 0 16px; }
.dl dt { font-weight: 700; font-size: 14px; color: var(--ink2); } .dl dd { margin: 0; }
.files { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.files li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
.checks { list-style: none; padding: 0; } .checks li { padding: 4px 0; }
pre { background: #F0F0F0; padding: 10px; border-radius: 4px; overflow-x: auto; }

/* Accés */
.auth { max-width: 440px; margin: 20px auto; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 28px; }
.auth-wide { max-width: 720px; }
.prose { max-width: 800px; }

/* Peu */
.foot { background: #333; color: #D9D9D9; font-size: 13px; }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 16px; padding-bottom: 16px; }
.foot a { color: #fff; }

/* Mòbil */
@media (max-width: 860px) {
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review { grid-template-columns: minmax(0, 1fr); }
  .preview iframe { height: 60vh; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  h1 { font-size: 24px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .brand img { height: 38px; } .brand-txt { display: none; }
  .dl { grid-template-columns: minmax(0, 1fr); } .dl dd { margin-bottom: 6px; }
  .auth { padding: 20px; margin: 0; }
}

/* Impressió (llista d'autoritzats) */
@media print {
  .top, .tabs, .subtabs, .foot, .noprint, .skip, .flash { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .main { padding: 0; }
  .tbl-print th, .tbl-print td { border: 1px solid #999; padding: 4px 6px; font-size: 10.5pt; }
  h2 { margin-top: 16px; page-break-after: avoid; }
  tr { page-break-inside: avoid; }
}
