/* =====================================================================
   QualyService — design system do painel
   Faixas: computador (≥1181px) · tablet (861–1180px) · celular (≤860px)
   Componentes valem em todas as larguras; os blocos @media no fim só
   ajustam layout. Nenhuma tela deve rolar para o lado.
   ===================================================================== */

/* ---------- 1. Tokens ---------- */
/* Visual técnico: cantos quase retos, sem sombras nem degradês, cabeçalhos em faixa cinza. */
:root {
    --navy: #0e2a4d;
    --navy-900: #0a1f3a;
    --navy-700: #183b66;
    --primary: #1668c9;
    --primary-dark: #0f539f;
    --primary-light: #eaf2fc;
    --primary-ring: rgba(22, 104, 201, .22);

    --bg: #eceff3;
    --surface: #ffffff;
    --surface-2: #f4f6f8;
    --head: #e3e8ee;
    --border: #d3d9e1;
    --border-strong: #aeb8c6;
    --text: #101828;
    --text-2: #344054;
    --text-muted: #667085;

    --success: #0f7b53;
    --success-light: #e6f5ee;
    --amber: #b25e09;
    --amber-light: #fdf1df;
    --danger: #c42b22;
    --danger-light: #fdecea;
    --info: #0b679e;
    --info-light: #e5f2fa;
    --purple: #6c3fc4;
    --purple-light: #f1ecfc;

    --radius-sm: 3px;
    --radius: 4px;
    --radius-lg: 4px;
    --shadow-xs: none;
    --shadow: none;
    --shadow-lg: 0 4px 16px rgba(10, 31, 58, .22);

    --sidebar-w: 252px;
    --topbar-h: 58px;
    --tabbar-h: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Apelidos usados pelas telas mais antigas */
    --qs-navy: var(--navy);
    --qs-navy-deep: var(--navy-900);
    --qs-blue: var(--primary);
    --qs-blue-dark: var(--primary-dark);
    --qs-blue-light: var(--primary-light);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1 { font-size: 22px; font-weight: 700; margin: 0 0 2px; line-height: 1.25; color: var(--navy); }
h2 { font-size: 15px; font-weight: 700; margin: 0; color: var(--navy); }
h3 { font-size: 15px; font-weight: 600; }
img { max-width: 100%; }
code { background: #eef1f5; padding: 2px 6px; border-radius: 4px; font-size: 12.5px; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hidden { display: none !important; }
@media (min-width: 861px) { .mobile-only { display: none !important; } }
.muted-text { color: var(--text-muted); font-weight: 400; }

.i {
    width: 20px; height: 20px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
}

.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 100;
    background: var(--navy); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; color: #fff; }

/* ---------- 3. Estrutura do app ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; }
/* Conteúdo ocupa toda a largura da tela; só o quadro de assinatura e as janelas têm largura própria. */
.container { margin: 0; padding: 28px 32px 64px; }

/* Barra lateral (computador/tablet) */
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    background: var(--navy);
    border-right: 1px solid var(--navy-900);
    color: #c2cee0;
    padding: 18px 0 14px;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 20px 18px; margin-bottom: 6px; border-bottom: 1px solid rgba(255, 255, 255, .1); color: #fff; }
.sidebar-brand:hover { color: #fff; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-grupo {
    display: block; padding: 18px 22px 6px;
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #7f94b2;
}
.nav-grupo:first-child { padding-top: 2px; }
.sidebar-nav a {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    min-height: 40px; padding: 9px 22px 9px 18px;
    border-left: 4px solid transparent;
    color: #c2cee0; font-size: 14px; font-weight: 500;
}
.sidebar-nav a .i { width: 19px; height: 19px; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sidebar-nav a.active { background: var(--navy-900); border-left-color: #5aa9f5; color: #fff; font-weight: 600; }
.sidebar-nav a.active .i { opacity: 1; color: #fff; }

.sidebar-footer {
    display: flex; align-items: center; gap: 6px;
    margin-top: 12px; padding: 12px 14px 0;
    border-top: 1px solid rgba(255, 255, 255, .1);
}
.sidebar-user {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 10px;
    padding: 7px 8px; border-radius: var(--radius-sm); color: #fff;
}
.sidebar-user:hover, .sidebar-user.active { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-user-txt { min-width: 0; line-height: 1.3; }
.sidebar-user-txt strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-txt small { display: block; font-size: 12px; color: #8ea3bf; }
.sidebar-sair {
    width: 38px; height: 38px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: var(--radius-sm); color: #8ea3bf;
}
.sidebar-sair:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-sair .i { width: 19px; height: 19px; }

.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--primary); color: #fff;
    font-weight: 600; font-size: 13.5px;
}
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }

/* Marca */
.qs-mark {
    width: 54px; height: 54px; border-radius: 15px; flex-shrink: 0;
    background: #fff; display: grid; place-items: center;
}
.qs-mark svg { width: 34px; height: 34px; }
.qs-mark-sidebar { width: 36px; height: 36px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .08); }
.qs-mark-sidebar svg { width: 26px; height: 26px; }

/* Elementos só do celular (escondidos no computador) */
.mobile-topbar, .tabbar, .sheet, .sheet-fundo { display: none; }

/* ---------- 4. Cabeçalho de página ---------- */
.page-head {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: 16px; flex-wrap: wrap;
    margin-bottom: 22px; padding-bottom: 12px;
    border-bottom: 2px solid var(--navy);
}
.page-head > div:first-child { min-width: 0; }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin: 2px 0 0; }
.section-heading {
    display: flex; align-items: center; gap: 8px;
    margin: 28px 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--navy);
}
.link-more { margin: -6px 0 0; font-size: 13.5px; font-weight: 500; }
.link-more a { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- 5. Cartões ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-xs);
    margin-bottom: 20px;
}
.card > h2:first-child, .card-title { margin: 0 0 16px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush table.grid { margin: 0; }

/* ---------- 6. Botões ---------- */
.btn, button, input[type=submit] {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 9px 16px;
    background: var(--primary); color: #fff;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 14px; line-height: 1.2; font-family: inherit;
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover, button:hover, input[type=submit]:hover { background: var(--primary-dark); color: #fff; }
.btn .i, button .i { width: 18px; height: 18px; }
.btn-ghost, button.btn-ghost {
    background: var(--surface); color: var(--text-2);
    border-color: var(--border-strong);
}
.btn-ghost:hover, button.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.perigo, button.perigo { background: var(--surface); color: var(--danger); border-color: #f3c3bf; }
.btn.perigo:hover { background: var(--danger-light); color: var(--danger); }
.btn:disabled, button:disabled { background: #d0d5dd; border-color: transparent; color: #fff; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-bloco { width: 100%; }

.link-btn {
    background: none; border: 0; box-shadow: none; min-height: 0; padding: 0;
    color: var(--danger); font-size: 13px; font-weight: 600; cursor: pointer;
}
.link-btn:hover { background: none; color: var(--danger); text-decoration: underline; }

/* Botões de ação em listas */
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form { display: inline-flex; margin: 0; }
.action-btn, button.action-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 34px; padding: 6px 12px;
    background: var(--surface); color: var(--text-2);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-weight: 600; font-size: 13px; line-height: 1.2; font-family: inherit;
    white-space: nowrap; cursor: pointer; box-shadow: none;
    transition: background-color .15s, border-color .15s, color .15s;
}
.action-btn svg {
    width: 16px; height: 16px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.action-btn:hover, button.action-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.action-btn-primary, button.action-btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.action-btn-primary:hover, button.action-btn-primary:hover { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.action-btn-danger, button.action-btn-danger { color: var(--danger); border-color: #f3c3bf; }
.action-btn-danger:hover, button.action-btn-danger:hover { background: var(--danger-light); color: var(--danger); border-color: #eea9a3; }

/* ---------- 7. Indicadores ---------- */
.stat-cards {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 8px;
    background: var(--border); border: 1px solid var(--border); border-top: 3px solid var(--navy);
}
.stat-card { display: flex; align-items: center; background: var(--surface); padding: 14px 18px; }
.stat-card > div { min-width: 0; display: flex; flex-direction: column-reverse; }
.stat-card strong { display: block; font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.stat-card small { display: block; color: var(--text-muted); font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 4px; }
.stat-icon { display: none; }
.stat-icon .i { width: 22px; height: 22px; }
.stat-icon-blue { background: var(--primary-light); color: var(--primary); }
.stat-icon-amber { background: var(--amber-light); color: var(--amber); }
.stat-icon-red { background: var(--danger-light); color: var(--danger); }
.stat-icon-green { background: var(--success-light); color: var(--success); }

/* ---------- 8. Selos (badges) ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: 2px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
    background: #eef1f5; color: var(--text-2);
    font-size: 11.5px; font-weight: 700; line-height: 1.5; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em;
}
.badge-ok { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-andamento { background: var(--info-light); color: var(--info); }
.badge-aguardando { background: var(--amber-light); color: var(--amber); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-neutral { background: #eef1f5; color: var(--text-muted); }
.badge-overlay { position: absolute; top: 8px; left: 8px; background: rgba(10, 31, 58, .78); color: #fff; }

/* ---------- 9. Alertas e avisos ---------- */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; margin: 0 0 16px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    font-size: 14px; font-weight: 500;
}
.alert-ok { background: var(--success-light); color: #0b5c3e; border-color: #bfe5d3; }
.alert-error { background: var(--danger-light); color: #8f1d17; border-color: #f6c6c1; }
.aviso-info {
    display: flex; gap: 11px;
    background: var(--primary-light); color: #1c4f86;
    border-radius: var(--radius-sm); padding: 14px;
    font-size: 13.5px; line-height: 1.5; margin-bottom: 16px;
}
.aviso-info svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.9; }
.banner-ok {
    display: flex; align-items: center; gap: 11px;
    background: var(--success-light); color: #0b5c3e;
    border-radius: var(--radius); padding: 15px; margin-bottom: 18px;
    font-size: 14px; font-weight: 600;
}
.banner-ok svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; }
.hint { color: var(--text-muted); font-size: 13px; margin: 10px 0 0; }
.help-box { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.help-box summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--primary); }
.help-box ol { margin: 12px 0 0; padding-left: 20px; font-size: 13.5px; line-height: 1.8; }
.sync-result { margin-top: 18px; padding: 16px; border-radius: var(--radius-sm); font-size: 14px; }
.sync-result-ok { background: var(--success-light); color: #0b5c3e; }
.sync-result-error { background: var(--danger-light); color: #8f1d17; }
.sync-stat { padding: 3px 0; }
.sync-errors { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; }

/* ---------- 10. Formulários ---------- */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid > * { min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }
/* Dados da OS: tipo, número e datas numa linha; cliente, responsável e status na outra */
.form-grid.os-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.os-grid > * { grid-column: span 3; }
.os-grid > .os-cliente { grid-column: span 6; }
.os-grid > .full { grid-column: 1 / -1; }
.form-grid label, .field-label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 13px; font-weight: 600; color: var(--text-2);
    overflow-wrap: anywhere;
}
.field-label { display: block; margin-bottom: 8px; }
.form-grid input, .form-grid textarea, .form-grid select,
.sign-name input, .lista-filtros input, .lista-filtros select, .lista-acoes select {
    width: 100%; min-width: 0; min-height: 42px;
    padding: 9px 12px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-weight: 400; font-size: 14px; line-height: 1.4; font-family: inherit;
    box-shadow: var(--shadow-xs);
    transition: border-color .15s, box-shadow .15s;
}
.form-grid textarea { min-height: 96px; resize: vertical; }
.form-grid select, .lista-filtros select {
    appearance: none; -webkit-appearance: none; padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; background-size: 16px;
}
.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus,
.sign-name input:focus, .lista-filtros input:focus, .lista-filtros select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-grid input::placeholder, .lista-filtros input::placeholder { color: #98a2b3; }
.form-grid input[readonly], .form-grid input:disabled, .form-grid select:disabled { background: var(--surface-2); color: var(--text-muted); }

.form-section-title {
    margin: 28px 0 16px; padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--primary);
}
.form-section-title:first-child { margin-top: 0; }

.checkbox-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.checkbox-grid .checkbox-item, label.checkbox-item {
    display: flex; flex-direction: row; align-items: center; gap: 10px;
    min-height: 44px; padding: 10px 12px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.checkbox-grid .checkbox-item:hover { border-color: var(--primary); }
.checkbox-grid .checkbox-item:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.checkbox-item input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; flex-shrink: 0; accent-color: var(--primary); box-shadow: none; }

/* Dropdown com checkboxes (serviços da OS) */
.multi-sel { position: relative; }
.multi-sel > summary {
    list-style: none; display: flex; align-items: center; min-height: 42px; padding: 9px 36px 9px 12px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center / 16px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 14px; color: var(--text); cursor: pointer;
}
.multi-sel > summary::-webkit-details-marker { display: none; }
.multi-sel > summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-sel[open] > summary, .multi-sel > summary:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); outline: none; }
.multi-sel.desabilitado > summary { background-color: var(--head); color: var(--text-muted); cursor: not-allowed; }
.multi-sel-painel {
    position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.multi-sel-painel input[type="search"] {
    display: block; width: calc(100% - 16px); margin: 8px; min-height: 38px; padding: 8px 10px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; font-size: 14px;
}
.multi-sel-lista { max-height: 320px; overflow-y: auto; padding: 0 4px 6px; }
.multi-sel-lista label.checkbox-item { min-height: 38px; padding: 7px 10px; border: 0; border-radius: var(--radius-sm); }
.multi-sel-lista label.checkbox-item:hover { background: var(--primary-light); }
.multi-sel-lista label.checkbox-item:has(input:checked) { font-weight: 600; }

.form-actions {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border);
}
.form-actions button, .form-actions .btn { min-height: 44px; padding: 11px 22px; }

/* ---------- 11. Tabelas ---------- */
.table-scroll { overflow-x: auto; }
.table-scroll table.grid { min-width: 720px; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 12px 16px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
table.grid th {
    background: var(--head); color: var(--text-2); border-bottom: 1px solid var(--border-strong);
    font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
table.grid tbody tr:hover { background: #fafbfd; }
table.grid tbody tr:last-child td { border-bottom: none; }
.empty-state { color: var(--text-muted); text-align: center; padding: 40px 20px !important; }

/* Tabelas de edição (transdutores, soldas): cada linha vira um cartão. */
.table-scroll-cards { overflow-x: visible; }
.table-scroll-cards table.grid { min-width: 0; }
table.table-cards thead { display: none; }
table.table-cards, table.table-cards > tbody { display: block; width: 100%; }
table.table-cards > tbody > tr { display: block; }
table.table-cards > tbody > tr:hover { background: none; }
table.table-cards > tbody > tr > td { display: block; width: 100%; border-bottom: none; padding: 0; }
table.table-cards .row-form {
    display: block; margin: 12px 16px; padding: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
table.table-cards .link-btn { margin: -4px 16px 8px; }
table.grid-inner, table.grid-inner tbody { display: block; width: 100%; border-collapse: collapse; }
table.grid-inner tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; align-items: end; }
table.grid-inner td { display: block; padding: 0; border: 0; }
table.grid-inner td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 4px;
    font-size: 11.5px; font-weight: 600; color: var(--text-muted);
}
table.grid-inner input, table.grid-inner select {
    width: 100%; min-height: 38px; padding: 8px 10px;
    border: 1px solid var(--border-strong); border-radius: 6px;
    font-weight: 400; font-size: 13.5px; line-height: 1.3; font-family: inherit;
}
table.grid-inner input:focus, table.grid-inner select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
table.grid-inner td.actions { grid-column: 1 / -1; justify-content: flex-end; }
table.grid-inner button { min-height: 36px; padding: 6px 12px; font-size: 13px; }

/* ---------- 12. Listas (OS, relatórios, clientes, usuários) ---------- */
.lista-topo {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin: 28px 0 10px;
}
.lista-topo h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; }
.lista-filtros { display: flex; gap: 8px; flex-wrap: wrap; }
.lista-filtros input {
    width: 280px; padding-left: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 12px center; background-size: 17px;
}
.lista-filtros select { width: auto; min-width: 180px; }

.lista {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    border-top: 3px solid var(--navy); overflow: hidden; margin-bottom: 20px;
}
.lista-item {
    display: grid;
    grid-template-columns: 44px minmax(150px, 1.3fr) minmax(150px, 1.3fr) 120px minmax(0, 1fr);
    grid-template-areas: "tag num cli data meta" "tag acoes acoes acoes acoes";
    gap: 10px 18px; align-items: center;
    padding: 12px 18px;
}
.lista-item + .lista-item, .lista-item + .lista-vazia { border-top: 1px solid var(--border); }
.lista-item:hover { background: #f6f8fb; }
.lista-tag {
    grid-area: tag; align-self: start;
    width: 44px; height: 44px; border-radius: 2px;
    display: grid; place-items: center;
    background: var(--cor, var(--navy)); color: #fff;
    font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.lista-num { grid-area: num; }
.lista-cli { grid-area: cli; }
.lista-data { grid-area: data; }
.lista-num, .lista-cli, .lista-data { display: flex; flex-direction: column; min-width: 0; font-size: 14px; }
.lista-num strong { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.lista-data span { font-variant-numeric: tabular-nums; }
.lista-cli small.lista-insp { display: flex; align-items: center; gap: 5px; margin-top: 2px; color: var(--navy); font-weight: 500; }
.lista-insp .i { width: 14px; height: 14px; flex-shrink: 0; color: var(--primary); }
.lista-cli small.lista-insp.vazio { color: var(--text-muted); font-weight: 400; }
.lista-insp.vazio .i { color: var(--text-muted); }
.lista-num small, .lista-cli small, .lista-data small {
    color: var(--text-muted); font-size: 12.5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lista-cli > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.lista-meta { grid-area: meta; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.lista-acoes { grid-area: acoes; display: flex; gap: 6px; flex-wrap: wrap; }
.lista-acoes select { width: auto; min-height: 34px; padding: 6px 10px; font-size: 13px; }
.lista-vazia { color: var(--text-muted); text-align: center; padding: 40px 20px; margin: 0; }
.lista > .lista-vazia:first-child { border-top: 0; }

.lista-usuarios .lista-item {
    grid-template-columns: 44px minmax(160px, 1.4fr) minmax(150px, 1fr) 140px auto;
    grid-template-areas: "tag num cli data acoes";
}
.lista-usuarios .lista-acoes, .lista-clientes .lista-acoes { justify-content: flex-end; }
.lista-clientes .lista-item {
    grid-template-columns: 44px minmax(160px, 1.4fr) minmax(140px, 1.2fr) minmax(120px, 1fr) auto auto;
    grid-template-areas: "tag num cli data meta acoes";
}

/* Chips de filtro (celular) */
.chip-filtros { display: none; gap: 8px; overflow-x: auto; padding: 2px 0 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip-filtros::-webkit-scrollbar { display: none; }
.chip, button.chip {
    flex-shrink: 0; min-height: 36px; padding: 7px 15px;
    background: var(--surface); color: var(--text-2);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; box-shadow: none;
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip.ativo, .chip.ativo:hover { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ---------- 13. Detalhes (OS, perfil) ---------- */
.info-rows { display: flex; flex-direction: column; }
.info-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-bottom: 1px solid #edf0f5; }
.info-row:first-child { padding-top: 4px; }
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-row .ir-icon {
    width: 24px; height: 38px; flex-shrink: 0;
    display: grid; place-items: center;
    color: var(--text-muted);
}
.info-row .ir-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.info-row .ir-body { flex: 1; min-width: 0; }
.info-row .ir-body small { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 1px; }
.info-row .ir-body strong { display: block; font-size: 14.5px; font-weight: 600; color: var(--text); line-height: 1.45; overflow-wrap: anywhere; }

.resumo-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid #edf0f5; font-size: 14px; }
.resumo-row:last-child { border-bottom: none; }
.resumo-row span { color: var(--text-muted); flex-shrink: 0; }
.resumo-row strong { font-weight: 600; text-align: right; }
.resumo-row strong.ok { color: var(--success); }

.arquivo-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 13px; margin-bottom: 9px;
}
.arquivo-row .ar-icon { width: 24px; height: 34px; flex-shrink: 0; display: grid; place-items: center; color: var(--text-muted); }
.arquivo-row .ar-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.arquivo-row .ar-body { flex: 1; min-width: 0; }
.arquivo-row .ar-body strong { display: block; font-size: 13.5px; font-weight: 600; }
.arquivo-row .ar-body small { color: var(--text-muted); font-size: 12px; }
.arquivo-row .ar-ok { color: var(--success); flex-shrink: 0; }
.arquivo-row .ar-ok svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.4; }

.stepper { display: flex; margin: 4px 0 22px; }
.stepper .st { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-align: center; }
.stepper .st .st-num { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--border-strong); color: #98a2b3; font-size: 13px; font-weight: 700; }
.stepper .st::before { content: ''; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--border-strong); }
.stepper .st:first-child::before { display: none; }
.stepper .st.feita .st-num, .stepper .st.atual .st-num { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper .st.atual { color: var(--navy); }
.stepper .st.feita::before { background: var(--primary); }

.perfil-topo { display: flex; align-items: center; gap: 16px; }
.perfil-topo strong { display: block; font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.perfil-avatar {
    width: 60px; height: 60px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--navy); color: #fff;
    font-size: 23px; font-weight: 700;
}
.perfil-sair { color: var(--danger) !important; border-color: #f3c3bf !important; }
.perfil-sair:hover { background: var(--danger-light) !important; }

/* Assinatura (cabeçalho de cartão com título + selo) */
.sign-card { max-width: 760px; }
.sign-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sign-name { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.sign-name input { font-size: 15px; }
.sign-pad { position: relative; margin-top: 8px; border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.sign-pad canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }
.sign-pad-hint { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: var(--text-muted); font-size: 13.5px; }
.sign-form .btn-row, .sign-card .btn-row { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.sign-form .btn-row .btn { flex: 1; }
.sign-done { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; background: var(--surface-2); text-align: center; }
.sign-done img { max-width: 100%; max-height: 130px; }

/* Imagens */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.image-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-xs); }
.image-card-thumb { position: relative; }
.image-card img { width: 100%; height: 160px; object-fit: cover; display: block; }
.image-meta { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 4px; font-size: 13px; }
.image-caption { color: var(--text-muted); font-size: 12px; }
.image-card form { padding: 0 12px 12px; }

.toolbar { display: flex; gap: 12px; align-items: center; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--border); }

/* ---------- 14. Escolha de modelo de laudo ---------- */
.modelo-grupo { margin: 22px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.modelo-grupo:first-of-type { margin-top: 0; }
.modelo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.modelo-card, button.modelo-card {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 8px;
    min-height: 104px; padding: 16px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    border-left: 4px solid var(--cor); text-align: left; white-space: normal;
    font-weight: 500;
}
.modelo-card:hover, button.modelo-card:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); border-left-color: var(--cor); }
.modelo-sigla {
    display: grid; place-items: center; min-width: 42px; height: 26px; padding: 0 8px; border-radius: 2px;
    background: var(--cor); color: #fff;
    font-size: 13px; font-weight: 700; line-height: 1;
}
.modelo-nome { font-size: 14px; font-weight: 600; line-height: 1.35; }
.modelo-tag { display: inline-block; vertical-align: middle; padding: 2px 8px; border-radius: 2px; background: var(--cor); color: #fff; font-size: 12px; font-weight: 700; }
h1 .modelo-tag { font-size: 14px; padding: 3px 9px; }

/* ---------- 15. Editor de laudo (laudo_editor.js) ---------- */
.le-sec, .card.le-sec { padding: 0; overflow: hidden; margin-bottom: 12px; }
.le-sec > summary {
    display: flex; justify-content: space-between; align-items: center;
    padding: 13px 20px; cursor: pointer; list-style: none;
    background: var(--surface-2); color: var(--navy);
    font-weight: 700; font-size: 14.5px;
}
.le-sec > summary::-webkit-details-marker { display: none; }
.le-sec > summary::after {
    content: ''; width: 18px; height: 18px; flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform .2s;
}
.le-sec[open] > summary { background: var(--head); border-bottom: 1px solid var(--border-strong); }
.le-sec[open] > summary::after { transform: rotate(180deg); }
.le-corpo { padding: 18px 20px 20px; }
.le-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
/* Campos do relatório: ocupam a largura toda e só descem de linha quando não cabem. */
.le-campos { display: flex; flex-wrap: wrap; gap: 16px; }
.le-campos > .le-largo { flex-basis: 100% !important; }
@media (max-width: 860px) { .le-campos > .le-campo { flex-basis: 100% !important; } }
.le-campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.le-largo { grid-column: 1 / -1; }
.le-campo label, .le-lab { font-size: 13px; font-weight: 600; color: var(--text-2); }
.le-campo label i { font-weight: 400; color: var(--text-muted); }
.le-campo input, .le-campo select, .le-campo textarea, .le-assin textarea, .le-assin select, .le-foto-ctl input {
    width: 100%; min-height: 44px; padding: 10px 12px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-weight: 400; font-size: 16px; line-height: 1.4; font-family: inherit;
}
.le-campo input:focus, .le-campo select:focus, .le-campo textarea:focus, .le-assin textarea:focus, .le-assin select:focus, .le-foto-ctl input:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring);
}
.le-campo textarea, .le-assin textarea { resize: vertical; }
.le-fixo { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; }
.le-opcoes { display: flex; flex-wrap: wrap; gap: 8px; }
.le-opc {
    display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 9px 12px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer;
}
.le-opc:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.le-opc input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--primary); }
.le-linha { margin-bottom: 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.le-linha .le-grade { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 12px; }
.le-linha-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.le-linha-topo span { display: flex; gap: 6px; }
.le-ico, button.le-ico {
    min-width: 40px; height: 40px; min-height: 40px; padding: 0;
    background: var(--surface); color: var(--text-2);
    border: 1px solid var(--border-strong); box-shadow: none; font-size: 16px;
}
.le-ico:hover, button.le-ico:hover { background: var(--primary-light); color: var(--primary-dark); }
.le-ico:disabled { opacity: .35; background: var(--surface); color: var(--text-2); }
.le-ico.perigo { color: var(--danger); }
.le-botoes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.le-botoes label.btn { cursor: pointer; }
.le-fotos { display: flex; flex-direction: column; gap: 10px; }
.le-foto { display: flex; gap: 12px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.le-foto img { width: 96px; height: 96px; flex: none; object-fit: cover; border-radius: 6px; background: #eef1f5; }
.le-foto-ctl { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.le-foto-ctl span { display: flex; gap: 6px; }
.le-croqui, .le-sig {
    min-height: 90px; display: grid; place-items: center; overflow: hidden;
    border: 2px dashed var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text-muted); font-size: 13.5px;
}
.le-croqui img { max-width: 100%; max-height: 280px; }
.le-sig img { max-height: 80px; max-width: 100%; }
.le-assin { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.le-assin:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.le-assin h4 { margin: 0; font-size: 14px; }
.le-cliente {
    display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap;
    margin-bottom: 14px; padding: 12px 14px;
    background: var(--primary-light); border: 1px solid #cfe1f7; border-radius: var(--radius-sm);
}
.le-cliente label { font-size: 13px; font-weight: 700; color: var(--primary-dark); }
.le-cliente select { flex: 1 1 220px; min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid #bcd4f2; border-radius: var(--radius-sm); font-weight: 400; font-size: 16px; font-family: inherit; background: var(--surface); }
.le-cliente a { font-size: 13px; font-weight: 600; white-space: nowrap; }
.le-acoes {
    position: sticky; bottom: 12px; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    margin-top: 8px; padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong); border-top: 3px solid var(--navy); border-radius: var(--radius);
}
.le-acoes .btn { margin-left: auto; min-height: 44px; padding: 11px 20px; }
.le-status { min-width: 0; font-size: 13px; font-weight: 600; color: var(--success); }
.le-status.erro { color: var(--danger); }
.le-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 14px; background: rgba(10, 31, 58, .55); }
.le-modal-box { width: 100%; max-width: 640px; padding: 20px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.le-modal-box h3 { margin: 0 0 6px; }
.le-toast {
    position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); z-index: 90; transform: translateX(-50%);
    max-width: 90vw; padding: 10px 18px; border-radius: var(--radius-sm);
    background: var(--navy); color: #fff; font-size: 14px; text-align: center; box-shadow: var(--shadow-lg);
}

/* ---------- 16. Início (celular): saudação e atalhos ---------- */
.app-greeting { margin: 4px 0 20px; }
.app-greeting h1 { font-size: 22px; margin: 0 0 4px; }
.app-greeting p { color: var(--text-muted); font-size: 14px; margin: 0; }
.app-greeting .ag-chip {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 12px; padding: 5px 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 12.5px; font-weight: 600; color: var(--navy);
}
.app-greeting .ag-chip svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.menu-card {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 10px; padding: 14px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.menu-card:hover { color: var(--text); border-color: var(--border-strong); }
.menu-card .mc-icon {
    width: 32px; height: 44px; flex-shrink: 0;
    display: grid; place-items: center;
    color: var(--navy);
}
.menu-card .mc-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu-card .mc-body { flex: 1; min-width: 0; }
.menu-card .mc-body strong { display: block; font-size: 15px; font-weight: 600; }
.menu-card .mc-body small { display: block; color: var(--text-muted); font-size: 13px; margin-top: 1px; }
.menu-card::after {
    content: ''; width: 18px; height: 18px; flex-shrink: 0; opacity: .5;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23344054' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.menu-card .mc-chevron { display: none; }
.menu-card-primary {
    background: var(--navy);
    border-color: var(--navy); color: #fff;
}
.menu-card-primary:hover { color: #fff; border-color: transparent; }
.menu-card-primary .mc-icon { color: #fff; }
.menu-card-primary .mc-body small { color: rgba(255, 255, 255, .85); }
.menu-card-primary::after { filter: invert(1); opacity: .8; }

.install-ios-hint { color: var(--text-muted); font-size: 12.5px; line-height: 1.5; margin: 8px 4px 4px; }

/* ---------- 17. Login ---------- */
body.is-guest { background: var(--surface); }
body.is-guest .container { max-width: none; margin: 0; padding: 0; }
/* Foto na tela inteira e, no centro, um cartão só com a logo e os campos. */
.login-screen {
    min-height: 100vh; display: flex; align-items: center; padding: 48px 24px;
    background-color: var(--navy-900);
    background-image:
        linear-gradient(160deg, rgba(10, 31, 58, .9) 0%, rgba(10, 31, 58, .78) 100%),
        var(--login-foto, linear-gradient(var(--navy-900), var(--navy-900)));
    background-size: cover; background-position: 72% center;
}
.login-wrap { width: 100%; max-width: 400px; margin: 0 auto; }
.login-box {
    width: 100%; padding: 36px 32px 28px;
    background: var(--surface); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(4, 14, 30, .45);
    display: flex; flex-direction: column;
}
.login-brand { margin-bottom: 28px; }
.login-brand .login-logo { max-width: 260px; margin: 0 auto; padding: 0; }
/* "Entrar" fica só para leitores de tela: o cartão já diz o que é. */
.login-titulo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.login-box form { display: flex; flex-direction: column; gap: 16px; }
.login-box label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.login-box .campo-icone { position: relative; display: block; width: 100%; }
.login-box .campo-icone > svg {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; pointer-events: none;
    fill: none; stroke: #98a2b3; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.login-box input {
    width: 100%; min-height: 46px; padding: 11px 14px 11px 42px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-weight: 400; font-size: 15px; font-family: inherit; color: var(--text);
    box-shadow: var(--shadow-xs);
}
.login-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.login-box button[type=submit] { min-height: 48px; margin-top: 6px; font-size: 15px; }
.ver-senha, button.ver-senha {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    min-height: 40px; padding: 8px 10px;
    background: none; border: 0; box-shadow: none; line-height: 0; cursor: pointer;
}
.ver-senha:hover { background: none; }
.ver-senha svg { width: 18px; height: 18px; fill: none; stroke: #98a2b3; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.login-box .campo-icone input#campo-senha { padding-right: 46px; }
.login-esqueci { display: block; margin-top: 16px; text-align: center; color: var(--primary); font-size: 14px; font-weight: 500; }
.login-aviso-senha { margin: 12px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; text-align: center; }
.login-secure { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12.5px; }
.login-secure svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--primary); stroke-width: 1.8; }
.login-secure b { display: block; color: var(--text-2); font-weight: 600; }
.ver-senha svg { width: 20px; height: 20px; fill: none; stroke: #98a2b3; stroke-width: 1.8; }

/* ---------- 18. Tablet: barra lateral vira trilho de ícones ---------- */
@media (min-width: 861px) and (max-width: 1180px) {
    :root { --sidebar-w: 76px; }
    .sidebar { padding: 16px 0 12px; }
    .sidebar-brand { justify-content: center; padding: 2px 0 16px; }
    .sidebar-user-txt, .sidebar-nav .txt { display: none; }
    .nav-grupo { font-size: 0; padding: 0; margin: 10px 8px; border-top: 1px solid rgba(255, 255, 255, .1); }
    .nav-grupo:first-child { display: none; }
    .sidebar-brand { border-bottom: 0; }
    .sidebar-nav a { justify-content: center; padding: 11px 0; }
    .sidebar-nav a .i { width: 21px; height: 21px; }
    .sidebar-footer { padding: 12px 8px 0; }
    .sidebar-footer { flex-direction: column; }
    .sidebar-user { flex: none; padding: 6px; }
    .container { padding: 28px 24px 56px; }
    .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .os-grid > * { grid-column: span 6; }
    .os-grid > .os-cliente { grid-column: 1 / -1; }
    .lista-filtros input { width: 220px; }
}

/* Telas largas: cada relatório numa única linha */
@media (min-width: 1440px) {
    .lista-item {
        grid-template-columns: 44px minmax(150px, 1.2fr) minmax(150px, 1.3fr) 120px auto auto;
        grid-template-areas: "tag num cli data meta acoes";
    }
    .lista-acoes { justify-content: flex-end; flex-wrap: nowrap; }
}

/* ---------- 19. Celular: visual de aplicativo ---------- */
@media (max-width: 860px) {
    body { font-size: 15px; }
    .desktop-only, .so-telas-grandes { display: none !important; }
    .app-shell { display: block; }
    .sidebar { display: none; }
    .app-main { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); }
    .container { padding: 18px 16px 28px; }

    /* Barra superior */
    .mobile-topbar {
        position: sticky; top: 0; z-index: 30;
        display: flex; align-items: center; gap: 8px;
        min-height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) 12px 0;
        background: var(--navy); color: #fff;
        border-bottom: 1px solid var(--navy-900);
    }
    .mt-icon-btn, button.mt-icon-btn {
        width: 40px; height: 40px; min-height: 40px; padding: 0; flex-shrink: 0;
        display: grid; place-items: center;
        background: transparent; color: #fff; border: 0; border-radius: var(--radius-sm); box-shadow: none;
    }
    .mt-icon-btn:hover, button.mt-icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
    .mt-icon-btn .i { width: 23px; height: 23px; }
    .mt-icon-btn[hidden] { display: none; }
    .mt-title { flex: 1; min-width: 0; font-size: 16.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .mt-brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding-left: 4px; }
    .mt-avatar {
        width: 36px; height: 36px; flex-shrink: 0; margin-left: 2px;
        display: grid; place-items: center; border-radius: 50%;
        background: rgba(255, 255, 255, .14); color: #fff;
        font-size: 14px; font-weight: 600;
    }
    .mt-avatar:hover { color: #fff; background: rgba(255, 255, 255, .22); }

    /* Barra de abas inferior */
    .tabbar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
        display: grid; grid-template-columns: repeat(4, 1fr);
        height: calc(var(--tabbar-h) + var(--safe-bottom));
        padding: 6px 6px var(--safe-bottom);
        background: var(--surface);
        border-top: 1px solid var(--border-strong);
    }
    .tabbar a, .tabbar button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        min-height: 0; padding: 4px 2px;
        background: none; border: 0; border-radius: 0; box-shadow: none;
        color: #8a94a6; font-weight: 600; font-size: 11px; line-height: 1.1; font-family: inherit;
    }
    .tabbar a:hover, .tabbar button:hover { background: none; color: var(--text-2); }
    .tabbar .i { width: 24px; height: 24px; stroke-width: 1.7; }
    .tabbar .active, .tabbar .active:hover { color: var(--primary); }
    .tabbar .active .i { stroke-width: 2; }

    /* Gaveta "Menu" */
    .sheet-fundo { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(10, 31, 58, .45); animation: qs-fade .18s ease-out; }
    .sheet {
        display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
        max-height: 86vh; overflow-y: auto; overscroll-behavior: contain;
        padding: 8px 14px calc(16px + var(--safe-bottom));
        background: var(--bg); border-radius: 6px 6px 0 0;
        box-shadow: 0 -12px 40px rgba(10, 31, 58, .2);
        animation: qs-sobe .22s cubic-bezier(.2, .8, .2, 1);
    }
    .sheet.hidden, .sheet-fundo.hidden { display: none !important; }
    body.sheet-aberta { overflow: hidden; }
    .sheet-alca { display: block; width: 40px; height: 4px; margin: 2px auto 12px; border-radius: 4px; background: var(--border-strong); }
    .sheet-user {
        display: flex; align-items: center; gap: 12px;
        padding: 12px 14px; margin-bottom: 4px;
        background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        color: var(--text);
    }
    .sheet-user:hover { color: var(--text); }
    .sheet-user > span:nth-child(2) { flex: 1; min-width: 0; }
    .sheet-user strong { display: block; font-size: 15px; font-weight: 600; }
    .sheet-user small { display: block; color: var(--text-muted); font-size: 13px; }
    .sheet-grupo { display: block; padding: 16px 6px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
    .sheet-lista { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
    .sheet-lista + .sheet-lista { margin-top: 12px; }
    .sheet-lista > a, .sheet-lista > button {
        display: flex; align-items: center; gap: 12px; width: 100%;
        min-height: 52px; padding: 8px 14px;
        background: none; border: 0; border-radius: 0; box-shadow: none;
        color: var(--text); font-weight: 500; font-size: 15px; font-family: inherit; text-align: left;
    }
    .sheet-lista > a + a, .sheet-lista > a + button, .sheet-lista > button + a { border-top: 1px solid #edf0f5; }
    .sheet-lista > a:hover, .sheet-lista > button:hover { background: var(--surface-2); color: var(--text); }
    .sheet-lista > a.active { color: var(--primary); font-weight: 600; }
    .sheet-ico { width: 28px; height: 34px; flex-shrink: 0; display: grid; place-items: center; color: var(--navy); }
    .sheet-ico .i { width: 19px; height: 19px; }
    .sheet-seta { width: 18px; height: 18px; margin-left: auto; color: #98a2b3; }
    .sheet-install[hidden] { display: none; }
    .sheet-install .install-ios-hint { padding: 0 12px 10px; margin: 0; }
    .sheet-sair, .sheet-sair:hover { color: var(--danger) !important; }
    .sheet-sair .sheet-ico { color: var(--danger); }

    /* Tipografia e cabeçalhos */
    h1 { font-size: 21px; }
    .page-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 18px; }
    .page-head .btn { width: 100%; min-height: 46px; }
    .page-subtitle { font-size: 14px; }
    .section-heading { margin: 26px 0 10px; }
    .card { padding: 18px 16px; border-radius: var(--radius); }

    /* Botões maiores para o dedo */
    .btn, button, input[type=submit] { min-height: 46px; padding: 12px 18px; font-size: 15px; }
    .form-actions { flex-direction: column; align-items: stretch; }
    .form-actions button, .form-actions .btn { width: 100%; min-height: 50px; }

    /* Formulários em uma coluna, fonte 16px (evita zoom no iOS) */
    .form-grid { grid-template-columns: 1fr; gap: 16px; }
    .os-grid > *, .os-grid > .os-cliente { grid-column: 1 / -1; }
    .form-grid input, .form-grid textarea, .form-grid select, .sign-name input,
    .lista-filtros input, .lista-filtros select { min-height: 48px; font-size: 16px; }
    .checkbox-grid { grid-template-columns: 1fr; }
    .checkbox-grid .checkbox-item { min-height: 50px; }

    /* Indicadores */
    .stat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-card { padding: 12px 14px; }
    .stat-card strong { font-size: 24px; }

    /* Listas viram cartões */
    .lista-topo { display: block; margin: 22px 0 10px; }
    .lista-topo h2 { margin-bottom: 12px; }
    .lista-filtros { width: 100%; margin-bottom: 12px; }
    .lista-filtros input { flex: 1 1 100%; width: auto; }
    .lista-filtros select { display: none; }
    .chip-filtros { display: flex; }
    .lista { background: none; border: 0; overflow: visible; }
    .lista-item, .lista-usuarios .lista-item, .lista-clientes .lista-item {
        grid-template-columns: 44px minmax(0, 1fr);
        grid-template-areas: "tag num" "tag cli" "tag data" "meta meta" "acoes acoes";
        gap: 4px 12px; padding: 14px;
        margin-bottom: 10px;
        background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    }
    .lista-item + .lista-item { border-top: 1px solid var(--border); }
    .lista-item:hover { background: var(--surface); }
    .lista-usuarios .lista-item { grid-template-areas: "tag num" "tag cli" "tag data" "acoes acoes"; }
    .lista-num strong { font-size: 15.5px; }
    .lista-meta { justify-content: flex-start; margin-top: 6px; }
    .lista-acoes { margin-top: 8px; gap: 8px; }
    .lista-acoes .action-btn, .lista-acoes .inline-form { flex: 1 1 auto; }
    .lista-acoes .inline-form .action-btn { width: 100%; }
    .lista-acoes .action-btn { min-height: 42px; font-size: 13.5px; }
    .lista-vazia { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
    table.table-cards .row-form { margin: 10px; }
    .actions { flex-wrap: wrap; }

    /* Escolha de modelo vira lista */
    .modelo-grupo { margin: 20px 0 10px; }
    .modelo-cards { display: block; }
    .modelo-card, button.modelo-card {
        flex-direction: row; align-items: center; gap: 12px;
        width: 100%; min-height: 64px; margin-bottom: 10px; padding: 12px 14px;
    }
    .modelo-card .modelo-sigla { width: 44px; height: 32px; flex-shrink: 0; }
    .modelo-card .modelo-nome { flex: 1; min-width: 0; font-size: 15px; }
    .modelo-card::after {
        content: ''; width: 18px; height: 18px; flex-shrink: 0; opacity: .5;
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23344054' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
    }

    /* Editor de laudo */
    .le-sec > summary { padding: 15px 16px; }
    .le-corpo { padding: 16px; }
    .le-grade { grid-template-columns: 1fr; }
    .le-linha .le-grade { grid-template-columns: 1fr 1fr; }
    .le-acoes { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px); flex-wrap: wrap; }
    .le-acoes .btn { width: 100%; margin-left: 0; }

    /* Assinatura e perfil */
    .sign-form .btn-row { flex-direction: column; }
    .perfil-topo { padding: 18px 16px; }

    /* Login */
    body.is-guest { background: var(--navy-900); }
    .login-screen {
        display: flex; flex-direction: column; justify-content: center;
        min-height: 100vh; min-height: 100dvh;
        padding: calc(32px + env(safe-area-inset-top, 0px)) 24px calc(28px + var(--safe-bottom));
        background-color: var(--navy-900);
        background-image:
            linear-gradient(175deg, rgba(10, 31, 58, .9) 0%, rgba(14, 42, 77, .86) 50%, rgba(10, 31, 58, .96) 100%),
            var(--login-foto, none);
        background-size: cover; background-position: 72% center;
    }
    .login-wrap { max-width: 430px; }
    .login-box { padding: 0; max-width: 430px; background: none; box-shadow: none; border-radius: 0; }
    .login-secure { border-top: 0; padding-top: 0; }
    .login-brand { margin-bottom: 30px; }
    .login-brand-image { display: block; width: 100%; max-width: 320px; height: auto; object-fit: contain; object-position: left center; }
    .login-box form { gap: 12px; }
    .login-box label { gap: 0; font-size: 0; color: transparent; }
    .login-box .campo-icone > svg { stroke: #8ba3c2; }
    .login-box .campo-icone input {
        min-height: 52px; padding: 14px 48px 14px 46px;
        background: rgba(255, 255, 255, .1); color: #fff;
        border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--radius-sm);
        font-size: 16px; box-shadow: none;
    }
    .login-box .campo-icone input::placeholder { color: #8ba3c2; }
    .login-box .campo-icone input:focus { border-color: #5aa9f5; background: rgba(255, 255, 255, .14); box-shadow: 0 0 0 3px rgba(90, 169, 245, .25); }
    .login-box button[type=submit] { min-height: 52px; margin-top: 8px; font-size: 16px; }
    .ver-senha svg { stroke: #8ba3c2; }
    .login-esqueci { display: block; margin-top: 18px; text-align: center; color: #8cc0f5; font-size: 14px; font-weight: 500; }
    .login-aviso-senha { margin-top: 10px; color: #c3d4ea; font-size: 13px; line-height: 1.5; text-align: center; }
    .login-box .alert-error { background: rgba(196, 43, 34, .2); color: #ffd6d2; border-color: rgba(255, 214, 210, .2); }
    .login-secure { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 32px; color: #8ba3c2; font-size: 12.5px; text-align: left; }
    .login-secure svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: #5aa9f5; stroke-width: 1.8; }
    .login-secure b { display: block; color: #c3d4ea; font-weight: 600; }
}

@media (max-width: 860px) and (display-mode: standalone) {
    .home-main {
        background-image: linear-gradient(rgba(244, 246, 249, .9), rgba(244, 246, 249, .9)), url('../../img/fundo_app.jpg');
        background-size: cover; background-position: center; background-attachment: fixed;
    }
}

@media (max-width: 380px) {
    .container { padding: 16px 12px 24px; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    .le-linha .le-grade { grid-template-columns: 1fr; }
}

@keyframes qs-sobe { from { transform: translateY(100%); } to { transform: none; } }
@keyframes qs-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
    .sidebar, .mobile-topbar, .tabbar, .sheet, .sheet-fundo, .skip-link { display: none !important; }
    .app-main { padding: 0 !important; }
}

/* Relatório Técnico de Inspeção (assets/js/rti_editor.js) */
.rti-sub { margin: 18px 0 10px; padding-bottom: 6px; font-size: 14px; color: var(--primary-dark); border-bottom: 1px solid var(--border); }
.le-corpo > .rti-sub:first-child { margin-top: 0; }
.rti-faixa { display: flex; align-items: center; gap: 8px; }
.rti-faixa input { flex: 1; min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 16px; font-family: inherit; }
.rti-faixa span { color: var(--text-muted); font-weight: 600; }
.rti-figs { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 12px 0; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rti-figs img { max-width: 100%; max-height: 220px; object-fit: contain; }
.rti-tab-wrap { overflow-x: auto; margin: 10px 0; -webkit-overflow-scrolling: touch; }
.rti-mat, .rti-tab-fixa { border-collapse: collapse; min-width: 100%; }
.rti-mat th, .rti-mat td, .rti-tab-fixa th, .rti-tab-fixa td { border: 1px solid var(--border); padding: 4px; font-size: 13px; }
.rti-mat th { background: var(--surface-2); text-align: left; white-space: nowrap; padding: 4px 8px; }
.rti-mat input { width: 100%; min-width: 64px; min-height: 40px; padding: 6px 8px; border: 1px solid transparent; border-radius: 6px; font-size: 16px; font-family: inherit; text-align: center; background: #fff; }
.rti-mat input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.rti-mat input.rti-cab { font-weight: 700; background: var(--primary-light); }
.rti-tab-fixa th { background: var(--surface-2); text-align: left; }
.rti-rein { margin-top: 16px; }
.rti-rein-corpo { margin-top: 12px; padding: 14px; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: var(--radius-sm); }
.rti-sug { margin-top: 8px; }
.rti-sug select { min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 15px; font-family: inherit; background: var(--surface); }
.le-linha .le-grade.rti-grade { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
/* Divisão do editor RTI por componente */
.rti-comp-titulo { margin: 28px 0 12px; padding: 10px 14px; background: var(--primary-light); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); font-size: 16px; color: var(--primary-dark); scroll-margin-top: 80px; }
.rti-comp-add { margin: 12px 0 28px; }
.rti-comp-add .hint { margin-top: 6px; }
/* Eventos do RTI: auto-fit estica os campos e ocupa a linha toda (auto-fill deixava colunas vazias). */
.le-linha .le-grade.rti-ev-grade, .le-linha.rti-comp .le-grade { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
@media (max-width: 860px) { .le-linha .le-grade.rti-ev-grade, .le-linha.rti-comp .le-grade { grid-template-columns: 1fr 1fr; } }
@media (max-width: 380px) { .le-linha .le-grade.rti-ev-grade, .le-linha.rti-comp .le-grade { grid-template-columns: 1fr; } }
@media (min-width: 861px) { .le-linha .rti-grade .rti-largo { grid-column: span 2; } }

/* Celular: alvos de toque ≥ 40px e fonte 16px nos campos (abaixo disso o iPhone dá zoom ao tocar). */
@media (max-width: 860px) {
    .lista-acoes select { min-height: 42px; font-size: 16px; }
    .rti-sug select { width: 100%; font-size: 16px; }
    .chip, button.chip { min-height: 40px; }
}

/* ---------- Painel BI (admin/dashboard.php) ---------- */
.bi-filtros { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.bi-filtros label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.bi-filtros select {
    min-width: 220px; min-height: 40px; padding: 8px 34px 8px 12px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    appearance: none; -webkit-appearance: none;
    font: 400 14px/1.3 inherit; color: var(--text); text-transform: none; letter-spacing: 0;
}
.bi-filtros select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }

.bi-kpis {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; margin-bottom: 16px;
    background: var(--border); border: 1px solid var(--border); border-top: 3px solid var(--navy);
}
.bi-kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; background: var(--surface); min-width: 0; }
.bi-kpi .l { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-muted); }
.bi-kpi strong { font-size: 30px; font-weight: 700; line-height: 1.15; color: var(--navy); font-variant-numeric: tabular-nums; }
.bi-kpi .s { font-size: 12.5px; color: var(--text-muted); }
.bi-kpi.alerta { box-shadow: inset 0 3px 0 #d03b3b; }
.bi-kpi.alerta .s { color: #a12a2a; font-weight: 600; }

.bi-grade { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.bi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 18px 16px; min-width: 0; }
.bi-card > h2 { margin: 0 -18px 12px; padding: 10px 18px; background: var(--head); border-bottom: 1px solid var(--border-strong); font-size: 12.5px; letter-spacing: .05em; text-transform: uppercase; }
.bi-4 { grid-column: span 4; } .bi-6 { grid-column: span 6; } .bi-8 { grid-column: span 8; } .bi-12 { grid-column: span 12; }
.bi-nota { margin: -4px 0 10px; font-size: 12.5px; color: var(--text-muted); }
.bi-vazio { margin: 18px 0; padding: 18px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border-strong); }

/* barras horizontais: barra até 14px de altura, ponta arredondada 4px, base reta */
.bi-barras { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bi-barras li { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr) 44px; gap: 10px; align-items: center; padding: 2px 0; font-size: 13px; cursor: default; }
.bi-barras li:hover .bi-rot, .bi-barras li:focus .bi-rot { color: var(--text); font-weight: 600; }
.bi-rot { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bi-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.bi-trilho { display: block; height: 14px; background: #f0f2f5; }
.bi-barra { display: block; height: 100%; border-radius: 0 4px 4px 0; }

/* cores: série 1 e 2 da paleta categórica; status reservados para nível de qualidade */
.bi-s1 { background: #2a78d6; fill: #2a78d6; }
.bi-s2 { background: #eb6834; fill: #eb6834; }
.bi-bom { background: #0ca30c; } .bi-atencao { background: #fab219; } .bi-serio { background: #ec835a; } .bi-critico { background: #d03b3b; }
.bi-neutro { background: #9aa5b4; } .bi-neutro2 { background: #c4cbd5; }

.bi-legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 4px; font-size: 12.5px; color: var(--text-2); }
.bi-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.bi-legenda i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

.bi-svg { display: block; width: 100%; height: auto; }
.bi-svg .bi-gl { stroke: #e3e7ed; stroke-width: 1; }
.bi-svg .bi-base { stroke: #8a95a5; stroke-width: 1; }
.bi-svg .bi-eixo { fill: var(--text-muted); font-size: 11px; font-family: inherit; }
.bi-svg .bi-alvo { fill: transparent; }
.bi-svg .bi-marca:hover .bi-alvo, .bi-svg .bi-marca:focus .bi-alvo { fill: rgba(14, 42, 77, .05); }
.bi-svg .bi-marca:focus { outline: none; }

.bi-tabela { margin-top: 10px; }
.bi-tabela summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary); }
.bi-tabela table { margin-top: 8px; }
.bi-tab-insp td, .bi-tab-insp th { white-space: nowrap; }
.bi-col-barra { width: 40%; }
.bi-tip {
    position: fixed; z-index: 95; pointer-events: none; max-width: 280px;
    padding: 6px 10px; background: var(--navy-900); color: #fff;
    border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; box-shadow: var(--shadow-lg);
}

@media (max-width: 1180px) {
    .bi-4, .bi-6, .bi-8 { grid-column: span 12; }
}
@media (max-width: 860px) {
    .bi-filtros label { flex: 1 1 100%; }
    .bi-filtros select { width: 100%; min-height: 46px; font-size: 16px; }
    .bi-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bi-kpi { padding: 12px 14px; }
    .bi-kpi strong { font-size: 24px; }
    .bi-grade { gap: 12px; }
    .bi-card { padding: 0 14px 14px; }
    .bi-card > h2 { margin: 0 -14px 12px; padding: 10px 14px; }
    .bi-barras li { grid-template-columns: minmax(0, 1fr) 40px; grid-template-areas: "rot val" "barra barra"; gap: 4px 8px; }
    .bi-barras .bi-rot { grid-area: rot; } .bi-barras .bi-val { grid-area: val; } .bi-barras .bi-trilho { grid-area: barra; }
    .bi-col-barra { display: none; }
}

/* ---------- Modal (dialog nativo: Esc fecha, foco fica dentro) ---------- */
dialog.modal {
    width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-top: 3px solid var(--navy); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(10, 31, 58, .55); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 54px); margin: 0; }
.modal-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--head); border-bottom: 1px solid var(--border-strong); }
.modal-topo h2 { font-size: 13px; letter-spacing: .05em; text-transform: uppercase; }
.modal-fechar, button.modal-fechar { min-height: 36px; width: 36px; padding: 0; background: transparent; color: var(--text-2); border: 1px solid transparent; font-size: 16px; }
.modal-fechar:hover, button.modal-fechar:hover { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.modal-corpo { padding: 18px 20px; overflow-y: auto; }
.modal-texto { margin: 0 0 14px; color: var(--text-2); }
.modal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-rodape { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 860px) {
    dialog.modal { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
    .modal-form { max-height: calc(100dvh - 22px); }
    .modal-grid { grid-template-columns: 1fr; }
    .modal-rodape { flex-direction: column-reverse; }
    .modal-rodape .btn { width: 100%; }
}

/* ---------- Logomarca (img/logomarca_qualyservice.png) ----------
   As letras são azul-escuras sobre fundo transparente: sobre o marinho ela
   sempre vai numa área branca. No trilho do tablet fica só o ícone "Q". */
.sidebar-brand { justify-content: center; margin: -18px 0 8px; padding: 14px 16px; background: #fff; border-bottom: 1px solid var(--navy-900); }
.sidebar-logo { display: block; width: 100%; max-width: 200px; height: auto; }
.sidebar-brand .qs-mark-sidebar { display: none; }
.mt-logo { display: block; height: 38px; width: auto; max-width: 100%; padding: 4px 8px; background: #fff; border-radius: var(--radius-sm); }
.login-logo { display: block; width: 100%; max-width: 340px; padding: 14px 18px; background: #fff; border-radius: var(--radius); }
.login-logo img { display: block; width: 100%; height: auto; }
@media (min-width: 861px) and (max-width: 1180px) {
    .sidebar-brand { margin: 0; padding: 2px 0 16px; background: none; border-bottom: 0; }
    .sidebar-logo { display: none; }
    .sidebar-brand .qs-mark-sidebar { display: grid; }
}
@media (max-width: 860px) {
    .login-brand .login-logo { max-width: 300px; margin: 0; padding: 14px 18px; }
    .login-brand .login-logo .login-brand-image { max-width: none; }
}

/* ---------- OS: inspetores, componentes por serviço e tela da OS ---------- */
.os-grid > .field-label { display: flex; margin-bottom: 0; }
.os-componentes { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.os-componentes h4 { margin: 0 0 4px; font-size: 14px; }
label.os-comp-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
label.os-comp-linha[hidden] { display: none; }
.os-comp-linha input { width: 88px; min-height: 38px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; text-align: center; }

.os-dados .sign-card-head { margin-bottom: 10px; }
.os-resumo { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 24px; margin: 0; }
.os-resumo > div { min-width: 0; }
.os-resumo .largo { grid-column: span 2; }
.os-resumo .total { grid-column: 1 / -1; }
.os-resumo dt { font-size: 12px; color: var(--text-muted); }
.os-resumo dd { margin: 1px 0 0; font-size: 14px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.os-srv + .os-srv { border-top: 1px solid var(--border); }
.os-seta { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .15s; }
[aria-expanded="true"] > .os-seta { transform: rotate(180deg); }
.os-comps { padding: 4px 20px 8px 76px; background: #f6f8fb; border-top: 1px dashed var(--border); }
.os-comp { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 10px 0; }
.os-comp + .os-comp { border-top: 1px solid var(--border); }
.os-comp .oc-nome { flex: 1 1 220px; min-width: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.os-comp .oc-insp { flex: 1 1 200px; min-width: 0; }
.os-comp .oc-insp .lista-insp { display: flex; align-items: center; gap: 5px; color: var(--navy); font-weight: 500; font-size: 13px; }
.os-comp .oc-insp .lista-insp.vazio { color: var(--text-muted); font-weight: 400; }
.os-comp .oc-acoes { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 1180px) { .os-resumo { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .os-comps { padding: 4px 14px 8px; } }
@media (max-width: 480px) { .os-resumo { grid-template-columns: 1fr; } .os-resumo .largo { grid-column: auto; } }
/* Relatório: componente de outro inspetor fica só para leitura */
.le-sec.le-bloq > summary { color: var(--text-muted); }
.le-aviso { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--head); color: var(--text-2); font-size: 13px; }
.page-head-acoes { display: flex; gap: 8px; flex-wrap: wrap; }

/* Sempre tema claro nos controles nativos (selects, calendário), mesmo com o Windows no modo escuro */
:root { color-scheme: light; }

/* Lista "escolha ou digite" (assets/js/combo.js), no lugar da janela preta do datalist */
input[data-combo] {
    padding-right: 34px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
}
.combo-lista {
    position: fixed; z-index: 1000; margin: 0; padding: 4px; list-style: none; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
}
.combo-lista[hidden] { display: none; }
.combo-lista li { padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px; color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.combo-lista li:hover, .combo-lista li.marcada { background: var(--primary-light); }
.combo-lista li.escolhida { font-weight: 600; }
.le-linha-topo .action-btn { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.le-linha-topo span { align-items: center; }
/* Eventos do serviço: nome digitado pelo gestor (Modelo Geral) */
.checkbox-item input.ev-nome { flex: 1; width: auto; height: auto; min-width: 0; min-height: 34px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; background: var(--surface); }
/* Verificação em duas etapas (login_2fa e dois_fatores) */
.df-texto { margin: 0 0 16px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.login-box label.df-lembrar { flex-direction: row; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.login-box label.df-lembrar input { width: 20px; height: 20px; min-height: 20px; padding: 0; margin: 0; box-shadow: none; flex-shrink: 0; }
.df-passos { margin: 0; padding-left: 22px; display: grid; gap: 18px; line-height: 1.5; }
.df-qr { display: block; width: max-content; margin: 12px 0 8px; padding: 8px; background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); line-height: 0; }
.df-qr svg { width: 220px; height: 220px; max-width: 100%; }
.df-manual summary { cursor: pointer; color: var(--primary); font-size: 14px; }
.df-manual code, .df-lista-codigos code { font-size: 15px; letter-spacing: .5px; word-break: break-all; }
.df-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; align-items: center; }
.df-form input { width: 170px; font-size: 18px; letter-spacing: 3px; text-align: center; }
.df-lista-codigos { columns: 2; margin: 12px 0; padding-left: 28px; line-height: 2.1; }
@media (max-width: 860px) {
    .login-box label.df-lembrar { font-size: 14px; color: #c3d4ea; }
    .login-box .df-texto { color: #c3d4ea; }
}
@media print {
    body * { visibility: hidden; }
    .df-codigos, .df-codigos * { visibility: visible; }
    .df-codigos { position: absolute; top: 0; left: 0; width: 100%; }
    .df-codigos .form-actions { display: none; }
}
.lista-num .df-situacao { margin-top: 4px; }
