:root {
    color-scheme: light;
    --site-primary: #2563eb;
    --site-ink: #1e293b;
    --site-muted: #64748b;
    --site-border: #dbe3ee;
    --site-surface: #fff;
    --site-page: #f3f6fb;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 1rem;
}

body {
    color: var(--site-ink);
    background: var(--site-page);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button,
input[type="submit"],
input[type="button"],
a.btn {
    min-height: 42px;
}

input,
select,
textarea {
    max-width: 100%;
}

:focus-visible {
    outline: 3px solid rgb(37 99 235 / 35%);
    outline-offset: 2px;
}

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem clamp(1rem, 4vw, 2rem);
    background: rgb(255 255 255 / 96%);
    border-bottom: 1px solid var(--site-border);
    box-shadow: 0 4px 16px rgb(15 23 42 / 5%);
    backdrop-filter: blur(12px);
}

.navbar-brand {
    flex: 0 0 auto;
    color: var(--site-ink);
    font-size: 1.05rem;
    font-weight: 750;
    letter-spacing: -0.02em;
}

.navbar-nav {
    gap: 0.35rem;
}

.navbar-nav a {
    min-height: 42px;
    display: flex;
    align-items: center;
    color: var(--site-muted);
    border-radius: 0.6rem;
}

.navbar-nav a:hover,
.navbar-nav a:focus-visible {
    color: var(--site-primary);
    background: #eff6ff;
}

.navbar-toggle {
    display: none;
    width: 44px;
    min-height: 44px;
    padding: 0.65rem;
    color: var(--site-ink);
    background: var(--site-surface);
    border: 1px solid var(--site-border);
    border-radius: 0.65rem;
    cursor: pointer;
}

.navbar-toggle span {
    display: block;
    height: 2px;
    margin: 4px 0;
    background: currentColor;
    border-radius: 2px;
}

.dropdown-content {
    border-radius: 0.75rem;
    padding: 0.4rem;
}

.dropdown-content li a {
    min-height: 40px;
    border-radius: 0.45rem;
}

.container {
    width: min(100% - 2rem, 1600px);
    margin: 1.5rem auto;
    padding: clamp(1rem, 2.5vw, 1.75rem);
    background: var(--site-surface);
    border: 1px solid rgb(219 227 238 / 75%);
    border-radius: 1rem;
    box-shadow: 0 12px 34px rgb(15 23 42 / 6%);
}

h1,
h2,
h3 {
    color: var(--site-ink);
    line-height: 1.25;
}

.dica-edicao {
    margin: -0.4rem 0 1rem;
    color: var(--site-muted);
    font-size: 0.9rem;
}

.painel-filtros,
.filtros-box {
    padding: clamp(0.85rem, 2vw, 1.25rem);
    background: #f8fafc;
    border: 1px solid var(--site-border);
    border-radius: 0.85rem;
}

.grid-filtros,
.filtros-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
    gap: 0.85rem;
}

.campo-filtro input,
.campo-filtro select,
.campo-filtro textarea,
.filtros-grid input,
.filtros-grid select,
.dropdown-toggle-btn {
    min-height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 0.6rem;
}

.botoes-filtro,
.acoes-topo,
.topo-tabela {
    flex-wrap: wrap;
    gap: 0.65rem;
}

.tabela-container,
.modal-lista {
    max-width: 100%;
    overflow: auto;
    overscroll-behavior-inline: contain;
    border: 1px solid var(--site-border);
    border-radius: 0.75rem;
    background: var(--site-surface);
}

table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 0.65rem 0.8rem;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #f8fafc;
    background: #26364b;
}

tbody tr:nth-child(even) {
    background: #f8fafc;
}

tbody tr:hover {
    background: #eff6ff;
}

td:not(.obs-editavel):not(.col-obs):not([data-campo*="Obs" i]):not([data-campo*="Problema" i]):not([class*="problem" i]) {
    width: max-content;
    white-space: nowrap;
}

td.obs-editavel,
td.col-obs,
td[class*="obs" i],
td[class*="problem" i],
td[data-campo*="Obs" i],
td[data-campo*="Problema" i],
td[data-campo="OBS" i] {
    width: 32ch;
    min-width: 12ch;
    max-width: 36ch;
    white-space: normal;
    overflow-wrap: anywhere;
}

.editavel,
.celula-editavel,
.tabela-container td[data-campo] {
    cursor: text;
}

.editavel:hover,
.celula-editavel:hover,
.tabela-container td[data-campo]:hover {
    background: #fff7d6;
}

.editor-celula,
td input:not([type="checkbox"]),
td select,
td textarea {
    min-width: 9rem;
    min-height: 40px;
    width: 100%;
    box-sizing: border-box;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--site-primary);
    border-radius: 0.45rem;
}

.celula-em-edicao {
    outline: 2px solid var(--site-primary);
    outline-offset: -2px;
}

.toast {
    max-width: calc(100vw - 2rem);
}

@media (max-width: 760px) {
    .navbar {
        flex-wrap: wrap;
        margin-bottom: 0.75rem;
        padding: 0.55rem max(0.75rem, env(safe-area-inset-left));
    }

    .navbar-toggle {
        display: block;
        margin-left: auto;
    }

    .navbar-nav {
        display: none;
        flex: 1 0 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        padding: 0.5rem 0 0.25rem;
    }

    .navbar.menu-aberto .navbar-nav {
        display: flex;
    }

    .navbar-nav > li,
    .navbar-nav > li > a {
        width: 100%;
    }

    .navbar-nav > li > a {
        justify-content: space-between;
        padding: 0.65rem 0.8rem;
    }

    .dropdown-content,
    .dropdown:hover .dropdown-content {
        position: static;
        display: none;
        width: 100%;
        min-width: 0;
        margin: 0.1rem 0 0.35rem;
        box-shadow: none;
        border: 0;
        background: #f8fafc;
    }

    .dropdown.dropdown-aberto .dropdown-content {
        display: block;
    }

    .container {
        width: calc(100% - 1rem);
        margin: 0.75rem auto;
        padding: 1rem;
        border-radius: 0.8rem;
    }

    .grid-filtros,
    .filtros-grid {
        grid-template-columns: 1fr;
    }

    .botoes-filtro > *,
    .acoes-topo > * {
        flex: 1 1 100%;
        justify-content: center;
    }

    .tabela-container {
        margin-inline: -0.25rem;
    }

    th,
    td {
        padding: 0.55rem 0.65rem;
    }

    .editor-celula,
    td input:not([type="checkbox"]),
    td select,
    td textarea {
        min-width: 7rem;
    }
}

@media (max-width: 420px) {
    .container {
        width: 100%;
        margin: 0.5rem 0;
        padding: 0.75rem;
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    h1 {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.25rem;
    }
}

@media print {
    .container {
        width: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .tabela-container {
        overflow: visible;
        border: 0;
    }
}
