/* Portal HACCP — identidade O Valor do Tempo (ovalordotempo.pt) */
:root {
  --navy: #1F2549;
  --navy-2: #2c3463;
  --gold: #9B8669;
  --gold-2: #C49A3A;
  --beige: #F5F4F0;
  --ink: #353535;
  --muted: #7a7a7a;
  --line: #e4e1da;
  --white: #fff;
  --ok: #2f7d4f;
  --ok-bg: #e8f3ec;
  --bad: #b3261e;
  --bad-bg: #fbeaea;
  --warn: #8a6100;
  --warn-bg: #fdf4dc;
  --radius: 6px;
  --shadow: 0 2px 10px rgba(31, 37, 73, .08);
  --head: "El Messiri", Georgia, serif;
  --body: "Lato", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); color: var(--ink); background: var(--white); font-size: 15px; line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--navy); }
h1, h2, h3 { font-family: var(--head); color: var(--navy); font-weight: 600; line-height: 1.2; }
h1 { font-size: 1.7rem; margin: .2rem 0 1.2rem; }
h2 { font-size: 1.3rem; margin: 1.8rem 0 .8rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 .6rem; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 18px; padding-bottom: 40px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Cabeçalho */
.top { background: var(--white); border-bottom: 1px solid var(--navy); position: sticky; top: 0; z-index: 20; }
.top-in { display: flex; align-items: center; gap: 18px; min-height: 76px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 46px; width: auto; }
.brand span { font-family: var(--head); color: var(--gold); font-size: 1.05rem; letter-spacing: .12em; border-left: 1px solid var(--line); padding-left: 10px; }
.store select, .store-one { font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--beige); color: var(--navy); min-width: 230px; max-width: 320px; }
.store-one { display: inline-block; }
.top-right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.who { font-size: .85rem; color: var(--muted); }
.who .acting { color: var(--white); background: var(--gold); padding: 2px 8px; border-radius: 20px; }
.menu { display: flex; align-items: stretch; flex-wrap: wrap; }
.menu > a, .gear summary { display: block; padding: 9px 14px; background: var(--navy); color: var(--white); text-decoration: none; font-size: .93rem; border-right: 1px solid rgba(255,255,255,.15); cursor: pointer; list-style: none; }
.menu > a:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.menu > a:hover, .menu > a.on, .gear summary:hover { background: var(--gold); }
.gear { position: relative; }
.gear summary { border-radius: 0 var(--radius) var(--radius) 0; border-right: 0; }
.gear summary::-webkit-details-marker { display: none; }
.drop { position: absolute; right: 0; top: calc(100% + 4px); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 230px; padding: 6px 0; z-index: 30; }
.drop a { display: block; padding: 8px 16px; text-decoration: none; color: var(--ink); }
.drop a:hover { background: var(--beige); }
.drop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* Migalhas e avisos */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.crumbs a { color: var(--gold); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.flash { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 14px; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-err { background: var(--bad-bg); color: var(--bad); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }

/* Grelha de cartões */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.card { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 200px; padding: 22px 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(31,37,73,.14); }
.disc { --c: var(--navy); width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: var(--white); }
.card-label { color: var(--navy); font-family: var(--head); font-size: 1.08rem; text-align: center; }
.badge { position: absolute; top: 10px; right: 10px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; background: var(--navy); color: var(--white); font-size: .78rem; font-weight: 700; display: grid; place-items: center; }

/* Página inicial */
.hero { background: var(--beige); margin: -18px 0 0; padding: 34px 0 40px; }
.hero-in { display: grid; grid-template-columns: 260px 1fr; gap: 32px; align-items: start; }
.hero h1 { font-size: 2.2rem; margin-top: 0; }
.quick { display: flex; flex-direction: column; gap: 10px; }
.quick a { display: block; padding: 11px 14px; background: var(--navy); color: var(--white); text-decoration: none; border-radius: var(--radius); text-align: center; }
.quick a:hover { background: var(--gold); }
.motto { font-family: var(--head); color: var(--gold); font-size: 1.6rem; line-height: 1.25; margin: 0 0 10px; }
.contact-box { background: var(--white); border-radius: var(--radius); padding: 12px 14px; font-size: .88rem; margin-top: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-top: 16px; }
.stat { background: var(--white); border-radius: var(--radius); padding: 14px; border-left: 4px solid var(--gold); }
.stat b { display: block; font-size: 1.6rem; color: var(--navy); font-family: var(--head); }
.stat.alert { border-left-color: var(--bad); }

/* Painéis e tabelas */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin: 0 0 22px; }
.panel > summary, .panel-h { padding: 16px 18px; font-family: var(--head); font-size: 1.25rem; color: var(--navy); cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.panel-b { padding: 0 18px 18px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 7px 9px; text-align: center; vertical-align: middle; }
.tbl thead th { background: var(--beige); color: var(--navy); font-weight: 700; }
.tbl tbody tr:nth-child(even) { background: #fbfaf8; }
.tbl td.l, .tbl th.l { text-align: left; }
.tbl td.nc { background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.tbl td.list { text-align: left; max-width: 360px; font-size: .82rem; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: .78rem; background: var(--beige); color: var(--navy); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.sara { background: #ece9f6; color: #4b3f8f; }
.pager { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }

/* Formulários */
.form { max-width: 980px; }
.fieldset { border: 0; border-top: 2px solid var(--navy); padding: 12px 0 4px; margin: 22px 0 0; }
.fieldset > legend { font-family: var(--head); color: var(--navy); font-size: 1.15rem; padding-right: 10px; }
.hint { background: var(--beige); border-left: 3px solid var(--gold); padding: 8px 12px; font-size: .86rem; margin: 6px 0 12px; border-radius: 0 var(--radius) var(--radius) 0; }
.hint.corr { border-left-color: var(--bad); }
.row { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.row > label, .fld { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; font-size: .88rem; color: var(--muted); }
.req::after { content: " *"; color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid #cfcbc2; border-radius: var(--radius); background: var(--white); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
textarea { min-height: 70px; resize: vertical; }
.radio-line { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; color: var(--ink); }
.radio-line label { display: inline-flex; gap: 6px; align-items: center; }
.area-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; }
.area-block h4 { margin: 0 0 8px; color: var(--gold); font-family: var(--head); font-weight: 600; font-size: 1rem; }
.temp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 18px; }
.temp-grid label { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; }
.temp-grid .lim { color: var(--muted); font-size: .78rem; }
.temp-grid input.out { border-color: var(--bad); background: var(--bad-bg); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.checks-tools { margin: 4px 0 8px; font-size: .82rem; }
.oil-row { display: grid; grid-template-columns: 180px 160px 1fr 1fr; gap: 10px; align-items: center; margin-bottom: 8px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius); border: 1px solid var(--navy); background: var(--navy); color: var(--white); font: inherit; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--gold); border-color: var(--gold); }
.btn-ghost { background: var(--white); color: var(--navy); }
.btn-ghost:hover { color: var(--white); }
.btn-gold { background: var(--gold); border-color: var(--gold); }
.btn-danger { background: var(--white); color: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: var(--bad); border-color: var(--bad); color: var(--white); }
.btn-sm { padding: 5px 10px; font-size: .84rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; align-items: center; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; color: var(--muted); }
.file { font-size: .82rem; text-decoration: none; margin-right: 6px; }

/* Login */
body.login { background: var(--beige); }
.login-box { max-width: 420px; margin: 8vh auto 0; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 30px 24px; text-align: center; }
.login-box img { height: 70px; margin-bottom: 10px; }
.login-box h1 { margin-bottom: 18px; }
.login-box form { text-align: left; display: flex; flex-direction: column; gap: 12px; }
.login-box .btn { justify-content: center; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.pinpad button { font-size: 1.3rem; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--beige); cursor: pointer; }

/* Rodapé */
.foot { background: var(--navy); color: #d7d9e6; font-size: .85rem; }
.foot a { color: var(--white); }
.foot-in { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }

/* Calendário */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .d { min-height: 86px; border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; font-size: .78rem; background: var(--white); }
.cal .d.out { background: #faf9f6; color: #bbb; }
.cal .d.today { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.cal .h { text-align: center; font-weight: 700; color: var(--navy); font-size: .8rem; }
.cal .ev { display: block; margin-top: 3px; padding: 2px 4px; border-radius: 3px; background: var(--beige); color: var(--navy); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.late { background: var(--bad-bg); color: var(--bad); }

/* Barras do desempenho */
.bar { height: 10px; background: var(--beige); border-radius: 5px; overflow: hidden; min-width: 120px; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.bar.mid > i { background: var(--gold-2); }
.bar.low > i { background: var(--bad); }

@media (max-width: 760px) {
  .top-in { gap: 10px; }
  .top-right { margin-left: 0; align-items: stretch; width: 100%; }
  .menu > a, .gear summary { flex: 1 1 auto; text-align: center; padding: 9px 8px; font-size: .86rem; }
  .menu > a:first-child, .gear summary { border-radius: 0; }
  .store select, .store-one { min-width: 0; width: 100%; max-width: none; }
  .store { flex: 1 1 100%; }
  .hero-in { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card { min-height: 160px; }
  .disc { width: 80px; height: 80px; }
  .disc .ico { width: 42px; height: 42px; }
  .oil-row { grid-template-columns: 1fr 1fr; }
}
@media print {
  .top, .foot, .actions, .filters, .pager, .no-print { display: none !important; }
  .main { padding: 0; }
  .tbl { font-size: 10px; }
}
