:root {
  color-scheme: light;
  --school: #891c2e;
  --bg: #f5f4f5;
  --surface: #fff;
  --ink: #242329;
  --muted: #64616a;
  --line: #ddd9de;
  --primary: #891c2e;
  --button: #891c2e;
  --soft: #f5e9ed;
  --shadow: 0 6px 24px #271b2407;
  --field-line: #aaa2ac;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--primary); text-underline-offset: 4px; }
header { background: var(--surface); border-top: 5px solid var(--school); border-bottom: 1px solid var(--line); }
.header-inner { max-width: 1060px; margin: auto; padding: 16px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; gap: 16px; align-items: center; color: var(--ink); text-decoration: none; min-width: 0; }
/* Show the school's own signature; the supplied files remain unmodified. */
.school-logo { display: block; width: 100px; height: 95px; flex: 0 0 100px; overflow: hidden; }
.school-logo img { display: block; width: 100%; height: auto; }
.brand-product { border-left: 1px solid var(--line); padding-left: 16px; line-height: 1.25; }
.brand-product > span { display: block; font-size: 18px; font-weight: 750; letter-spacing: -.035em; margin: 7px 0; }
.brand-product small { display: block; font-size: 8px; letter-spacing: .12em; font-weight: 650; color: var(--muted); }
.brand-product .brand-tagline { font-size: 7px; letter-spacing: .09em; }
.user-name { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; padding-left: 2px; }
nav { max-width: 1020px; margin: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
nav a, nav .link { display: inline-flex; align-items: center; min-height: 48px; padding: 8px 12px; text-decoration: none; border-radius: 8px; font-size: 14px; font-weight: 650; }
nav a { color: var(--muted); }
nav a:hover, nav a[aria-current=page] { background: var(--soft); color: var(--primary); }
nav form { margin-left: auto; }
nav .link { background: none; color: var(--muted); border: none; cursor: pointer; }
main { max-width: 940px; margin: auto; padding: 32px 20px 64px; min-height: 65vh; }
h1 { font-size: clamp(1.85rem, 5.7vw, 2.65rem); line-height: 1.16; letter-spacing: -.045em; margin: 10px 0 16px; }
h2 { font-size: 1.18rem; line-height: 1.4; margin: 0 0 18px; letter-spacing: -.025em; }
h3 { font-size: 1.05rem; line-height: 1.4; margin: 12px 0 6px; }
p { margin: 0 0 16px; }
.muted, .hint, small { color: var(--muted); }
.hint { font-size: .88rem; margin-top: 16px; }
.eyebrow { font-size: 10px; font-weight: 750; letter-spacing: .16em; color: var(--primary); margin-bottom: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin: 20px 0; box-shadow: var(--shadow); }
.page-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.button, button { font: inherit; font-weight: 680; font-size: .95rem; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--button); color: #fff; border: 1px solid transparent; border-radius: 8px; padding: 12px 19px; cursor: pointer; text-decoration: none; line-height: 1.4; white-space: normal; }
.button:hover, button:hover { filter: brightness(.94); }
.secondary { background: var(--surface); border-color: var(--line); color: var(--primary); }
.danger { color: #a52b24; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 20px 0 0; }
.actions > * { flex: 1 1 auto; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 28px 0; }
.stats > div { border: 1px solid var(--line); border-left: 3px solid var(--school); background: var(--surface); padding: 20px; border-radius: 10px; }
.stats strong { display: block; font-size: 2rem; line-height: 1.2; font-weight: 700; letter-spacing: -.04em; }
.stats span { font-size: .82rem; color: var(--muted); }
.ficha-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; text-decoration: none; color: var(--ink); transition: border-color .15s; }
.ficha-row:hover { border-color: var(--primary); }
.ficha-row p { color: var(--muted); font-size: .92rem; }
.ficha-row small { font-size: .75rem; }
.ficha-row > span { font-size: 24px; color: var(--primary); }
.badge { display: inline-block; font-size: .75rem; font-weight: 750; border: 1px solid var(--line); border-radius: 25px; padding: 5px 12px; background: var(--soft); color: var(--ink); }
.badge.rascunho:before { content: '○ '; }
.badge.submetida { background: #fff2cd; color: #705100; border-color: #dec580; }
.badge.submetida:before { content: '◷ '; }
.badge.validada { background: #daf2e4; color: #145333; border-color: #8dbea1; }
.badge.validada:before { content: '✓ '; }
.badge.devolvida { background: #fee6df; color: #8a2b15; border-color: #dfac9c; }
.badge.devolvida:before { content: '↩ '; }
label { font-weight: 650; font-size: .94rem; display: block; margin: 15px 0 6px; }
input, select, textarea { font: inherit; font-size: 1rem; border: 1px solid var(--field-line); border-radius: 7px; background: var(--surface); color: var(--ink); width: 100%; min-height: 48px; padding: 11px 12px; }
textarea { resize: vertical; }
input[type=checkbox] { width: 24px; height: 24px; min-height: 24px; vertical-align: middle; accent-color: var(--button); }
input[type=file] { font-size: .87rem; min-height: 64px; }
input::file-selector-button { min-height: 40px; margin-right: 8px; }
form p { margin-bottom: 18px; }
.helptext { display: block; color: var(--muted); font-size: .82rem; margin-top: 6px; }
.helptext ul { padding-left: 20px; }
.errorlist { color: #a32d23; font-weight: 650; font-size: .9rem; padding-left: 20px; }
.message { padding: 18px 20px; background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--school); border-radius: 9px; margin-bottom: 20px; }
.message.error { border-color: #b63a30; background: #ffede8; color: #85261e; }
.message h2 { margin-bottom: 8px; }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 26px 0 12px; }
.steps li { flex: 1; text-align: center; min-height: 48px; background: var(--soft); border-radius: 7px; display: grid; place-items: center; font-weight: 700; }
.steps a { display: grid; place-items: center; width: 100%; height: 48px; text-decoration: none; }
.steps [aria-current] { background: var(--button); color: #fff; }
.steps [aria-current] a { color: #fff; }
.formset-row { border: 1px solid var(--line); border-radius: 9px; padding: 18px; margin: 16px 0 24px; min-width: 0; }
.formset-row legend { font-weight: 700; padding: 0 7px; }
.formset-row:has(input[name$="-DELETE"]:checked) { opacity: .65; }
.item { padding: 18px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.item:last-child { border-bottom: 0; }
.item > a { display: inline-flex; align-items: center; min-height: 48px; }
.item small { display: block; }
dt { font-size: .8rem; font-weight: 750; color: var(--muted); margin: 14px 0 3px; }
dd { margin: 0; overflow-wrap: anywhere; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
figure { margin: 12px 0; }
figure img { width: 100%; height: 190px; object-fit: cover; border-radius: 9px; }
figcaption { font-size: .85rem; color: var(--muted); }
.photo-preview { width: 100%; max-width: 360px; max-height: 220px; object-fit: cover; border-radius: 9px; }
summary { cursor: pointer; font-weight: 700; min-height: 48px; display: list-item; align-content: center; }
.filters { padding-top: 12px; padding-bottom: 12px; }
.filters form { margin-top: 15px; }
.login { max-width: 480px; margin: 16px auto; }
.login > h1 { font-size: clamp(2.3rem, 8vw, 3.4rem); }
.login .card { border-top: 3px solid var(--school); padding-top: 24px; }
.login button { width: 100%; }
footer { border-top: 1px solid var(--line); padding: 24px 20px; max-width: 1060px; margin: auto; font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.footer-brand { color: var(--ink); font-weight: 700; }
.footer-brand small { display: block; font-weight: 400; }
footer a { min-height: 48px; display: inline-flex; align-items: center; margin-left: auto; }
.footer-note { width: 100%; font-size: .75rem; }
.skip { position: absolute; left: 16px; top: -100px; background: var(--surface); padding: 12px; z-index: 5; }
.skip:focus { top: 10px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
.empty { text-align: center; padding: 35px 20px; }
.button + h2 { margin-top: 28px; }
@media (min-width: 700px) {
  .header-inner { padding: 16px 30px; flex-wrap: nowrap; }
  .school-logo { width: 118px; height: 112px; flex-basis: 118px; }
  .brand { gap: 24px; }
  .brand-product { padding-left: 24px; }
  .brand-product > span { font-size: 24px; }
  .brand-product small { font-size: 9px; }
  .brand-product .brand-tagline { font-size: 8px; }
  .user-name { max-width: 210px; font-size: 14px; }
  main { padding-top: 44px; }
  .page-heading { flex-direction: row; align-items: center; justify-content: space-between; }
  .page-heading .muted { max-width: 540px; }
  .card { padding: 28px; }
  .filters { padding-top: 12px; padding-bottom: 12px; }
  .stats { max-width: 540px; }
  .actions > * { flex: 0 1 auto; }
  .login { margin-top: 32px; }
  .footer-note { width: auto; }
}
@media (max-width: 360px) {
  .header-inner { padding-left: 16px; padding-right: 16px; }
  .brand { gap: 12px; }
  .brand-product { padding-left: 12px; }
  .brand-product > span { font-size: 17px; }
}
/* ==================================================
   LAB LOGIN V1 — FICHA DE OFICINA
   Interface mobile first
   ================================================== */

.lab-login {
  --login-primary: #891c2e;
  --login-text: #20242b;
  --login-muted: #667085;
  --login-border: #d8dce3;
  --login-background: #ffffff;

  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 20px 0 32px;
  color: var(--login-text);
}

.lab-login *,
.lab-login *::before,
.lab-login *::after {
  box-sizing: border-box;
}

.lab-login-card {
  background: var(--login-background);
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 26px 22px;
  box-shadow: 0 12px 36px rgba(24, 29, 39, .06);
}

.lab-login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lab-login-logo {
  display: block;
  width: 58px;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  flex-shrink: 0;
}

.lab-login-brand-text {
  min-width: 0;
}

.lab-login-overline {
  margin: 0 0 6px;
  color: var(--login-primary);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .11em;
}

.lab-login-brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 1.65rem);
  line-height: 1.2;
  letter-spacing: -.035em;
}

.lab-login-tagline {
  margin: 7px 0 0;
  color: var(--login-muted);
  font-size: .82rem;
}

.lab-login-divider {
  height: 1px;
  background: #e9eaee;
  margin: 24px 0;
}

.lab-login-intro h2 {
  margin: 0 0 6px;
  font-size: 1.18rem;
  font-weight: 750;
}

.lab-login-intro p {
  margin: 0 0 24px;
  color: var(--login-muted);
  font-size: .91rem;
  line-height: 1.6;
}

.lab-login-form {
  width: 100%;
}

.lab-field {
  margin-bottom: 20px;
}

.lab-field label {
  display: block;
  margin: 0 0 8px;
  color: var(--login-text);
  font-size: .88rem;
  font-weight: 700;
}

.lab-field input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid var(--login-border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--login-text);
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}

.lab-field input::placeholder {
  color: #858b96;
}

.lab-field input:focus {
  outline: 2px solid transparent;
  border-color: var(--login-primary);
  box-shadow: 0 0 0 3px rgba(137, 28, 46, .13);
}

.lab-field input[aria-invalid="true"] {
  border-color: #b42318;
}

.lab-field-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.lab-field-heading label {
  margin: 0;
}

.lab-field-heading a {
  font-size: .82rem;
  font-weight: 650;
  text-decoration: none;
}

.lab-password-wrap {
  position: relative;
}

.lab-password-wrap input {
  padding-right: 92px;
}

.lab-login .lab-password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  min-height: 40px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--login-primary);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
}

.lab-login .lab-password-toggle:hover {
  background: #f8edf0;
}

.lab-login .lab-password-toggle:focus-visible {
  outline: 3px solid rgba(137, 28, 46, .4);
  outline-offset: 2px;
}

.lab-login .lab-login-submit {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
  padding: 13px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--login-primary);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 750;
  cursor: pointer;
}

.lab-login .lab-login-submit:hover {
  background: #701525;
}

.lab-login .lab-login-submit:disabled {
  opacity: .7;
  cursor: wait;
}

.lab-login .lab-login-submit:focus-visible {
  outline: 3px solid rgba(137, 28, 46, .4);
  outline-offset: 3px;
}

.lab-login-help {
  margin: 20px 0 0;
  text-align: center;
  color: var(--login-muted);
  font-size: .82rem;
  line-height: 1.6;
}

.lab-login-privacy {
  margin: 18px 0 0;
  text-align: center;
  font-size: .82rem;
}

.lab-login-privacy a {
  color: var(--login-muted);
}

.lab-login-alert {
  padding: 14px;
  margin-bottom: 20px;
  border: 1px solid #f0b4ad;
  border-radius: 10px;
  background: #fff2f0;
  color: #912018;
  font-size: .88rem;
}

.lab-login-alert p {
  margin: 0 0 6px;
}

.lab-login-alert p:last-child {
  margin-bottom: 0;
}

.lab-field-error {
  margin-top: 8px;
  color: #a1251b;
  font-size: .82rem;
}

.lab-field-error p {
  margin: 0 0 4px;
}

@media (min-width: 600px) {
  .lab-login {
    padding-top: 38px;
  }

  .lab-login-card {
    padding: 36px;
  }

  .lab-login-logo {
    width: 68px;
  }
}

@media (max-width: 400px) {
  .lab-login-card {
    padding: 22px 18px;
    border-radius: 14px;
  }

  .lab-login-brand {
    gap: 12px;
  }

  .lab-login-logo {
    width: 52px;
  }

  .lab-login-overline {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lab-login *,
  .lab-login *::before,
  .lab-login *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* FIM LAB LOGIN V1 */



/* ==================================================
   LOGIN V2 — TEMA CLARO E IDENTIDADE UNICA
   ================================================== */

body.page-login {
  background: #f7f8fa;
  color: #20242b;
  min-height: 100vh;
}

body.page-login main {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  padding: 28px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.page-login .lab-login {
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 0;
}

body.page-login .lab-login-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 30px 26px;
  box-shadow: 0 16px 48px rgba(32, 36, 43, .07);
}

body.page-login .lab-login-brand h1 {
  color: #20242b;
}

body.page-login .lab-login-intro h2 {
  color: #20242b;
}

body.page-login .lab-field input {
  background: #ffffff;
  color: #20242b;
  border-color: #c9cdd5;
}

body.page-login .lab-field input::placeholder {
  color: #737b89;
}

body.page-login .lab-login-submit {
  background: #891c2e;
  color: #ffffff;
}

body.page-login .lab-login-submit:hover {
  background: #701525;
}

@media (max-width: 420px) {
  body.page-login main {
    padding: 20px 14px;
    align-items: center;
  }

  body.page-login .lab-login-card {
    padding: 25px 20px;
    border-radius: 14px;
  }
}

/* FIM LOGIN V2 */

/* ==================================================
   LAB — MENU DE UTILIZADOR V1
   ================================================== */

.lab-user-menu {
  position: relative;
  margin-left: auto;
  z-index: 100;
}

.lab-user-dropdown {
  position: relative;
}

.lab-user-trigger {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 12px;
  color: #20242b;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
}

.lab-user-trigger::-webkit-details-marker {
  display: none;
}

.lab-user-trigger::marker {
  content: "";
}

.lab-user-trigger:hover,
.lab-user-dropdown[open] .lab-user-trigger {
  background: #f7f1f3;
}

.lab-user-trigger:focus-visible {
  outline: 3px solid rgba(137, 28, 46, .35);
  outline-offset: 2px;
}

.lab-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid #e6d9dd;
  border-radius: 50%;
  background: #ffffff;
}

.lab-user-avatar img {
  display: block;
  width: 85%;
  height: 85%;
  object-fit: contain;
}

.lab-user-avatar-large {
  width: 56px;
  height: 56px;
}

.lab-user-trigger-name {
  max-width: 150px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lab-user-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: min(340px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #ffffff;
  color: #20242b;
  box-shadow: 0 18px 48px rgba(32, 36, 43, .14);
}

.lab-user-profile {
  display: flex;
  align-items: center;
  gap: 13px;
}

.lab-user-profile-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.5;
}

.lab-user-profile-info strong,
.lab-user-profile-info small {
  overflow-wrap: anywhere;
}

.lab-user-profile-info strong {
  font-size: 15px;
}

.lab-user-profile-info small,
.lab-user-profile-info span {
  color: #667085;
  font-size: 12px;
}

.lab-user-panel-divider {
  height: 1px;
  margin: 15px 0;
  background: #e5e7eb;
}

.lab-user-profile-label {
  margin-bottom: 10px;
  color: #891c2e;
  font-size: 13px;
  font-weight: 750;
}

.lab-user-profile-details {
  display: grid;
  grid-template-columns: 65px minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  font-size: 12px;
}

.lab-user-profile-details span {
  color: #667085;
}

.lab-user-profile-details strong {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.lab-user-panel-link {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #20242b;
  text-align: left;
  text-decoration: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.lab-user-panel-link:hover {
  background: #f7f1f3;
  color: #891c2e;
}

.lab-user-panel-link:focus-visible {
  outline: 3px solid rgba(137, 28, 46, .35);
}

.lab-user-logout {
  margin: 0;
}

.lab-user-logout-button {
  color: #891c2e;
}

@media (max-width: 600px) {
  .lab-user-trigger {
    gap: 7px;
    padding: 6px;
  }

  .lab-user-trigger-name {
    display: none;
  }

  .lab-user-panel {
    right: -6px;
  }
}

/* FIM LAB — MENU DE UTILIZADOR V1 */
