:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --text: #172033;
    --muted: #68758a;
    --line: #e5ebf3;
    --primary: #246bfe;
    --primary-dark: #164cd5;
    --accent: #00b8a9;
    --orange: #ff9d28;
    --green: #18a058;
    --red: #e74747;
    --purple: #7c5cff;
    --shadow: 0 18px 45px rgba(23, 32, 51, .09);
    --radius: 22px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: inherit; text-decoration: none; }
code { background: #eef3ff; padding: 2px 6px; border-radius: 8px; }
.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh;
    background: linear-gradient(180deg, #071c3d 0%, #0f316a 100%);
    color: white; padding: 24px; display: flex; flex-direction: column; gap: 28px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-logo, .brand-badge {
    width: 46px; height: 46px; border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 900; background: linear-gradient(135deg, var(--primary), var(--accent)); color: white;
    box-shadow: 0 12px 28px rgba(0, 184, 169, .28);
}
.brand small, .sidebar-footer small { display: block; color: rgba(255,255,255,.66); font-size: 12px; margin-top: 2px; }
.nav-list { display: grid; gap: 8px; }
.nav-link { display: flex; gap: 12px; align-items: center; padding: 13px 14px; border-radius: 16px; color: rgba(255,255,255,.8); font-weight: 700; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.13); color: #fff; }
.sidebar-footer { margin-top: auto; display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.10); padding: 12px; border-radius: 18px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #e8f0ff; color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 900; flex: 0 0 auto; }
.avatar.large { width: 54px; height: 54px; font-size: 20px; }
.avatar.xl { width: 76px; height: 76px; font-size: 26px; }
.main-content { padding: 28px; max-width: 1320px; width: 100%; margin: 0 auto; padding-bottom: 94px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; color: var(--primary); font-size: 12px; font-weight: 900; margin: 0 0 5px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; color: var(--muted); }
.btn { border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 900; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .2s ease; }
.btn.primary { background: var(--primary); color: white; box-shadow: 0 14px 25px rgba(36, 107, 254, .22); }
.btn.primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn.ghost { background: #eef3ff; color: var(--primary); }
.btn.white { background: white; color: var(--primary); }
.btn.full { width: 100%; }
.btn.small { padding: 8px 12px; border-radius: 11px; font-size: 13px; }
.hero-panel, .profile-card {
    background: linear-gradient(135deg, var(--primary) 0%, #174fbc 50%, var(--accent) 100%);
    color: white; border-radius: 30px; padding: 28px; box-shadow: var(--shadow);
    display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px;
}
.hero-panel h2, .profile-card h2 { font-size: clamp(26px, 4vw, 44px); margin: 12px 0 8px; letter-spacing: -.04em; }
.hero-panel p, .profile-card p { color: rgba(255,255,255,.82); margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.16); color: white; padding: 7px 11px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.pill.light { background: #eef3ff; color: var(--primary); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card, .card, .table-card, .client-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.stat-card { padding: 20px; display: grid; gap: 8px; }
.stat-card span { color: var(--muted); font-weight: 800; }
.stat-card strong { font-size: 34px; letter-spacing: -.04em; }
.stat-card small { color: var(--muted); }
.content-grid { display: grid; gap: 18px; margin-bottom: 22px; }
.content-grid.two { grid-template-columns: 1.2fr .8fr; }
.card { padding: 20px; }
.card h3 { margin: 0 0 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head a { color: var(--primary); font-weight: 900; }
.list { display: grid; gap: 10px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: #fbfdff; }
.list-item strong { display: block; }
.list-item small { color: var(--muted); display: block; margin-top: 4px; }
.tag { border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.tag-blue { background: #e7efff; color: var(--primary); }
.tag-purple { background: #eeeaff; color: var(--purple); }
.tag-orange { background: #fff3df; color: #bf6a00; }
.tag-green { background: #e7f8ee; color: var(--green); }
.tag-red { background: #ffeaea; color: var(--red); }
.tag-gray { background: #edf0f4; color: #566070; }
.toolbar { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.search-box { display: flex; gap: 8px; width: min(620px, 100%); }
input, textarea, select {
    width: 100%; border: 1px solid var(--line); background: #fbfdff; color: var(--text);
    border-radius: 14px; padding: 12px 13px; font: inherit; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(36, 107, 254, .10); }
label { display: grid; gap: 7px; color: #344057; font-weight: 800; }
.form-stack { display: grid; gap: 14px; }
.form-card { padding: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.full-row { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card-grid.single-column { grid-template-columns: 1fr; }
.client-card { padding: 18px; display: flex; align-items: center; gap: 14px; transition: .18s ease; }
.client-card:hover { transform: translateY(-2px); border-color: #cddcff; }
.client-card h3 { margin: 0 0 6px; }
.client-card p { margin: 0 0 6px; color: var(--muted); }
.client-card small { color: var(--muted); }
.table-card { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { text-align: left; padding: 15px 16px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.profile-card { background: white; color: var(--text); align-items: flex-start; }
.profile-card p { color: var(--muted); }
.profile-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.profile-meta span { background: #f2f6ff; color: #344057; padding: 8px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.job-hero { border-left: 6px solid var(--primary); }
.progress { height: 10px; background: #eaf0f8; border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: inherit; }
.checklist { display: grid; gap: 8px; margin: 14px 0; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 15px; }
.checkbox { width: 30px; height: 30px; border-radius: 10px; border: 2px solid #cbd6e4; background: white; color: white; font-weight: 900; cursor: pointer; }
.checkbox.checked { background: var(--green); border-color: var(--green); }
.done { text-decoration: line-through; color: var(--muted); }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.upload-box { border: 1px dashed #bdd0ec; background: #fbfdff; border-radius: 18px; padding: 14px; display: grid; gap: 10px; margin-bottom: 14px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.media-card { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: #fbfdff; }
.media-card img, .file-tile { width: 100%; height: 110px; object-fit: cover; display: flex; align-items: center; justify-content: center; background: #eef3ff; font-weight: 900; color: var(--primary); }
.media-card small { display: block; padding: 8px; color: var(--muted); }
.timeline { display: grid; gap: 12px; }
.timeline-item { border-left: 3px solid var(--primary); padding-left: 12px; }
.timeline-item span { color: var(--muted); font-size: 12px; font-weight: 900; }
.timeline-item p { margin: 5px 0 0; }
.notice { padding: 13px 15px; border-radius: 15px; margin-bottom: 16px; background: #e7f8ee; color: #14613a; border: 1px solid #bfebd0; }
.notice.error { background: #ffeaea; color: #a32626; border-color: #ffcaca; }
.notice.warning { background: #fff7df; color: #8a5a00; border-color: #ffe19a; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #dbe8ff, transparent 30%), linear-gradient(135deg, #f4f7fb, #e9fff9); }
.auth-card { width: min(430px, 100%); background: white; border-radius: 30px; box-shadow: var(--shadow); padding: 28px; border: 1px solid var(--line); }
.auth-card h1 { margin: 10px 0; font-size: 34px; letter-spacing: -.04em; }
.bottom-nav { display: none; }
.email-item { align-items: flex-start; }
.email-item p { margin: 8px 0 0; color: var(--muted); }
@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main-content { padding: 18px; padding-bottom: 92px; }
    .content-grid.two, .stat-grid { grid-template-columns: 1fr; }
    .hero-panel, .profile-card { flex-direction: column; align-items: flex-start; }
    .toolbar, .search-box, .inline-form { flex-direction: column; }
    .form-grid { grid-template-columns: 1fr; }
    .bottom-nav { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255,255,255,.96); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 24px; padding: 8px; }
    .bottom-nav a { display: grid; gap: 3px; text-align: center; color: var(--muted); font-size: 18px; font-weight: 900; }
    .bottom-nav span { font-size: 11px; }
}

/* v2 - calendário, modais, logins e ficheiros */
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.employee-select { min-height: 128px; }
.help-text { color: var(--muted); font-size: 12px; margin-top: -4px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.task-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn.orange { background: var(--orange); color: #2d1900; box-shadow: 0 14px 25px rgba(255, 157, 40, .18); }
.btn.green { background: var(--green); color: white; box-shadow: 0 14px 25px rgba(24, 160, 88, .18); }
.btn.red { background: var(--red); color: white; }
.btn.danger { background: var(--red); color: white; box-shadow: 0 14px 25px rgba(239, 68, 68, .18); }
.btn.disabled, .btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
.calendar-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.calendar-toolbar form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.calendar-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); overflow: hidden; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-head { background: #f7faff; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 900; padding: 13px; border-bottom: 1px solid var(--line); }
.calendar-day { min-height: 148px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px; background: #fff; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { background: #f8fafc; color: #a0a9b8; }
.day-number { display: flex; align-items: center; justify-content: space-between; font-weight: 900; margin-bottom: 8px; }
.day-number.today span { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: white; }
.task-pill { width: 100%; text-align: left; border: 0; border-radius: 12px; padding: 8px 9px; margin: 4px 0; background: #eef3ff; color: #17305f; font-weight: 900; cursor: pointer; display: grid; gap: 2px; }
.task-pill:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(23, 32, 51, .08); }
.task-pill em { font-style: normal; color: var(--muted); font-weight: 700; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-pill.status-in_progress { background: #fff3df; color: #7a4300; }
.task-pill.status-completed { background: #e7f8ee; color: #115d35; }
.task-pill.status-cancelled { background: #ffeaea; color: #8a1f1f; }
.task-pill.status-scheduled { background: #eeeaff; color: #4936a1; }
.modal-backdrop { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 18px; background: rgba(7, 20, 44, .52); z-index: 60; }
.modal-backdrop.open { display: flex; }
.modal-card { width: min(720px, 100%); max-height: 88vh; overflow: auto; background: white; border-radius: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.24); padding: 22px; border: 1px solid var(--line); }
.modal-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.modal-close { border: 0; background: #eef3ff; color: var(--primary); border-radius: 12px; width: 38px; height: 38px; font-size: 22px; cursor: pointer; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.info-box { border: 1px solid var(--line); background: #fbfdff; border-radius: 16px; padding: 12px; }
.info-box strong { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.file-section { display: grid; gap: 16px; }
.folder-title { display: flex; align-items: center; gap: 8px; margin: 16px 0 10px; }
.folder-title h4 { margin: 0; }
.media-card video { width: 100%; height: 130px; object-fit: cover; display: block; background: #111827; }
.file-tile.video { background: #111827; color: white; }
.file-tile.doc { background: #f2f6ff; color: var(--primary); }
.visit-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: #fbfdff; }
.visit-row + .visit-row { margin-top: 8px; }
.badge-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.user-list { display: grid; gap: 12px; }
.user-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: var(--shadow); }
.user-card-left { display: flex; align-items: center; gap: 12px; }
.inline-status-form { display: inline-flex; }
@media (max-width: 760px) {
    .calendar-grid { grid-template-columns: 1fr; }
    .calendar-head { display: none; }
    .calendar-day { min-height: auto; border-right: 0; }
    .calendar-day.outside { display: none; }
    .info-grid { grid-template-columns: 1fr; }
    .user-card, .visit-row { grid-template-columns: 1fr; display: grid; }
}

/* v2.7 - Pastas em ícones + pop-up de galeria */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 16px; margin-top: 16px; }
.folder-tile { position: relative; min-width: 0; }
.folder-card { width: 100%; border: 1px solid var(--line); background: #fbfdff; border-radius: 22px; padding: 18px 12px; min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; cursor: pointer; box-shadow: 0 10px 25px rgba(17, 24, 39, .05); transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.folder-card:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(17, 24, 39, .10); border-color: #b7caeb; }
.delete-folder-btn { position: absolute; top: -8px; right: -8px; z-index: 4; width: 32px; height: 32px; border-radius: 999px; border: 2px solid white; background: #ef4444; color: white; font-size: 22px; font-weight: 900; line-height: 1; cursor: pointer; box-shadow: 0 8px 18px rgba(17,24,39,.24); display: inline-flex; align-items: center; justify-content: center; }
.delete-folder-btn:hover { transform: scale(1.06); background: #dc2626; }
.folder-icon { font-size: 54px; line-height: 1; filter: drop-shadow(0 8px 12px rgba(17, 24, 39, .08)); }
.folder-card strong { display: block; font-size: 15px; color: var(--text); line-height: 1.2; word-break: break-word; }
.folder-card small { display: block; color: var(--muted); font-size: 11px; line-height: 1.2; }
.folder-modal .modal-card { width: min(980px, 100%); }
.folder-manage-box { display: grid; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: #fbfdff; margin-bottom: 16px; }
.compact-upload { grid-template-columns: 1fr 1fr auto; align-items: end; }
.modal-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 12px; }
.media-thumb { border: 1px solid var(--line); background: #fbfdff; border-radius: 18px; overflow: hidden; text-align: left; cursor: pointer; padding: 0; color: inherit; box-shadow: 0 10px 24px rgba(17,24,39,.04); transition: transform .15s ease, box-shadow .15s ease; }
.media-thumb:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(17,24,39,.10); }
.media-thumb img, .media-thumb video, .media-thumb .file-tile { width: 100%; height: 142px; object-fit: cover; display: flex; align-items: center; justify-content: center; }
.media-thumb video { background: #111827; }
.media-thumb small { display: block; padding: 9px; color: var(--muted); font-size: 11px; line-height: 1.35; }

.media-item { position: relative; min-width: 0; }
.media-item .media-thumb { width: 100%; height: 100%; display: block; }
.delete-file-btn { position: absolute; top: 8px; right: 8px; z-index: 3; width: 30px; height: 30px; border-radius: 999px; border: 2px solid white; background: #ef4444; color: white; font-size: 20px; font-weight: 900; line-height: 1; cursor: pointer; box-shadow: 0 8px 18px rgba(17,24,39,.24); display: inline-flex; align-items: center; justify-content: center; }
.delete-file-btn:hover { transform: scale(1.06); background: #dc2626; }
.confirm-modal { z-index: 110; }
.confirm-card { width: min(430px, 100%); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.gallery-modal { z-index: 90; }
.gallery-card { width: min(1050px, 100%); }
.gallery-frame { min-height: min(68vh, 680px); background: #08111f; border-radius: 20px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gallery-frame img, .gallery-frame video { max-width: 100%; max-height: min(68vh, 680px); display: block; }
.gallery-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; }
.gallery-doc-box { display: grid; gap: 18px; justify-items: center; color: white; }
.gallery-doc-box .file-tile { width: 180px; height: 140px; border-radius: 18px; }
.btn.small { padding: 9px 12px; font-size: 12px; }
@media (max-width: 760px) {
    .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .folder-card { min-height: 132px; padding: 14px 8px; }
    .folder-icon { font-size: 44px; }
    .modal-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .media-thumb img, .media-thumb video, .media-thumb .file-tile { height: 118px; }
    .compact-upload { grid-template-columns: 1fr; }
    .gallery-frame { min-height: 48vh; }
    .gallery-actions { flex-direction: column; }
}

/* v2.12 - Lixo, recuperar e eliminações de administração */
.section-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.section-tabs .tab { display: inline-flex; align-items: center; justify-content: center; padding: 11px 14px; border-radius: 14px; font-weight: 900; background: #eef3ff; color: var(--primary); border: 1px solid #dbe6ff; }
.section-tabs .tab.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 14px 25px rgba(36, 107, 254, .18); }
.section-tabs .duplicate-tab { gap: 7px; }
.tab-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    font-weight: 900;
    box-shadow: 0 5px 12px rgba(239, 68, 68, .28);
}
.section-tabs .tab.active .tab-badge {
    background: #dc2626;
    color: #fff;
    border: 1px solid rgba(255,255,255,.65);
}

.inline-action { display: inline-flex; margin: 0; }
.client-card-actions { align-items: flex-start; }
.client-card-body { min-width: 0; flex: 1; }
.card-buttons { margin-top: 12px; }
.notice.warning { background: #fff7df; color: #8a5a00; border-color: #ffe19a; }
/* v2.17 - separadores ativos/lixo mais compactos no telemóvel */
.section-tabs { align-items: center; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.section-tabs .trash-tab { width: 44px; min-width: 44px; padding: 10px 0; font-size: 17px; line-height: 1; }
@media (max-width: 980px) {
    .section-tabs { flex-direction: row; gap: 8px; margin-bottom: 12px; }
    .section-tabs .tab { white-space: nowrap; padding: 10px 12px; font-size: 13px; }
    .section-tabs .trash-tab { padding: 9px 0; width: 40px; min-width: 40px; font-size: 16px; }
    .client-card-actions { flex-direction: row; }
}

/* v2.15 - menu móvel completo + tabelas em cartões no telemóvel */
.bottom-more { position: relative; display: grid; }
.bottom-more-btn {
    border: 0;
    background: transparent;
    display: grid;
    gap: 3px;
    text-align: center;
    color: var(--muted);
    font-size: 22px;
    font-weight: 900;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    font-family: inherit;
}
.bottom-more-btn span { font-size: 11px; }
.bottom-more-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: 220px;
    display: none;
    background: rgba(255,255,255,.98);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 22px 55px rgba(23,32,51,.18);
    padding: 8px;
    z-index: 30;
}
.bottom-more.open .bottom-more-menu { display: grid; gap: 4px; }
.bottom-more-menu a {
    display: flex !important;
    align-items: center;
    gap: 10px;
    text-align: left !important;
    padding: 12px 13px;
    border-radius: 15px;
    font-size: 14px !important;
    color: var(--text) !important;
}
.bottom-more-menu a:hover { background: #eef3ff; color: var(--primary) !important; }
.bottom-more-menu a span { font-size: 18px; }

@media (max-width: 980px) {
    .bottom-nav { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 760px) {
    .table-card.responsive-card-table {
        overflow: visible;
        background: transparent;
        border: 0;
        box-shadow: none;
    }
    table.responsive-list {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0;
    }
    table.responsive-list thead { display: none; }
    table.responsive-list,
    table.responsive-list tbody,
    table.responsive-list tr,
    table.responsive-list td { display: block; width: 100%; }
    table.responsive-list tr {
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 22px;
        box-shadow: var(--shadow);
        padding: 12px 14px;
        margin-bottom: 14px;
    }
    table.responsive-list td {
        border-bottom: 1px solid var(--line);
        padding: 11px 0;
        display: grid;
        grid-template-columns: 105px minmax(0, 1fr);
        gap: 12px;
        align-items: start;
        word-break: break-word;
    }
    table.responsive-list td:last-child { border-bottom: 0; }
    table.responsive-list td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .07em;
        padding-top: 2px;
    }
    table.responsive-list td.actions-cell {
        display: block;
        padding-top: 13px;
    }
    table.responsive-list td.actions-cell::before {
        display: block;
        margin-bottom: 9px;
    }
    table.responsive-list .quick-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        width: 100%;
    }
    table.responsive-list .quick-actions .btn,
    table.responsive-list .quick-actions .inline-action,
    table.responsive-list .quick-actions .inline-action button {
        width: 100%;
    }
    table.responsive-list .tag { justify-self: start; }
}

/* v2.16 - Ajustes de espaço no dashboard em telemóvel */
@media (max-width: 760px) {
    .main-content {
        padding: 12px;
        padding-bottom: 92px;
    }
    .topbar {
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
    }
    .topbar > div:first-child {
        min-width: 0;
        flex: 1 1 auto;
    }
    .topbar h1 {
        font-size: 24px;
        line-height: 1.05;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .eyebrow {
        font-size: 10px;
        line-height: 1;
        letter-spacing: .06em;
        white-space: nowrap;
        margin-bottom: 3px;
    }
    .top-actions {
        flex: 0 0 auto;
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        justify-content: flex-end;
    }
    .top-actions .btn {
        padding: 8px 10px;
        border-radius: 11px;
        font-size: 12px;
        min-height: 36px;
        white-space: nowrap;
    }
    .hero-panel {
        border-radius: 22px;
        padding: 16px;
        gap: 14px;
        margin-bottom: 14px;
    }
    .hero-panel h2 {
        font-size: 25px;
        line-height: 1.05;
        margin: 9px 0 6px;
    }
    .hero-panel p {
        font-size: 13px;
        line-height: 1.35;
    }
    .hero-panel .pill {
        font-size: 11px;
        padding: 6px 9px;
    }
    .hero-panel .quick-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .hero-panel .quick-actions .btn {
        padding: 10px 8px;
        min-height: 42px;
        font-size: 12px;
        border-radius: 12px;
        white-space: nowrap;
    }
    .hero-panel .quick-actions .btn:first-child {
        grid-column: 1 / -1;
    }
    .stat-grid {
        gap: 10px;
        margin-bottom: 14px;
    }
    .stat-card {
        padding: 14px;
    }
    .stat-card strong {
        font-size: 28px;
    }
    .card {
        padding: 15px;
    }
    .content-grid {
        gap: 14px;
        margin-bottom: 14px;
    }
}

@media (max-width: 390px) {
    .topbar h1 {
        font-size: 22px;
    }
    .top-actions .btn {
        padding-left: 8px;
        padding-right: 8px;
        font-size: 11px;
    }
    .hero-panel .quick-actions .btn {
        font-size: 11px;
        padding-left: 6px;
        padding-right: 6px;
    }
}

/* v2.20 - Select de clientes compacto e alinhado com restantes campos */
.client-search-select {
    position: relative;
    display: grid;
    gap: 6px;
}

.client-combobox {
    gap: 0;
}
.client-combobox .client-search-input {
    margin: 0;
}

.client-combobox select[data-client-select] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.client-search-input {
    width: 100%;
    min-height: 46px;
    padding: 11px 42px 11px 40px;
    border: 1px solid #d6e0f5;
    border-radius: 14px;
    background-color: #fbfdff;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2368758a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2368758a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: 13px center, right 14px center;
    background-size: 18px 18px, 18px 18px;
    box-shadow: 0 1px 0 rgba(24,39,75,.03);
}
.client-combobox.open .client-search-input {
    border-color: #8fb4ff;
    box-shadow: 0 0 0 3px rgba(64, 122, 255, .12);
}
.client-search-count {
    display: none;
}
.client-combobox-list {
    display: none;
    position: absolute;
    z-index: 80;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow: auto;
    padding: 6px;
    border: 1px solid #d6e0f5;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(15, 23, 42, .16);
}
.client-combobox.open .client-combobox-list {
    display: grid;
    gap: 4px;
}
.client-combobox-option {
    width: 100%;
    text-align: left;
    border: 0;
    border-radius: 10px;
    background: transparent;
    padding: 10px 12px;
    color: #172033;
    font-weight: 700;
    cursor: pointer;
}
.client-combobox-option:hover,
.client-combobox-option.active {
    background: #eef4ff;
}
.client-combobox-option.selected {
    background: #e7f0ff;
    color: #2357c6;
}
.client-combobox-option.disabled {
    color: #8b97aa;
    cursor: default;
    font-weight: 600;
}
.client-search-select.no-results .client-search-input {
    border-color: #ffb4b4;
}
@media (max-width: 760px) {
    .client-search-input {
        min-height: 44px;
        font-size: 14px;
    }
    .client-combobox-list {
        max-height: 230px;
    }
}
.soft-separator {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 22px 0;
}
.small-text {
    font-size: 13px;
    margin-top: -6px;
}
.compact-hero {
    padding: 22px 24px;
}
.compact-hero h2 {
    font-size: clamp(24px, 3vw, 34px);
}
@media (max-width: 700px) {
    .compact-hero {
        align-items: flex-start;
    }
    .soft-separator {
        margin: 18px 0;
    }
}

/* v2.25 - Correção responsive da ficha da tarefa (job_view.php) */
@media (max-width: 760px) {
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }
    .job-hero {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        padding: 16px;
        border-radius: 22px;
        gap: 14px;
    }
    .job-hero > div {
        width: 100%;
        min-width: 0;
    }
    .job-hero h2 {
        font-size: 23px;
        line-height: 1.08;
        overflow-wrap: anywhere;
        word-break: break-word;
        margin: 10px 0 7px;
    }
    .job-hero p {
        font-size: 13px;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }
    .job-hero .tag {
        max-width: 100%;
        white-space: normal;
        line-height: 1.2;
    }
    .profile-meta {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 8px;
    }
    .profile-meta span {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        border-radius: 14px;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        font-size: 12px;
        line-height: 1.32;
    }
    .task-actions,
    .job-hero .quick-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 8px;
    }
    .inline-status-form,
    .task-actions form,
    .job-hero .quick-actions form,
    .job-hero .quick-actions .inline-action {
        display: grid;
        width: 100%;
    }
    .task-actions .btn,
    .job-hero .quick-actions .btn,
    .job-hero .quick-actions button {
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
        font-size: 12px;
        line-height: 1.2;
        white-space: normal;
        text-align: center;
    }
    .check-row {
        align-items: flex-start;
    }
    .check-row span {
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
    .inline-form {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }
    .inline-form .btn,
    .form-stack .btn {
        width: 100%;
    }
    .folder-manage-box .inline-form,
    .folder-manage-box .compact-upload {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }
    .modal-backdrop {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }
    .modal-card,
    .folder-modal .modal-card,
    .gallery-card,
    .confirm-card {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        max-height: none;
        margin: 10px auto 92px;
        padding: 16px;
        border-radius: 22px;
        overflow-x: hidden;
    }
    .modal-head {
        gap: 10px;
    }
    .modal-head h3 {
        font-size: 20px;
        line-height: 1.15;
        overflow-wrap: anywhere;
    }
    .modal-close {
        flex: 0 0 auto;
    }
    .modal-media-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .media-thumb small {
        overflow-wrap: anywhere;
    }
    .gallery-frame {
        min-height: 42vh;
        border-radius: 16px;
    }
    .gallery-frame img,
    .gallery-frame video {
        max-height: 52vh;
    }
    .gallery-actions,
    .confirm-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 8px;
    }
    .gallery-actions .btn,
    .confirm-actions .btn {
        width: 100%;
    }
}

@media (max-width: 390px) {
    .job-hero h2 {
        font-size: 21px;
    }
    .modal-media-grid {
        grid-template-columns: 1fr 1fr;
    }
    .folder-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* v2.26 - Corrige overflow do titulo na topbar em job_view.php e ticket_view.php */
@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .topbar > div:first-child {
        min-width: 0;
        flex: 1 1 0;
        max-width: 100%;
        overflow: visible;
    }
    .topbar h1 {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
        word-break: break-word;
        hyphens: auto;
        max-width: 100%;
    }
    .top-actions {
        align-self: flex-start;
    }
}

/* v2.27 - Topbar reorganizada: painel/ações na primeira linha e título separado */
.topbar {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 22px;
}
.topbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-width: 0;
    margin-bottom: 8px;
}
.topbar-main .eyebrow {
    margin: 0;
    min-width: 0;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar .page-title,
.topbar h1.page-title {
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    line-height: 1.05;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
}
.topbar .top-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
}

@media (max-width: 760px) {
    .topbar {
        display: block;
        align-items: initial;
        gap: 0;
        margin-bottom: 12px;
    }
    .topbar > .topbar-main {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex: initial;
        max-width: 100%;
        overflow: visible;
        margin-bottom: 7px;
    }
    .topbar-main .eyebrow {
        font-size: 10px;
        line-height: 1;
        letter-spacing: .06em;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar .page-title,
    .topbar h1.page-title {
        font-size: 24px;
        line-height: 1.08;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
        word-break: normal;
        max-width: 100%;
    }
    .topbar .top-actions {
        align-self: center;
        flex: 0 0 auto;
        gap: 6px;
    }
    .topbar .top-actions .btn {
        padding: 8px 10px;
        border-radius: 11px;
        font-size: 12px;
        min-height: 36px;
        white-space: nowrap;
    }
}

@media (max-width: 390px) {
    .topbar .page-title,
    .topbar h1.page-title {
        font-size: 22px;
    }
    .topbar .top-actions .btn {
        padding-left: 8px;
        padding-right: 8px;
        font-size: 11px;
    }
}

/* v2.29 - Imagem única por cliente */
.client-image-field {
    gap: 10px;
}
.current-client-image {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfdff;
}
.current-client-image img {
    width: 92px;
    height: 68px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #eef3ff;
}
.current-client-image span {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.current-client-image small {
    color: var(--muted);
    font-weight: 700;
    overflow-wrap: anywhere;
}
.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    font-weight: 800;
    color: #344057;
}
.check-inline input {
    width: auto;
}
.client-address-photo-card {
    display: grid;
    grid-template-columns: minmax(180px, 300px) minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
    margin-bottom: 22px;
}
.client-photo-panel {
    min-height: 190px;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #f2f6ff;
}
.client-photo-panel img {
    width: 100%;
    height: 100%;
    min-height: 190px;
    object-fit: cover;
    display: block;
}
.client-photo-placeholder {
    min-height: 190px;
    display: grid;
    place-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 44px;
    font-weight: 900;
}
.client-photo-placeholder span {
    display: block;
    font-size: 13px;
    color: var(--muted);
}
.client-address-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    min-width: 0;
}
.client-address-panel h3 {
    margin: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.client-address-panel p:not(.eyebrow) {
    margin: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}
.client-address-panel .btn + .btn {
    margin-top: -2px;
}
@media (max-width: 760px) {
    .client-address-photo-card {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 14px;
    }
    .client-photo-panel,
    .client-photo-panel img,
    .client-photo-placeholder {
        min-height: 170px;
    }
    .current-client-image {
        align-items: flex-start;
    }
    .current-client-image img {
        width: 86px;
        height: 64px;
    }
}
.form-field-block {
    display: grid;
    gap: 7px;
}
.field-label {
    color: #344057;
    font-weight: 800;
}

/* v2.30 - Imagem do cliente dentro do profile-card + recorte quadrado */
.client-profile-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(280px, 420px);
    align-items: start;
}
.client-profile-main {
    min-width: 0;
}
.client-profile-side {
    display: grid;
    gap: 12px;
    justify-items: end;
    min-width: 0;
}
.client-profile-side .quick-actions {
    justify-content: flex-end;
}
.client-profile-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #f7faff;
}
.client-profile-photo,
.client-profile-photo img,
.client-photo-placeholder.small {
    width: 112px;
    height: 112px;
    flex: 0 0 112px;
    border-radius: 50%;
}
.client-profile-photo {
    overflow: hidden;
    border: 3px solid #fff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, .12);
    background: #eef3ff;
}
.client-profile-photo img {
    display: block;
    object-fit: cover;
}
.client-photo-placeholder.small {
    min-height: 0;
    display: grid;
    place-items: center;
    font-size: 30px;
    color: var(--muted);
}
.client-photo-placeholder.small span {
    font-size: 11px;
    margin-top: -18px;
}
.client-profile-address {
    min-width: 0;
    display: grid;
    gap: 4px;
}
.client-profile-address span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.client-profile-address strong {
    color: #344057;
    font-size: 14px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: pre-line;
}
.client-profile-address a {
    color: var(--primary);
    font-size: 13px;
    font-weight: 900;
}
.client-cropper-box {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fbfdff;
}
.client-cropper-stage {
    width: 220px;
    height: 220px;
    max-width: 70vw;
    max-height: 70vw;
    overflow: hidden;
    position: relative;
    border-radius: 50%;
    border: 3px solid #fff;
    background: #edf3ff;
    box-shadow: inset 0 0 0 1px var(--line), 0 14px 28px rgba(15, 23, 42, .12);
    touch-action: none;
    cursor: grab;
}
.client-cropper-stage.dragging {
    cursor: grabbing;
}
.client-cropper-stage::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 999px rgba(255,255,255,.02), inset 0 0 0 2px rgba(36,107,254,.16);
    pointer-events: none;
}
.client-cropper-stage img {
    position: absolute;
    left: 0;
    top: 0;
    max-width: none;
    user-select: none;
    transform-origin: 0 0;
    will-change: transform;
}
.client-cropper-controls {
    display: grid;
    gap: 8px;
    min-width: 0;
}
.client-cropper-controls label {
    gap: 8px;
}
.client-cropper-controls input[type="range"] {
    padding-left: 0;
    padding-right: 0;
}
@media (max-width: 900px) {
    .client-profile-card {
        grid-template-columns: auto minmax(0, 1fr);
    }
    .client-profile-side {
        grid-column: 1 / -1;
        justify-items: stretch;
        width: 100%;
    }
    .client-profile-side .quick-actions {
        justify-content: flex-start;
    }
}
@media (max-width: 760px) {
    .client-profile-card {
        grid-template-columns: 1fr;
    }
    .client-profile-card .avatar.xl {
        width: 58px;
        height: 58px;
        font-size: 22px;
    }
    .client-profile-summary {
        align-items: flex-start;
    }
    .client-profile-photo,
    .client-profile-photo img,
    .client-photo-placeholder.small {
        width: 88px;
        height: 88px;
        flex-basis: 88px;
    }
    .client-cropper-box {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .client-cropper-controls {
        width: 100%;
    }
}
.client-cropper-box[hidden] { display: none !important; }


/* v2.32 - Cliente: foto centrada, redonda e ligeiramente maior */
.client-profile-summary {
    justify-content: center;
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
}
.client-profile-photo,
.client-profile-photo img,
.client-photo-placeholder.small {
    width: 132px;
    height: 132px;
    flex: 0 0 132px;
    border-radius: 50%;
}
.client-profile-photo {
    background: transparent;
}
.client-profile-photo img {
    object-fit: cover;
}
@media (max-width: 760px) {
    .client-profile-summary {
        justify-content: center;
        align-items: center;
    }
    .client-profile-photo,
    .client-profile-photo img,
    .client-photo-placeholder.small {
        width: 106px;
        height: 106px;
        flex-basis: 106px;
        border-radius: 50%;
    }
}

/* v2.33 - Cliente: imagem principal com 200px */
.client-profile-photo,
.client-profile-photo img,
.client-photo-placeholder.small {
    width: 200px;
    height: 200px;
    flex: 0 0 200px;
    border-radius: 50%;
}
@media (max-width: 760px) {
    .client-profile-photo,
    .client-profile-photo img,
    .client-photo-placeholder.small {
        width: 200px;
        height: 200px;
        flex: 0 0 200px;
        border-radius: 50%;
    }
}

/* v2.34 - Checklists: progresso sempre a 100% da largura do cartão */
.checklist-card {
    align-items: stretch;
    width: 100%;
}
.checklist-card > div,
.checklist-card .client-card-body {
    width: 100%;
    flex: 1 1 100%;
    min-width: 0;
}
.checklist-card .progress {
    width: 100%;
    display: block;
    box-sizing: border-box;
}
.checklist-card h3,
.checklist-card p,
.checklist-card small {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* v2.35 - Sistema de possíveis clientes duplicados */
.duplicate-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}
.duplicate-filter {
    min-width: min(320px, 100%);
    display: grid;
    gap: 8px;
}
.duplicate-filter label {
    display: grid;
    gap: 6px;
    font-weight: 900;
}
.duplicate-filter small {
    color: var(--muted);
    font-weight: 800;
}
.duplicate-list {
    display: grid;
    gap: 18px;
}
.duplicate-card {
    display: grid;
    gap: 16px;
}
.duplicate-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}
.duplicate-head h3 {
    margin: 8px 0 0;
    line-height: 1.15;
}
.duplicate-client-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}
.duplicate-client-box {
    display: block;
    gap: 0;
    align-items: flex-start;
    border: 1px solid var(--line);
    background: #fbfdff;
    border-radius: 20px;
    padding: 14px;
    min-width: 0;
}

.duplicate-client-box > div {
    width: 100%;
    min-width: 0;
}
.duplicate-client-box h4 {
    margin: 0 0 5px;
    overflow-wrap: anywhere;
}
.duplicate-client-box p {
    margin: 0 0 5px;
    color: var(--muted);
    overflow-wrap: anywhere;
}
.duplicate-client-box small {
    display: block;
    color: var(--muted);
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.duplicate-actions {
    margin-top: 10px;
}
.duplicate-reasons {
    display: grid;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}
.duplicate-reason-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 15px;
}
.duplicate-reason-row span {
    font-weight: 900;
    overflow-wrap: anywhere;
}
.duplicate-reason-row em {
    font-style: normal;
    font-weight: 900;
    color: var(--primary);
}
.duplicate-reason-row small {
    grid-column: 1 / -1;
    color: var(--muted);
    overflow-wrap: anywhere;
}
.empty-state {
    display: grid;
    gap: 10px;
    justify-items: start;
}
@media (max-width: 760px) {
    .duplicate-hero,
    .duplicate-head {
        display: grid;
        grid-template-columns: 1fr;
    }
    .duplicate-client-grid {
        grid-template-columns: 1fr;
    }
    .duplicate-client-box {
        padding: 12px;
    }
    .duplicate-reason-row {
        grid-template-columns: 1fr;
    }
}

/* v2.41 - Ações da tarefa no topo, junto ao estado */
.job-hero-clean {
    display: block;
}
.job-hero-main {
    width: 100%;
    min-width: 0;
}
.job-status-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-bottom: 10px;
}
.job-status-left {
    display: flex;
    align-items: center;
    min-width: 0;
}
.job-top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}
.job-top-actions .inline-action {
    display: inline-flex;
    margin: 0;
}
.job-top-actions .btn {
    white-space: nowrap;
}

@media (max-width: 760px) {
    .job-status-actions {
        align-items: flex-start;
        gap: 10px;
    }
    .job-hero .quick-actions.job-top-actions {
        display: flex;
        grid-template-columns: none;
        width: auto;
        max-width: 100%;
        justify-content: flex-end;
        gap: 6px;
        flex-wrap: wrap;
    }
    .job-hero .quick-actions.job-top-actions .btn,
    .job-hero .quick-actions.job-top-actions button {
        width: auto;
        padding: 8px 10px;
        font-size: 11px;
        white-space: nowrap;
    }
    .job-hero .quick-actions.job-top-actions form,
    .job-hero .quick-actions.job-top-actions .inline-action {
        display: inline-flex;
        width: auto;
    }
}

@media (max-width: 420px) {
    .job-status-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .job-hero .quick-actions.job-top-actions {
        justify-content: flex-start;
        width: 100%;
    }
}


/* v2.42 - Botões de ações das listas de tarefas/tickets sempre em linha no telemóvel */
@media (max-width: 760px) {
    table.responsive-list .quick-actions.list-row-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }
    table.responsive-list .quick-actions.list-row-actions .btn,
    table.responsive-list .quick-actions.list-row-actions .inline-action,
    table.responsive-list .quick-actions.list-row-actions .inline-action button {
        width: auto !important;
        flex: 0 0 auto;
        min-width: 0;
    }
    table.responsive-list .quick-actions.list-row-actions .btn,
    table.responsive-list .quick-actions.list-row-actions .inline-action button {
        padding: 7px 9px;
        font-size: 11px;
        border-radius: 10px;
        white-space: nowrap;
        line-height: 1.2;
    }
}


/* v2.43 - Forçar botões Open/Edit/Delete em linha nas listas */
.table-card table.responsive-list td.actions-cell {
    min-width: 170px;
}
.table-action-line {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 2px !important;
    -webkit-overflow-scrolling: touch;
}
.table-action-line .btn,
.table-action-line .inline-action,
.table-action-line .inline-action button,
.table-action-line form,
.table-action-line form button {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    display: inline-flex !important;
    white-space: nowrap !important;
    margin: 0 !important;
}
.table-action-line .btn,
.table-action-line button {
    padding: 7px 9px !important;
    font-size: 11px !important;
    line-height: 1.1 !important;
    border-radius: 10px !important;
}
@media (max-width: 760px) {
    table.responsive-list td.actions-cell {
        overflow-x: auto !important;
    }
    table.responsive-list td.actions-cell::before {
        margin-bottom: 8px;
    }
    table.responsive-list .table-action-line {
        width: 100% !important;
        justify-content: flex-start !important;
    }
}

/* v2.45 - pesquisa por palavras, paginação, visitas e dashboard clicável */
.stat-card-link {
    color: inherit;
    text-decoration: none;
    min-width: 0;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.stat-card-link:hover,
.stat-card-link:focus-visible {
    transform: translateY(-2px);
    border-color: #bdd0f4;
    box-shadow: 0 22px 48px rgba(23, 32, 51, .13);
    outline: none;
}
.client-per-page {
    flex: 0 0 150px;
    max-width: 150px;
}
.client-list-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -4px 0 14px;
    color: var(--muted);
    font-size: 13px;
}
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 6px;
}
.pagination-link,
.pagination-current {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    font-weight: 850;
    color: var(--primary);
}
.pagination-current {
    color: var(--text);
    background: #f8faff;
}
.pagination-link.disabled {
    opacity: .42;
    pointer-events: none;
}

@media (max-width: 980px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stat-card {
        min-width: 0;
        padding: 13px;
        gap: 5px;
    }
    .stat-card span,
    .stat-card small {
        font-size: 12px;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }
    .stat-card strong {
        font-size: 27px;
    }
    .client-list-search .client-per-page {
        max-width: none;
        width: 100%;
        flex-basis: auto;
    }
    .client-list-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }
    .pagination {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pagination-current {
        grid-column: 1 / -1;
        grid-row: 1;
    }
}

/* v2.46 - origem das pastas na ficha do cliente e ficheiros dos tickets */
.folder-source-link {
    display: block;
    margin: 7px 8px 0;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.folder-source-link:hover {
    text-decoration: underline;
}
.folder-source-link.static {
    color: var(--muted);
    cursor: default;
}
.folder-source-link.static:hover {
    text-decoration: none;
}
.folder-origin {
    margin: 4px 0;
    font-weight: 800;
}
.folder-origin a {
    color: var(--primary);
    text-decoration: none;
}
.folder-origin a:hover {
    text-decoration: underline;
}
.ticket-files-heading {
    border-top: 1px solid var(--line);
    margin-top: 4px;
    padding-top: 14px;
}
.ticket-files-heading h3 {
    margin: 0 0 4px;
}
.ticket-files-heading p {
    margin: 0;
}

/* v2.48 - Tarefas, visitas e Job Lists no calendário */
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.calendar-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.calendar-entry {
    display: flex;
    grid-template-columns: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}
.calendar-entry-client {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.calendar-entry-icon {
    flex: 0 0 auto;
    font-size: 15px;
    line-height: 1;
}
.calendar-entry-visit {
    background: #fff3e8;
    color: #7a3f00;
}
.calendar-entry-job-list {
    background: #edf7f3;
    color: #14523d;
}
.calendar-entry-visit.status-completed,
.calendar-entry-job-list.status-converted {
    background: #e7f8ee;
    color: #115d35;
}
.calendar-entry-visit.status-cancelled,
.calendar-entry-job-list.status-cancelled {
    background: #ffeaea;
    color: #8a1f1f;
}
.calendar-entry-job-list.status-waiting {
    background: #eeeaff;
    color: #4936a1;
}


/* v2.49 - importação condicional e ações do hero da Dashboard */
.dashboard-hero {
    align-items: flex-start;
}
.dashboard-hero-content {
    flex: 1 1 auto;
    min-width: 0;
}
.dashboard-hero-actions {
    flex: 0 0 auto;
    align-self: flex-start;
    justify-content: flex-end;
    flex-wrap: nowrap;
    margin-left: auto;
}
.dashboard-hero-actions .btn {
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
}

@media (max-width: 980px) {
    .dashboard-hero {
        align-items: flex-start;
    }
    .dashboard-hero-actions {
        width: 100%;
        margin-left: 0;
        align-self: stretch;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .dashboard-hero-actions .btn {
        width: 100%;
        padding: 10px 8px;
        min-height: 42px;
        font-size: 12px;
    }
    .dashboard-hero-actions .btn:first-child {
        grid-column: 1 / -1;
    }
}



/* v2.50 - Hero da Dashboard com conteúdo a 100% e data na linha das ações */
.dashboard-hero-content {
    width: 100%;
    flex: 0 0 100%;
}
.dashboard-hero-top {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.dashboard-hero-top .pill {
    flex: 0 0 auto;
}
.dashboard-hero-top .dashboard-hero-actions {
    margin-left: auto;
}

@media (max-width: 980px) {
    .dashboard-hero-content {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    .dashboard-hero-top {
        display: contents;
    }
    .dashboard-hero-top .pill {
        order: 1;
        align-self: flex-start;
    }
    .dashboard-hero-content h2 {
        order: 2;
    }
    .dashboard-hero-content > p {
        order: 3;
    }
    .dashboard-hero-top .dashboard-hero-actions {
        order: 4;
        margin-top: 14px;
    }
}


/* v2.51 - Cabeçalho compacto do calendário */
.page-title-suffix {
    display: inline-block;
    margin-left: .42em;
    color: var(--muted);
    font-size: .72em;
    font-weight: 800;
    letter-spacing: -.01em;
    white-space: nowrap;
}
.calendar-toolbar-compact {
    display: grid;
    width: 100%;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 12px;
}
.calendar-control-stack {
    display: grid;
    width: 100%;
    gap: 8px;
}
.calendar-month-navigation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}
.calendar-month-navigation.has-create {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}
.calendar-month-navigation .btn {
    min-width: 0;
    width: 100%;
    padding: 9px 12px;
    text-align: center;
    white-space: nowrap;
}
.calendar-filter-form {
    display: grid !important;
    grid-template-columns: minmax(135px, .85fr) minmax(180px, 1.25fr) auto;
    gap: 8px !important;
    width: 100%;
    align-items: stretch !important;
}
.calendar-filter-form input,
.calendar-filter-form select,
.calendar-filter-form .btn {
    width: 100%;
    min-width: 0;
    margin: 0;
}
.calendar-filter-form .btn {
    padding-left: 15px;
    padding-right: 15px;
    white-space: nowrap;
}
.calendar-toolbar-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    width: 100%;
}
.calendar-toolbar-info > p {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
}
.calendar-toolbar-info .calendar-legend {
    flex: 0 0 auto;
    margin-top: 0;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .page-title-suffix {
        margin-left: .32em;
        font-size: .66em;
    }
    .calendar-month-navigation.has-create {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .calendar-month-navigation .btn {
        padding: 8px 5px;
        font-size: 11px;
    }
    .calendar-filter-form {
        grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr) auto;
        gap: 6px !important;
    }
    .calendar-filter-form input,
    .calendar-filter-form select,
    .calendar-filter-form .btn {
        font-size: 12px;
    }
    .calendar-filter-form input,
    .calendar-filter-form select {
        padding-left: 7px;
        padding-right: 7px;
    }
    .calendar-filter-form .btn {
        padding-left: 9px;
        padding-right: 9px;
    }
    .calendar-toolbar-info {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }
    .calendar-toolbar-info > p {
        display: none;
    }
    .calendar-toolbar-info .calendar-legend {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }
}


/* v2.52 - Filtros e ações do calendário na mesma linha */
.calendar-month-navigation,
.calendar-month-navigation.has-create {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.calendar-filter-form {
    grid-template-columns: minmax(125px, .9fr) minmax(170px, 1.2fr) auto;
}
.calendar-filter-form.has-create {
    grid-template-columns: minmax(125px, .9fr) minmax(170px, 1.2fr) auto auto;
}
.calendar-search-btn,
.calendar-create-task-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: max-content;
    text-decoration: none;
}
@media (max-width: 760px) {
    .calendar-filter-form,
    .calendar-filter-form.has-create {
        grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr) auto auto;
        gap: 5px !important;
    }
    .calendar-filter-form:not(.has-create) {
        grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr) auto;
    }
    .calendar-search-btn,
    .calendar-create-task-btn {
        padding-left: 7px !important;
        padding-right: 7px !important;
        font-size: 11px !important;
    }
}


/* v2.53 - Selects em cima e ações por baixo no calendário */
.calendar-filter-form,
.calendar-filter-form.has-create,
.calendar-filter-form:not(.has-create) {
    display: flex !important;
    flex-direction: column;
    gap: 8px !important;
    width: 100%;
}
.calendar-filter-selects {
    display: grid;
    grid-template-columns: minmax(125px, .9fr) minmax(170px, 1.2fr);
    gap: 8px;
    width: 100%;
}
.calendar-filter-selects input,
.calendar-filter-selects select {
    width: 100%;
    min-width: 0;
    margin: 0;
}
.calendar-filter-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}
.calendar-filter-actions .calendar-search-btn,
.calendar-filter-actions .calendar-create-task-btn {
    width: auto;
    min-width: 110px;
}
.calendar-filter-actions .calendar-search-btn {
    margin-right: auto;
}
.calendar-filter-actions .calendar-create-task-btn {
    margin-left: auto;
}
@media (max-width: 760px) {
    .calendar-filter-selects {
        grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr);
        gap: 6px;
    }
    .calendar-filter-actions {
        gap: 6px;
    }
    .calendar-filter-actions .calendar-search-btn,
    .calendar-filter-actions .calendar-create-task-btn {
        width: auto;
        min-width: 96px;
        padding-left: 10px !important;
        padding-right: 10px !important;
        font-size: 12px !important;
    }
}

/* v2.56 - menu lateral adaptado a ecrãs de portátil */
.sidebar {
    overflow: hidden;
    min-height: 0;
}
.sidebar .brand,
.sidebar .sidebar-footer {
    flex: 0 0 auto;
}
.sidebar .nav-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.35) transparent;
}
.sidebar .nav-list::-webkit-scrollbar {
    width: 6px;
}
.sidebar .nav-list::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar .nav-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.28);
    border-radius: 999px;
}
.sidebar .nav-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,.45);
}

@media (min-width: 981px) and (max-height: 900px) {
    .sidebar {
        padding: 18px;
        gap: 16px;
    }
    .sidebar .nav-list {
        gap: 5px;
    }
    .sidebar .nav-link {
        padding: 10px 12px;
        border-radius: 13px;
        font-size: 14px;
    }
    .sidebar .brand-logo,
    .sidebar .brand-badge {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }
    .sidebar .sidebar-footer {
        padding: 10px;
        border-radius: 15px;
    }
}

@media (min-width: 981px) and (max-height: 720px) {
    .sidebar {
        padding: 14px 16px;
        gap: 12px;
    }
    .sidebar .nav-list {
        gap: 3px;
    }
    .sidebar .nav-link {
        padding: 8px 10px;
        border-radius: 12px;
        font-size: 13px;
    }
    .sidebar .brand small,
    .sidebar .sidebar-footer small {
        font-size: 11px;
    }
}


/* v2.57 - cartões de clientes compactos e ações alinhadas no fundo */
.client-card.client-card-actions {
    height: 100%;
    align-items: stretch;
    flex-direction: column;
}
.client-card.client-card-actions .client-card-body {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}
.client-card.client-card-actions .card-buttons {
    width: 100%;
    margin-top: auto;
    padding-top: 14px;
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
}
.client-card.client-card-actions .card-buttons > .btn,
.client-card.client-card-actions .card-buttons > .inline-action {
    flex: 1 1 0;
    min-width: 0;
}
.client-card.client-card-actions .card-buttons > .inline-action,
.client-card.client-card-actions .card-buttons > .inline-action button {
    width: 100%;
}
.client-card.client-card-actions .card-buttons .btn,
.client-card.client-card-actions .card-buttons button {
    min-height: 36px;
    padding-left: 8px;
    padding-right: 8px;
    justify-content: center;
    white-space: nowrap;
}
@media (max-width: 420px) {
    .client-card.client-card-actions .card-buttons {
        gap: 6px;
    }
    .client-card.client-card-actions .card-buttons .btn,
    .client-card.client-card-actions .card-buttons button {
        font-size: 12px;
        padding-left: 6px;
        padding-right: 6px;
    }
}


/* v2.58 - avatar pequeno na mesma linha do nome do cliente */
.client-card.client-card-actions .client-card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-bottom: 6px;
}
.client-card.client-card-actions .client-card-title-row h3 {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}
.client-card.client-card-actions .client-card-avatar.avatar.large {
    width: 36px;
    height: 36px;
    min-width: 36px;
    flex: 0 0 36px;
    font-size: 14px;
}


/* v2.59 - Tipos de tarefa visíveis na lista */
.task-title-cell > strong {
    display: block;
}
.task-title-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 7px;
}
.task-type-tag {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 5px 9px;
    line-height: 1.1;
}
.task-list-location {
    display: inline-block;
    margin: 0;
    color: var(--muted);
}
.task-type-electricity { background: #e7efff; color: #1d4ed8; }
.task-type-solar { background: #fff7cf; color: #7a5700; }
.task-type-panels { background: #dff7ff; color: #075f78; }
.task-type-roofs { background: #f1e8ff; color: #6941a5; }
.task-type-maintenance { background: #fff0df; color: #9a4d00; }
.task-type-quote { background: #e7f8ee; color: #11613a; }
.task-type-installation { background: #e5f7f2; color: #08705d; }
.task-type-other { background: #edf0f4; color: #566070; }

@media (max-width: 760px) {
    .task-title-meta {
        align-items: flex-start;
    }
    .task-list-location {
        flex-basis: 100%;
    }
}


/* v2.64 - Tabs do Lixo iguais às Tasks */
.tabs {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 0 16px;
}
.tabs .tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 14px;
    border-radius: 14px;
    font-weight: 900;
    white-space: nowrap;
    background: #eef3ff;
    color: var(--primary);
    border: 1px solid #dbe6ff;
}
.tabs .tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 14px 25px rgba(36, 107, 254, .18);
}
.tabs .trash-tab {
    width: 44px;
    min-width: 44px;
    padding: 10px 0;
    font-size: 17px;
    line-height: 1;
}
@media (max-width: 760px) {
    .tabs { gap: 8px; margin-bottom: 12px; }
    .tabs .tab { padding: 10px 12px; font-size: 13px; }
    .tabs .trash-tab { padding: 9px 0; width: 40px; min-width: 40px; font-size: 16px; }
}


/* v2.65 - Checklists integradas nas páginas de Tarefas e Visitas */
.section-tabs .checklist-tab { gap: 7px; }
.embedded-checklists-section { margin-top: 0; }
.embedded-checklists-section .client-grid { margin-top: 14px; }
@media (max-width: 760px) {
    .section-tabs .checklist-tab { flex: 0 0 auto; }
    .embedded-checklists-section { padding: 14px; }
}


/* v2.66 - Checklists em duas colunas e criação de cliente a partir da visita */
.embedded-checklists-section .client-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}
.embedded-checklists-section .checklist-card {
    width: 100%;
    min-width: 0;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    box-sizing: border-box;
}
.embedded-checklists-section .checklist-card h3 {
    display: block;
    width: 100%;
    margin: 0 0 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.embedded-checklists-section .checklist-card .checklist-client-name {
    display: block;
    width: 100%;
    margin: 0 0 18px;
    min-height: 20px;
    color: var(--muted);
}
.embedded-checklists-section .checklist-card .checklist-progress-row {
    width: 100%;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.embedded-checklists-section .checklist-card .progress {
    width: 100%;
    margin: 9px 0 0;
}
@media (max-width: 760px) {
    .embedded-checklists-section .client-grid {
        grid-template-columns: 1fr;
    }
    .embedded-checklists-section .checklist-card {
        min-height: 0;
    }
}


/* v2.67 - Checklists visíveis e alinhamento dos botões da visita */
.embedded-checklists-section .checklist-card h3 {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
}

.visit-trash-form {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 12px;
    width: 100%;
}
.visit-trash-form .visit-trash-button {
    width: auto;
    min-width: 0;
    padding: 7px 11px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.15;
    box-shadow: none;
}

@media (min-width: 761px) {
    .job-hero .quick-actions.visit-top-actions {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        align-self: flex-start;
        gap: 8px;
        width: auto;
        max-width: 58%;
    }
    .job-hero .quick-actions.visit-top-actions .btn,
    .job-hero .quick-actions.visit-top-actions button,
    .job-hero .quick-actions.visit-top-actions form,
    .job-hero .quick-actions.visit-top-actions .inline-action {
        width: auto;
        min-width: 0;
        white-space: nowrap;
    }
}

@media (min-width: 1000px) {
    .job-hero .quick-actions.visit-top-actions {
        flex-wrap: nowrap;
        max-width: none;
    }
}

@media (max-width: 760px) {
    .visit-trash-form .visit-trash-button {
        width: auto !important;
        justify-self: center;
    }
}


/* v2.68 - Aviso de cliente ainda não registado */
.client-not-registered {
    color: #dc2626 !important;
    font-weight: 700;
}


/* v2.69 - menu desktop a 15px e cartões da equipa iguais aos clientes */
@media (min-width: 981px) {
    .sidebar .nav-link {
        font-size: 15px;
    }
}

.team-card .client-card-title-row {
    margin-bottom: 8px;
}
.team-card .client-card-avatar.avatar.large {
    width: 34px;
    height: 34px;
    min-width: 34px;
    flex-basis: 34px;
    font-size: 13px;
}
.team-card .client-card-title-row h3 {
    margin: 0;
}


/* v2.71 - Separação dos cartões na ficha do cliente + pastas da tarefa a 100% */
.client-detail-card {
    width: 100%;
    margin-bottom: 22px;
}
.client-detail-card:last-of-type {
    margin-bottom: 22px;
}
.task-folder-section {
    width: 100%;
    min-width: 0;
}
.task-folder-section .task-folder-grid {
    width: 100%;
    max-width: none;
    min-width: 0;
    grid-column: 1 / -1;
    box-sizing: border-box;
}
@media (max-width: 760px) {
    .client-detail-card {
        margin-bottom: 14px;
    }
}


/* v2.72 - Tickets, contactos clicáveis e filtros das tarefas */
.ticket-title-cell .ticket-title-content {
    width: 100%;
    min-width: 0;
}
.ticket-title-cell .ticket-title-content > strong {
    display: block;
}
.ticket-list-description {
    display: block;
    width: 100%;
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

.client-contact-links {
    display: grid;
    gap: 4px;
    min-width: 0;
    margin-top: 1px;
}
.client-contact-link {
    width: fit-content;
    max-width: 100%;
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.client-contact-link:hover {
    text-decoration: underline;
}

.profile-meta a {
    color: inherit;
    text-decoration: none;
}
.profile-meta a:hover {
    text-decoration: underline;
}

.search-box .task-search-input {
    min-width: 210px;
    flex: 1 1 auto;
}
.task-status-search-group {
    display: flex;
    align-items: stretch;
    flex: 0 0 auto;
    min-width: 0;
}
.task-status-search-group select {
    width: 190px;
    max-width: 190px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 0;
}
.task-status-search-group .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    white-space: nowrap;
}

@media (max-width: 760px) {
    table.responsive-list td.ticket-title-cell .ticket-title-content {
        grid-column: 2;
        width: 100%;
    }
    .toolbar .search-box {
        flex-wrap: wrap;
    }
    .search-box .task-search-input {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
    }
    .task-status-search-group {
        width: 100%;
    }
    .task-status-search-group select {
        width: auto;
        max-width: none;
        flex: 1 1 auto;
        min-width: 0;
    }
    .task-status-search-group .btn {
        flex: 0 0 auto;
    }
}


/* v2.73 - títulos junto às tabs, filtros recolhíveis e calendário responsivo */
.topbar.no-page-title {
    margin-bottom: 12px;
}
.topbar.no-page-title .topbar-main {
    margin-bottom: 0;
}
.page-tabs-heading,
.page-action-heading {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    width: 100%;
    min-width: 0;
    margin: 0 0 16px;
}
.inline-page-title {
    flex: 0 0 auto;
    margin: 0;
    color: var(--text);
    font-size: clamp(25px, 3vw, 34px);
    line-height: 1.05;
    letter-spacing: -.035em;
    white-space: nowrap;
}
.page-tabs-heading .section-tabs {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}
.page-action-heading {
    justify-content: space-between;
}
.page-action-heading .btn {
    flex: 0 0 auto;
}

.calendar-control-stack,
.calendar-search-panel,
.calendar-search-panel .calendar-filter-form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.calendar-filter-toggle {
    width: fit-content;
    min-width: 150px;
}
.calendar-search-panel[hidden] {
    display: none !important;
}
.calendar-month-navigation-bottom {
    margin: 0 0 10px;
}
.calendar-month-navigation-bottom .btn {
    min-height: 42px;
}

@media (max-width: 760px) {
    .topbar.no-page-title {
        margin-bottom: 9px;
    }
    .page-tabs-heading,
    .page-action-heading {
        gap: 9px;
        margin-bottom: 12px;
    }
    .inline-page-title {
        font-size: 20px;
    }
    .page-tabs-heading .section-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 2px;
    }
    .page-action-heading .btn {
        padding: 9px 11px;
        font-size: 12px;
        white-space: nowrap;
    }
    .calendar-toolbar-compact {
        min-width: 0;
    }
    .calendar-filter-toggle {
        width: 100%;
        min-width: 0;
    }
    .calendar-search-panel {
        overflow: visible;
    }
    .calendar-filter-form,
    .calendar-filter-form.has-create,
    .calendar-filter-form:not(.has-create) {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        align-items: stretch !important;
    }
    .calendar-filter-selects {
        width: 100%;
        min-width: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .calendar-filter-selects input,
    .calendar-filter-selects select {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    .calendar-filter-actions {
        width: 100%;
        min-width: 0;
    }
    .calendar-month-navigation-bottom {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }
    .calendar-month-navigation-bottom .btn {
        width: 100%;
        min-width: 0;
        white-space: normal;
        line-height: 1.15;
    }
}

@media (max-width: 520px) {
    .calendar-filter-selects {
        grid-template-columns: minmax(0, 1fr);
    }
    .calendar-filter-actions .calendar-search-btn,
    .calendar-filter-actions .calendar-create-task-btn {
        min-width: 0;
        max-width: calc(50% - 4px);
    }
}

@media (max-width: 390px) {
    .page-tabs-heading {
        gap: 7px;
    }
    .inline-page-title {
        font-size: 18px;
    }
    .page-tabs-heading .section-tabs .tab {
        padding-left: 9px;
        padding-right: 9px;
        font-size: 12px;
    }
}

/* v2.74 - Team: ações junto da pill, permissão no perfil e calendário da equipa */
.hero-pill-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}
.hero-pill-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.team-hero,
.profile-hero {
    align-items: flex-start;
}
.team-hero-content,
.profile-hero > div {
    width: 100%;
    min-width: 0;
}
.team-hero-pill-row {
    justify-content: space-between;
    width: 100%;
}
.team-hero .hero-pill-actions .btn {
    box-shadow: none;
}
.profile-pill-row {
    justify-content: flex-start;
}
.profile-permission-tag {
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .92);
}

.team-calendar-hero {
    align-items: center;
}
.team-calendar-hero .team-calendar-scope-tag {
    background: rgba(255, 255, 255, .92);
    color: var(--primary);
}
.team-calendar-hero-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    flex-wrap: wrap;
}
.team-calendar-controls {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}
.team-calendar-filter-form {
    display: grid;
    grid-template-columns: minmax(170px, .8fr) minmax(220px, 1.2fr) auto;
    align-items: end;
    gap: 12px;
    width: 100%;
}
.team-calendar-filter-form .btn {
    min-height: 46px;
}
.team-calendar-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.team-calendar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.1;
}
.team-calendar-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 12px;
}
.team-calendar-wrap {
    margin-bottom: 16px;
}
.team-calendar-grid .calendar-day {
    min-width: 0;
}
.team-event-pill {
    width: 100%;
    min-width: 0;
    border: 0;
    border-radius: 11px;
    padding: 7px 8px;
    margin: 4px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 900;
    text-align: left;
}
.team-event-pill:hover {
    transform: translateY(-1px);
    filter: brightness(.98);
}
.team-event-pill-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.team-event-vacation { background: #e7efff; color: #1d4ed8; }
.team-event-absence { background: #ffeaea; color: #a51f1f; }
.team-event-sick { background: #f1e8ff; color: #6941a5; }
.team-event-day-off { background: #e7f8ee; color: #11613a; }
.team-event-training { background: #fff3df; color: #9a4d00; }
.team-event-other { background: #edf0f4; color: #566070; }
.team-calendar-empty {
    margin-top: 14px;
}
.team-event-modal-actions {
    margin-top: 16px;
}
.team-event-modal-actions .inline-action,
.team-event-modal-actions .inline-action .btn {
    width: auto;
}
.team-calendar-form {
    max-width: 920px;
}

@media (max-width: 760px) {
    .team-hero-pill-row {
        align-items: flex-start;
        gap: 10px;
    }
    .team-hero .hero-pill-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .team-hero .hero-pill-actions .btn {
        width: 100%;
        min-width: 0;
        padding-left: 9px;
        padding-right: 9px;
        font-size: 12px;
    }
    .profile-pill-row {
        align-items: flex-start;
    }
    .profile-permission-tag {
        white-space: normal;
    }
    .team-calendar-hero {
        align-items: flex-start;
    }
    .team-calendar-hero-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .team-calendar-hero-actions .btn {
        width: 100%;
        min-width: 0;
    }
    .team-calendar-filter-form {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .team-calendar-filter-form label,
    .team-calendar-filter-form input,
    .team-calendar-filter-form select,
    .team-calendar-filter-form .btn {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }
    .team-calendar-navigation .btn {
        flex: 1 1 0;
        min-width: 0;
        padding-left: 8px;
        padding-right: 8px;
        font-size: 12px;
        white-space: nowrap;
    }
    .team-calendar-grid .calendar-day {
        display: block;
        width: 100%;
        min-width: 0;
    }
    .team-event-pill-name {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
    }
    .team-event-modal-actions {
        display: grid;
        grid-template-columns: 1fr;
    }
    .team-event-modal-actions .btn,
    .team-event-modal-actions .inline-action,
    .team-event-modal-actions .inline-action .btn {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .team-hero .hero-pill-actions,
    .team-calendar-hero-actions {
        grid-template-columns: 1fr;
    }
}


/* v2.75 - Dois calendários por empregado na página Team */
.team-card .team-calendar-card-buttons {
    width: 100%;
    margin-top: auto;
    padding-top: 14px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.team-card .team-calendar-card-buttons .btn {
    width: 100%;
    min-height: 38px;
    justify-content: center;
    white-space: normal;
    text-align: center;
}
.team-card .team-admin-card-buttons {
    margin-top: 8px;
    padding-top: 0;
}

/* v2.76 - Instalação PWA e atalho no ecrã principal */
.pwa-install-banner {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 1300;
    width: min(680px, calc(100% - 32px));
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #dbe6ff;
    border-radius: 18px;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 20px 48px rgba(16, 37, 75, .20);
    backdrop-filter: blur(12px);
}
.pwa-install-banner[hidden] {
    display: none !important;
}
.pwa-install-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-size: 14px;
    font-weight: 950;
    letter-spacing: -.03em;
}
.pwa-install-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.pwa-install-copy strong {
    color: #18243a;
    font-size: 15px;
    line-height: 1.25;
}
.pwa-install-copy small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}
.pwa-install-button {
    min-width: 92px;
    justify-content: center;
}
.pwa-install-dismiss {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: #eef3ff;
    color: #31558e;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.pwa-instructions-modal {
    z-index: 1400;
}
.pwa-instructions-card {
    max-width: 520px;
}
.pwa-instructions {
    margin-top: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    background: #f5f8ff;
    border: 1px solid #dbe6ff;
}
.pwa-instructions[hidden] {
    display: none !important;
}
.pwa-instructions ol {
    margin: 0;
    padding-left: 22px;
    display: grid;
    gap: 12px;
}
.pwa-instructions li {
    padding-left: 3px;
    line-height: 1.45;
}
.auth-body .pwa-install-banner {
    bottom: 16px;
}

@media (max-width: 900px) {
    body:not(.auth-body) .pwa-install-banner {
        bottom: 82px;
    }
}

@media (max-width: 560px) {
    .pwa-install-banner {
        width: calc(100% - 20px);
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 9px;
        padding: 10px;
        border-radius: 16px;
    }
    .pwa-install-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: 12px;
    }
    .pwa-install-copy small {
        display: none;
    }
    .pwa-install-button {
        min-width: 76px;
        padding: 9px 11px;
        font-size: 12px;
    }
    .pwa-install-dismiss {
        position: absolute;
        top: -10px;
        right: -5px;
        width: 28px;
        height: 28px;
        border: 1px solid #dbe6ff;
        background: #fff;
        font-size: 18px;
        box-shadow: 0 5px 12px rgba(16, 37, 75, .12);
    }
}

/* v2.77 - Branding, filtros recolhíveis, calendário móvel e Team compacto */
.auth-company-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto 12px;
}
.auth-company-logo img {
    display: block;
    width: 180px;
    height: 180px;
    max-width: 62vw;
    object-fit: contain;
    border-radius: 24px;
}
.auth-card > h1 {
    text-align: center;
    margin-top: 4px;
}
.pwa-install-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

/* Toggle geral para páginas com pesquisa/filtros */
.collapsible-filter {
    display: grid;
    gap: 8px;
    width: min(760px, 100%);
    min-width: 0;
}
.toolbar > .collapsible-filter {
    flex: 1 1 auto;
}
.collapsible-filter-toggle {
    width: fit-content;
    min-width: 150px;
}
.collapsible-filter-panel {
    width: 100%;
    min-width: 0;
}
.collapsible-filter-panel[hidden] {
    display: none !important;
}
.collapsible-filter-panel > form,
.collapsible-filter-panel .search-box,
.collapsible-filter-panel .duplicate-filter,
.collapsible-filter-panel .team-calendar-filter-form {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0;
}

/* Calendário: ação principal sempre visível e pesquisa adaptável */
.calendar-main-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
}
.calendar-main-actions .calendar-filter-toggle,
.calendar-main-actions .calendar-create-task-btn {
    width: auto;
    min-width: 132px;
}
.calendar-search-panel .calendar-filter-form,
.calendar-search-panel .calendar-filter-form.has-create,
.calendar-search-panel .calendar-filter-form:not(.has-create) {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
}
.calendar-filter-fields {
    display: grid;
    grid-template-columns: minmax(150px, .72fr) minmax(280px, 1.28fr);
    gap: 8px;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}
.calendar-filter-fields > input,
.calendar-employee-search-group {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}
.calendar-employee-search-group {
    display: flex;
    align-items: stretch;
}
.calendar-employee-search-group select {
    width: auto;
    max-width: none;
    min-width: 0;
    flex: 1 1 auto;
}
.calendar-employee-search-group .calendar-search-btn {
    flex: 0 0 auto;
    min-width: 100px;
}

/* Team: título mais pequeno sem a pill Field team */
.team-hero-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    min-width: 0;
}
.team-hero .team-compact-title {
    margin: 0 !important;
    font-size: clamp(20px, 2.4vw, 30px) !important;
    line-height: 1.12;
    letter-spacing: -.025em;
}
.team-hero-heading-row .hero-pill-actions {
    flex: 0 0 auto;
}

@media (max-width: 760px) {
    .auth-card {
        padding: 22px;
    }
    .auth-company-logo img {
        width: 150px;
        height: 150px;
    }
    .collapsible-filter,
    .toolbar > .collapsible-filter {
        width: 100%;
        min-width: 0;
        flex-basis: 100%;
    }
    .collapsible-filter-toggle {
        width: 100%;
        min-width: 0;
    }
    .collapsible-filter-panel > form,
    .collapsible-filter-panel .search-box,
    .collapsible-filter-panel .duplicate-filter,
    .collapsible-filter-panel .team-calendar-filter-form {
        box-sizing: border-box;
        overflow: visible;
    }
    .calendar-main-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }
    .calendar-main-actions .calendar-filter-toggle,
    .calendar-main-actions .calendar-create-task-btn {
        width: 100%;
        min-width: 0;
        padding-left: 8px;
        padding-right: 8px;
        font-size: 12px;
        white-space: normal;
        text-align: center;
    }
    .calendar-filter-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 7px;
    }
    .calendar-filter-fields > input,
    .calendar-employee-search-group,
    .calendar-employee-search-group select,
    .calendar-employee-search-group .calendar-search-btn {
        max-width: 100% !important;
        min-width: 0 !important;
    }
    .calendar-employee-search-group .calendar-search-btn {
        width: auto !important;
        flex: 0 0 auto;
        padding-left: 11px !important;
        padding-right: 11px !important;
        font-size: 12px !important;
    }
    .team-hero-heading-row {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }
    .team-hero .team-compact-title {
        font-size: 19px !important;
        line-height: 1.2;
    }
    .team-hero-heading-row .hero-pill-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .auth-company-logo img {
        width: 132px;
        height: 132px;
    }
    .team-hero-heading-row .hero-pill-actions {
        grid-template-columns: 1fr;
    }
}


/* v2.80 - Descrição da visita a ocupar toda a largura da célula */
.visit-title-cell .visit-title-content {
    display: block;
    width: 100%;
    min-width: 0;
}
.visit-title-cell .visit-title-content > strong {
    display: block;
    width: 100%;
}
.visit-list-description {
    display: block;
    width: 100%;
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
@media (max-width: 760px) {
    table.responsive-list td.visit-title-cell .visit-title-content {
        grid-column: 2;
        min-width: 0;
    }
}


/* v2.81 - Aviso de cliente não registado por baixo do nome */
.visit-client-cell .visit-client-content {
    display: block;
    width: 100%;
    min-width: 0;
}
.visit-client-cell .visit-client-content > strong,
.visit-client-cell .visit-client-content > small {
    display: block;
    width: 100%;
}
.visit-client-cell .client-not-registered {
    margin-top: 4px;
}
@media (max-width: 760px) {
    table.responsive-list td.visit-client-cell .visit-client-content {
        grid-column: 2;
        min-width: 0;
    }
}


/* v2.82 - Localização da tarefa por baixo do título */
.task-title-cell .task-title-content {
    display: block;
    width: 100%;
    min-width: 0;
}
.task-title-cell .task-title-content > strong {
    display: block;
    width: 100%;
}
.task-title-cell .task-list-location {
    display: block;
    width: 100%;
    max-width: none;
    margin: 4px 0 0;
    white-space: normal;
    overflow-wrap: anywhere;
}
.task-title-cell .task-title-meta {
    width: 100%;
}

/* v2.83 - Tipo da tarefa por baixo da etiqueta "Task" no telemóvel */
@media (max-width: 760px) {
    table.responsive-list td.task-title-cell .task-title-content {
        display: contents;
    }
    table.responsive-list td.task-title-cell::before {
        grid-column: 1;
        grid-row: 1;
    }
    table.responsive-list td.task-title-cell .task-title-content > strong {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }
    table.responsive-list td.task-title-cell .task-list-location {
        grid-column: 2;
        grid-row: 2;
        min-width: 0;
        margin-top: 4px;
    }
    table.responsive-list td.task-title-cell .task-title-meta {
        grid-column: 1;
        grid-row: 2;
        align-self: start;
        width: 100%;
        margin-top: 4px;
    }
    table.responsive-list td.task-title-cell .task-type-tag {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}


/* v2.84 - Ações das Tasks alinhadas ao topo da linha */
.tasks-list-table td.actions-cell {
    vertical-align: top;
}
.tasks-list-table td.actions-cell .quick-actions.list-row-actions {
    align-items: flex-start !important;
}


/* v2.85 - Ações principais das Tasks junto ao botão Mostrar pesquisa */
.tasks-toolbar {
    align-items: flex-start;
}
.tasks-toolbar > .collapsible-filter {
    flex: 1 1 auto;
    min-width: 0;
}
.tasks-toolbar > .task-toolbar-actions {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-left: auto;
    justify-content: flex-end;
}

@media (max-width: 980px) {
    .tasks-toolbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .tasks-toolbar > .collapsible-filter {
        order: 1;
        width: 100%;
        flex: 0 0 auto;
    }
    .tasks-toolbar > .task-toolbar-actions {
        order: 2;
        width: 100%;
        margin-left: 0;
        align-self: stretch;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .tasks-toolbar > .task-toolbar-actions .btn {
        width: 100%;
        min-width: 0;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .tasks-toolbar > .task-toolbar-actions {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* v2.86 - Clientes e Calendário com a mesma barra de ações das Tasks */
.clients-toolbar,
.calendar-actions-toolbar {
    align-items: flex-start;
}
.calendar-actions-toolbar {
    width: 100%;
    margin-bottom: 0;
}
.calendar-actions-toolbar > .calendar-control-stack {
    flex: 1 1 auto;
    min-width: 0;
}
.calendar-actions-toolbar > .calendar-toolbar-actions {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-left: auto;
    justify-content: flex-end;
}

@media (max-width: 980px) {
    .clients-toolbar,
    .calendar-actions-toolbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .calendar-actions-toolbar > .calendar-control-stack {
        order: 1;
        width: 100%;
        flex: 0 0 auto;
    }
    .calendar-actions-toolbar > .calendar-toolbar-actions {
        order: 2;
        width: 100%;
        margin-left: 0;
        align-self: stretch;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .calendar-actions-toolbar > .calendar-toolbar-actions .btn {
        width: 100%;
        min-width: 0;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .calendar-actions-toolbar > .calendar-toolbar-actions {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* v2.87 - Clientes e Calendário usam exatamente a estrutura de pesquisa das Tasks */
.client-list-search,
.calendar-search-panel .calendar-filter-form.search-box {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 8px !important;
    width: min(620px, 100%) !important;
    max-width: 100% !important;
    min-width: 0 !important;
    align-items: stretch !important;
}

.client-list-search .task-search-input,
.calendar-search-panel .calendar-filter-form.search-box .task-search-input {
    min-width: 210px;
    flex: 1 1 auto;
    width: auto;
    max-width: 100%;
}

.client-list-search .task-status-search-group,
.calendar-search-panel .calendar-filter-form.search-box .task-status-search-group {
    display: flex;
    align-items: stretch;
    flex: 0 0 auto;
    min-width: 0;
    width: auto;
}

.client-list-search .task-status-search-group .client-per-page,
.calendar-search-panel .calendar-filter-form.search-box .task-status-search-group select {
    width: 190px;
    max-width: 190px;
    min-width: 0;
    flex: 0 0 auto;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 0;
}

.client-list-search .task-status-search-group .btn,
.calendar-search-panel .calendar-filter-form.search-box .task-status-search-group .btn {
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    white-space: nowrap;
}

@media (max-width: 760px) {
    .client-list-search,
    .calendar-search-panel .calendar-filter-form.search-box {
        flex-wrap: wrap !important;
        width: 100% !important;
    }

    .client-list-search .task-search-input,
    .calendar-search-panel .calendar-filter-form.search-box .task-search-input {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        font-size: inherit;
        padding: 12px 13px;
    }

    .client-list-search .task-status-search-group,
    .calendar-search-panel .calendar-filter-form.search-box .task-status-search-group {
        display: flex;
        width: 100%;
        min-width: 0;
    }

    .client-list-search .task-status-search-group .client-per-page,
    .calendar-search-panel .calendar-filter-form.search-box .task-status-search-group select {
        width: auto;
        max-width: none;
        min-width: 0;
        flex: 1 1 auto;
        font-size: inherit;
        padding: 12px 13px;
    }

    .client-list-search .task-status-search-group .btn,
    .calendar-search-panel .calendar-filter-form.search-box .task-status-search-group .btn {
        width: auto;
        min-width: 0;
        flex: 0 0 auto;
        padding: 12px 13px;
        font-size: inherit;
    }
}


/* v2.88 - Ações do calendário centradas e consistentes no telemóvel */
@media (max-width: 980px) {
    .calendar-actions-toolbar > .calendar-control-stack .calendar-filter-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        margin-inline: auto;
        text-align: center;
    }

    .calendar-actions-toolbar > .calendar-toolbar-actions {
        justify-items: center;
    }

    .calendar-actions-toolbar > .calendar-toolbar-actions .btn {
        grid-column: 1 / -1;
        width: calc(50% - 4px) !important;
        max-width: calc(50% - 4px);
        margin-inline: auto;
        padding: 10px 14px;
        font-size: inherit !important;
        line-height: normal;
    }
}

@media (max-width: 420px) {
    .calendar-actions-toolbar > .calendar-toolbar-actions .btn {
        width: 100% !important;
        max-width: 100%;
    }
}

/* v2.89 - Botão + Cliente centrado no dispositivo móvel */
@media (max-width: 980px) {
    .clients-toolbar > .client-toolbar-actions {
        order: 2;
        width: 100%;
        margin-left: 0;
        align-self: stretch;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .clients-toolbar > .client-toolbar-actions .btn {
        width: auto;
        margin-inline: auto;
        text-align: center;
    }
}

/* v2.90 - Botões principais a 100% no calendário e clientes no telemóvel */
@media (max-width: 980px) {
    .clients-toolbar > .client-toolbar-actions,
    .calendar-actions-toolbar > .calendar-toolbar-actions {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        align-self: stretch !important;
        display: flex !important;
        justify-content: center !important;
        align-items: stretch !important;
    }

    .clients-toolbar > .client-toolbar-actions .btn,
    .calendar-actions-toolbar > .calendar-toolbar-actions .btn,
    .calendar-actions-toolbar > .calendar-toolbar-actions .calendar-create-task-btn {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        text-align: center !important;
    }

    .calendar-actions-toolbar > .calendar-control-stack,
    .calendar-actions-toolbar > .calendar-control-stack .calendar-filter-toggle,
    .calendar-actions-toolbar .collapsible-filter-toggle.calendar-filter-toggle {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .calendar-actions-toolbar > .calendar-control-stack .calendar-filter-toggle,
    .calendar-actions-toolbar .collapsible-filter-toggle.calendar-filter-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }
}
