/* -------------------------------------------------------------------------
 * Portal de Suporte DecimalWorld — identidade gráfica de decimalworld.pt
 * Open Sans (SIL OFL 1.1, ver fonts/OFL.txt)
 * ------------------------------------------------------------------------- */

@font-face {
    font-family: "Open Sans";
    src: url("../fonts/opensans.woff") format("woff");
    font-weight: 300 800;
    font-stretch: 75% 100%;
    font-style: normal;
    font-display: swap;
}

:root {
    --navy: #0B2A5B;
    --navy-dark: #071B3D;
    --blue: #0B3D91;
    --sky: #2FA8FF;
    --copper-light: #E3A878;
    --copper: #C98757;
    --copper-dark: #9A5C32;
    --bg: #F4F7FB;
    --card: #FFFFFF;
    --line: #DCE4F0;
    --line-soft: #EAF0F8;
    --text: #1B2B4A;
    --muted: #566782;
    --ok: #1E7F4F;
    --ok-bg: #E7F4EC;
    --warn: #A35F00;
    --warn-bg: #FFF1DB;
    --crit: #C23B32;
    --crit-bg: #FCE6E4;
    --info-bg: #E3EEFC;
    --radius: 16px;
    --font: "Open Sans", system-ui, "Segoe UI", Arial, sans-serif;
    color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font: 15px/1.55 var(--font);
    color: var(--text);
    background: radial-gradient(1100px 700px at 82% 0%, #0F4AAE 0%, #0B3D91 28%, #0B2A5B 62%, #071B3D 100%) fixed, #071B3D;
}

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--copper-dark); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; margin: 0; color: var(--navy); }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 12px; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 6px; }

.eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--copper-dark);
    margin-bottom: 6px;
}

/* ---------- Moldura ---------- */

.shell {
    width: 1280px;
    max-width: calc(100% - 32px);
    margin: 28px auto 40px;
    border-radius: 22px;
    overflow: hidden;
    background: var(--bg);
    box-shadow: 0 24px 60px rgba(3, 12, 30, 0.45);
}

.top {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 28px;
    background: var(--navy);
    border-bottom: 1px solid rgba(180, 195, 219, 0.15);
}
.brand { display: block; flex: 0 0 auto; line-height: 0; }
.brand img { width: 200px; height: auto; }

.mainnav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; }
.mainnav a {
    color: #DCE6F5;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
.mainnav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.mainnav a.on { background: rgba(255, 255, 255, 0.14); color: #fff; }
.mainnav a.cta { margin-left: auto; background: var(--copper); color: #fff; }
.mainnav a.cta:hover, .mainnav a.cta.on { background: var(--copper-dark); }

.who { display: flex; align-items: center; gap: 10px; color: #fff; flex: 0 0 auto; }
.who-text { display: flex; flex-direction: column; line-height: 1.25; max-width: 160px; }
.who-text { color: #fff; text-decoration: none; }
.who-text:hover b { color: var(--copper-light); }
.who-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text small { color: #BFCCE0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who form { margin: 0; }
.link-out {
    font: inherit; font-size: 13px; font-weight: 600;
    color: #DCE6F5; background: transparent;
    border: 1px solid rgba(220, 230, 245, 0.35); border-radius: 999px;
    padding: 5px 12px; cursor: pointer;
}
.link-out:hover { border-color: var(--copper-light); color: #fff; }
.menu-toggle { display: none; }

.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; flex: 0 0 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--copper-light), var(--copper));
    color: #fff; font-weight: 700; font-size: 13px;
}

.page { padding: 30px 32px 36px; min-height: 60vh; }

.foot {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 32px;
    background: var(--navy);
    color: #BFCCE0; font-size: 13px;
}
.foot a { color: #DCE6F5; }
.foot-brand { line-height: 0; }

/* ---------- Componentes ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(11, 42, 91, 0.04);
}
.card > h2 { margin-bottom: 14px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.more { font-size: 13px; font-weight: 600; color: var(--blue); text-decoration: none; white-space: nowrap; }
.more:hover { text-decoration: underline; }
.empty { color: var(--muted); padding: 6px 0; }
.empty p { margin-bottom: 14px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-weight: 700; font-size: 14px;
    padding: 10px 20px;
    border-radius: 999px;
    border: 1.5px solid var(--copper);
    background: var(--copper); color: #fff;
    text-decoration: none; cursor: pointer;
    white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--copper-dark); border-color: var(--copper-dark); color: #fff; }
.btn-line { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-line:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-block { width: 100%; }
.btn[hidden] { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.intro { max-width: 760px; }

.note {
    border-radius: 12px; padding: 12px 16px; margin-bottom: 18px;
    border: 1px solid transparent; font-size: 14px;
}
.note-ok { background: var(--ok-bg); border-color: #BFE3CD; color: #14532D; }
.note-erro { background: var(--crit-bg); border-color: #F3C2BD; color: #8A1F18; }
.note-aviso { background: var(--warn-bg); border-color: #F5D7A6; color: #6B3E00; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
    background: var(--info-bg); color: var(--blue);
}
.st-aberto { background: #E3EEFC; color: #0B3D91; }
.st-em_curso { background: #E1F3FF; color: #075A93; }
.st-aguarda_cliente { background: var(--warn-bg); color: var(--warn); }
.st-agendado { background: #F7EADF; color: var(--copper-dark); }
.st-resolvido { background: var(--ok-bg); color: var(--ok); }
.st-fechado { background: #EEF1F5; color: #5A667A; }

.prio { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.prio::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #A9B6CA; vertical-align: 1px; }
.pr-normal::before { background: var(--sky); }
.pr-alta::before { background: #E08A00; }
.pr-urgente { color: var(--crit); }
.pr-urgente::before { background: var(--crit); }

.tag-trip {
    display: inline-block; margin-left: 8px;
    font-size: 11px; font-weight: 700; letter-spacing: .02em;
    color: var(--copper-dark); background: #F7EADF;
    border-radius: 6px; padding: 1px 7px; white-space: nowrap; vertical-align: 1px;
}
.who-tag {
    display: inline-block; font-size: 11px; font-weight: 700;
    color: var(--blue); background: var(--info-bg);
    border-radius: 6px; padding: 1px 7px; white-space: nowrap;
}
.tag-internal { color: var(--warn); background: var(--warn-bg); }
.tag-muted { color: var(--muted); background: #EEF1F5; }
.pill-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--copper); color: #fff; font-size: 11px; text-align: center; }

/* ---------- Formulários ---------- */

input[type=text], input[type=search], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=datetime-local],
input:not([type]), select, textarea {
    width: 100%;
    font: inherit; font-size: 15px; color: var(--text);
    background: #fff;
    border: 1px solid #C9D5E6;
    border-radius: 10px;
    padding: 9px 12px;
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
select { appearance: none; padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230B2A5B' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 12px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 168, 255, 0.25); }
input[aria-invalid=true], textarea[aria-invalid=true], select[aria-invalid=true] { border-color: var(--crit); }
input[type=file] { font: inherit; font-size: 14px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button {
    font: inherit; font-weight: 600; font-size: 13px;
    margin-right: 10px; padding: 7px 14px;
    border-radius: 999px; border: 1.5px solid var(--navy);
    background: #fff; color: var(--navy); cursor: pointer;
}
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--copper); vertical-align: -3px; margin: 0 8px 0 0; }
.file-names { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }

.form .row {
    display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 8px 22px;
    padding: 14px 0; border-top: 1px solid var(--line-soft);
}
.form .row:first-of-type { border-top: 0; }
.form .row > label, .form .row > span { font-weight: 700; color: var(--navy); padding-top: 9px; font-size: 14px; }
.form .row em { display: block; font-style: normal; font-weight: 400; font-size: 12px; color: var(--muted); }
.form .row.actions > div { display: flex; gap: 10px; flex-wrap: wrap; }
.form .row .check { display: block; padding: 6px 0; font-weight: 400; }
.form > .hint { margin-bottom: 10px; }
.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
.field-error { display: block; color: var(--crit); font-size: 13px; font-weight: 600; margin-top: 6px; }
.check { cursor: pointer; }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; }
.filters label { flex: 0 1 200px; }
.filters .f-search { flex: 1 1 260px; }
.filters .btn { padding: 9px 18px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; }
.inline-form label { font-size: 13px; font-weight: 700; color: var(--navy); }
.inline-form select { margin-top: 4px; min-width: 300px; }

/* ---------- Tabelas ---------- */

.table-wrap { overflow-x: auto; margin: 0 -6px; }
table.tickets { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tickets th {
    text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted);
    padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tickets td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tickets tbody tr:hover td { background: #F8FAFD; }
table.tickets tbody tr:last-child td { border-bottom: 0; }
table.tickets tr.dim td { color: var(--muted); }
table.tickets tr.sel td { background: #FBF4EE; }
table.tickets tfoot td { border-top: 1px solid var(--line); border-bottom: 0; font-weight: 700; color: var(--navy); }
table.tickets .num { text-align: right; white-space: nowrap; }
table.tickets .ref a { font-weight: 700; text-decoration: none; white-space: nowrap; }
table.tickets .subj a { font-weight: 600; color: var(--navy); text-decoration: none; }
table.tickets .subj a:hover { color: var(--copper-dark); text-decoration: underline; }
table.tickets .when { color: var(--muted); white-space: nowrap; font-size: 13px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a, .row-actions form { display: inline; margin-left: 10px; font-size: 13px; font-weight: 600; }
.link-danger { font: inherit; font-size: 13px; font-weight: 600; color: var(--crit); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.rem-warn { color: var(--warn); }
.rem-crit { color: var(--crit); }

.tabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--line); margin: -6px 0 10px; flex-wrap: wrap; }
.tab {
    padding: 8px 14px 10px; font-weight: 600; font-size: 14px; color: var(--muted);
    text-decoration: none; border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--navy); }
.tab.on { color: var(--navy); border-bottom-color: var(--copper); }
.tabs .count { margin-left: auto; font-size: 13px; color: var(--muted); }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pager a { min-width: 34px; text-align: center; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; font-weight: 600; color: var(--navy); }
.pager a.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- Página inicial ---------- */

.hero {
    display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: center;
    background: linear-gradient(135deg, #fff 0%, #F7FAFE 100%);
    border: 1px solid var(--line); border-radius: 20px;
    padding: 30px 34px; margin-bottom: 22px;
}
.hero h1 { font-size: 32px; margin-bottom: 12px; }
.hero h1 b { color: var(--copper); font-weight: 800; }
.hero p { color: var(--muted); max-width: 600px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-art { width: 300px; height: auto; justify-self: end; }

.stats { display: grid; gap: 20px; margin-bottom: 20px; }
.stats > .card, .hours-grid > .card { margin-bottom: 0; }
.hours-grid { margin-bottom: 20px; }
.stats-3 { grid-template-columns: 1.25fr 1fr 1fr; }
.stats-2 { grid-template-columns: 1fr 1fr; }
.stat-card { display: flex; flex-direction: column; }
.stat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.stat-head small { color: var(--muted); }
.stat-empty { font-weight: 600; color: var(--navy); margin-top: 8px; }
.big-number { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 12px; flex-wrap: wrap; }
.big-number b { font-size: 40px; font-weight: 800; color: var(--navy); line-height: 1; letter-spacing: -0.02em; }
.big-number span { color: var(--muted); font-size: 14px; }
.split { display: flex; gap: 22px; margin: 0 0 12px; flex-wrap: wrap; }
.split dt { font-size: 12px; color: var(--muted); }
.split dd { margin: 0; font-weight: 700; color: var(--navy); font-size: 16px; }
.stat-card .more { margin-top: auto; }

.bar { height: 10px; border-radius: 999px; background: #E4EBF5; overflow: hidden; margin-bottom: 14px; }
.bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--sky), var(--blue)); transition: width .6s ease; }
.hc-warn .bar span { background: linear-gradient(90deg, #F3B65C, #E08A00); }
.hc-crit .bar span { background: linear-gradient(90deg, #E36A60, var(--crit)); }
.hc-msg { font-size: 13px; font-weight: 600; border-radius: 10px; padding: 8px 12px; background: var(--warn-bg); color: #6B3E00; }
.hc-crit .hc-msg { background: var(--crit-bg); color: #8A1F18; }
.hc-msg.hc-info { background: var(--info-bg); color: var(--blue); }

.mini-bar { display: inline-block; width: 70px; height: 6px; border-radius: 999px; background: #E4EBF5; overflow: hidden; vertical-align: middle; margin-right: 8px; }
.mini-bar span { display: block; height: 100%; width: 0; background: var(--blue); }
.mb-warn span { background: #E08A00; }
.mb-crit span { background: var(--crit); }

/* ---------- Painel da equipa ---------- */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi { display: flex; flex-direction: column; gap: 2px; text-decoration: none; margin: 0; padding: 18px 20px; }
.kpi b { font-size: 34px; font-weight: 800; color: var(--navy); line-height: 1.1; }
.kpi span { color: var(--muted); font-weight: 600; font-size: 14px; }
.kpi:hover { border-color: var(--copper-light); }
.kpi-warn b { color: var(--copper-dark); }

.cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack > .card:last-child { margin-bottom: 20px; }

.queue, .trips, .alerts, .people, .time-list, .months, .files { list-style: none; margin: 0; padding: 0; }
.queue li + li { border-top: 1px solid var(--line-soft); }
.queue a { display: flex; flex-direction: column; gap: 3px; padding: 11px 4px; text-decoration: none; color: var(--text); border-radius: 8px; }
.queue a:hover { background: #F8FAFD; }
.q-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-top b { color: var(--blue); }
.q-subj { font-weight: 600; color: var(--navy); }
.q-meta { font-size: 13px; color: var(--muted); }

.trips li { display: flex; gap: 14px; align-items: center; padding: 10px 0; }
.trips li + li { border-top: 1px solid var(--line-soft); }
.trip-date {
    flex: 0 0 58px; text-align: center; border-radius: 12px; padding: 6px 0;
    background: #F7EADF; color: var(--copper-dark); display: flex; flex-direction: column; line-height: 1.2;
}
.trip-date b { font-size: 17px; }
.trip-date small { font-size: 11px; }
.trip-date.tbd { background: #EEF1F5; color: var(--muted); }
.trips a { display: flex; flex-direction: column; text-decoration: none; color: var(--text); min-width: 0; }
.trips a b { color: var(--navy); }
.trips a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trips a small { color: var(--muted); }

.alerts li { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 10px 0 10px 14px; border-left: 3px solid #E08A00; margin-bottom: 8px; }
.alerts li.al-crit { border-left-color: var(--crit); }
.alerts li.al-ok { border-left-color: var(--sky); }
.alerts a { font-weight: 700; color: var(--navy); text-decoration: none; }
.alerts small { grid-column: 1 / -1; color: var(--muted); }

.people li { display: flex; align-items: center; gap: 10px; padding: 8px 0; flex-wrap: wrap; }
.people li + li { border-top: 1px solid var(--line-soft); }
.people a { display: flex; flex-direction: column; text-decoration: none; color: var(--text); flex: 1 1 160px; min-width: 0; }
.people a b { color: var(--navy); }
.people a small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.dim { opacity: .6; }

/* ---------- Bolsa de horas ---------- */

.hours-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }
.months li { display: grid; grid-template-columns: 70px minmax(0, 1fr) 150px; gap: 12px; align-items: center; padding: 6px 0; }
.m-label { font-weight: 600; color: var(--navy); font-size: 14px; }
.m-bar { height: 12px; background: #EEF3FA; border-radius: 999px; overflow: hidden; }
.m-bar span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--copper-light), var(--copper)); }
.m-val { font-weight: 700; color: var(--navy); font-size: 14px; }
.m-val small { font-weight: 400; color: var(--muted); }
.contract-form { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.contract-form h3 { margin-bottom: 12px; }
.contract-form label { display: block; font-size: 13px; font-weight: 700; color: var(--navy); }
.contract-form label input { margin-top: 4px; font-weight: 400; }
.cf-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.cf-actions { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- Pedido ---------- */

.ticket-head h1 { font-size: 26px; }
.head-badges { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px !important; font-size: 13px; }
.ticket-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }

.thread { list-style: none; margin: 0 0 20px; padding: 0; }
.msg { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.msg header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #EAF3FE; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.msg header b { color: var(--navy); }
.msg header time { margin-left: auto; font-size: 13px; color: var(--muted); }
.msg .avatar { width: 30px; height: 30px; flex-basis: 30px; font-size: 12px; background: linear-gradient(135deg, #6FB8F0, var(--blue)); }
.msg.staff header { background: #F7EADF; }
.msg.staff .avatar { background: linear-gradient(135deg, var(--copper-light), var(--copper)); }
.msg.internal { border-color: #F5D7A6; border-style: dashed; }
.msg.internal header { background: var(--warn-bg); }
.msg-body { padding: 14px 18px; overflow-wrap: anywhere; }
.files { padding: 0 18px 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.files li { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.files a { font-weight: 600; text-decoration: none; }
.files small { color: var(--muted); }
.msg.ev { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: transparent; border: 0; border-left: 3px solid var(--line); border-radius: 0; padding: 4px 14px; color: var(--muted); font-size: 13px; }
.msg.ev span { font-weight: 600; color: var(--text); }
.msg.ev-internal { border-left-color: #F5D7A6; }

.reply h2 { margin-bottom: 10px; }
.reply-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.reply-bar .btn { margin-left: auto; }
.reply-bar .check, .reply-bar .inline { font-size: 14px; }
.reply-bar .inline select { width: auto; display: inline-block; margin-left: 6px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; }

.facts { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 9px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.side-action { margin: 16px 0 0; }
.form-side label { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 12px; }
.form-side label select, .form-side label input { margin-top: 4px; font-weight: 400; }
.form-side .hint { margin: -6px 0 12px; }

.time-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.time-list li:first-child { border-top: 0; padding-top: 0; }
.t-dur { flex: 0 0 52px; font-weight: 800; color: var(--copper-dark); }
.t-info { display: flex; flex-direction: column; flex: 1; font-size: 13px; min-width: 0; }
.t-info b { color: var(--navy); }
.t-info small { color: var(--muted); }
.time-list form { margin: 0; }
.icon-btn { font: inherit; font-size: 18px; line-height: 1; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--crit); border-color: var(--crit); }
.time-form { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.time-form label { display: block; font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.time-form label input, .time-form label select { margin-top: 4px; font-weight: 400; }
.time-form label.check { font-weight: 400; color: var(--text); padding-top: 26px; }
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.type-switch a {
    display: flex; flex-direction: column; gap: 4px;
    padding: 16px 18px; border-radius: var(--radius);
    background: #fff; border: 1.5px solid var(--line);
    text-decoration: none; color: var(--muted); font-size: 14px;
}
.type-switch a b { color: var(--navy); font-size: 16px; }
.type-switch a:hover { border-color: var(--copper-light); }
.type-switch a.on { border-color: var(--copper); box-shadow: 0 0 0 3px rgba(201, 135, 87, 0.18); }

.error-card { max-width: 620px; margin: 40px auto; text-align: center; padding: 40px; }
.error-card h1 { margin-bottom: 12px; }

/* ---------- Entrada (visitantes) ---------- */

body.guest { display: flex; align-items: flex-start; justify-content: center; }
.guest-wrap { width: 980px; max-width: calc(100% - 32px); margin: 48px auto; }
.guest-brand { display: block; width: 250px; margin: 0 auto 26px; line-height: 0; }
.login-card {
    display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    background: #fff; border-radius: 22px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(3, 12, 30, 0.45);
}
.login-main { padding: 44px 46px; }
.login-main h1 { font-size: 28px; margin-bottom: 14px; }
.login-main .lead { color: var(--muted); font-size: 16px; margin-bottom: 24px; }
.btn-ms {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    width: 100%; padding: 14px 20px; margin-bottom: 20px;
    border-radius: 12px; border: 1px solid #8C8C8C;
    background: #fff; color: #2F2F2F;
    font-weight: 600; font-size: 16px; text-decoration: none;
    transition: background .15s, box-shadow .15s;
}
.btn-ms:hover { background: #F5F7FA; color: #2F2F2F; box-shadow: 0 2px 10px rgba(11, 42, 91, 0.12); }
.fine { font-size: 13px; color: var(--muted); }
.login-aside {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px;
    padding: 40px 38px; text-align: center;
    background: linear-gradient(160deg, #F4F7FB 0%, #E6EEF9 100%);
    border-left: 1px solid var(--line);
}
.login-aside img { width: 220px; }
.login-aside p { font-size: 14px; color: var(--text); max-width: 300px; }
.guest-foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 22px; color: #BFCCE0; font-size: 13px; }
.guest-foot a { line-height: 0; }

/* ---------- Entrada com email e palavra-passe ---------- */

.login-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.login-form label { font-weight: 700; font-size: 14px; color: var(--navy); margin-top: 8px; }
.login-form .field-error { margin-top: 0; }
.login-form .btn { margin-top: 16px; }
.login-row { display: flex; justify-content: flex-end; font-size: 14px; margin-top: 4px; }
.login-row a { font-weight: 600; }
.btn-lg { padding: 13px 22px; font-size: 16px; }
.login-narrow { grid-template-columns: minmax(0, 1fr); max-width: 560px; margin: 0 auto; }
.code-input { font-size: 24px !important; letter-spacing: .35em; text-align: center; font-weight: 700; }
.steps-list { padding-left: 20px; margin: 0 0 16px; }
.steps-list li { margin-bottom: 10px; }
code, .secret { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.secret { display: inline-block; margin-top: 6px; padding: 6px 10px; font-size: 16px; letter-spacing: .06em; color: var(--navy); font-weight: 700; user-select: all; }
.invite-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; border-color: var(--copper-light); background: #FFFBF7; }
.invite-box h2, .invite-box p { grid-column: 1 / -1; margin: 0; }
.copy-field { font-family: ui-monospace, Consolas, monospace; font-size: 13px !important; }
#dois-passos .form-side { margin-top: 6px; }
#dois-passos h3 { margin: 6px 0 12px; }

/* ---------- Ecrãs mais pequenos ---------- */

@media (max-width: 1340px) {
    .top { flex-wrap: wrap; }
    .mainnav { order: 3; flex-basis: 100%; }
    .who { margin-left: auto; }
    .ticket-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 860px) {
    .page { padding: 22px 18px 28px; }
    .stats-3, .stats-2, .cols, .hours-grid, .ticket-grid { grid-template-columns: minmax(0, 1fr); }
    .kpis { grid-template-columns: 1fr 1fr; }
    .hero { grid-template-columns: minmax(0, 1fr); padding: 24px; }
    .hero-art { width: 220px; justify-self: center; order: -1; }
    .form .row { grid-template-columns: minmax(0, 1fr); padding: 10px 0; }
    .form .row > label, .form .row > span { padding-top: 0; }
    .cf-grid { grid-template-columns: 1fr 1fr; }
    .login-card { grid-template-columns: minmax(0, 1fr); }
    .login-aside { border-left: 0; border-top: 1px solid var(--line); }
    .login-main { padding: 32px 26px; }
}

@media (max-width: 640px) {
    .shell { max-width: 100%; margin: 0; border-radius: 0; }
    .top { padding: 10px 16px; gap: 12px; }
    .brand img { width: 150px; }
    .menu-toggle {
        display: inline-block; margin-left: auto;
        font: inherit; font-weight: 600; font-size: 14px;
        color: #fff; background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; padding: 6px 14px;
    }
    .mainnav { display: none; flex-direction: column; align-items: stretch; }
    body.nav-open .mainnav { display: flex; }
    .mainnav a.cta { margin-left: 0; text-align: center; }
    .who { flex-basis: 100%; order: 4; }
    body:not(.nav-open) .who { display: none; }
    .who form { margin-left: auto; }
    .page { padding: 18px 16px 24px; }
    .foot { padding: 14px 16px; flex-wrap: wrap; }
    h1, .hero h1 { font-size: 24px; }
    .type-switch { grid-template-columns: 1fr; }
    .months li { grid-template-columns: 60px minmax(0, 1fr); }
    .m-val { grid-column: 2; }
    .tf-row { grid-template-columns: 1fr; }
    .time-form label.check { padding-top: 0; }
    .inline-form select { min-width: 0; }
    .reply-bar .btn { margin-left: 0; width: 100%; }
    .invite-box { grid-template-columns: minmax(0, 1fr); }
}
input:disabled { background: var(--bg); color: var(--muted); }

/* ---------- Verificação da instalação ---------- */
.diag { max-width: 720px; }
.diag-list { list-style: none; margin: 0 0 18px; padding: 0; }
.diag-list li { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.diag-list li span:last-child { display: flex; flex-direction: column; }
.diag-list small { color: var(--muted); margin-top: 2px; }
.dg-i { flex: 0 0 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #fff; }
.dg-ok .dg-i { background: var(--ok); }
.dg-aviso .dg-i { background: #E08A00; }
.dg-erro .dg-i { background: var(--crit); }
.dg-erro b { color: var(--crit); }
.diag-detail { white-space: pre-wrap; font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--text); }

/* ---------- Definições ---------- */
.inline-pair { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-pair input { width: 90px; }
.inline-pair select { width: auto; min-width: 220px; }
.inline-pair span { color: var(--muted); font-size: 14px; }
.smtp-fields.is-off { opacity: .45; }
.settings .card-head small { font-size: 13px; }

/* ---------- Agendamento de deslocações ---------- */
.sched-step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; }
.sched-step label { margin-bottom: 10px; }
.step-n { width: 24px; height: 24px; margin-top: 20px; border-radius: 50%; background: var(--copper); color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.js-when:disabled { background: var(--bg); cursor: not-allowed; }
.tech-agenda { margin: 6px 0 10px; }
.agenda-tech { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.agenda-tech h3 { font-size: 13px; margin-bottom: 8px; }
.agenda-list { list-style: none; margin: 0; padding: 0; }
.agenda-list li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.agenda-list li:first-child { border-top: 0; }
.agenda-list a { display: flex; flex-direction: column; text-decoration: none; color: var(--text); min-width: 0; flex: 1; }
.agenda-list a b { color: var(--navy); }
.agenda-list a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agenda-list a small { color: var(--muted); }
.ag-when { flex: 0 0 54px; display: flex; flex-direction: column; color: var(--copper-dark); font-weight: 600; line-height: 1.25; }
.agenda-list li.clash { background: var(--warn-bg); border-radius: 8px; padding-left: 6px; }
.ag-clash { margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--warn); }
.side-sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.ag-day + .ag-day { margin-top: 16px; }
.ag-day h3 { font-size: 14px; text-transform: capitalize; margin-bottom: 4px; }
.ag-day.is-today h3 { color: var(--copper-dark); }
.ag-day .agenda-list li { font-size: 14px; padding: 9px 0; }

[hidden] { display: none !important; }
