/* AlempDocs · cores do site alemp.tec.br */
:root {
    --navy: #0b1f3a;
    --navy-2: #12315c;
    --teal: #00c9a7;
    --teal-dark: #0b7a63;
    --blue: #2f7cf6;
    --text: #1a2332;
    --muted: #5b6b81;
    --line: #e4eaf2;
    --line-2: #cfd8e5;
    --bg: #f4f7fb;
    --white: #ffffff;
    --danger: #b42318;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 10px 40px rgba(11, 31, 58, .08);
    --font: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Exo 2', 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--teal-dark); font-weight: 600; text-decoration: none; }
a:hover { color: var(--navy); text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--navy); margin: 0; line-height: 1.2; }
h1 { font-size: clamp(24px, 3vw, 30px); font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
h2 { font-size: 20px; font-weight: 700; }
.h3 { font-size: 18px; font-weight: 700; }
.h4 { font-size: 16px; font-weight: 700; }
code { background: #eef2f7; padding: 1px 6px; border-radius: 6px; font-size: 14px; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.upper { text-transform: uppercase; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 12px; }
.logo-text { font-family: var(--font-display); font-size: 24px; font-weight: 500; line-height: 1; }
.logo-text b { font-weight: 800; font-style: italic; color: var(--teal); }
.logo-dark .logo-text { color: var(--white); }
.logo-light .logo-text { color: var(--navy); }
.logo-light .logo-text b { color: var(--blue); }

/* Shell: menu lateral + conteúdo */
.shell { min-height: 100vh; display: flex; }
.side { width: 256px; flex: 0 0 256px; background: var(--navy); color: var(--white); padding: 24px 14px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 24px; }
.side-brand:hover { text-decoration: none; }
.side-toggle { display: none; background: transparent; border: 0; color: var(--white); width: 44px; height: 44px; border-radius: 10px; cursor: pointer; align-items: center; justify-content: center; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav > a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: #c9d4e3; font-size: 15px; font-weight: 600; }
.nav > a:hover { background: rgba(255, 255, 255, .06); color: var(--white); text-decoration: none; }
.nav > a.active { background: var(--navy-2); color: var(--white); box-shadow: inset 3px 0 0 var(--teal); }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 14px 4px 0 6px; border-top: 1px solid rgba(255, 255, 255, .1); }
.side-user-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: var(--white); padding: 4px; border-radius: 10px; }
.side-user-link:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: var(--white); }
.side-user-info { display: flex; flex-direction: column; min-width: 0; }
.side-user-info b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-info small { font-size: 13px; color: #9fb0c6; font-weight: 400; }
.side-user .icon-btn { color: #c9d4e3; }
.side-user .icon-btn:hover { background: rgba(255, 255, 255, .08); color: var(--white); }
.avatar { width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%; background: var(--navy-2); color: var(--teal); font-weight: 700; display: flex; align-items: center; justify-content: center; }

.main { flex: 1; min-width: 0; padding: 32px clamp(16px, 3vw, 40px) 48px; display: flex; flex-direction: column; gap: 24px; }


/* Cabeçalho de página */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.page-head p { margin: 0; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent; font-family: var(--font-display); font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-2); color: var(--white); }
.btn-accent { background: var(--teal); color: var(--navy); }
.btn-accent:hover { background: #00b394; color: var(--navy); }
.btn-ghost { background: var(--white); color: var(--navy); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger-ghost { background: var(--white); color: var(--danger); border-color: #f1c4bf; }
.btn-danger-ghost:hover { border-color: var(--danger); color: var(--danger); }
.btn-lg { min-height: 50px; font-size: 16px; padding: 0 22px; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 46px; min-height: 46px; padding: 0; flex: 0 0 46px; }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn.loading { opacity: .7; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--navy-2); cursor: pointer; }
.icon-btn:hover { background: #eef2f7; color: var(--navy); }

/* Cards */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 22px clamp(16px, 2.4vw, 26px); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head-wrap { flex-wrap: wrap; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.narrow { max-width: 760px; width: 100%; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty p { margin: 0; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; color: var(--text); font-weight: 400; }
a.kpi:hover { border-color: var(--line-2); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.kpi-label { display: flex; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 600; color: var(--muted); }
.kpi strong { font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--navy); line-height: 1.1; }
.kpi small { font-size: 14px; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.dot-gray { background: #9fb0c6; } .dot-blue { background: var(--blue); } .dot-teal { background: var(--teal); } .dot-navy { background: var(--navy); }
.dot-p0 { background: #d64534; } .dot-p1 { background: #f08c00; } .dot-p2 { background: var(--blue); } .dot-p3 { background: #9fb0c6; }

/* Layout em duas colunas que empilha no celular */
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split-main { flex: 999 1 560px; min-width: 0; }
.split-side { flex: 1 1 300px; min-width: 0; }
.split-doc .split-main { flex-basis: 640px; }

/* Tabelas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; padding: 12px 10px; white-space: nowrap; }
.table td { padding: 12px 10px; border-top: 1px solid #eef2f7; vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 22px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table tbody tr:hover { background: #f8fafd; }
.table .num { text-align: right; }
.table .actions { text-align: right; width: 1%; }
.table:not(.table-edit) { min-width: 720px; }
.cell-2 { display: flex; flex-direction: column; gap: 2px; }
.cell-2 small { font-size: 13px; color: var(--muted); }
.table-edit td { padding: 8px 6px; }
.table-edit input { min-height: 42px; }
.sla-mini { width: 100%; border-collapse: collapse; font-size: 15px; }
.sla-mini th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding-bottom: 6px; }
.sla-mini td { padding: 9px 0; border-top: 1px solid #eef2f7; }
.sla-mini td:first-child { font-weight: 600; }
.sla-mini .dot { margin-right: 6px; }

/* Status */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-family: var(--font); font-size: 13px; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.pill-rascunho, .pill-cancelada { background: #eef2f7; color: #3d4b5f; }
.pill-enviada { background: #e6effe; color: #1c4fa8; }
.pill-visualizada { background: #fff3df; color: #8a4b00; }
.pill-aceita { background: #e0f7f2; color: #0b6b56; }
.pill-recusada { background: #fde8e6; color: #a1281b; }
.pill-vencida { background: #fff; color: #a1281b; border: 1px solid #f1c4bf; }

/* Filtros e busca */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--white); color: #3d4b5f; font-size: 14px; }
.chip:hover { border-color: var(--navy); color: var(--navy); text-decoration: none; }
.chip.active { background: var(--navy); border-color: var(--navy); color: var(--white); }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 42px !important; width: 300px; max-width: 100%; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Formulários */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label-row label { font-size: 15px; font-weight: 600; color: var(--text); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label-row a { font-size: 14px; }
.req { color: var(--danger); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
    width: 100%; min-height: 46px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 14px;
    font: inherit; font-size: 16px; color: var(--text); background: var(--white);
}
textarea { resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235b6b81' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 124, 246, .15); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
input[type=file] { font: inherit; font-size: 15px; }
.help { margin: 0; font-size: 14px; color: var(--muted); }
.help.ok { color: var(--teal-dark); }
.help.warn { color: #8a4b00; }
.error { margin: 0; font-size: 14px; color: var(--danger); font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); flex: 0 0 20px; }
.input-group { display: flex; gap: 8px; }
.input-group input { flex: 1; min-width: 0; }
.input-icon { position: relative; }
.input-icon input { padding-right: 52px; }
.input-icon .icon-btn { position: absolute; right: 3px; top: 3px; width: 44px; height: 40px; color: var(--muted); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--line-2); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: #f4f7fb; color: var(--muted); font-size: 15px; }
.input-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; min-width: 0; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.grid > * { grid-column: span 12; }
@media (min-width: 720px) {
    .col-2 { grid-column: span 2 !important; } .col-3 { grid-column: span 3 !important; } .col-4 { grid-column: span 4 !important; }
    .col-5 { grid-column: span 5 !important; } .col-6 { grid-column: span 6 !important; } .col-8 { grid-column: span 8 !important; }
}
.cnpj-badge-slot { display: flex; align-items: center; padding-top: 22px; }
.cnpj-badge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: #e0f7f2; color: #0b6b56; font-size: 14px; font-weight: 600; }
.cnpj-badge.warn { background: #fff3df; color: #8a4b00; }
@media (max-width: 719px) { .cnpj-badge-slot { padding-top: 0; } .cnpj-badge-slot:empty { display: none; } }

.step { display: flex; align-items: center; gap: 12px; }
.step span { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: var(--teal); font-family: var(--font-display); font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 32px; }
.proposal-form { display: flex; flex-direction: column; gap: 20px; }

/* Itens da proposta */
.item-row { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: #fbfcfe; }
.item-grid { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 12px; align-items: end; }
.item-grid > .field, .item-grid > .item-total { grid-column: 1 / 2; }
.item-remove { grid-column: 2; grid-row: 1; align-self: end; }
.item-total { display: flex; flex-direction: column; gap: 2px; }
.item-total strong { font-family: var(--font-display); font-size: 18px; color: var(--navy); min-height: 46px; display: flex; align-items: center; }
@media (min-width: 900px) {
    .item-grid { grid-template-columns: 200px minmax(0, 1fr) 90px 150px 120px 130px 44px; }
    .item-grid > .field, .item-grid > .item-total { grid-column: auto; }
    .item-remove { grid-column: 7; grid-row: 1; margin-bottom: 1px; }
    .item-details { grid-column: 2 / 7 !important; }
    .item-total strong { justify-content: flex-end; }
    .item-total span { text-align: right; }
}
.items-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; margin-top: 14px; }
.totals { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 260px; }
.totals div { display: flex; justify-content: space-between; gap: 24px; padding: 10px 14px; border-radius: 10px; background: var(--bg); }
.totals div:first-child { background: var(--navy); color: var(--white); }
.totals dt { font-weight: 600; }
.totals dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 18px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.action-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px clamp(16px, 2vw, 22px); background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -6px 24px rgba(11, 31, 58, .06); }
.action-bar .btn-danger-ghost { margin-right: auto; }

/* Alertas */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); font-size: 15px; border: 1px solid; }
.alert svg { flex: 0 0 20px; margin-top: 1px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-success { background: #e9f9f5; border-color: #a8e6d8; color: #0b5a48; }
.alert-warning { background: #fff7e8; border-color: #f5d49a; color: #6e3c00; }
.alert-error { background: #fdeeec; border-color: #f1c4bf; color: #8d1f14; }

/* Pré-visualização do documento */
.preview-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.preview-bar span { display: inline-flex; align-items: center; gap: 6px; }
.paper { background: var(--white); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); padding: clamp(18px, 5vw, 56px); max-width: 860px; overflow-x: auto; }
.facts { margin: 0; display: flex; flex-direction: column; }
.facts div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid #eef2f7; font-size: 15px; }
.facts div:first-child { border-top: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.timeline li div { display: flex; flex-direction: column; min-width: 0; word-break: break-word; }
.attach { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius-sm); background: var(--bg); }
.attach div { flex: 1; display: flex; flex-direction: column; min-width: 0; word-break: break-all; }
.attach svg { color: var(--navy-2); }

/* Empresa */
.company-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.company-logo { max-height: 56px; max-width: 200px; object-fit: contain; border-radius: 8px; }
.company-logo-empty { width: 56px; height: 56px; border-radius: 12px; background: var(--bg); color: var(--muted); display: flex; align-items: center; justify-content: center; }
.logo-upload { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }

/* Login */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-hero { flex: 1 1 480px; background: var(--navy); color: var(--white); padding: 48px clamp(24px, 6vw, 88px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-hero .logo-text { font-size: 30px; }
.auth-pitch { display: flex; flex-direction: column; gap: 24px; max-width: 520px; }
.auth-pitch h1 { color: var(--white); font-size: clamp(28px, 3.4vw, 44px); line-height: 1.15; display: block; }
.auth-pitch p { margin: 0; font-size: 18px; line-height: 1.6; color: #c9d4e3; }
.auth-pitch ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-pitch li { display: flex; align-items: center; gap: 12px; }
.auth-pitch li span { width: 32px; height: 32px; border-radius: 10px; background: rgba(0, 201, 167, .15); color: var(--teal); display: flex; align-items: center; justify-content: center; flex: 0 0 32px; }
.auth-foot { margin: 0; font-size: 14px; color: #9fb0c6; }
.auth-main { flex: 1 1 440px; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 36px clamp(20px, 4vw, 40px); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.auth-title { display: flex; flex-direction: column; gap: 6px; }
.auth-title h2 { font-size: 28px; }
.auth-title p { margin: 0; color: var(--muted); }
.secure-note { margin: 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--muted); }
@media (max-width: 760px) {
    .auth-hero { padding: 28px 20px; gap: 20px; }
    .auth-pitch h1 { font-size: 24px; }
    .auth-pitch p, .auth-pitch ul, .auth-foot { display: none; }
}

@media print {
    .side, .page-head, .preview-bar, .split-side, .alert { display: none !important; }
    .main { padding: 0; }
    .paper { border: 0; box-shadow: none; padding: 0; }
}

/* Contratos: escolha dos serviços e cláusulas */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.module-card { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--white); cursor: pointer; transition: border-color .15s, background .15s; }
.module-card:hover { border-color: var(--line-2); }
.module-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.module-card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; padding-right: 28px; }
.module-card-body b { font-family: var(--font-display); color: var(--navy); font-size: 16px; }
.module-card-body small { color: var(--muted); font-size: 14px; line-height: 1.4; }
.module-card-tick { position: absolute; top: 14px; right: 14px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-2); display: flex; align-items: center; justify-content: center; color: transparent; }
.module-card:has(input:checked) { border-color: var(--teal); background: #effbf8; }
.module-card:has(input:checked) .module-card-tick { background: var(--teal); border-color: var(--teal); color: var(--navy); }
.module-card:has(input:focus-visible) { outline: 3px solid var(--blue); outline-offset: 2px; }
.clause-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.clause-block details { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fbfcfe; }
.clause-block summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; min-height: 48px; }
.clause-block summary::-webkit-details-marker { display: none; }
.clause-block summary::after { content: "Editar"; margin-left: auto; font-size: 14px; font-weight: 600; color: var(--teal-dark); }
.clause-block details[open] summary::after { content: "Fechar"; }
.clause-num { font-family: var(--font-display); font-weight: 700; color: var(--teal-dark); min-width: 32px; }
.clause-name { font-weight: 600; color: var(--navy); }
.clause-edit { padding: 0 14px 14px; }
.clause-block.added details { animation: clause-in .6s ease; }
@keyframes clause-in { from { background: #e0f7f2; } to { background: #fbfcfe; } }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.label { font-size: 15px; font-weight: 600; }
.mono-ish { font-size: 15px; line-height: 1.6; }

/* Assinatura eletrônica */
.signer-row { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 0; }
.signer-row legend { font-family: var(--font-display); font-weight: 700; color: var(--navy); padding: 0 6px; }
.signers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.signers li { display: flex; gap: 10px; align-items: flex-start; }
.signers li div { min-width: 0; word-break: break-word; }
.sig-dot { width: 12px; height: 12px; flex: 0 0 12px; margin-top: 6px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--white); }
.sig-dot.ok { background: var(--teal); border-color: var(--teal); }
.sig-dot.no { background: #d64534; border-color: #d64534; }

/* Card de assinaturas do mês */
.quota strong { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.quota-of { font-family: var(--font); font-size: 15px; font-weight: 600; color: var(--muted); }
.quota-bar { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.quota-bar span { display: block; height: 100%; border-radius: 999px; background: var(--teal); }
.quota-pouco .quota-bar span { background: #f08c00; }
.quota-fim .quota-bar span { background: #d64534; }
.quota-fim strong { color: #a1281b; }

/* Verificação em duas etapas */
.code-input { font-family: var(--font-display); font-size: 22px !important; letter-spacing: 4px; text-align: center; max-width: 260px; }
.auth-card .code-input { max-width: none; }
.qr-box { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.qr { background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); line-height: 0; }
.qr svg { width: 200px; height: 200px; }
.secret { font-size: 16px; letter-spacing: 1px; word-break: break-all; }
.setup-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.recovery { border: 2px solid var(--teal); background: #effbf8; border-radius: var(--radius-sm); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.recovery p { margin: 0; }
.recovery-codes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.recovery-codes code { display: block; text-align: center; font-size: 16px; padding: 6px; background: #fff; }

/* Páginas de erro e link expirado */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.error-card { width: 100%; max-width: 520px; background: var(--white); border: 1px solid var(--line); border-radius: 20px; padding: 36px clamp(20px, 5vw, 44px); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.error-card h1 { font-size: 26px; }
.error-card p { margin: 0; }
.error-code { font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: 2px; text-transform: uppercase; color: var(--teal-dark); margin-top: 10px !important; }

/* Auditoria */
.audit-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.audit-filters .field { min-width: 180px; flex: 1 1 180px; }
.audit-det { font-size: 13px; color: var(--muted); word-break: break-word; max-width: 360px; }
.pill-alerta { background: #fde8e6; color: #a1281b; }

/* =====================================================================
   CELULAR E TABLET (até 900 px)
   Navegação embaixo (alcance do polegar), listas em cartões, campos
   curtos lado a lado, botões de 44 px+, ações fixas no rodapé.
   ===================================================================== */
html { -webkit-tap-highlight-color: rgba(0, 201, 167, .18); scroll-padding-top: 76px; }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--white); color: var(--navy); padding: 10px 14px; border-radius: 0 0 10px 0; }
.skip-link:focus { left: 0; }
.bottom-nav, .top-avatar, .m-label, .nav-title { display: none; }

@media (max-width: 900px) {
    body.app { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
    .shell { flex-direction: column; }

    /* barra superior enxuta: logo + avatar */
    .side { position: sticky; top: 0; z-index: 30; width: 100%; flex: none; height: auto; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); overflow: visible; }
    .side-top { padding: 0 4px; gap: 8px; }
    .side-toggle { display: none; }
    .top-avatar { display: inline-flex; margin-left: auto; border-radius: 50%; }
    .top-avatar .avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: 14px; }

    /* menu completo: tela cheia por cima, aberto pelo "Menu" da barra inferior */
    .nav { display: none; }
    .side.open .nav { display: flex; position: fixed; inset: 0; z-index: 60; background: var(--navy); padding: max(20px, env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
    .side.open .nav > a { min-height: 52px; font-size: 17px; }
    .nav-title { display: block; margin: 0 0 8px 12px; font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--white); }
    html.menu-open, html.menu-open body { overflow: hidden; }

    /* barra inferior */
    .bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(11, 31, 58, .06); }
    .bottom-nav > a, .bottom-nav > button, .fab summary { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border: 0; background: none; color: var(--muted); font: 600 12px/1.1 var(--font); text-decoration: none; cursor: pointer; border-radius: 12px; }
    .bottom-nav > a.active { color: var(--navy); }
    .bottom-nav > a.active svg { color: var(--teal-dark); }
    .bottom-nav > a:hover { text-decoration: none; }
    .fab { position: relative; }
    .fab summary { list-style: none; color: var(--navy); }
    .fab summary::-webkit-details-marker { display: none; }
    .fab-btn { width: 48px; height: 48px; margin-top: -22px; border-radius: 50%; background: var(--navy); color: var(--teal); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(11, 31, 58, .3); border: 3px solid var(--white); transition: transform .15s; }
    .fab[open] .fab-btn { transform: rotate(45deg); }
    .fab-menu { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%); width: min(260px, 90vw); background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(11, 31, 58, .2); padding: 8px; display: flex; flex-direction: column; }
    .fab-menu a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: 10px; color: var(--navy); font-size: 16px; }
    .fab-menu a:hover, .fab-menu a:active { background: var(--bg); text-decoration: none; }

    .main { padding: 16px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); gap: 18px; }
    .split, .split-side { gap: 16px; }

    /* tela com rodapé de ações (formulários e documento aberto): ele substitui a barra inferior */
    body.app:has(.action-bar), body.app:has(.doc-dock) { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
    body.app:has(.action-bar) .bottom-nav, body.app:has(.doc-dock) .bottom-nav { display: none; }
    .action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; border-radius: 0; border-width: 1px 0 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); flex-wrap: nowrap; }
    .action-bar .btn { flex: 1 1 0; padding: 0 12px; }
    .action-bar .btn-primary { flex-grow: 2; }
    .action-bar .btn-danger-ghost { margin-right: 0; flex: 0 0 52px; font-size: 0; gap: 0; }
    .doc-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(11, 31, 58, .08); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); flex-wrap: nowrap; gap: 8px; }
    .doc-dock .btn { flex: 1 1 0; padding: 0 10px; min-height: 48px; }
    .doc-dock .dock-main { flex-grow: 2; }
    .hide-m { display: none; }

    /* itens da proposta/contrato: 2 colunas */
    .item-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 10px; }
    .item-grid > .item-service { grid-column: 1 / 3; grid-row: 1; }
    .item-grid > .item-remove { grid-column: 3; grid-row: 1; }
    .item-grid > .item-desc, .item-grid > .item-details { grid-column: 1 / -1; }
    .item-grid > .item-qty, .item-grid > .item-cob { grid-column: 1; }
    .item-grid > .item-price, .item-grid > .item-total { grid-column: 2 / -1; }
}

@media (max-width: 720px) {
    h1 { font-size: 24px; }
    .page-head { align-items: stretch; gap: 12px; }
    .head-actions:not(.doc-dock) { width: 100%; }
    .head-actions:not(.doc-dock) > .btn { flex: 1 1 auto; }
    .head-actions .search, .card-head .search { flex: 1 1 100%; }
    .search input { width: 100%; }

    /* resumo do painel: 2 por linha */
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .kpi { padding: 14px; gap: 6px; }
    .kpi strong { font-size: 24px; }
    .kpi small { font-size: 13px; line-height: 1.3; }
    .kpi-label { font-size: 13px; }
    .kpi.quota { grid-column: 1 / -1; }

    /* filtros em uma linha que rola para o lado */
    .card-head { padding: 14px 16px; }
    .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; width: calc(100% + 32px); -webkit-overflow-scrolling: touch; }
    .chips::-webkit-scrollbar { display: none; }
    .chip { flex: 0 0 auto; min-height: 40px; }

    /* listas viram cartões */
    .table.table-cards { min-width: 0; }
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody { display: block; }
    .table-cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 14px 16px; border-top: 1px solid #eef2f7; position: relative; }
    .table-cards tbody tr:first-child { border-top: 0; }
    .table-cards td { display: block; padding: 0 !important; border: 0; grid-column: 1 / -1; text-align: left !important; white-space: normal; }
    .table-cards td.card-title { grid-column: 1; grid-row: 1; font-size: 16px; }
    .table-cards td.card-side { grid-column: 2; grid-row: 1; text-align: right !important; }
    .table-cards td.card-muted { color: var(--muted); font-size: 15px; }
    .table-cards td[data-label] { display: inline-flex; flex-wrap: wrap; gap: 0 6px; grid-column: auto / span 1; font-size: 15px; }
    .table-cards td[data-label]::before { content: attr(data-label) ":"; color: var(--muted); font-weight: 600; }
    .table-cards td.card-full[data-label] { grid-column: 1 / -1; }
    .table-cards td.actions { width: auto; display: flex; gap: 8px; margin-top: 6px; }
    .table-cards td.actions .icon-btn { flex: 1 1 0; width: auto; height: 44px; gap: 8px; border: 1px solid var(--line-2); border-radius: 10px; font: 600 15px var(--font); }
    .table-cards .m-label { display: inline; }
    /* o cartão inteiro abre o item (área de toque grande) */
    .table-cards a.card-link::after { content: ""; position: absolute; inset: 0; }
    .table-cards td.actions, .table-cards td.card-side { position: relative; z-index: 1; }
    .table-cards tbody tr:active { background: #f1f5fa; }
    .table-wrap { overflow-x: visible; }
    .table:not(.table-cards) { min-width: 0; }
    .card-foot { padding: 12px 16px; }

    /* formulários: campos curtos lado a lado */
    .grid { gap: 14px 12px; }
    .m-3 { grid-column: span 3 !important; } .m-4 { grid-column: span 4 !important; }
    .m-6 { grid-column: span 6 !important; } .m-8 { grid-column: span 8 !important; } .m-9 { grid-column: span 9 !important; }
    .card-pad { padding: 18px 16px; }
    .step h2 { font-size: 18px; }
    .totals { min-width: 0; width: 100%; }
    .items-foot .btn { width: 100%; }
    .module-grid { grid-template-columns: minmax(0, 1fr); }

    /* documento (pré-visualização) */
    .paper { padding: 16px 12px; border-radius: 10px; }
    .paper .doc { font-size: 9.5pt; }
    .paper .d-parties, .paper .d-parties tbody, .paper .d-parties tr, .paper .d-parties td,
    .paper .d-sign, .paper .d-sign tbody, .paper .d-sign tr, .paper .d-sign td { display: block; width: auto !important; }
    .paper .d-party-gap { display: none; }
    .paper .d-parties td + td + td { margin-top: 8px; }
    .paper .d-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .paper .d-totals { width: 100%; }
    .paper .d-head td { display: block; text-align: left !important; }
    .paper .d-meta { margin-top: 8px; }
    .preview-bar { flex-direction: column; align-items: flex-start; }
}

/* toque: alvos de pelo menos 44 px */
@media (pointer: coarse) {
    .icon-btn { width: 44px; height: 44px; }
    .btn-sm { min-height: 44px; }
    .check { min-height: 44px; }
    .back { min-height: 40px; }
    .clause-block summary { min-height: 56px; }
}

/* Fechar contrato (proposta → contrato → assinatura) */
.next-step { border: 2px solid var(--teal); box-shadow: 0 8px 30px rgba(0, 201, 167, .12); }
.next-step h2 { display: flex; align-items: center; gap: 8px; }
.next-step h2 svg { color: var(--teal-dark); }
fieldset.plain { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chips-check { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check span { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--white); font-size: 14px; font-weight: 600; color: #3d4b5f; }
.chip-check span svg { display: none; }
.chip-check input:checked + span { background: #e0f7f2; border-color: var(--teal); color: #0b5a48; }
.chip-check input:checked + span svg { display: inline; }
.chip-check input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 2px; }
.signer-mini { display: flex; flex-direction: column; gap: 6px; }
.signer-mini .label { margin: 0; font-size: 14px; }
details.more { border-top: 1px solid var(--line); padding-top: 8px; }
details.more > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-weight: 600; color: var(--teal-dark); font-size: 15px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; display: inline-block; width: 20px; font-size: 18px; }
details.more[open] > summary::before { content: "−"; }
@media (pointer: coarse) { .chip-check span { min-height: 44px; } }

/* SLA editável no celular: cada prioridade vira um bloco (sem rolagem lateral) */
@media (max-width: 720px) {
    .table-sla, .table-sla tbody { display: block; min-width: 0 !important; width: 100%; }
    .table-sla thead { display: none; }
    .table-sla tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px 10px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fbfcfe; }
    .table-sla td { display: flex; flex-direction: column; gap: 4px; padding: 0 !important; border: 0 !important; min-width: 0; }
    .table-sla td[data-label]::before { content: attr(data-label); font-size: 13px; font-weight: 600; color: var(--muted); }
    .table-sla td.sla-p { grid-column: 1 / 3; grid-row: 1; }
    .table-sla td.actions { grid-column: 3; grid-row: 1; width: auto; justify-content: flex-end; align-items: flex-end; }
    .table-sla td.sla-d { grid-column: 1 / -1; }
    .table-sla td.sla-r { grid-column: 1; }
    .table-sla td.sla-s { grid-column: 2 / -1; }
    .table-sla input { min-width: 0; width: 100%; }
    .sla-editor .table-wrap { overflow: visible; }
    .row-actions .btn { flex: 1 1 100%; }
}

/* rede de segurança: nada do conteúdo empurra a página para o lado */
@media (max-width: 900px) {
    html, body { overflow-x: hidden; max-width: 100%; }
    .main, .card, .split-main, .split-side { min-width: 0; max-width: 100%; }
    input, select, textarea { max-width: 100%; }
}

/* rodapé do documento: secundários compactos (ícone + legenda), principal ocupa o resto */
@media (max-width: 900px) {
    .doc-dock .btn { min-width: 0; white-space: nowrap; }
    .doc-dock .btn:not(.dock-main) { flex: 0 0 64px; flex-direction: column; gap: 2px; padding: 0 4px; font-size: 11px; min-height: 52px; border-color: transparent; background: transparent; }
    .doc-dock .btn:not(.dock-main) svg { width: 20px; height: 20px; }
    .doc-dock .dock-main { flex: 1 1 auto; min-height: 52px; overflow: hidden; text-overflow: ellipsis; }
}
