/*
 * CLIMAOS — SEGURANÇA E LGPD
 * Folha de estilos. Não contém dados pessoais nem regras de segurança
 * (toda regra de segurança é aplicada no servidor).
 */
:root {
    --bg: #f4f7fb; --card: #ffffff; --text: #14202e; --muted: #5a6b7d;
    --primary: #0b6bcb; --primary-text: #ffffff; --border: #d4dde8;
    --ok-bg: #e5f4e4; --ok: #1d6b2a; --err-bg: #fbebeb; --err: #a11d1d; --warn-bg: #f9eeda; --warn: #7a5200;
}
@media (prefers-color-scheme: dark) {
    :root { --bg: #0f1722; --card: #182333; --text: #e9eff6; --muted: #9fb0c2; --primary: #4aa3ff; --primary-text: #08111c; --border: #2b3a4f;
        --ok-bg: #173322; --ok: #8fe0a0; --err-bg: #3a1a1a; --err: #ffb0b0; --warn-bg: #3a2e12; --warn: #ffd98a; }
}
* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; }
.topbar { padding: 14px 16px; background: var(--card); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 1.15rem; }
.brand-mark { color: var(--primary); }
.container { max-width: 560px; margin: 0 auto; padding: 20px 16px 40px; }
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 6px; }
label { font-weight: 600; margin-top: 10px; }
input[type=text], input[type=tel], input[type=password] {
    width: 100%; min-height: 50px; padding: 12px 14px; font-size: 1rem; color: var(--text);
    background: var(--card); border: 2px solid var(--border); border-radius: 12px;
}
input:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.pw { display: flex; gap: 8px; }
.pw input { flex: 1; }
.pw-toggle { min-width: 92px; border: 2px solid var(--border); background: var(--card); color: var(--text); border-radius: 12px; font-size: .95rem; }
.btn { min-height: 52px; margin-top: 16px; border: 0; border-radius: 12px; font-size: 1.05rem; font-weight: 700; cursor: pointer; padding: 0 18px; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-secondary { background: transparent; color: var(--text); border: 2px solid var(--border); width: 100%; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 24px; height: 24px; margin-top: 2px; flex: none; }
.notices { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 4px 16px 14px; margin-top: 16px; }
.notices ol { padding-left: 20px; margin: 8px 0; }
.notices li { margin-bottom: 6px; }
.alert { padding: 12px 14px; border-radius: 12px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.field-error { color: var(--err); margin: 2px 0 0; font-size: .92rem; }
.field-error::before { content: "⚠ "; }
.links { margin-top: 18px; }
a { color: var(--primary); }
.plan { padding: 12px 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--card); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 108px; background: var(--card); border: 2px solid var(--border); border-radius: 16px; font-weight: 700; text-align: center; padding: 10px; }
.tile-icon { font-size: 1.8rem; }
.tile-soon { opacity: .6; }
.tile small { font-weight: 500; color: var(--muted); }
.logout { margin-top: 24px; }
.checks { list-style: none; padding: 0; }
.checks li { padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; }
.checks .ok { background: var(--ok-bg); color: var(--ok); }
.checks .fail { background: var(--err-bg); color: var(--err); }
.legal h2 { margin-top: 22px; }
.footer { text-align: center; padding: 20px 16px 32px; color: var(--muted); font-size: .9rem; }
.btn-block { display: flex; align-items: center; justify-content: center; text-decoration: none; width: 100%; }
.hint { color: var(--muted); font-size: .92rem; margin: 2px 0 0; }
.steps { padding-left: 22px; }
.steps li { margin-bottom: 8px; }
.legal .btn-secondary { margin: 8px 0 16px; }
a.tile { color: var(--text); text-decoration: none; }
a.tile:active { transform: scale(.98); }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 10px; font-size: .82rem; font-weight: 600; color: var(--text); text-decoration: none; min-height: 60px; justify-content: center; }
.bottomnav a span { font-size: 1.35rem; }
body:has(.bottomnav) .footer { padding-bottom: 96px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin: 12px 0; }
.toolbar form { flex: 1; display: flex; gap: 8px; }
.toolbar input[type=search] { flex: 1; min-height: 50px; padding: 12px 14px; font-size: 1rem; color: var(--text); background: var(--card); border: 2px solid var(--border); border-radius: 12px; }
.btn-small { min-height: 50px; margin-top: 0; padding: 0 14px; display: inline-flex; align-items: center; text-decoration: none; }
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.card { display: block; background: var(--card); border: 2px solid var(--border); border-radius: 14px; padding: 14px 16px; color: var(--text); text-decoration: none; }
.card strong { display: block; font-size: 1.05rem; }
.card small { color: var(--muted); }
.meta { color: var(--muted); }
.details { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 6px 16px; margin: 12px 0; }
.details dt { font-weight: 700; margin-top: 10px; }
.details dd { margin: 2px 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.actions .btn { margin-top: 0; display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; }
.btn-danger { background: transparent; color: var(--err); border: 2px solid var(--err); }
textarea, select, input[type=date], input[type=time], input[type=number] { width: 100%; min-height: 50px; padding: 12px 14px; font-size: 1rem; font-family: inherit; color: var(--text); background: var(--card); border: 2px solid var(--border); border-radius: 12px; }
textarea { min-height: 96px; resize: vertical; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
h2.section { margin: 22px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.w-auto { width: auto; }
.mt0 { margin-top: 0; }
.mt { margin-top: 16px; }
/* Etapa 3: agenda e ordens de serviço */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 > div { min-width: 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid var(--border); }
.badge-scheduled { background: var(--card); color: var(--text); }
.badge-confirmed { background: var(--ok-bg); color: var(--ok); }
.badge-done { background: var(--ok-bg); color: var(--ok); }
.badge-canceled { background: var(--err-bg); color: var(--err); }
.card-off { opacity: .6; }
.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.status-row form { margin: 0; }
.status-row .btn { width: auto; }
.checklist { border: 2px solid var(--border); border-radius: 12px; padding: 12px; margin: 16px 0; }
.checklist legend { font-weight: 700; padding: 0 6px; }
.checks .skip { color: var(--muted); }
.pre { white-space: pre-wrap; }
.amount { font-size: 1.2rem; font-weight: 700; }
.today a { display: block; padding: 12px 14px; background: var(--card); border: 2px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; }
.plain { list-style: none; padding: 0; margin: 6px 0 0; }
.plain li { padding: 4px 0; }
.doc-head h1 { margin-bottom: 4px; }
@media print {
    .topbar, .bottomnav, .footer, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
    .container { max-width: none; padding: 0; }
    .details dt, .details dd, .checks li { color: #000; }
}
.row2 > div { display: flex; flex-direction: column; gap: 6px; }
.checklist input[type=text] { display: block; margin-top: 10px; }
/* Etapa 4: orçamentos e PDF */
.items { border: 2px solid var(--border); border-radius: 12px; padding: 12px; margin: 16px 0; display: flex; flex-direction: column; gap: 6px; }
.items legend { font-weight: 700; padding: 0 6px; }
.item-row { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.label { font-weight: 600; margin-top: 10px; }
.subtotal { display: flex; align-items: center; min-height: 50px; font-weight: 700; }
.total-line { font-size: 1.15rem; margin: 8px 0 0; }
.items-table { width: 100%; border-collapse: collapse; margin: 12px 0; background: var(--card); border-radius: 12px; overflow: hidden; }
.items-table th, .items-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.items-table .num { text-align: right; white-space: nowrap; }
.items-table tfoot th { font-size: 1.1rem; }
.badge-b-draft { background: var(--card); color: var(--text); }
.badge-b-sent { background: var(--warn-bg); color: var(--warn); }
.badge-b-approved { background: var(--ok-bg); color: var(--ok); }
.badge-b-rejected { background: var(--err-bg); color: var(--err); }
/* Etapa 5: histórico e lembretes */
.reminder { display: flex; flex-direction: column; gap: 4px; }
.reminder-late { border-color: var(--err); }
.mini-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.mini-actions form { margin: 0; }
.mini-actions .btn { width: auto; margin-top: 0; }
.today-box { padding: 12px 14px; background: var(--card); border: 2px solid var(--border); border-radius: 12px; }
.today-box.late { border-color: var(--err); color: var(--err); }
.timeline { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 10px; }

/* App instalável (PWA) */
[hidden] { display: none !important; }
.install { margin: 12px 0; }
.install .btn { margin-top: 8px; }
.link-btn { background: none; border: 0; padding: 10px 0 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: .92rem; cursor: pointer; }
.offline-tips li { margin-bottom: 10px; }
@media (display-mode: standalone) { .topbar { padding-top: calc(14px + env(safe-area-inset-top)); } }
.install .hint strong { display: inline; font-size: inherit; }
