/* ============================================================
   app.css — NoraTech Painel
   Tema alinhado ao Flutter Web (referência): canvas escuro, sidebar
   clara, cartão branco na listagem, azul Material, tabela zebrada,
   ações em círculos (Font Awesome). Login e vitrine pública usam
   estilos próprios.
   ============================================================ */

/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-w:        248px;
    --sidebar-bg:       #e8eaed;
    --sidebar-border:   #d1d5db;
    --sidebar-text:     #1e293b;
    --sidebar-muted:    #64748b;
    --sidebar-hover:    #dce0e6;
    --sidebar-active-bg:#d0d4db;
    --accent:           #1976d2;
    --accent-hover:     #1565c0;
    --danger:           #e53935;
    --success:          #2e7d32;
    --success-hover:    #1b5e20;
    --warning:          #f39c12;
    --text:             #1a1f2e;
    --text-muted:       #64748b;
    --bg:               #f4f6fb;
    --app-canvas-bg:    #12151c;
    --card-bg:          #ffffff;
    --border:           #e2e8f0;
    /* Fundo de inputs/textarea/select — altere só aqui para mudar em todo o painel */
    --input-bg:         rgba(255, 255, 255, 0.5);
    /* Tabela de itens (OS / orçamento) */
    --entity-items-table-bg: rgba(255, 255, 255, 0.4);
    --input-border:     #cfd8e3;
    --radius:           12px;
    --shadow:           0 2px 14px rgba(0,0,0,.12);
    --panel-shadow:     0 4px 24px rgba(0,0,0,.18);
    --modal-overlay:    rgba(0,0,0,.55);
    --font:             'Segoe UI', system-ui, -apple-system, sans-serif;
    /* Formulários (painel, entidades, configurações): texto, select, textarea */
    /* --input-bg (linha ~33): cor de fundo dos campos de texto */
    --form-control-height:    40px;
    --form-control-padding-y: 8px;
    --form-control-padding-x: 12px;
    --form-field-border:      #cbd5e0;
    --form-radius:            4px;
    --form-label-color:       #4a5568;
    --page-body-padding:      8px;
}

html, body { height: 100%; }

/* Scrollbar discreto (track transparente, thumb fino) */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
*::-webkit-scrollbar-track {
    background: transparent;
}
*::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.65);
}
*::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}
*::-webkit-scrollbar-corner {
    background: transparent;
}

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

body.app-body {
    background-color: var(--app-canvas-bg);
    background-image:
        radial-gradient(ellipse 100% 60% at 50% -15%, rgba(25, 118, 210, 0.14), transparent 55%),
        linear-gradient(165deg, #161a22 0%, #0c0e14 45%, #12151c 100%);
    overflow-x: hidden;
}

/* Textura / marca d’água leve na área principal (opcional: noratech-bg.jpg) */
.app-body .main {
    position: relative;
}
.app-body .main::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/noratech-bg.jpg') center/cover no-repeat;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}
.app-body .main-inner {
    position: relative;
    z-index: 1;
    min-width: 0;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ─── Layout Principal ─────────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
    min-width: 0;
    width: 100%;
}

/* ─── Sidebar (Flutter: barra clara) ───────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
}

.sidebar-logo img {
    height: auto;
    max-height: 80px;
    width: auto;
    max-width: 100%;
    display: block;
    margin-bottom: 0;
}

.sidebar-logo .brand-tagline {
    color: var(--accent-hover);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    margin-top: -10px;
    margin-bottom: 8px;
}

.sidebar-role-line {
    margin-top: 10px;
    font-size: 12px;
    color: var(--sidebar-text);
    font-weight: 600;
    line-height: 1.35;
}

.sidebar-role-paren {
    color: var(--sidebar-muted);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 14px 0 16px;
}

.sidebar-section {
    padding: 10px 18px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 18px;
    margin: 2px 8px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background .15s, color .15s, border-color .15s;
    text-decoration: none;
}

.sidebar-item:hover {
    background: var(--sidebar-hover);
    color: var(--accent);
    text-decoration: none;
}

.sidebar-item.active {
    background: var(--sidebar-active-bg);
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
}

.sidebar-item i {
    font-size: 17px;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
    color: var(--sidebar-muted);
}

.sidebar-item:hover i,
.sidebar-item.active i {
    color: var(--accent);
}

.sidebar-footer {
    padding: 12px 16px 14px;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}

.sidebar-user-info { flex: 1; overflow: hidden; min-width: 0; }
.sidebar-user-name { color: var(--sidebar-text); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: var(--sidebar-muted); font-size: 11px; }

.sidebar-version {
    margin-top: 12px;
    font-size: 10px;
    color: var(--sidebar-muted);
    text-align: center;
    line-height: 1.35;
}

.sidebar-logout {
    color: var(--sidebar-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color .15s;
    flex-shrink: 0;
}
.sidebar-logout:hover { color: var(--danger); }

/* ─── Conteúdo Principal ───────────────────────────────────── */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    padding: var(--page-body-padding);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    flex-shrink: 0;
}

.page-header--split {
    align-items: center;
}

.app-body .page-header .page-title {
    font-size: 22px;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: -0.02em;
}

.app-body .page-header .page-subtitle {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-content {
    padding: var(--page-body-padding);
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.page-content > .alert {
    margin-bottom: 8px;
}

/* Painel branco (listagens estilo Flutter) */
.panel-page-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--panel-shadow);
    border: 1px solid rgba(255,255,255,.06);
    overflow: hidden;
}

.panel-page-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 22px 24px 8px;
    border-bottom: 1px solid var(--border);
}

.panel-page-card__head .page-title,
.panel-page-card__head .page-subtitle {
    color: var(--text);
}

.panel-page-card__head .page-subtitle {
    color: var(--text-muted);
}

.panel-page-card__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-page-card .alert {
    margin: 16px 24px 0;
}

.panel-page-card__body {
    padding: 18px 24px 22px;
}

.settings-panel {
    margin-bottom: 20px;
}

.settings-panel:last-of-type {
    margin-bottom: 0;
}

.settings-surface {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.settings-section {
    margin: 0;
}

.settings-section + .settings-section {
    padding-top: 24px;
    border-top: 1px solid #c5cdd8;
}

.settings-section__head {
    margin-bottom: 16px;
}

.settings-section__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.settings-section__subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.settings-icon-field__row {
    display: flex;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
}

.settings-icon-preview {
    flex-shrink: 0;
    width: var(--form-control-height);
    height: var(--form-control-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--form-radius);
    border: 1px solid var(--form-field-border);
    background: #fff;
    color: var(--accent);
    font-size: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.settings-icon-field__input {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}

.settings-form__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
    padding-top: 20px;
    border-top: 1px solid #c5cdd8;
}

.settings-save-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #e8f8f0;
    color: #166534;
    border: 1px solid #86efac;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.32s ease, transform 0.32s ease;
}

.settings-save-badge i {
    font-size: 12px;
}

.settings-save-badge--hide {
    opacity: 0;
    transform: translateY(2px);
    pointer-events: none;
}

.settings-code {
    font-size: 12px;
    font-family: ui-monospace, monospace;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text);
}

.entity-form-grid__full-row {
    grid-column: 1 / -1;
}

.filters-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 20px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.filters-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 18px 22px;
    flex: 1;
    min-width: 0;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: min(100%, 220px);
    flex: 1;
}

.filter-field--narrow {
    flex: 0 1 200px;
    min-width: 160px;
}

/* Campo de busca nas listas: botão limpar (X) à direita */
.filter-field--with-clear .filter-field__input-wrap {
    position: relative;
    width: 100%;
}

.filter-field--with-clear .filter-field__input-wrap > .form-input {
    padding-right: 40px;
}

.filter-field__clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 5;
    transition: background 0.12s, color 0.12s;
}

.filter-field__clear.is-visible {
    display: inline-flex;
}

.filter-field__clear:hover {
    background: var(--bg);
    color: var(--text);
}

.filters-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--form-label-color);
}

.filters-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Filtros: mesmo contorno dos campos padrão (fundo branco na barra cinza) */
.filters-toolbar .form-input,
.filters-toolbar .form-select,
.filters-toolbar select.form-input {
    width: 100%;
    min-height: var(--form-control-height);
    height: var(--form-control-height);
    padding: 0 var(--form-control-padding-x);
    border: 1px solid var(--form-field-border);
    border-radius: var(--form-radius);
    background: var(--input-bg);
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--text);
    transition: border .2s, box-shadow .2s;
    box-sizing: border-box;
}

.filters-toolbar select.form-input,
.filters-toolbar .form-select {
    appearance: none;
    cursor: pointer;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.4 0L6 4.6 10.6 0 12 1.4l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-color: var(--input-bg);
}

.filters-toolbar .form-input:focus,
.filters-toolbar .form-select:focus,
.filters-toolbar select.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.16);
}

.panel-page-card__pager {
    padding: 14px 24px 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

.table-scroll--flutter {
    position: relative;
    overflow-x: auto;
    background: var(--card-bg);
}

.table-scroll--flutter::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    /*background: url('../images/logo.png') center 42% / min(420px, 55%) no-repeat;*/
    opacity: 0.035;
    z-index: 0;
}

.table-scroll--flutter > .data-table {
    position: relative;
    z-index: 1;
}

/* ─── Dashboard (painel claro sobre canvas escuro) ─────────── */
.dashboard-surface {
    background: linear-gradient(180deg, #e4e8ee 0%, #dce2ea 100%);
    border-radius: 14px;
    padding: 18px 20px 22px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        0 2px 0 rgba(255, 255, 255, 0.45) inset,
        0 8px 28px rgba(0, 0, 0, 0.18);
    max-width: 100%;
    min-width: 0;
}

.dashboard-surface__toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.dashboard-surface__toolbar-hint {
    font-size: 12px;
    color: #475569;
    margin-right: auto;
    flex: 1 1 12rem;
    min-width: 0;
}

.dashboard-money-toggle {
    color: var(--accent);
    border-color: #b8c4d4;
}

.dashboard-money-toggle:hover {
    color: var(--accent-hover);
    border-color: var(--accent);
}

.app-body .page-header .btn--refresh-circle.is-off {
    opacity: 0.55;
    filter: grayscale(0.35);
}

.dashboard-section {
    margin-bottom: 22px;
}

.dashboard-section:last-child {
    margin-bottom: 0;
}

.dashboard-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #b9c2cf;
    padding-bottom: 10px;
    margin-bottom: 14px;
}

.dashboard-section__head--report {
    border-bottom: none;
    padding-bottom: 0;
}

.dashboard-section__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

.dashboard-section__title--lined {
    width: 100%;
    gap: 14px;
}

.dashboard-section__title-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    white-space: nowrap;
}

.dashboard-section__title-label > i {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.dashboard-section__title-label--accent > i {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, #fff);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.dashboard-section__title-label--success > i {
    color: var(--success);
    background: color-mix(in srgb, var(--success) 14%, #fff);
    border: 1px solid color-mix(in srgb, var(--success) 22%, transparent);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .dashboard-section__title-label--accent > i {
        background: rgba(25, 118, 210, 0.12);
        border-color: rgba(25, 118, 210, 0.22);
    }
    .dashboard-section__title-label--success > i {
        background: rgba(46, 125, 50, 0.12);
        border-color: rgba(46, 125, 50, 0.22);
    }
}

.dashboard-section__title-line {
    flex: 1;
    height: 1px;
    background: #b9c2cf;
    min-width: 24px;
}

.dashboard-section__title i {
    color: var(--accent);
    font-size: 17px;
    opacity: 0.95;
}

.dashboard-section__head--charts {
    flex-wrap: wrap;
}

.dashboard-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.dash-kpi-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px 10px 12px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 118px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.dash-kpi-card--combined {
    min-height: auto;
    padding: 12px 10px 14px;
    justify-content: flex-start;
    gap: 2px;
}

/* Cards relatório OS / Orçamentos: layout em faixa + hero + duas colunas */
.dash-kpi-card--report.dash-kpi-card--combined {
    align-items: stretch;
    text-align: left;
    padding: 18px 18px 16px;
    gap: 0;
}

.dash-kpi-card__row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.dash-kpi-card--report .dash-kpi-card__label {
    margin-bottom: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #64748b;
}

.dash-kpi-card__corner-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 14%, #fff);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.dash-kpi-card__corner-icon--budget {
    color: var(--success);
    background: color-mix(in srgb, var(--success) 14%, #fff);
    border-color: color-mix(in srgb, var(--success) 22%, transparent);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .dash-kpi-card__corner-icon {
        background: rgba(25, 118, 210, 0.12);
        border-color: rgba(25, 118, 210, 0.22);
    }
    .dash-kpi-card__corner-icon--budget {
        background: rgba(46, 125, 50, 0.12);
        border-color: rgba(46, 125, 50, 0.22);
    }
}

.dash-kpi-card__hero {
    margin-bottom: 16px;
}

.dash-kpi-card--report .dash-kpi-card__value--count {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.dash-kpi-card--report .dash-kpi-card__value--money {
    margin-top: 6px;
    font-size: 18px;
    font-weight: 800;
}

.dash-kpi-card__split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0 10px;
    align-items: stretch;
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}

.dash-kpi-card__split-rule {
    width: 1px;
    min-height: 100%;
    background: #e2e8f0;
    align-self: stretch;
    margin: 2px 0;
}

.dash-kpi-card__col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: flex-start;
}

.dash-kpi-card__col-head {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
}

.dash-kpi-card__col-head i {
    font-size: 13px;
    margin-top: 1px;
    flex-shrink: 0;
    opacity: 0.95;
}

.dash-kpi-card__col--ab .dash-kpi-card__col-head {
    color: var(--accent);
}

.dash-kpi-card__col--fin .dash-kpi-card__col-head {
    color: var(--success);
}

.dash-kpi-card__col-money {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}

.dash-kpi-card__col--ab .dash-kpi-card__col-money {
    color: var(--accent);
}

.dash-kpi-card__col--fin .dash-kpi-card__col-money {
    color: var(--success);
}

.dash-kpi-card__break {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    width: 100%;
    margin-top: 8px;
    font-size: 12.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
}

.dash-kpi-card__break--money {
    margin-top: 6px;
    font-size: 11.5px;
    font-weight: 600;
}

.dash-kpi-stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.dash-kpi-stat i {
    font-size: 12px;
    opacity: 0.9;
}

.dash-kpi-stat--ab {
    color: var(--accent);
}

.dash-kpi-stat--fin {
    color: var(--success);
}

.dash-kpi-stat__sep {
    color: #94a3b8;
    font-weight: 500;
}

.dash-kpi-card__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 6px;
    line-height: 1.25;
}

.dash-kpi-card__value {
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.dash-kpi-card__value--count {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
}

.dash-kpi-card__value--money {
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
}

.dash-kpi-card__footer {
    margin-top: auto;
    padding-top: 10px;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dash-kpi-foot--blue {
    color: var(--accent);
}

.dash-kpi-foot--green {
    color: var(--success);
}

.dash-kpi-foot__sep {
    color: #94a3b8;
    font-weight: 500;
}

.dashboard-cadastros-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.dashboard-cadastros-grid--quantities {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    max-width: none;
}

.dash-kpi-card--cadastro {
    min-height: 96px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    text-align: left;
    padding: 16px 18px;
}

.dash-kpi-card--cadastro .dash-kpi-card__label {
    width: 100%;
    text-align: left;
    margin-bottom: 4px;
}

.dash-kpi-card--cadastro .dash-kpi-card__value {
    flex: 1;
    text-align: left;
}

.dash-kpi-card__icon-wrap {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.dash-kpi-card__icon-wrap--green {
    background: #e8f5e9;
    color: var(--success);
}

.dash-kpi-card__icon-wrap--purple {
    background: #ede7f6;
    color: #5e35b1;
}

.dashboard-charts-row {
    display: grid;
    gap: 12px;
}

.dashboard-charts-row--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-charts-row--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-card--wrap {
    background: #fff;
    border-radius: 10px;
    padding: 14px 14px 10px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chart-card--wrap .chart-card__title {
    margin-bottom: 10px;
}

.chart-card--wrap .chart-card__canvas {
    position: relative;
    min-height: 200px;
}

.dashboard-section--charts .dashboard-period .btn--ghost {
    background: #f1f5f9;
    border-color: var(--input-border);
    color: var(--text);
}

.dashboard-section--charts .dashboard-period .btn--ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.dashboard-section--charts .dashboard-period .btn--primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.dashboard-section--charts .dashboard-period .btn--primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

@media (max-width: 1100px) {
    .dashboard-charts-row--3,
    .dashboard-charts-row--2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .dashboard-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .dashboard-kpi-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-cadastros-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Cards de Dashboard ───────────────────────────────────── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Dashboard: 4 cards na mesma linha (Ordens / Orçamentos) */
.cards-grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1200px) {
    .cards-grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: box-shadow .2s;
}

.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.12); }

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}

.card-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

.card-icon.blue   { background: #e3f2fd; color: var(--accent); }
.card-icon.green  { background: #e8f8f0; color: var(--success); }
.card-icon.orange { background: #fff3e0; color: var(--warning); }
.card-icon.red    { background: #fdecea; color: var(--danger); }
.card-icon.purple { background: #f0eaff; color: #7c3aed; }

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}

.card-value.hidden-value::after {
    content: '•••';
    font-size: 22px;
}

.card-meta {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.card-meta .badge-open   { color: var(--warning); font-weight: 600; }
.card-meta .badge-closed { color: var(--success); font-weight: 600; }

.card-receita-total {
    margin-top: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.charts-row {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}
.charts-row--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.charts-row--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 1100px) {
    .charts-row--3 { grid-template-columns: 1fr; }
    .charts-row--2 { grid-template-columns: 1fr; }
}
.chart-card__title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}
.dashboard-period {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.btn--icon {
    padding: 8px 10px;
}

.btn--danger {
    background: var(--danger) !important;
    color: #fff !important;
    border-color: var(--danger) !important;
}
.btn--danger:hover { filter: brightness(0.95); text-decoration: none; color: #fff !important; }

.autocomplete-wrap { position: relative; }

.autocomplete-list {
    position: absolute;
    z-index: 10050;
    left: 0;
    right: 0;
    top: 100%;
    margin: 4px 0 0;
    padding: 4px 0;
    list-style: none;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--panel-shadow);
    max-height: 220px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    isolation: isolate;
}

.autocomplete-list li {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.35;
    word-break: break-word;
    background: var(--card-bg);
    color: var(--text);
}

.autocomplete-list li:hover {
    background: #f3f4f6;
}

.autocomplete-list--floating {
    position: fixed !important;
    z-index: 20000 !important;
    margin-top: 0;
}

.autocomplete-wrap--with-clear .form-input--has-clear {
    padding-right: 40px;
}

.autocomplete-clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 5;
    transition: background 0.12s, color 0.12s;
}

.autocomplete-clear-btn.is-visible {
    display: inline-flex;
}

.autocomplete-clear-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.form-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

/* Dashboard: abertos | fechados (duas colunas alinhadas) */
.card-status-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch;
    margin-top: 10px;
    column-gap: 8px;
}

.card-status-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    text-align: left;
}

.card-status-split > .card-status-col:first-child {
    padding-right: 4px;
}

.card-status-split > .card-status-col:last-child {
    padding-left: 4px;
}

.card-status-label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    max-width: 100%;
}

.card-status-label.badge-open   { color: var(--warning); }
.card-status-label.badge-closed { color: var(--success); }

.card-status-value {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.card-status-value.badge-open   { color: var(--warning); }
.card-status-value.badge-closed { color: var(--success); }

.card-status-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    padding: 0 2px;
    font-size: 13px;
    font-weight: 300;
    color: var(--text-muted);
    opacity: 0.55;
    user-select: none;
    line-height: 1;
}

/* ─── Seção de Gráficos ────────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ≥1280px: 3 colunas iguais (dashboard tem 3 gráficos) — ocupa 100% da linha */
@media (min-width: 1280px) {
    .charts-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1279px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.charts-grid .chart-card {
    min-width: 0;
}

.chart-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
}

.chart-series-toggle {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.series-btn {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: all .15s;
    color: var(--text-muted);
}

.series-btn.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

/* ─── Barra de Ferramentas (filtro + botão) ─────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
}

.search-wrap i {
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

.search-input {
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    width: 240px;
    background: var(--card-bg);
    color: var(--text);
    transition: border .2s;
}

.search-input:focus { outline: none; border-color: var(--accent); }

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
}

.filter-select:focus { outline: none; border-color: var(--accent); }

/* ─── Botões ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    height: var(--form-control-height);
    min-height: var(--form-control-height);
    padding: 0 var(--form-control-padding-x);
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s, filter .15s;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.2;
}

.btn i { font-size: 16px; }

.btn-primary,
.btn.btn--primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover,
.btn.btn--primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    text-decoration: none;
    color: #fff;
    filter: none;
}

.btn-success,
.btn.btn--success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover,
.btn.btn--success:hover {
    background: var(--success-hover);
    border-color: var(--success-hover);
    text-decoration: none;
    color: #fff;
}

.btn-danger,
.btn.btn--danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover,
.btn.btn--danger:hover {
    filter: brightness(0.95);
    text-decoration: none;
    color: #fff;
}

.btn-outline,
.btn.btn--outline {
    background: #e8eaed;
    border-color: #cfd4dc;
    color: var(--text);
}
.btn-outline:hover,
.btn.btn--outline:hover {
    background: #dde1e7;
    text-decoration: none;
    color: var(--text);
}

.btn-ghost,
.btn.btn--ghost {
    background: #f1f5f9;
    border-color: var(--input-border);
    color: var(--text-muted);
}
.btn-ghost:hover,
.btn.btn--ghost:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: var(--text);
    text-decoration: none;
}

.app-body .page-header .btn.btn--ghost {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.22);
    color: #e2e8f0;
}
.app-body .page-header .btn.btn--ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.btn.btn--link {
    background: transparent;
    border-color: transparent;
    color: var(--accent);
    font-weight: 600;
    height: auto;
    min-height: 0;
    padding: 10px 8px;
}
.btn.btn--link:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

.btn--refresh-circle {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--input-border);
    color: var(--text-muted);
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.btn--refresh-circle:hover {
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
    background: #fff;
}

.app-body .page-header .btn--refresh-circle {
    background: rgba(255,255,255,.95);
}

.btn-sm,
.btn.btn--sm {
    height: var(--form-control-height);
    min-height: var(--form-control-height);
    padding: 0 12px;
    font-size: 12px;
    border-radius: 8px;
}
.btn-sm i,
.btn.btn--sm i { font-size: 14px; }

.btn.btn--icon-only {
    width: var(--form-control-height);
    min-width: var(--form-control-height);
    padding: 0;
}

.btn-icon {
    padding: 6px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    transition: all .15s;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { background: #fdecea; color: var(--danger); border-color: var(--danger); }

/* Ações em linha: círculos azul (editar) e verde (imprimir), estilo Flutter */
.btn-icon-circle {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 15px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform .12s ease, filter .15s, box-shadow .15s;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.btn-icon-circle:hover {
    filter: brightness(1.06);
    transform: scale(1.04);
    text-decoration: none;
    color: #fff;
}
.btn-icon-circle--edit { background: var(--accent); }
.btn-icon-circle--print { background: var(--success); }
.btn-icon-circle--more { background: #475569; color: #fff; }

/* ─── Tabela ────────────────────────────────────────────────── */
.table-wrap {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: 1px solid var(--border); }

tbody tr:hover { background: rgba(25, 118, 210, 0.045); }

.data-table--flutter tbody tr:nth-child(even) {
    background: #f6f8fb;
}

.data-table--flutter tbody tr:hover {
    background: #e8f0fe;
}

.data-table--flutter tbody td {
    border-left: none;
    border-right: none;
    vertical-align: middle;
}

.data-table--flutter thead th {
    font-size: 11px;
    letter-spacing: .06em;
    color: #64748b;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.td-code {
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* Nunca usar display:flex no <td> — desalinha bordas entre linhas. Botões ficam no inner. */
.td-actions {
    width: 1%;
    padding-right: 14px;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.td-actions__inner {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* Listagens: colunas fixas (tel/valor/data ~120px) + texto em 1 linha com … e title no HTML */
.data-table--list-fixed {
    table-layout: fixed;
    width: 100%;
}

.data-table--list-fixed tbody td.td-ellipsis {
    overflow: hidden;
    vertical-align: middle;
}

/* Colunas que partilham largura variável (% no colgroup) — encolhem com reticências */
.data-table--list-fixed tbody td.td-ellipsis--shrink {
    max-width: 0;
}

.data-table--list-fixed .td-ellipsis__text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table--list-fixed .td-col-fixed {
    width: 120px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
}

.data-table--list-fixed .td-col-datetime {
    width: 136px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    vertical-align: middle;
}

/* Lista de orçamentos: “Válido até” com data/hora completa (dd/mm/aaaa hh:mm) */
.data-table--budgets-list.data-table--list-fixed .td-col-datetime {
    width: 140px;
    min-width: 140px;
    max-width: 140px;
}

.data-table--list-fixed .td-col-id {
    width: 48px;
    min-width: 44px;
    max-width: 52px;
    white-space: nowrap;
    padding-left: 8px;
    padding-right: 2px;
}

.data-table--orders-list.data-table--list-fixed .td-col-id,
.data-table--budgets-list.data-table--list-fixed .td-col-id {
    width: 48px;
    min-width: 44px;
    max-width: 52px;
}

/* ─── Badges de Status ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-aberto   { background: #fff3e0; color: #b45309; }
.badge-fechado  { background: #e8f8f0; color: #166534; }
.badge-ativo    { background: #e8f8f0; color: #166534; }
.badge-inativo  { background: #fdecea; color: #991b1b; }

/* ─── Paginação ─────────────────────────────────────────────── */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: 0 0 var(--radius) var(--radius);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}

.page-btn:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn.disabled { color: var(--text-muted); cursor: not-allowed; opacity: .5; pointer-events: none; }
.page-btn.dots { border: none; background: none; cursor: default; }

/* Per-page select */
.per-page-select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
}

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    z-index: 500;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}

.modal-overlay.hidden { display: none; }

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,.22);
    width: 100%;
    max-width: 680px;
    animation: modalIn .18s ease;
}

.modal-lg { max-width: 900px; }
.modal-sm { max-width: 420px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 22px;
    display: flex;
    align-items: center;
    transition: color .15s;
    padding: 2px;
}
.modal-close:hover { color: var(--danger); }

.modal-body {
    padding: 20px 22px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ─── Formulário ────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}

.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

/* ─── Padrão de campo de texto (novas telas: reutilizar este bloco) ───
   Markup:
     <div class="entity-form-grid entity-form-grid--cols-2"> … </div>
     <div class="form-field">
       <label class="form-label form-label--required" for="id">Nome / fantasia</label>
       <input class="form-input" id="id" name="…" type="text">
     </div>
   .form-label--required acrescenta o asterisco (obrigatório). Login (.login-field) é exceção própria.
   Grades: --cols-1 | --cols-2 | --cols-3 | --cols-4 | --split-contact | .form-field--full / .entity-form-grid__full-row
   Quebras: ≤900px reduz densidade; ≤640px empilha em coluna única (exceto onde já é 1 col). */
.form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--form-label-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.3;
}

.form-label--required::after {
    content: '\00a0*';
    color: var(--danger);
    font-weight: 700;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.form-field--full {
    grid-column: 1 / -1;
}

.entity-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 22px;
}

.entity-form-grid + .entity-form-grid,
.entity-form-grid + .entity-form-section,
.entity-form-section + .entity-form-grid,
.entity-form-section + .entity-form-section,
.entity-form-section {
    margin-top: 16px;
}

.entity-form-section {
    width: 100%;
}

/* Painel com autocomplete (cliente, produtos) acima das seções seguintes */
.entity-modal__body > .entity-form-section--stack-top {
    position: relative;
    z-index: 40;
    overflow: visible;
}

.entity-form-section--stack-top .entity-form-grid--split-contact,
.entity-form-section--stack-top .entity-panel--items {
    overflow: visible;
}

.entity-form-section--stack-top .form-field {
    overflow: visible;
}

.entity-form-grid--cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entity-form-grid--cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.entity-form-grid--cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.entity-form-grid--cols-1 {
    grid-template-columns: minmax(0, 1fr);
}

/* Cliente + telefone — OS / orçamento */
.entity-form-grid--split-contact {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

/* Descrição + anotações internas — OS (50% / 50%) */
.entity-form-grid--order-images-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
}

.entity-form-grid--order-images-row--half {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.entity-form-grid--order-images-row--half .form-field--order-images {
    grid-column: 1;
}

.form-field--order-images {
    width: 100%;
    min-width: 0;
}

/* Desktop: imagens em fila horizontal — cards 72px */
.form-field--order-images .order-image-gallery {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    width: auto;
    max-width: 100%;
    margin-top: 0;
    align-items: center;
}

.form-field--order-images .order-image-gallery .order-image-tile:not(.order-image-tile--add),
.form-field--order-images .order-image-gallery .image-preview-item {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    min-width: 72px;
    aspect-ratio: unset;
    border-radius: 8px;
    cursor: pointer;
}

.form-field--order-images .order-image-gallery .order-image-tile--add {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    min-width: 72px;
    display: flex;
    font-size: 18px;
}

.form-field--order-images .order-image-gallery .order-image-tile--add[hidden] {
    display: none !important;
}

.form-field--order-images .order-image-gallery .order-image-tile__remove,
.form-field--order-images .order-image-gallery .image-preview-remove {
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    font-size: 8px;
    border-radius: 3px;
    z-index: 2;
    background: rgba(229, 57, 53, 0.5);
    color: #fff;
    transition: background 0.15s, color 0.15s;
}

.form-field--order-images .order-image-gallery .order-image-tile__remove:hover,
.form-field--order-images .order-image-gallery .image-preview-remove:hover {
    background: #fff;
    color: #e53935;
}

.page-content--entity .form-textarea {
    min-height: 120px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 900px) {
    .entity-form-grid--cols-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .entity-form-grid--cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .entity-form-grid--split-contact {
        grid-template-columns: 1fr;
    }

    .entity-form-grid--order-images-row--half {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .entity-form-grid--cols-4,
    .entity-form-grid--cols-3,
    .entity-form-grid--cols-2 {
        grid-template-columns: 1fr;
    }

    .entity-form-grid:not([class*='cols-']) {
        grid-template-columns: 1fr;
    }
}

label:not(.login-checkbox):not(.form-check) {
    font-size: 11px;
    font-weight: 600;
    color: var(--form-label-color);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="search"],
select {
    padding: var(--form-control-padding-y) var(--form-control-padding-x);
    border: 1px solid var(--form-field-border);
    border-radius: var(--form-radius);
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--text);
    background: #fff;
    transition: border .2s, box-shadow .2s;
    width: 100%;
    min-height: var(--form-control-height);
    line-height: 1.35;
    box-sizing: border-box;
}

textarea {
    padding: var(--form-control-padding-y) var(--form-control-padding-x);
    border: 1px solid var(--form-field-border);
    border-radius: var(--form-radius);
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--text);
    background: #fff;
    transition: border .2s, box-shadow .2s;
    width: 100%;
    line-height: 1.35;
    box-sizing: border-box;
}

input[type="file"].form-input {
    min-height: var(--form-control-height);
    padding: var(--form-control-padding-y) var(--form-control-padding-x);
    line-height: 1.35;
}

/* Campos .form-input — padrão do painel (fundo cinza-claro, igual OS/orçamento) */
input.form-input,
select.form-input,
textarea.form-textarea {
    width: 100%;
    min-height: var(--form-control-height);
    padding: var(--form-control-padding-y) var(--form-control-padding-x);
    border: 1px solid var(--form-field-border);
    border-radius: var(--form-radius);
    font-size: 13.5px;
    font-family: var(--font);
    color: var(--text);
    background: var(--input-bg);
    transition: border 0.2s, box-shadow 0.2s;
    line-height: 1.35;
    box-sizing: border-box;
}

select.form-input,
.form-select {
    appearance: none;
    cursor: pointer;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.4 0L6 4.6 10.6 0 12 1.4l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-color: var(--input-bg);
}

input.form-input:focus,
select.form-input:focus,
textarea.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.18);
}

textarea.form-textarea {
    resize: vertical;
    min-height: 120px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.18);
}

textarea { resize: vertical; min-height: 80px; }

.form-hint { font-size: 11px; color: var(--text-muted); }
.form-error { font-size: 11px; color: var(--danger); }

/* ─── Autocomplete (dropdown genérico) ─────────────────────── */
.autocomplete-dropdown {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 200;
    max-height: 220px;
    overflow-y: auto;
    display: none;
}

.autocomplete-dropdown.show { display: block; }

.autocomplete-item {
    padding: 9px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--bg); }
.autocomplete-empty { padding: 10px 12px; color: var(--text-muted); font-size: 13px; }

/* ─── Itens de OS / Orçamento ───────────────────────────────── */
.items-table-wrap {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
}

.items-table-wrap table { font-size: 13px; }
.items-table-wrap thead th { padding: 8px 12px; font-size: 11px; }
.items-table-wrap tbody td { padding: 8px 12px; }

.item-total { font-weight: 600; }

.add-item-row {
    padding: 8px 12px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

/* ─── Upload de Imagens (OS) ─────────────────────────────────── */
.order-image-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}

.order-image-gallery__input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.order-image-tile {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: #f1f5f9;
}

.order-image-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.order-image-tile--add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8ecf1;
    border: 1px dashed #b9c2cf;
    cursor: pointer;
    color: #64748b;
    font-size: 28px;
    padding: 0;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.order-image-tile--add:hover,
.order-image-tile--add:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
    background: #ebf0ff;
    outline: none;
}

.order-image-tile--add[hidden] {
    display: none;
}

.order-image-tile__remove,
.image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    background: #e53935;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    padding: 0;
    line-height: 1;
    transition: background 0.15s, transform 0.1s;
}

.order-image-tile__remove:hover,
.image-preview-remove:hover {
    background: #c62828;
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: var(--bg);
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: #ebf0ff;
}

.upload-zone i { font-size: 28px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.upload-zone span { font-size: 13px; color: var(--text-muted); }

.image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.image-preview-item img {
    width: 100%; height: 100%;
    object-fit: cover;
}

/* Visualizador de imagens (OS) */
.order-image-viewer {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.order-image-viewer[hidden] {
    display: none !important;
}

.order-image-viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: pointer;
    z-index: 0;
}

.order-image-viewer__close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    pointer-events: auto;
}

.order-image-viewer__close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.order-image-viewer__panel {
    position: relative;
    z-index: 1;
    width: min(96vw, 920px);
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    pointer-events: none;
}

.order-image-viewer__panel > * {
    pointer-events: auto;
}

.order-image-viewer__main {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.order-image-viewer__img {
    display: block;
    max-width: 100%;
    max-height: min(62vh, 640px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
}

.order-image-viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.15s, background 0.15s;
}

.order-image-viewer__nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.order-image-viewer__nav--prev { left: -4px; }
.order-image-viewer__nav--next { right: -4px; }

.order-image-viewer__nav:disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.order-image-viewer__nav:not(:disabled) {
    pointer-events: auto;
}

.order-image-viewer__thumbs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 4px 0;
    max-width: 100%;
}

.order-image-viewer__thumb {
    width: 56px;
    height: 56px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    background: #1a1a1a;
    flex-shrink: 0;
    transition: border-color 0.15s, opacity 0.15s;
    opacity: 0.75;
}

.order-image-viewer__thumb:hover {
    opacity: 0.95;
}

.order-image-viewer__thumb--active {
    border-color: #fff;
    opacity: 1;
}

.order-image-viewer__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 640px) {
    .order-image-viewer__nav {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .order-image-viewer__nav--prev { left: 0; }
    .order-image-viewer__nav--next { right: 0; }

    .order-image-viewer__thumb {
        width: 48px;
        height: 48px;
    }
}

/* Overlay Flutter PDF (/pdf/) — position absolute no painel/iframe evita faixa colapsada */
.pdf-flutter-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    width: 100dvw !important;
    height: 100vh !important;
    height: 100dvh !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    z-index: 2147483000;
    display: block !important;
    box-sizing: border-box;
    overflow: hidden;
    pointer-events: auto;
}

.pdf-flutter-overlay[hidden] {
    display: none !important;
    pointer-events: none !important;
}

body.pdf-flutter-overlay-open {
    overflow: hidden !important;
}

.pdf-flutter-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    cursor: pointer;
    z-index: 0;
}

.pdf-flutter-overlay__panel {
    position: absolute;
    z-index: 1;
    top: 12px;
    bottom: 12px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(800px, calc(100vw - 24px));
    max-width: 800px;
    height: auto;
    margin: 0;
    display: block;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-sizing: border-box;
}

.pdf-flutter-overlay__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.85);
    color: #f8fafc;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pdf-flutter-overlay__close:hover {
    background: #1e293b;
}

.pdf-flutter-overlay__loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 600;
}

.pdf-flutter-overlay__loading[hidden] {
    display: none !important;
}

.pdf-flutter-overlay__frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #fff;
}

/* Pacote printing do Flutter: evita iframe residual visível */
iframe#__net_nfet_printing__ {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    border: 0 !important;
    overflow: hidden !important;
    left: -9999px !important;
    top: 0 !important;
}

@media (max-width: 767px) {
    .pdf-flutter-overlay__panel {
        top: 0;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 100%;
        max-width: 800px;
        border-radius: 0;
    }
}

/* ─── Alertas / Toast ───────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.alert-error   { background: #fdecea; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #e8f8f0; color: #166534; border: 1px solid #86efac; }
.alert-warning { background: #fff3e0; color: #92400e; border: 1px solid #fcd34d; }

.toast-container {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
    animation: toastIn .22s ease;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
}

.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger); color: #fff; }
.toast-info    { background: var(--accent); color: #fff; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* ─── Login Page ────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    font-family: 'Inter', var(--font);
}

.login-page__backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-color: #0a0e14;
    background-image: url('../images/background.jpg');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.login-page__backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    pointer-events: none;
}

.login-page__mark {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-weight: 800;
    font-size: clamp(2.5rem, 12vw, 6rem);
    letter-spacing: -0.04em;
    color: rgba(100, 200, 255, 0.12);
    text-transform: lowercase;
    padding-bottom: 8vh;
}

.login-page__mark small {
    margin-top: 0.35rem;
    font-size: 0.18em;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: rgba(144, 202, 249, 0.14);
    text-transform: uppercase;
}

.login-card {
    position: relative;
    z-index: 1;
    background: #ffffff;
    border-radius: 14px;
    padding: 40px 36px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.login-title {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1f2e;
    margin: 0 0 28px;
    letter-spacing: -0.02em;
}

.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 13px;
    margin-bottom: 18px;
}

.login-alert i { flex-shrink: 0; margin-top: 2px; }

.login-field {
    position: relative;
    margin-bottom: 16px;
}

.login-field__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #9ca3af;
    pointer-events: none;
    z-index: 1;
}

/* Especificidade acima de input[type="text"] global (padding 9px 12px) */
.login-field .login-field__input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 48px;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.login-field .login-field__input--with-toggle {
    padding-right: 48px;
}

.login-field .login-field__input::placeholder {
    color: #9ca3af;
}

.login-field .login-field__input:hover {
    border-color: #cbd5e1;
}

.login-field .login-field__input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

.login-field__toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: color 0.15s, background 0.15s;
}

.login-field__toggle:hover {
    color: #64748b;
    background: #f1f5f9;
}

/* Senha visível: ícone no azul do login */
.login-field__toggle.login-field__toggle--active {
    color: #3182ce;
}

.login-field__toggle.login-field__toggle--active:hover {
    color: #2b6cb0;
    background: rgba(49, 130, 206, 0.12);
}

.login-remember {
    margin-top: 12px;
    margin-bottom: 0;
}

/* Acima da regra global `label { text-transform: uppercase }` */
label.login-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    text-transform: none;
    letter-spacing: normal;
}

.login-checkbox__label {
    text-transform: none;
    font-weight: 500;
    letter-spacing: normal;
}

.login-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.login-checkbox__box {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #d1d5db;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.login-checkbox__box i {
    font-size: 14px;
    color: #fff;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s, transform 0.15s;
}

.login-checkbox input:checked + .login-checkbox__box {
    background: #48bb78;
    border-color: #48bb78;
}

.login-checkbox input:checked + .login-checkbox__box i {
    opacity: 1;
    transform: scale(1);
}

.login-checkbox input:focus-visible + .login-checkbox__box {
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.35);
}

.login-submit {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 10px;
    background: #3182ce;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.05s;
}

.login-submit:hover {
    background: #2b6cb0;
}

.login-submit:active {
    transform: scale(0.99);
}

/* ─── Empty State ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state i   { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state h3  { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.empty-state p   { font-size: 13px; }

/* ─── Divisor de seção ──────────────────────────────────────── */
.section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border);
}

/* ─── Utilitários ───────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.fw-600       { font-weight: 600; }
.fw-700       { font-weight: 700; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* ─── Spinner ───────────────────────────────────────────────── */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Vitrine ───────────────────────────────────────────────── */
.vitrine-page .vitrine-editor-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.vitrine-panel {
    padding: 20px;
}

.vitrine-add-row {
    display: flex;
    gap: 8px;
}

.vitrine-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.vitrine-li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}

.vitrine-li:last-child { border-bottom: none; }

.vitrine-li-title {
    font-size: 13px;
    font-weight: 500;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vitrine-li-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.vitrine-empty { margin-top: 16px; border: 1px dashed var(--border); border-radius: var(--radius); }

.vitrine-grid,
.vitrine-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.vitrine-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
}

.vitrine-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: var(--bg);
}

.vitrine-card-placeholder {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 36px;
}

.vitrine-card-body { padding: 12px; }

.vitrine-card-name {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    min-height: 2.6em;
}

.vitrine-card-type { font-size: 11px; margin-top: 4px; }

.vitrine-card-price {
    font-weight: 700;
    color: var(--accent);
    margin-top: 8px;
    font-size: 14px;
}

.vitrine-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(0,0,0,.65);
    color: #fff;
}

.vitrine-card-badge.off { background: var(--danger); }

.vitrine-public-body { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }

.vitrine-public-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}

.vitrine-public-inner { max-width: 1100px; margin: 0 auto; width: 100%; }

.vitrine-public-logo { height: 40px; width: auto; }

.vitrine-public-brand { font-weight: 700; font-size: 18px; color: var(--text); }

.vitrine-public-main { flex: 1; padding: 24px 20px 40px; }

.vitrine-grid-public { max-width: 1100px; margin: 0 auto; }

.vitrine-public-footer { border-top: 1px solid var(--border); background: var(--card-bg); }

/* ─── Menu mobile (hamburger) ───────────────────────────────── */
.mobile-nav-toggle,
.mobile-nav-backdrop {
    display: none;
}

.mobile-nav-toggle .mobile-nav-icon--close {
    display: none;
}

body.nav-open .mobile-nav-toggle .mobile-nav-icon--menu {
    display: none;
}

body.nav-open .mobile-nav-toggle .mobile-nav-icon--close {
    display: block;
}

body.nav-open {
    overflow: hidden;
}

/* ─── Responsivo (viewport &lt; 800px: menu hambúrguer + coluna única onde aplicável) ─ */
@media (max-width: 799px) {
    .vitrine-page .vitrine-editor-split { grid-template-columns: 1fr; }

    .sidebar {
        display: flex;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 160;
        box-shadow: none;
    }

    body.nav-open .sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
    }

    .main {
        margin-left: 0;
    }

    .mobile-nav-toggle {
        display: none;
    }

    .mobile-nav-toggle-host .mobile-nav-toggle,
    .layout > .mobile-nav-toggle {
        display: none !important;
    }

    .mobile-header-nav {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        align-self: start;
    }

    .mobile-header-nav .mobile-nav-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        position: static !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: 40px;
        height: 40px;
        margin: 0;
        box-shadow: none;
        z-index: auto;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--card-bg);
        color: var(--text);
        cursor: pointer;
        padding: 0;
    }

    .mobile-header-nav .mobile-nav-toggle:hover {
        background: var(--bg);
        color: var(--accent);
        border-color: var(--accent);
    }

    .entity-modal__header .mobile-nav-toggle {
        background: rgba(0, 0, 0, 0.22);
        color: #fff;
        border-color: rgba(255, 255, 255, 0.28);
    }

    .entity-modal__header .mobile-nav-toggle:hover {
        background: rgba(0, 0, 0, 0.34);
        color: #fff;
        border-color: rgba(255, 255, 255, 0.4);
    }

    .page-header .mobile-nav-toggle {
        background: rgba(255, 255, 255, 0.12);
        color: #f1f5f9;
        border-color: rgba(255, 255, 255, 0.2);
    }

    .page-header .mobile-nav-toggle:hover {
        background: rgba(255, 255, 255, 0.2);
        color: #fff;
        border-color: rgba(255, 255, 255, 0.35);
    }

    .page-header.page-header--split {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: start;
        gap: 10px 12px;
        padding: 12px 14px;
    }

    .page-header.page-header--split .page-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: -4px;
    }

    .page-header.page-header--split .page-subtitle {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: -6px;
    }

    .page-header.page-header--split > div:not(.mobile-header-nav):not(.page-header-actions) {
        min-width: 0;
        align-self: center;
    }

    .page-header.page-header--split .page-header-actions {
        flex-shrink: 0;
        align-self: center;
    }

    .page-header:not(.page-header--split) {
        display: flex;
        flex-wrap: nowrap;
        align-items: flex-start;
        padding: 12px 14px;
        gap: 12px;
    }

    .page-header:not(.page-header--split) .mobile-header-nav {
        flex-shrink: 0;
    }

    .mobile-nav-toggle:hover {
        filter: brightness(0.98);
    }

    .mobile-nav-icon {
        font-size: 22px;
        line-height: 1;
    }

    .mobile-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 150;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }

    body.nav-open .mobile-nav-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .page-header {
        padding: 12px 14px;
    }

    /* Modal entidade: menu | título | ações na mesma linha */
    .entity-modal__header {
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 10px 12px;
        padding: 12px 14px;
    }

    .entity-modal__header .mobile-header-nav {
        align-self: center;
    }

    .entity-modal__header .entity-modal__title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .entity-modal__back {
        display: none !important;
    }

    .entity-modal__title {
        order: unset;
        margin: 0;
        text-align: left;
        justify-self: start;
        align-self: center;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .entity-modal__header-actions {
        order: unset;
        justify-self: end;
        align-self: center;
        flex-shrink: 0;
    }

    /* Listagens: 1 linha por registro, largura da tela (sem scroll horizontal) */
    .panel-page-card--list .table-scroll--flutter {
        overflow-x: hidden;
    }

    .panel-page-card--list .data-table--list-fixed {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

    .panel-page-card--list .data-table--list-fixed col {
        width: auto !important;
    }

    .data-table--list-fixed .td-col-id {
        width: 44px;
        min-width: 40px;
        max-width: 48px;
        padding-left: 6px;
        padding-right: 2px;
    }

    .data-table--list-fixed .td-col-fixed {
        width: auto;
        min-width: 0;
        max-width: 72px;
        padding-left: 4px;
        padding-right: 4px;
    }

    .data-table--list-fixed .td-col-datetime,
    .data-table--budgets-list.data-table--list-fixed .td-col-datetime {
        width: auto;
        min-width: 0;
        max-width: 86px;
    }

    .data-table--list-fixed .td-actions {
        width: 36px;
        max-width: 40px;
        min-width: 36px;
        padding-left: 2px;
        padding-right: 6px;
    }

    .data-table--list-fixed thead th {
        padding: 6px 4px;
        font-size: 9px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
    }

    .data-table--list-fixed tbody td {
        padding: 6px 4px;
        font-size: 12px;
        line-height: 1.35;
    }

    /* Produtos: nome em destaque; preço venda compacto; compra oculto no mobile */
    .data-table--products-list th:nth-child(3),
    .data-table--products-list td:nth-child(3) {
        width: 18%;
        max-width: 68px;
    }

    .data-table--products-list th:nth-child(4),
    .data-table--products-list td:nth-child(4) {
        display: none;
    }

    /* OS: oculta descrição (detalhe na edição); status compacto */
    .data-table--orders-list th:nth-child(3),
    .data-table--orders-list td:nth-child(3) {
        display: none;
    }

    .data-table--orders-list th:nth-child(5),
    .data-table--orders-list td:nth-child(5) {
        max-width: 68px;
    }

    /* Clientes: nome + telefone */
    .data-table--clients-list th:nth-child(4),
    .data-table--clients-list td:nth-child(4),
    .data-table--clients-list th:nth-child(5),
    .data-table--clients-list td:nth-child(5) {
        display: none;
    }

    .data-table--clients-list th:nth-child(3),
    .data-table--clients-list td:nth-child(3) {
        max-width: 96px;
    }

    /* Orçamentos */
    .data-table--budgets-list th:nth-child(3),
    .data-table--budgets-list td:nth-child(3),
    .data-table--budgets-list th:nth-child(4),
    .data-table--budgets-list td:nth-child(4) {
        max-width: 68px;
    }

    .data-table--budgets-list th:nth-child(5),
    .data-table--budgets-list td:nth-child(5) {
        max-width: 80px;
    }

    /* Usuários: permissão compacta */
    .data-table--users-list th:nth-child(4),
    .data-table--users-list td:nth-child(4) {
        max-width: 80px;
    }

    .form-grid { grid-template-columns: 1fr; }
    .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }
    .cards-grid { grid-template-columns: 1fr 1fr; }
    .cards-grid--4 { grid-template-columns: 1fr; }
    .modal { margin: 0; border-radius: 0; max-width: 100%; }
    .modal-overlay { padding: 0; align-items: flex-end; }
}

/* Menu compacto: ver responsive.css (oculto a partir de 1024px) */
@media (min-width: 1024px) {
    .mobile-nav-toggle,
    .mobile-nav-backdrop,
    .mobile-header-nav {
        display: none !important;
    }

    body.nav-open {
        overflow: auto;
    }
}

/* ─── Sidebar: fundo opcional (assets/images/sidebar-bg.jpg) ─ */
.sidebar.sidebar--asset-bg {
    background-image:
        linear-gradient(180deg, rgba(232, 234, 237, 0.94), rgba(226, 230, 235, 0.9)),
        url('../images/sidebar-bg.jpg');
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
}

/* ─── Paginação numérica &lt; 1 2 3 … &gt; ─────────────────────── */
.panel-page-card__pager--numeric {
    justify-content: center;
}

.pagination-bar {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 6px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.pagination-bar__edge,
.pagination-bar__page {
    min-width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.pagination-bar__edge {
    color: var(--accent);
    font-weight: 700;
}

.pagination-bar a.pagination-bar__edge:hover,
.pagination-bar a.pagination-bar__page:hover {
    background: #e3f2fd;
    color: var(--accent);
    text-decoration: none;
}

.pagination-bar__page--current {
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: default;
    text-decoration: none;
}

.pagination-bar__edge--disabled {
    color: #cbd5e1;
    cursor: default;
    font-weight: 600;
}

.pagination-bar__ellipsis {
    padding: 0 4px;
    color: var(--text-muted);
    user-select: none;
}

.btn--refresh-circle--primary {
    background: #fff !important;
    border-color: var(--input-border) !important;
    color: var(--accent) !important;
}

.btn--refresh-circle--primary:hover {
    background: #e3f2fd !important;
    border-color: var(--accent) !important;
    color: var(--accent-hover) !important;
}

/* Listagem OS / orçamento: cor do código = status (Aberto azul, Finalizado/Aprovado verde, etc.) */
.td-code.td-code--status-aberto {
    color: #1976d2;
}

.td-code.td-code--status-finalizado {
    color: #2e7d32;
}

.td-code.td-code--status-andamento {
    color: #e65100;
}

.td-code.td-code--status-cancelado {
    color: #64748b;
}

.td-code.td-code--status-reprovado {
    color: #c62828;
}

.td-code--link {
    text-decoration: none;
}

.td-code--link:hover {
    text-decoration: underline;
}

.td-text-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.td-text-link:hover {
    text-decoration: underline;
    color: #1565c0;
}

.td-code--link.td-code--status-aberto:hover {
    color: #1565c0;
}

.td-code--link.td-code--status-finalizado:hover {
    color: #1b5e20;
}

.td-code--link.td-code--status-andamento:hover {
    color: #bf360c;
}

.td-code--link.td-code--status-cancelado:hover {
    color: #475569;
}

.td-code--link.td-code--status-reprovado:hover {
    color: #b71c1c;
}

/* ─── Listagens (header fixo + card com scroll + paginação fixa) ─ */
/* Só páginas com tabela sticky (panel-page-card--list). Showcase e similares ficam com scroll de página. */
.app-body:has(.panel-page-card--list) {
    overflow: hidden;
    height: 100%;
}

.app-body:has(.panel-page-card--list) .layout {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.app-body:has(.panel-page-card--list) .main {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.app-body:has(.panel-page-card--list) .main-inner {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.page-content.page-content--list:has(.panel-page-card--list) {
    flex: 1 1 auto;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.page-content--list > .alert {
    flex-shrink: 0;
}

.panel-page-card--list {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    border-radius: 16px;
}

.panel-page-card--list .panel-page-card__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.panel-page-card--list .filters-toolbar {
    flex-shrink: 0;
    padding: 12px var(--page-body-padding);
}

.panel-page-card--list .panel-page-card__body .table-scroll--flutter {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: auto;
    overflow-y: visible;
}

.panel-page-card--list .table-scroll--flutter {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.panel-page-card--list .panel-page-card__pager {
    flex-shrink: 0;
    margin-top: 0;
    padding: 8px var(--page-body-padding);
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
    justify-content: center;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    border-radius: 0 0 16px 16px;
}

.panel-page-card--list .panel-page-card__pager--footer {
    justify-content: stretch;
}

/* Mobile listagens: página inteira scrollável (não travar viewport) */
@media (max-width: 767px) {
    .app-body:has(.panel-page-card--list) {
        overflow: auto;
        height: auto;
        min-height: 100%;
    }

    .app-body:has(.panel-page-card--list) .layout,
    .app-body:has(.panel-page-card--list) .main {
        height: auto;
        max-height: none;
        min-height: 100dvh;
        overflow: visible;
    }

    .app-body:has(.panel-page-card--list) .main-inner {
        max-height: none;
        overflow: visible;
        min-height: 0;
    }

    .page-content.page-content--list:has(.panel-page-card--list) {
        max-height: none;
        overflow: visible;
        flex: 1 0 auto;
    }

    .panel-page-card--list {
        max-height: none;
        overflow: visible;
        flex: 1 0 auto;
    }

    .panel-page-card--list .panel-page-card__body {
        overflow: visible;
        flex: 0 0 auto;
        min-height: 0;
    }

    .panel-page-card--list .panel-page-card__body .table-scroll--flutter,
    .panel-page-card--list .table-scroll--flutter {
        flex: 0 0 auto;
        min-height: 0;
        overflow-x: auto;
        overflow-y: visible;
    }
}

.panel-page-card--list .data-table--flutter thead th {
    padding: 7px 12px;
    font-size: 10px;
}

.panel-page-card--list .data-table--flutter tbody td {
    padding: 5px 12px;
    font-size: 13px;
    line-height: 1.35;
}

.panel-page-card--list .td-actions {
    padding-top: 4px;
    padding-bottom: 4px;
    padding-right: 10px;
}

.panel-page-card--list .td-actions__inner {
    gap: 5px;
}

.panel-page-card--list .btn-icon-circle {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.panel-page-card--list .pagination-bar {
    gap: 3px 5px;
}

.panel-page-card--list .pagination-bar__edge,
.panel-page-card--list .pagination-bar__page {
    min-width: 28px;
    height: 28px;
    font-size: 12px;
    padding: 0 5px;
}

.panel-page-card--list .pagination-bar__ellipsis {
    height: 28px;
    line-height: 28px;
    padding: 0 2px;
}

/* ─── Formulário entidade (modal estilo referência) ─────────── */
/* Shell ocupa a viewport; header/rodapé fixos; scroll só no corpo */
.app-body:has(.page-content--entity) {
    overflow: hidden;
    height: 100%;
}

.app-body:has(.page-content--entity) .layout {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.app-body:has(.page-content--entity) .main {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

.app-body:has(.page-content--entity) .main-inner {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.page-content.page-content--entity {
    flex: 1 1 auto;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.page-content--entity {
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-sizing: border-box;
}

.page-content--entity .entity-modal {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
}

.entity-modal {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--panel-shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    min-height: auto;
}

.entity-modal__header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px 16px;
    padding: 14px 18px;
    background: linear-gradient(180deg, #1e88e5 0%, #1976d2 100%);
    color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.entity-modal__back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}

.entity-modal__back:hover {
    background: rgba(0, 0, 0, 0.32);
    color: #fff;
    text-decoration: none;
}

.entity-modal__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: left;
    justify-self: start;
    max-width: 100%;
}

.entity-modal__header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-self: end;
}

.entity-modal__close,
.entity-modal__icon-act {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    text-decoration: none;
    transition: background 0.15s;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.entity-modal__close:hover,
.entity-modal__icon-act:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    text-decoration: none;
}

.entity-modal__icon-act--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.entity-modal__body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    padding: var(--page-body-padding);
    background: linear-gradient(180deg, #f4f6fb 0%, #eef1f6 100%);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.entity-modal__body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/logo.png') center 42% / min(420px, 58%) no-repeat;
    opacity: 0.045;
    pointer-events: none;
}

.entity-modal__body > * {
    position: relative;
    z-index: 1;
}

/* Autocomplete: seções empilhadas acima dos irmãos (sobrescreve regra acima) */
.entity-modal__body > .entity-form-section--stack-top {
    z-index: 40;
}

.entity-modal__footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-top: 1px solid var(--border);
    border-radius: 0 0 16px 16px;
    background: var(--card-bg);
    overflow: hidden;
    isolation: isolate;
    flex-shrink: 0;
}

.page-content--entity .entity-modal__footer {
    position: relative;
    z-index: 100;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
    margin-top: 0;
}

.entity-modal__foot-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: filter 0.15s, background 0.15s;
}

.entity-modal__foot-btn--secondary {
    background: #eceff1;
    color: #37474f;
    border-radius: 0 0 0 16px;
}

.entity-modal__foot-btn--secondary:hover {
    background: #dfe3e6;
    color: #263238;
}

.entity-modal__foot-btn--primary {
    background: #1976d2;
    color: #fff;
    border-radius: 0 0 16px 0;
}

.entity-modal__foot-btn--primary:hover {
    filter: brightness(1.05);
}

.entity-panel {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px 20px;
    margin-top: 8px;
}

.entity-panel__title {
    display: block;
    font-size: 13px;
    margin-bottom: 14px;
    color: var(--text);
}

/* Grid da linha de inclusão — 5 colunas (Item expande | Qtd | Preço | Desconto | ação). */
.entity-panel--items {
    --entity-item-grid-cols: minmax(0, 1fr) 56px 120px 96px 42px;
    --entity-item-col-gap: 10px;
    --entity-item-cell-pad-x: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-top: 0;
}

.entity-item-add-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
    position: relative;
    box-sizing: border-box;
}

.entity-item-add-labels,
.entity-item-add-fields {
    display: grid;
    grid-template-columns: var(--entity-item-grid-cols);
    column-gap: var(--entity-item-col-gap);
    row-gap: 6px;
    align-items: end;
}

.entity-panel--items .entity-item-add-labels .form-label {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-transform: none;
    letter-spacing: normal;
    color: var(--form-label-color);
}

.entity-item-add-labels > * {
    min-width: 0;
}

.entity-item-add-labels > label[for="prod_search"] {
    text-align: left;
}

.entity-item-add-labels label[for="add_qtd"] {
    text-align: center;
    justify-self: center;
}

.entity-item-add-labels label[for="add_price"] {
    text-align: right;
    justify-self: stretch;
    padding-right: 8px;
}

.entity-item-add-labels label[for="add_disc"] {
    text-align: right;
    justify-self: stretch;
    padding-right: 14px;
    white-space: nowrap;
}

.entity-item-add-spacer {
    display: block;
    min-width: 0;
}

.entity-item-add-fields > * {
    min-width: 0;
}

.entity-item-add-fields > .autocomplete-wrap {
    min-width: 0;
    width: 100%;
}

.entity-item-add-fields .entity-item-add-qtd {
    width: 100%;
    text-align: center;
}

.entity-item-add-fields .input-affix--currency,
.entity-item-add-fields .input-affix--pct {
    width: 100%;
    max-width: none;
}

.entity-item-add-actions {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    min-width: 0;
    box-sizing: border-box;
}

.entity-item-add-fields .input-affix--currency .form-input {
    text-align: right;
}

.entity-item-add-actions .btn-add-square {
    flex-shrink: 0;
}

/* Prefixo R$ / sufixo % sem sobrepor o valor (OS / orçamento — linha de itens) */
.input-affix {
    display: flex;
    align-items: stretch;
    min-width: 0;
    min-height: var(--form-control-height);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
    transition: border 0.2s, box-shadow 0.2s;
}

.input-affix:focus-within {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.18);
}

.input-affix .form-input {
    border: none;
    border-radius: 0;
    box-shadow: none !important;
    flex: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
}

.input-affix .form-input:focus {
    outline: none;
    box-shadow: none;
}

.input-affix--currency .input-affix__prefix {
    padding: 9px 0 9px 12px;
    font-size: 13.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    pointer-events: none;
}

.input-affix--currency .form-input {
    padding-left: 6px;
}

.input-affix--pct .input-affix__suffix {
    padding: 9px 12px 9px 4px;
    font-size: 13.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    pointer-events: none;
}

.input-affix--pct .form-input {
    padding-right: 4px;
    text-align: right;
}

.data-table--entity-items .input-affix--currency {
    width: 100%;
    max-width: 120px;
}

.data-table--entity-items .input-affix--pct {
    width: 100%;
    max-width: 96px;
}

.entity-input--narrow {
    max-width: 96px;
    min-width: 96px;
}

.entity-input--mid {
    max-width: 140px;
    min-width: 110px;
}

.btn-add-square {
    width: var(--form-control-height);
    height: var(--form-control-height);
    min-width: var(--form-control-height);
    padding: 0;
    border: none;
    border-radius: 8px;
    background: var(--success);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transition: filter 0.12s, transform 0.12s;
}

.btn-add-square:hover {
    filter: brightness(1.08);
    transform: scale(1.03);
}

.entity-items-table-wrap {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--entity-items-table-bg);
    position: relative;
}

.entity-items-table-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.04;
    pointer-events: none;
}

.entity-items-summary {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.entity-items-summary__discount-block,
.entity-items-summary__totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    min-width: min(100%, 240px);
}

.entity-items-summary__discount-block {
    flex: 1 1 auto;
    align-items: stretch;
    max-width: 280px;
    width: 100%;
}

.entity-items-summary__discount-block .entity-items-summary__row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
}

.entity-items-summary__discount-block .entity-items-summary__pct-input,
.entity-items-summary__discount-block .entity-items-summary__value {
    justify-self: end;
}

.entity-items-summary__totals {
    flex: 0 0 auto;
    margin-left: auto;
}

.entity-items-summary__pct-input {
    width: 96px;
}

.entity-items-summary__pct-input .form-input {
    text-align: right;
    min-height: 34px;
    padding-top: 6px;
    padding-bottom: 6px;
}

.entity-items-summary__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.entity-items-summary__row--grand {
    margin-top: 2px;
    padding-top: 10px;
    border-top: 1px dashed #cfd8dc;
}

.entity-items-summary__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--form-label-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.entity-items-summary__value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.entity-items-summary__value--grand {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
}

.entity-items-summary__grand-input {
    max-width: 11rem;
    margin-left: auto;
}

.entity-items-summary__grand-field {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
    .entity-items-summary {
        flex-direction: column;
        align-items: stretch;
    }

    .entity-items-summary__discount-block,
    .entity-items-summary__totals {
        max-width: none;
        align-items: stretch;
    }

    .entity-items-summary__totals {
        margin-left: 0;
    }
}

.data-table--entity-items {
    margin: 0;
    font-size: 13px;
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}

.data-table--entity-items thead th {
    background: #eceff1;
    font-size: 12px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    padding: 10px 8px;
    border-bottom: 1px solid #455a64;
}

.data-table--entity-items tbody td {
    padding: 10px 8px;
    background: var(--entity-items-table-bg);
}

.data-table--entity-items thead th:first-child,
.data-table--entity-items tbody td:first-child {
    text-align: left;
    padding-left: 12px;
}

.data-table--entity-items thead th:not(:first-child) {
    text-align: center;
}

.data-table--entity-items .td-entity-item {
    vertical-align: middle;
    padding-left: 12px;
}

.data-table--entity-items .td-entity-qty {
    width: 56px;
    vertical-align: middle;
    text-align: center;
}

.data-table--entity-items .td-entity-price {
    width: 120px;
    vertical-align: middle;
    text-align: center;
}

.data-table--entity-items .td-entity-disc {
    width: 96px;
    vertical-align: middle;
    text-align: center;
}

.data-table--entity-items .td-entity-total {
    width: 100px;
    vertical-align: middle;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
}

.data-table--entity-items .td-entity-actions {
    width: 40px;
    text-align: center;
    vertical-align: middle;
}

.entity-item-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.data-table--entity-items .input-ghost {
    margin: 0;
    width: 100%;
    min-height: 0;
    border: none;
    background: transparent;
    padding: 5px 6px;
    font-size: 13px;
    font-family: inherit;
    color: inherit;
    line-height: 1.35;
    border-radius: 4px;
    box-shadow: none;
    transition: background 0.12s, box-shadow 0.12s;
}

.data-table--entity-items .input-ghost:focus {
    outline: none;
    background: rgba(25, 118, 210, 0.08);
    box-shadow: inset 0 0 0 1px rgba(25, 118, 210, 0.35);
}

.data-table--entity-items .input-ghost--qty {
    max-width: 56px;
    text-align: center;
    -moz-appearance: textfield;
}

.data-table--entity-items .input-ghost--qty::-webkit-outer-spin-button,
.data-table--entity-items .input-ghost--qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.data-table--entity-items .input-affix--ghost {
    border: none;
    background: transparent;
    min-height: 0;
    box-shadow: none;
    align-items: center;
}

.data-table--entity-items .td-entity-disc .input-affix--ghost {
    display: flex;
    width: 100%;
    max-width: 96px;
    margin-left: auto;
    margin-right: 0;
}

.data-table--entity-items .td-entity-disc .input-affix--ghost .input-ghost {
    text-align: right;
    padding-right: 2px;
}

.data-table--entity-items .td-entity-price .input-affix--ghost {
    display: inline-flex;
    vertical-align: middle;
    margin-left: auto;
    margin-right: auto;
}

.data-table--entity-items .td-entity-price .input-affix--ghost .input-ghost {
    text-align: right;
}

.data-table--entity-items .input-affix--ghost:focus-within {
    outline: none;
    background: rgba(25, 118, 210, 0.08);
    box-shadow: inset 0 0 0 1px rgba(25, 118, 210, 0.35);
    border-radius: 4px;
}

.data-table--entity-items .input-affix--ghost .input-affix__prefix {
    padding: 5px 0 5px 4px;
    font-size: 13px;
}

.data-table--entity-items .input-affix--ghost .input-affix__suffix {
    padding: 5px 6px 5px 2px;
    font-size: 13px;
}

.data-table--entity-items .input-affix--ghost .input-ghost {
    padding: 5px 4px;
}

.entity-row-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}

.entity-row-remove:hover {
    background: rgba(229, 57, 53, 0.12);
    color: var(--danger);
}

.td-empty {
    text-align: center;
    vertical-align: middle;
    padding: 48px 16px !important;
    min-height: 120px;
    color: #78909c;
    font-size: 13px;
    background: var(--entity-items-table-bg);
}

.password-field {
    position: relative;
    display: flex;
    align-items: stretch;
}

.password-field .form-input {
    flex: 1;
    padding-right: 44px;
}

.password-field__toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.15s, color 0.15s;
}

.password-field__toggle:hover {
    background: #f1f5f9;
    color: var(--accent);
}

/* Campo telefone com ações Ligar / WhatsApp */
.phone-field {
    position: relative;
    width: 100%;
}

.phone-field__input {
    width: 100%;
    padding-right: 72px;
}

.phone-field--single-action .phone-field__input {
    padding-right: 40px;
}

.phone-field__actions {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 4px;
}

.phone-field__btn {
    width: 30px;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.phone-field__btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.phone-field__btn--call:not(:disabled) {
    background: #e3f2fd;
    color: var(--accent);
}

.phone-field__btn--call:not(:disabled):hover {
    background: #bbdefb;
}

.phone-field__btn--whatsapp:not(:disabled) {
    background: #e8f5e9;
    color: #128c7e;
}

.phone-field__btn--whatsapp:not(:disabled):hover {
    background: #c8e6c9;
}

@media (max-width: 900px) {
    /* Mantém as mesmas colunas do desktop; rolagem horizontal se a viewport for estreita */
    .entity-panel--items {
        --entity-item-grid-cols: minmax(280px, 1fr) 56px 120px 96px 42px;
    }

    .entity-item-add-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .entity-item-add-labels,
    .entity-item-add-fields {
        min-width: 644px;
    }

    .entity-items-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table--entity-items {
        min-width: 720px;
    }
}

@media (max-width: 600px) {
    .entity-modal__footer {
        grid-template-columns: 1fr;
    }

    .entity-modal__foot-btn--secondary {
        border-radius: 0;
    }

    .entity-modal__foot-btn--primary {
        border-radius: 0 0 16px 16px;
    }
}
