:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --surface2: #243044;
    --text: #e8edf4;
    --muted: #8b9cb3;
    --accent: #3d9a5c;
    --accent-hover: #4db36e;
    --danger: #e05c5c;
    --border: #2d3a4f;
    --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}
.brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-links a, .btn-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-links a:hover, .btn-link:hover { color: var(--accent); }
.nav-links .user { color: var(--text); font-weight: 500; }

.support-banner {
    padding: 0.6rem 1.5rem;
    background: rgba(61, 154, 92, 0.12);
    border-bottom: 1px solid rgba(61, 154, 92, 0.35);
    color: var(--text);
    font-size: 0.875rem;
    text-align: center;
}

.support-banner strong { color: var(--accent); }

.restriction-banner {
    background: rgba(224, 92, 92, 0.12);
    border-bottom-color: rgba(224, 92, 92, 0.4);
}
.restriction-banner strong { color: var(--danger); }

.support-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    margin: 0 1rem;
    flex-wrap: wrap;
}

.support-nav-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.support-search-wrap {
    position: relative;
    flex: 1;
    min-width: 160px;
    max-width: 280px;
}

.support-search-input {
    width: 100%;
    padding: 0.45rem 0.65rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
}

.support-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.support-result {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.support-result:last-child { border-bottom: none; }
.support-result:hover { background: var(--surface2); }
.support-result-title { font-size: 0.875rem; font-weight: 500; }
.support-result-meta { font-size: 0.75rem; color: var(--muted); }
.support-result-empty { padding: 0.75rem; color: var(--muted); font-size: 0.85rem; }

.support-farm-select {
    padding: 0.45rem 0.65rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    max-width: 220px;
}

.support-context-pill {
    font-size: 0.8rem;
    color: var(--text);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    white-space: nowrap;
}

.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }

.support-farm-locked {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    color: var(--muted);
}

@media (max-width: 900px) {
    .navbar { flex-wrap: wrap; gap: 0.5rem; }
    .support-nav { margin: 0; order: 3; width: 100%; }
}

.container { padding: 1.5rem; max-width: 1400px; margin: 0 auto; }

.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.page-header p { color: var(--muted); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.farm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.farm-card h2 { font-size: 1.2rem; margin-bottom: 0.25rem; }
.farm-card p { color: var(--muted); font-size: 0.9rem; margin-bottom: 1rem; }
.card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: #c0392b; color: #fff; border: 1px solid #a93226; }
.btn-danger:hover { background: #a93226; }

.features { margin-top: 2rem; }
.features h2 { margin-bottom: 0.75rem; }
.features ul { padding-left: 1.25rem; color: var(--muted); }
.features li { margin-bottom: 0.35rem; }
.features a { color: var(--accent); }

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    color: var(--muted);
}

.empty-state pre {
    margin-top: 1rem;
    background: var(--bg);
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    text-align: left;
    overflow-x: auto;
}

.auth-card {
    max-width: 400px;
    margin: 3rem auto;
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.auth-card h1 { margin-bottom: 1.5rem; }
.auth-card label { display: block; margin-bottom: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.auth-card input,
.auth-card select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
}

.wizard-card { max-width: 440px; }

.auth-card .btn { width: 100%; margin-top: 0.5rem; }
.auth-card .hint { margin-top: 1rem; font-size: 0.8rem; color: var(--muted); }
.auth-card code { background: var(--bg); padding: 0.15rem 0.4rem; border-radius: 4px; }

/* Senha com bot├úo olho */
.password-field {
    position: relative;
    margin-bottom: 1rem;
}
.password-field input {
    margin-bottom: 0;
    padding-right: 2.75rem;
}
.password-toggle {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.password-toggle:hover {
    color: var(--text);
    background: var(--surface2);
}
.password-toggle .phosphor-icon {
    display: block;
}
.password-toggle-icon[hidden] {
    display: none !important;
}

.auth-card .auth-submit {
    margin-top: 0.25rem;
}
.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.auth-actions .auth-action-btn {
    width: 100%;
    margin-top: 0;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}

.alert { padding: 0.75rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-error { background: rgba(224, 92, 92, 0.15); color: var(--danger); }
.alert-error a,
.restriction-banner a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.turnstile-wrap { margin: 1rem 0; }
.email-verify-card .email-highlight { margin: 0.75rem 0 1rem; font-size: 1.05rem; }
.email-verify-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.email-verify-actions .btn { flex: 1; min-width: 140px; }
.btn-disabled, .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hint.error, #verify-toast.error { color: var(--danger); }
.hint.hidden, .hidden { display: none !important; }

/* Map */
.map-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 0.4rem 0.75rem;
}

.toolbar-left { display: flex; align-items: center; gap: 0.75rem; }
.toolbar-left h1 { font-size: 1.25rem; }
.toolbar-left select, #move-paddock-select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-family: inherit;
}

.stocking-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.stocking-label { color: var(--muted); margin-right: 0.35rem; }
#module-ua { font-weight: 600; color: var(--accent); }

.side-panel {
    position: fixed;
    right: 1rem;
    top: 5rem;
    bottom: 1rem;
    width: min(340px, calc(100vw - 2rem));
    max-height: calc(100vh - 6rem);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.15rem 1rem;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    overflow: hidden;
    box-sizing: border-box;
}

.side-panel.hidden { display: none !important; }
.side-panel h3 {
    margin: 0 1.75rem 0.65rem 0;
    flex-shrink: 0;
    font-size: 1.05rem;
    line-height: 1.3;
}
/* Resumo + lista de animais: rola; a├º├╡es de mover ficam fixas embaixo */
.side-panel #panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 0.15rem;
    margin-bottom: 0.25rem;
}
.side-panel .detail { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
.side-panel .detail strong { color: var(--text); }

/* M5 — projeção GMD no painel do lote */
.lot-gmd-block {
    margin: 0.85rem 0 0.5rem;
    padding: 0.65rem 0.7rem;
    background: var(--surface-2, rgba(0,0,0,0.12));
    border-radius: 8px;
    border: 1px solid var(--border);
}
.lot-gmd-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.lot-gmd-loading { font-size: 0.78rem; margin: 0; }
.lot-gmd-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.45rem;
}
.lot-gmd-stat {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.lot-gmd-stat.wide { grid-column: 1 / -1; }
.lot-gmd-stat .k { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.lot-gmd-stat .v { font-size: 0.88rem; font-weight: 600; color: var(--text); }
.lot-gmd-chart-wrap {
    position: relative;
    height: 168px;
    width: 100%;
    margin-top: 0.25rem;
}
.lot-gmd-tip {
    margin-top: 0.45rem;
    padding: 0.45rem 0.5rem;
    font-size: 0.72rem;
    line-height: 1.35;
    background: var(--surface, #1a2332);
    border: 1px solid var(--border);
    border-radius: 6px;
    max-height: 160px;
    overflow-y: auto;
}
.lot-gmd-tip.hidden { display: none !important; }
.lot-gmd-tip-date { margin-bottom: 0.25rem; }
.lot-gmd-tip-row { margin: 0.1rem 0; }
.lot-gmd-tip-focus { margin: 0.35rem 0 0.15rem; font-weight: 600; color: var(--text); }
.lot-gmd-tip-list {
    list-style: none;
    margin: 0.3rem 0 0;
    padding: 0;
}
.lot-gmd-tip-list li {
    padding: 0.12rem 0;
    border-bottom: 1px solid rgba(128,128,128,0.12);
}
.lot-gmd-tip-list a { color: var(--accent, #5b8def); text-decoration: none; }
.lot-gmd-tip-list a:hover { text-decoration: underline; }
.lot-gmd-hint {
    font-size: 0.7rem;
    margin: 0.4rem 0 0;
    line-height: 1.3;
}

.panel-animals { margin-top: 0.75rem; font-size: 0.85rem; }
.panel-animal-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.panel-animal-list li {
    display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
    padding: 0.35rem 0.5rem; background: var(--surface-2); border-radius: 6px;
}
.panel-animal-list li span { flex: 1; min-width: 120px; }
.panel-animal-list .btn-sm { padding: 0.15rem 0.45rem; font-size: 0.72rem; }
.panel-actions {
    flex-shrink: 0;
    margin-top: 0.5rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}
.panel-actions label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }
.panel-actions select { width: 100%; margin-bottom: 0.5rem; }
.panel-actions .btn { width: 100%; }

.btn-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface2);
    border: 1px solid var(--accent);
    color: var(--text);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    z-index: 2000;
    font-size: 0.9rem;
}

.toast.hidden { display: none; }
.toast.error { border-color: var(--danger); }

.leaflet-container { background: #1a2332; font-family: inherit; }

/* Leaflet Draw ΓÇö v├⌐rtices redondos, pequenos; linhas de guia normais */
.leaflet-editing-icon,
.leaflet-div-icon.leaflet-editing-icon,
.leaflet-draw-marker,
.leaflet-marker-icon.leaflet-draw-marker,
.leaflet-marker-icon.leaflet-editing-icon,
.map-draw-vertex {
    border-radius: 50% !important;
    width: 9px !important;
    height: 9px !important;
    margin-left: -4.5px !important;
    margin-top: -4.5px !important;
    border: 2px solid #fff !important;
    background: #3d9a5c !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
    box-sizing: border-box !important;
    background-image: none !important;
}
.leaflet-touch-icon.leaflet-editing-icon,
.leaflet-div-icon.leaflet-touch-icon {
    width: 14px !important;
    height: 14px !important;
    margin-left: -7px !important;
    margin-top: -7px !important;
}
.leaflet-draw-guide-dash {
    stroke: #3d9a5c !important;
    stroke-width: 2 !important;
    stroke-dasharray: 6, 6 !important;
    fill: none !important;
    opacity: 0.75 !important;
}
.leaflet-draw-tooltip {
    font-size: 0.75rem;
    padding: 0.2rem 0.45rem;
}

.map-point-icon {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
/* Rótulos do mapa: um cartão compacto (nome + área), clicável. */
.leaflet-div-icon.map-label {
    background: transparent !important;
    border: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    pointer-events: auto;
    overflow: visible !important;
}
.map-label-inner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    width: max-content;
    max-width: 11rem;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(15, 20, 25, 0.88);
    color: #f0f4f8;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    line-height: 1.2;
    pointer-events: auto;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.map-label-name {
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    color: #f0f4f8;
}
.map-label-area {
    font-size: 0.6rem;
    font-weight: 500;
    color: #c5d0dc;
    white-space: nowrap;
}
.map-label span {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
    white-space: nowrap;
    pointer-events: auto;
}
.map-label.module-label .map-label-inner { border-color: #4CAF50; }
.map-label.module-label .map-label-name { color: #8fd4a8; }
.map-label.module-label .map-label-area { color: #a8e0bc; }
.map-label.paddock-label .map-label-inner { border-color: #64b5f6; }
.map-label.paddock-label .map-label-name { font-size: 0.65rem; color: #e3f2fd; }
.map-label.paddock-label .map-label-area { font-size: 0.55rem; color: #bbdefb; }
.map-label.module-label span { color: #8fd4a8; }
.map-label.paddock-label span { font-size: 0.65rem; color: #e3f2fd; }
.map-label.cattle-label span { font-size: 0.6rem; opacity: 0.9; color: #f0f4f8; }

.map-dialog {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center; z-index: 1100;
    pointer-events: auto;
}
.map-dialog-card { width: 100%; max-width: 380px; padding: 1.25rem; }
.map-dialog-card.map-dialog-card--wide {
    max-width: 760px;
    max-height: 90vh;
    overflow: auto;
}
.map-dialog-data-grid.map-dialog-data-grid--split {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(280px, 1.15fr);
    gap: 0.5rem 1.25rem;
    align-items: start;
}
.map-dialog-ident {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: end;
}
.map-dialog-ident--nocolor { grid-template-columns: 1fr; }
.map-dialog-usable {
    margin-top: 0;
    padding-top: 0;
    padding-left: 1.1rem;
    border-left: 1px solid var(--border);
    min-width: 0;
}
.map-usable-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}
.map-dialog-paddock-list {
    max-height: 11rem;
    overflow-y: auto;
    margin: 0.45rem 0 0.35rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.map-dialog-paddock-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    padding: 0.2rem 0;
}
.map-dialog-paddock-item .ha { margin-left: auto; color: var(--muted); white-space: nowrap; }
.map-dialog-usable-summary { font-size: 0.8rem; margin: 0.25rem 0 0.5rem; }
.map-usable-ha-row {
    display: grid;
    grid-template-columns: 1fr 7.5rem;
    gap: 0.5rem;
    align-items: end;
}
.map-usable-ha-row label { margin-bottom: 0.2rem; }
.map-usable-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}
.map-usable-mode {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    margin: 0;
}
@media (max-width: 720px) {
    .map-dialog-data-grid.map-dialog-data-grid--split {
        display: block;
    }
    .map-dialog-usable {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}
.map-dialog-card h3 { margin-bottom: 1rem; }
.map-dialog .form-group { margin-bottom: 0.75rem; }
.map-dialog-actions { align-items: center; flex-wrap: wrap; }
.map-dialog-actions-grow { flex: 1; min-width: 0.5rem; }
.map-dialog-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}
.map-dialog-tab {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
.map-dialog-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.map-dialog-shape-hint { font-size: 0.85rem; line-height: 1.45; margin-bottom: 0.5rem; }
/* Modo pol├¡gono: painel lateral sem cobrir o mapa ΓÇö mapa permanece clic├ível */
.map-dialog.shape-mode {
    inset: auto;
    right: 1rem;
    top: 5rem;
    left: auto;
    bottom: auto;
    width: 300px;
    height: auto;
    background: transparent;
    display: block;
    pointer-events: none;
}
.map-dialog.shape-mode .map-dialog-card {
    pointer-events: auto;
    max-width: 100%;
    margin: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

/* V├⌐rtices de edi├º├úo acima das camadas do mapa */
body.map-vertex-edit-active .leaflet-marker-pane { z-index: 700 !important; }
body.map-vertex-edit-active .leaflet-overlay-pane { z-index: 650 !important; }

.paddock-tooltip {
    font-size: 0.8rem;
    line-height: 1.4;
}

.cattle-marker {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    cursor: grab;
    position: relative;
}

.cattle-marker.male { background: #4a90d9; }
.cattle-marker.female { background: #d94a8a; }
.cattle-marker.dragging { cursor: grabbing; opacity: 0.7; }

/* Wrapper Leaflet: sem fundo/borda padr├úo do divIcon */
.lot-marker-wrap.leaflet-div-icon {
    background: transparent;
    border: none;
}

/* Pin de lote clean ΓÇö card quase quadrado, borda arredondada */
.lot-marker {
    position: relative;
    overflow: visible;
    width: 86px;
    min-height: 74px;
    box-sizing: border-box;
    padding: 8px 5px 9px;
    border-radius: 16px;
    background: #fff;
    border: 2px solid #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    line-height: 1.15;
    user-select: none;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.lot-marker.dragging {
    cursor: grabbing;
    opacity: 0.85;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transform: scale(1.04);
}

/* Pin compacto (zoom médio) — só contagem M/F */
.lot-marker.lot-marker--compact {
    width: 64px;
    min-height: 36px;
    padding: 6px 6px 8px;
    border-radius: 12px;
    gap: 0;
}
.lot-marker.lot-marker--compact .lot-sex-row {
    font-size: 1rem;
    gap: 8px;
}
.lot-marker.lot-marker--compact .lot-lock-btn {
    width: 18px;
    height: 18px;
    font-size: 9px;
    right: -5px;
    bottom: -5px;
}

.lot-marker .lot-sex-row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.lot-marker .lot-m {
    color: #2b9fd9; /* azul macho */
}

.lot-marker .lot-f {
    color: #e891b8; /* rosa f├¬mea */
}

.lot-marker .lot-ua,
.lot-marker .lot-days {
    font-size: 0.68rem;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lot-marker .lot-ua {
    margin-top: 2px;
}

.lot-marker .lot-days {
    color: #222;
    font-weight: 500;
}

/* Cadeado no canto inferior direito do pin */
.lot-marker .lot-lock-btn {
    position: absolute;
    right: -6px;
    bottom: -6px;
    width: 22px;
    height: 22px;
    padding: 0;
    margin: 0;
    border: 1.5px solid #1a1a1a;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    -webkit-user-select: none;
    user-select: none;
}

.lot-marker .lot-lock-btn:hover {
    background: #f3f4f6;
}

.lot-marker .lot-lock-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.lot-marker.is-locked {
    border-color: #b45309;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.28);
}

.lot-marker.is-locked .lot-lock-btn {
    background: #fff7ed;
    border-color: #b45309;
}

/* legado (se restar markup antigo) */
.lot-marker .lot-emoji { font-size: 15px; line-height: 1; }
.lot-marker .lot-count {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #1a2332;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 1.5px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
    pointer-events: none;
}

.map-entity-popup { font-size: 0.85rem; line-height: 1.5; }
.map-entity-popup .map-edit-btn,
.map-entity-popup .map-delete-btn {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
}

.paddock-module-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: rgba(76, 175, 80, 0.12);
}
.paddock-module-label {
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
}
.paddock-module-select {
    max-width: 220px;
    min-width: 160px;
}

/* Forms & tables */
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.btn-edit-cattle {
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    min-width: 110px;
    text-align: center;
}
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { text-align: center; padding: 1.25rem; }
.stat-value { display: block; font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 0.85rem; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.action-card { text-decoration: none; color: inherit; transition: border-color 0.2s; }
.action-card:hover { border-color: var(--accent); }
.action-card h2 { font-size: 1.1rem; margin-bottom: 0.35rem; }
.action-card p { color: var(--muted); font-size: 0.85rem; }
.cattle-form { padding: 1.5rem; }
.form-section { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.form-section h2 { font-size: 1rem; margin-bottom: 0.75rem; color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.25rem; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { font-size: 0.8rem; color: var(--muted); }
.form-control, .cattle-form select, .cattle-form input, .cattle-form textarea {
    background: var(--bg); border: 1px solid var(--border); color: var(--text);
    padding: 0.5rem 0.75rem; border-radius: 8px; font-family: inherit;
}
.form-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.filter-bar { display: flex; gap: 0.75rem; flex-wrap: wrap; padding: 1rem; margin-bottom: 1rem; align-items: center; }
.filter-bar .form-control { min-width: 200px; flex: 1; }
.cattle-filter-form { margin-bottom: 1rem; padding: 0; overflow: hidden; }
.cattle-filter-form .filter-bar-main { margin-bottom: 0; }
.filter-advanced {
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--border);
}
.filter-advanced.hidden { display: none; }
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem 1rem;
    padding-top: 1rem;
}
.filter-field { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-field label { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.filter-field-range .range-inputs { display: flex; align-items: center; gap: 0.4rem; }
.filter-field-range .range-inputs .form-control { flex: 1; min-width: 0; }
.range-sep { font-size: 0.8rem; color: var(--muted); flex-shrink: 0; }
.filter-hint { font-size: 0.72rem; color: var(--muted); line-height: 1.3; }
.table-wrap { overflow-x: auto; padding: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th, .data-table td { padding: 0.65rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 500; background: var(--bg); }
.data-table tr:hover { background: rgba(61, 154, 92, 0.05); }
.empty-cell { text-align: center; color: var(--muted); padding: 2rem !important; }
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; color: var(--muted); }
.import-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.import-form .form-group { margin-bottom: 1rem; }
.checkbox-group { flex-direction: row; align-items: center; gap: 0.5rem; }
.import-result { margin-bottom: 1.5rem; }
.row-ok td { color: #8fd4a8; }
.row-error td { color: var(--danger); }
.column-list { padding-left: 1.25rem; color: var(--muted); line-height: 1.8; }

/* Cattle list selection & detail */
.list-tabs { margin-bottom: 1rem; padding: 0.5rem 1rem; }
.tab-bar { display: flex; gap: 0.25rem; flex-wrap: wrap; padding: 0.5rem; margin-bottom: 1rem; }
.tab-link {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: default;
}
.tab-link.active { background: var(--accent); color: #fff; }
.tab-link.tab-ready { cursor: pointer; color: var(--text); background: var(--surface2); }
.tab-link.tab-ready:hover { background: var(--accent); color: #fff; }
.tab-link.tab-disabled { opacity: 0.45; }

.selection-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-color: var(--accent);
    background: rgba(61, 154, 92, 0.08);
}
.selection-bar.hidden { display: none; }
.selection-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; margin: 0; }
.header-actions .inline-form { display: inline-flex; }
.bulk-edit-card { max-width: 720px; width: 100%; max-height: 90vh; overflow-y: auto; }
.bulk-edit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem 1rem;
    margin: 1rem 0;
}
.bulk-edit-warning {
    color: #e8b86d;
    font-size: 0.85rem;
    margin: 0.5rem 0 0;
}
.bulk-edit-warning.hidden { display: none; }
.parents-cell a { color: var(--accent); text-decoration: none; }
.parents-cell a:hover { text-decoration: underline; }

.col-select { width: 2.5rem; text-align: center; }
.cattle-select-table input[type="radio"],
.cattle-select-table input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }
.selection-actions .btn.hidden { display: none; }
.cattle-row { cursor: pointer; }
.cattle-row:has(input:checked) { background: rgba(61, 154, 92, 0.12) !important; }
.uid-link { color: var(--accent); text-decoration: none; }
.uid-link:hover { text-decoration: underline; }
.clickable-row { cursor: pointer; }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.25rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }

.detail-hero { margin-bottom: 1rem; }
.detail-hero-main { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.cattle-photo {
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    object-fit: cover;
    border: 1px solid var(--border);
}
.cattle-photo.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: var(--bg);
}
.detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    flex: 1;
}
.mini-stat { text-align: center; padding: 0.75rem; background: var(--bg); border-radius: 8px; }
.mini-stat-value { display: block; font-size: 1.35rem; font-weight: 700; color: var(--accent); }
.mini-stat-label { font-size: 0.75rem; color: var(--muted); }

.detail-section { margin-bottom: 1rem; }
.detail-section h2 { font-size: 1rem; color: var(--accent); margin-bottom: 0.75rem; }
.detail-section h3 { font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--muted); }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem 1.5rem;
}
.detail-grid div { display: flex; flex-direction: column; gap: 0.15rem; }
.detail-grid dt { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.detail-grid dd { font-size: 0.95rem; }
.detail-grid dd small { color: var(--muted); }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}
.badge-active { background: rgba(61, 154, 92, 0.2); color: #8fd4a8; }
.badge-sold { background: rgba(139, 156, 179, 0.2); color: var(--muted); }
.badge-dead { background: rgba(224, 92, 92, 0.2); color: var(--danger); }
.badge-transferred { background: rgba(74, 144, 217, 0.2); color: #8ab4f0; }
.badge-missing { background: rgba(217, 74, 138, 0.2); color: #f0a0c8; }

.highlight-value { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.highlight-value small { display: block; font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.muted { color: var(--muted); font-size: 0.9rem; }
.empty-inline { color: var(--muted); padding: 1rem 0; }
.notes-block { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.notes-block p { color: var(--muted); font-size: 0.9rem; }

.genealogy-parents {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.parent-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}
.parent-card h3 { color: var(--accent); margin-bottom: 0.5rem; }
.parent-name { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; }
.parent-name a { color: var(--text); text-decoration: none; }
.parent-name a:hover { color: var(--accent); }
.parent-meta { display: grid; gap: 0.35rem; }
.parent-meta div { display: flex; gap: 0.5rem; font-size: 0.85rem; }
.parent-meta dt { color: var(--muted); min-width: 3.5rem; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.hidden { display: none !important; }

/* Brete */
.brete-home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.brete-continue-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    border-color: var(--accent);
    background: rgba(61, 154, 92, 0.1);
}
.brete-session-form .form-group { margin-bottom: 1rem; }
.session-list { list-style: none; display: flex; flex-direction: column; gap: 0.75rem; }
.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.session-info { display: flex; flex-direction: column; gap: 0.15rem; }
.brete-recent { margin-top: 1rem; }

/* --- Brete work: layout denso (cabe na tela; s├│ a tabela da sess├úo rola) --- */

.app-content.brete-page {
    padding: 0.5rem 0.75rem 0.75rem;
    max-width: none;
}

.brete-work {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.brete-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0;
    padding: 0.4rem 0.75rem;
}
.brete-toolbar-left { display: flex; align-items: center; gap: 0.6rem; }
.brete-toolbar-left h1 { font-size: 1rem; margin: 0; line-height: 1.2; }
.brete-toolbar-left .muted { font-size: 0.75rem; margin: 0; }
.brete-toolbar-right { display: flex; align-items: center; gap: 0.5rem; }
.brete-status-badge {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--surface2);
    color: var(--muted);
}
.brete-status-found { background: rgba(61, 154, 92, 0.2); color: #8fd4a8; }
.brete-status-new { background: rgba(74, 144, 217, 0.2); color: #8ab4f0; }

/* ├ürea principal fixa na viewport ΓÇö Detalhes fica FORA do grid e n├úo estica voltar/gr├ífico */
.brete-mockup-grid {
    --brete-work-h: calc(100vh - var(--topbar-height, 52px) - 7.5rem);
    display: grid;
    /* voltar | centro | (icone sep. imediata + grafico) */
    grid-template-columns: 64px minmax(0, 1fr) minmax(200px, 26%);
    gap: 0.45rem;
    align-items: stretch;
    margin-bottom: 0;
    height: var(--brete-work-h);
    min-height: var(--brete-work-h);
    max-height: var(--brete-work-h);
}
/* Coluna direita: icone FORA do card do grafico */
.brete-right-col {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0.4rem;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
}
.brete-right-col .brete-chart-col {
    flex: 1 1 auto;
    min-width: 120px;
}
@media (max-width: 1000px) {
    .brete-mockup-grid {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
        max-height: none;
    }
    .brete-right-col {
        height: auto;
        max-height: none;
    }
}

.brete-back-col {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: stretch;
    min-height: 0;
    height: 100%;
    max-height: 100%;
}
.brete-back-btn {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: var(--surface);
    border: 1.5px solid var(--text);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    padding: 0.25rem;
}
.brete-back-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--surface2); }
.brete-back-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.brete-back-arrow { font-size: 2rem; line-height: 0.85; font-weight: 300; }
.brete-back-label { font-size: 0.55rem; text-align: center; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.25; }
.brete-back-col .btn { padding: 0.25rem 0.4rem; font-size: 0.75rem; }

.brete-center-col {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    min-height: 0;
    overflow: visible;
}

/* UID / RFID / Tatuagem em linha (economiza altura) */
.brete-top-id-stack {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    max-width: none;
    width: 100%;
}
@media (max-width: 700px) {
    .brete-top-id-stack { grid-template-columns: 1fr; }
}

.brete-wire-box {
    border: 1.5px solid var(--text);
    border-radius: 4px;
    background: var(--surface);
    padding: 0.25rem 0.5rem;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.brete-wire-box label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text);
    margin-bottom: 0;
    line-height: 1.1;
}
.brete-wire-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    outline: none;
    padding: 0;
    line-height: 1.2;
}

/* Brinco + marca + peso centralizados */
.brete-hero-stack {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    align-items: center;
    justify-content: center;
    max-width: 420px;
    margin: 0 auto;
    width: 100%;
    flex: 0 0 auto;
    overflow: visible; /* badge/grade de sep. podem sair à direita */
}
.brete-visual-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    position: relative;
}
.brete-visual-slot {
    flex: 1 1 0;
    min-width: 0;
}
.brete-visual-slot[hidden] { display: none !important; }
.brete-add-ear-btn {
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--accent);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    z-index: 2;
}
.brete-add-ear-btn:hover {
    background: rgba(61, 154, 92, 0.12);
    border-color: var(--accent);
}
.brete-add-ear-btn[hidden] { display: none !important; }

.brete-visual-row.is-single {
    display: block;
}
.brete-visual-row.is-single .brete-visual-slot:not([hidden]) {
    position: relative;
    width: min(100%, 300px);
    max-width: 300px;
    margin: 0 auto;
    flex: none;
}
.brete-visual-row.is-single .brete-add-ear-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
}
.brete-visual-row.is-single.is-primary-left .brete-add-ear-btn {
    left: calc(50% + min(50%, 150px) + 0.3rem);
    right: auto;
}
.brete-visual-row.is-single.is-primary-right .brete-add-ear-btn {
    right: calc(50% + min(50%, 150px) + 0.3rem);
    left: auto;
}

.brete-visual-row.is-dual .brete-hero-box .brete-hero-input { font-size: 1.6rem; }
.brete-hero-box { width: 100%; padding: 0.35rem 0.5rem 0.4rem; text-align: center; }
.brete-hero-secondary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    width: min(100%, 300px);
    margin: 0 auto;
    overflow: visible; /* peso fixo; sep. cresce para a direita */
}
.brete-brand-box,
.brete-weight-box {
    width: 100%;
    padding: 0.3rem 0.45rem;
    text-align: center;
    box-sizing: border-box;
}

.brete-hero-input, .brete-brand-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    text-align: center;
    font-family: inherit;
    font-weight: 800;
    outline: none;
}
.brete-visual-composite {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.1rem;
    width: 100%;
}
.brete-visual-prefix {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    user-select: none;
}
.brete-visual-prefix.hidden { display: none; }
.brete-visual-composite.has-prefix .brete-visual-input { flex: 0 1 auto; min-width: 3ch; }
.brete-visual-hint {
    display: block;
    margin-top: 0.05rem;
    font-size: 0.58rem;
    color: var(--muted);
    line-height: 1.2;
}
.brete-hero-box .brete-hero-input { font-size: 2.15rem; line-height: 1.05; }
.brete-brand-input { font-size: 1.25rem; letter-spacing: 0.12em; line-height: 1.1; }
.brete-weight-input { font-size: 1.75rem; color: var(--accent); line-height: 1.1; }
.brete-hero-label {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.62rem;
    color: var(--muted);
    text-transform: lowercase;
    line-height: 1.15;
}

.brete-chart-col {
    padding: 0.4rem 0.5rem;
    display: flex;
    flex-direction: column;
    border: 1.5px solid var(--text);
    border-radius: 4px;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}
.brete-chart-col h3 {
    font-size: 0.7rem;
    color: var(--text);
    margin-bottom: 0.25rem;
    font-weight: 600;
    flex: 0 0 auto;
}
.brete-chart-wrap {
    flex: 1 1 auto;
    min-height: 80px;
    max-height: 100%;
    position: relative;
}
.brete-chart-empty { text-align: center; padding: 0.5rem 0; font-size: 0.72rem; flex: 0 0 auto; }

.brete-side-panels {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.35rem;
    margin-top: 0;
    /* altura natural ΓÇö n├úo encolhe sob o painel de detalhes */
    flex: 0 0 auto;
    min-height: 0;
}
.brete-side-panels > .card {
    padding: 0.4rem 0.55rem;
    margin: 0;
    min-height: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
}
@media (max-width: 700px) {
    .brete-side-panels { grid-template-columns: 1fr; }
}

.brete-vaccines-panel h3, .brete-pregnancy-panel h3 {
    font-size: 0.75rem;
    margin-bottom: 0;
    color: var(--accent);
}
.brete-meds-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}
.brete-meds-head .btn { padding: 0.15rem 0.45rem; font-size: 0.7rem; }
.brete-meds-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 16rem;
    overflow-y: auto;
    min-height: 2.4rem;
}
.brete-meds-empty {
    font-size: 0.72rem;
    color: var(--muted);
    padding: 0.45rem 0.15rem;
    line-height: 1.35;
}
.brete-meds-group-title {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.2rem;
}
.brete-meds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 0.35rem;
}
.brete-med-card-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.12rem 0.25rem;
    padding: 0.4rem 0.4rem 0.4rem 0.55rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 7px;
    cursor: pointer;
    min-height: 0;
}
.brete-med-card-item.is-on {
    border-color: var(--accent);
    background: rgba(61, 154, 92, 0.12);
}
.brete-med-card-item .name {
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1.2;
}
.brete-med-card-item .dose {
    grid-column: 1 / -1;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--accent);
    line-height: 1.05;
    margin: 0.05rem 0 0.1rem;
}
.brete-med-card-item .formula,
.brete-med-card-item .cost {
    font-size: 0.62rem;
    color: var(--muted);
    grid-column: 1 / -1;
    line-height: 1.2;
}
.brete-med-card-item .cost { color: var(--muted); }
.brete-med-card-menu {
    grid-row: 1;
    align-self: start;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0 0.1rem;
    font-size: 0.95rem;
    line-height: 1;
}
.brete-med-card-menu:hover { color: var(--text); }
.brete-med-card {
    max-width: 560px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.brete-med-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem 0.75rem;
}
.brete-med-span2 { grid-column: 1 / -1; }
.brete-med-label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}
.brete-med-seg {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.brete-med-seg-btn {
    flex: 1;
    background: var(--bg);
    border: none;
    color: var(--muted);
    padding: 0.4rem 0.5rem;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
}
.brete-med-seg-btn + .brete-med-seg-btn { border-left: 1px solid var(--border); }
.brete-med-seg-btn.is-on {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.brete-med-qty { display: flex; gap: 0.35rem; }
.brete-med-qty input { flex: 1; min-width: 0; }
.brete-med-qty select { width: 5.5rem; }
#med-dose-amount {
    font-size: 1.35rem;
    font-weight: 700;
    padding: 0.45rem 0.55rem;
}
.brete-med-preview {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.8rem;
    color: var(--accent);
    min-height: 1.1em;
}
@media (max-width: 560px) {
    .brete-med-form { grid-template-columns: 1fr; }
    .brete-med-span2 { grid-column: auto; }
}

.brete-pregnancy-options { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.brete-pregnancy-option {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.4rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.7rem;
    cursor: pointer;
}
.brete-pregnancy-option input { accent-color: var(--accent); }
.brete-pregnancy-hidden { opacity: 0.4; pointer-events: none; }

/* Detalhes fora do grid: abre para baixo sem redimensionar voltar/gr├ífico */
.brete-details-panel {
    padding: 0;
    overflow: visible;
    margin-top: 0.45rem;
    position: relative;
    z-index: 1;
}
.brete-details-panel summary {
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
    list-style: none;
    font-size: 0.75rem;
}
.brete-details-panel summary::-webkit-details-marker { display: none; }
.brete-details-panel[open] summary { border-bottom: 1px solid var(--border); }
.brete-details-panel[open] {
    max-height: none;
    overflow: visible;
}
.brete-details-grid { padding: 0.4rem 0.6rem 0.5rem; }

.brete-rec-row {
    display: flex;
    justify-content: center;
    padding: 0.15rem 0 0;
    flex: 0 0 auto;
}
.brete-rec-btn {
    min-width: 120px;
    padding: 0.4rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--text);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
}
.brete-rec-btn:hover { border-color: var(--accent); background: rgba(61, 154, 92, 0.15); }
.brete-rec-btn:disabled { opacity: 0.5; cursor: wait; }

/* Tabela da sess├úo: abaixo da dobra ΓÇö scroll da p├ígina s├│ para chegar aqui */
.brete-records-table-section {
    margin-top: 0.75rem;
    scroll-margin-top: 0.5rem;
}
.brete-table-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.brete-table-header h2 { font-size: 1.1rem; }
.brete-table-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.brete-table-controls label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); }
.brete-table-controls .form-control { min-width: 120px; font-size: 0.85rem; padding: 0.35rem 0.5rem; }
.brete-records-table { font-size: 0.8rem; }
.brete-table-row { cursor: pointer; }
.brete-table-row:hover { background: rgba(61, 154, 92, 0.08); }
.brete-row-active { background: rgba(61, 154, 92, 0.15) !important; }

/* --- Fase 1b: app shell + sidebar (Phosphor) --- */

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 52px;
}

[data-theme="light"] {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface2: #e8ecf1;
    --text: #1a2332;
    --muted: #5c6b7f;
    --border: #d4dce6;
}

.phosphor-icon {
    flex-shrink: 0;
    display: block;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    padding: 1.25rem 1.5rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.app-content.map-page {
    display: flex;
    flex-direction: column;
    max-width: none;
    margin: 0;
    padding: 0.4rem 0.65rem 0.5rem;
    min-height: 0;
    overflow: hidden;
    gap: 0.3rem;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    /* transi├º├úo s├│ ap├│s sidebar-ready ΓÇö evita animar no 1┬║ paint (flash) */
}

.app-layout.sidebar-ready .sidebar {
    transition: width 0.2s ease;
}

.sidebar-header {
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
    min-height: 32px;
}

.sidebar-brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.sidebar-brand-icon { font-size: 1.35rem; line-height: 1; }

.sidebar-brand-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.5rem;
    overflow-y: auto;
}

.sidebar-footer {
    padding: 0.5rem 0.5rem 1rem;
    border-top: 1px solid var(--border);
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 0.75rem 0.75rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    margin-bottom: 2px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    background: var(--surface2);
    color: var(--text);
}

.sidebar-link.is-active {
    background: rgba(61, 154, 92, 0.18);
    color: var(--accent);
    font-weight: 500;
}

.sidebar-link-sub {
    padding-left: 2.25rem;
    font-size: 0.82rem;
}

.sidebar-link.is-soon {
    opacity: 0.75;
}

.sidebar-link-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-badge {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: var(--surface2);
    color: var(--muted);
    flex-shrink: 0;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

/* display:none (n├úo s├│ width:0) ΓÇö sen├úo gap do flex desloca IoT/Finan├ºas por causa do badge */
.sidebar-collapsed .sidebar-brand-text,
.sidebar-collapsed .sidebar-link-text,
.sidebar-collapsed .sidebar-section-label,
.sidebar-collapsed .sidebar-badge {
    display: none;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    gap: 0;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.sidebar-collapsed .sidebar-link-sub {
    padding-left: 0.5rem;
}

.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    gap: 0;
}

.sidebar-collapsed .sidebar-section-label {
    display: none;
}

.sidebar-collapsed .sidebar-nav {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--topbar-height);
    padding: 0 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    flex-shrink: 0;
}

.topbar-support {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.topbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.topbar-btn:hover {
    background: var(--surface2);
    color: var(--text);
}

.topbar-btn-desktop { display: inline-flex; }

/* Hamburger (list) s├│ em viewport estreita; desktop usa s├│ o bot├úo de recolher */
.topbar-btn-mobile { display: none; }

.topbar-user {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
}

.topbar-logout-form { margin: 0; }

.topbar-btn-logout { color: var(--muted); }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 95;
}

.page-lead { color: var(--muted); margin-top: 0.25rem; }

.text-muted { color: var(--muted); font-size: 0.9rem; }

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.settings-card h2 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.sync-status {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sync-status-ok { color: var(--accent); }

.settings-panel {
    padding: 1.25rem 1.5rem;
    max-width: 720px;
}

.team-table-wrap {
    overflow-x: auto;
}
.team-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.team-table th,
.team-table td {
    text-align: left;
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.team-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.8rem;
}
.team-inline-form .form-select-sm,
.form-select-sm {
    max-width: 160px;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
}
.team-invite-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.team-invite-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.team-invite-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.settings-label {
    font-size: 0.85rem;
    color: var(--muted);
    display: block;
    margin-bottom: 0.25rem;
}

.team-farm-checks {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.65rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.team-farm-checks-toolbar {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.team-farm-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1.35;
}

.team-farm-check input {
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.team-list-header {
    padding-top: 0.25rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
}

.team-farm-filter label {
    font-size: 0.85rem;
    color: var(--muted);
}

.settings-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-section h2 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
}

.settings-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.settings-radio {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.settings-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.settings-row label {
    font-size: 0.85rem;
    color: var(--muted);
}

.form-select {
    padding: 0.5rem 0.65rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    max-width: 280px;
}

.module-soon {
    max-width: 420px;
    margin: 2rem auto;
    text-align: center;
    padding: 2rem 1.5rem;
}

.module-soon-icon {
    color: var(--muted);
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.module-soon-badge {
    display: inline-block;
    margin: 0.5rem 0 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}

.guest-nav { border-bottom: 1px solid var(--border); }

.guest-content { padding-top: 2rem; }

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }

    .app-layout.sidebar-ready .sidebar {
        transition: transform 0.2s ease;
    }

    .sidebar-mobile-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-mobile-open .sidebar-backdrop {
        display: block;
    }

    .topbar-btn-desktop { display: none; }

    .topbar-btn-mobile { display: inline-flex; }

    .app-layout.sidebar-collapsed .sidebar {
        width: var(--sidebar-width);
    }

    .sidebar-collapsed .sidebar-brand-text,
    .sidebar-collapsed .sidebar-link-text,
    .sidebar-collapsed .sidebar-section-label,
    .sidebar-collapsed .sidebar-badge {
        display: revert;
    }

    .sidebar-collapsed .sidebar-section-label {
        display: block;
    }

    .sidebar-collapsed .sidebar-link {
        justify-content: flex-start;
        gap: 0.65rem;
        padding: 0.55rem 0.75rem;
    }

    .sidebar-collapsed .sidebar-brand {
        gap: 0.6rem;
    }

    .sidebar-collapsed .sidebar-nav {
        padding: 0.75rem 0.5rem;
    }

    .support-nav.topbar-support {
        flex-wrap: wrap;
    }

    .support-search-wrap {
        max-width: none;
        flex: 1 1 100%;
    }
}

/* Relatorios */
.report-card h2 { margin-bottom: 0.35rem; font-size: 1.15rem; }
.report-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.85rem 1rem;
    margin-bottom: 0.85rem;
}
.report-form-actions { margin-bottom: 1rem; }
.report-preview { margin-top: 0.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.report-table th.num,
.report-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-total-row td { border-top: 2px solid var(--border); background: var(--surface2, rgba(0,0,0,0.04)); }
.report-sex-summary { margin-top: 0.85rem; font-size: 0.95rem; }
.report-save-box {
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface2, rgba(0,0,0,0.03));
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: flex-end;
}
.report-save-box label { display: block; width: 100%; font-size: 0.85rem; color: var(--muted); margin-bottom: -0.25rem; }
.report-save-box .form-control { flex: 1 1 220px; min-width: 180px; }

/* Brete - separacoes (peso mantém largura da coluna; badge/grade à direita) */
.brete-weight-with-sep {
    position: relative;
    width: 100%;
    min-width: 0;
    overflow: visible;
}
.brete-weight-with-sep .brete-weight-box {
    width: 100%;
    min-width: 0;
    /* não compartilha flex com badge — caixa de peso = célula do grid */
}
/* Cluster badge + grade: flutuando à direita do peso (não comprime) */
.brete-sep-float {
    position: absolute;
    left: calc(100% + 0.5rem);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    z-index: 6;
    pointer-events: auto;
}
/* Esconde o cluster se nada visível */
.brete-sep-float:not(:has(.brete-sep-badge:not(.hidden))):not(:has(.brete-imm-badge:not(.hidden))):not(:has(.brete-imm-pick:not(.hidden))) {
    display: none;
}
.brete-sep-badge {
    min-width: 4.5rem;
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.25rem;
    font-weight: 800;
    line-height: 1;
    border: 3px solid currentColor;
    border-radius: 12px;
    align-self: center;
    padding: 0.15rem 0.45rem;
    user-select: none;
    flex: 0 0 auto;
}
.brete-sep-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface2, rgba(0,0,0,0.04));
}
.brete-sep-help { width: 100%; margin: 0; font-size: 0.85rem; }
.brete-sep-groups { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.brete-sep-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
}
.brete-sep-chip.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(61, 154, 92, 0.35);
}
.brete-sep-num {
    display: inline-flex;
    width: 1.6rem;
    height: 1.6rem;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    border: 2px solid currentColor;
    border-radius: 50%;
}
.brete-sep-color {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}
.brete-sep-count {
    font-size: 0.75rem;
    color: var(--muted);
    min-width: 1rem;
}
.brete-sep-pill {
    display: inline-flex;
    min-width: 1.5rem;
    height: 1.5rem;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    border: 2px solid;
    border-radius: 6px;
    padding: 0 0.3rem;
}
.brete-row-sep {
    box-shadow: inset 4px 0 0 var(--sep-color, transparent);
}
.brete-records-table-section.sep-mode .brete-table-row {
    cursor: pointer;
}

/* Brete - separacao imediata (icone ao lado do grafico, badge no peso) */
.brete-imm-sep-btn {
    flex: 0 0 auto;
    width: 3rem;
    min-height: 5.5rem;
    align-self: flex-start;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    padding: 0.4rem 0.25rem;
    font-family: inherit;
    z-index: 2;
}
.brete-imm-sep-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.brete-imm-sep-btn.has-match,
.brete-imm-sep-btn.is-active-cfg {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(61, 154, 92, 0.3);
}
.brete-imm-sep-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    font-weight: 800;
    gap: 0.15rem;
}
.brete-imm-mini-num {
    display: inline-flex;
    width: 1.25rem;
    height: 1.25rem;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    border: 2px solid currentColor;
    border-radius: 50%;
}
.brete-imm-mini-more {
    font-size: 0.55rem;
    color: var(--muted);
    font-weight: 700;
}
.brete-imm-sep-caption {
    font-size: 0.58rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--muted);
    text-align: center;
    line-height: 1.15;
    max-width: 2.8rem;
}
.brete-imm-result {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
}
/* Só ocupa espaço se badge ou grade estiverem visíveis */
.brete-imm-result:not(:has(.brete-imm-badge:not(.hidden))):not(:has(.brete-imm-pick:not(.hidden))) {
    display: none;
}
.brete-imm-badge {
    font-size: 2.2rem;
    min-width: 3.6rem;
}
.brete-imm-badge.is-multi {
    color: #78909c;
    border-color: #78909c;
    background: rgba(120, 144, 156, 0.14);
}
.brete-imm-pick {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.28rem 0.35rem;
    align-content: center;
}
.brete-imm-pick.hidden {
    display: none;
}
.brete-imm-pick-btn {
    min-width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    font-family: inherit;
    line-height: 1;
    border: 2px solid #78909c;
    border-radius: 8px;
    background: rgba(120, 144, 156, 0.12);
    color: #78909c;
    cursor: pointer;
}
.brete-imm-pick-btn:hover:not(:disabled) {
    filter: brightness(0.95);
    box-shadow: 0 0 0 2px rgba(120, 144, 156, 0.35);
}
.brete-imm-pick-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
    border-style: dashed;
}
.brete-imm-pick-btn.is-hit:not(.is-chosen) {
    color: #78909c;
    border-color: #78909c;
    background: rgba(120, 144, 156, 0.16);
}
.brete-imm-pick-btn.is-chosen {
    /* cor via style inline do grupo */
    box-shadow: 0 0 0 2px currentColor;
}

#brete-imm-modal.map-dialog {
    z-index: 2000;
}
.brete-imm-modal-card {
    max-width: 720px;
    width: min(96vw, 720px);
    max-height: min(90vh, 900px);
    overflow: auto;
    position: relative;
}
.brete-imm-enable {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.brete-imm-groups-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}
.brete-imm-side {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem;
    background: var(--surface2, rgba(0,0,0,0.03));
}
.brete-imm-side h4 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.brete-imm-rules {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0.5rem 0;
    min-height: 2rem;
}
.brete-imm-rule-row {
    display: grid;
    grid-template-columns: 1.2fr 1.1fr 1.2fr auto;
    gap: 0.35rem;
    align-items: center;
}
.brete-imm-val-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.brete-imm-val-wrap .form-control { min-width: 4rem; flex: 1; }
.brete-imm-modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
@media (max-width: 720px) {
    .brete-imm-rule-row { grid-template-columns: 1fr 1fr; }
    .brete-imm-rule-row > :nth-child(3) { grid-column: 1 / -1; }
}
/* Financeiro (Bloco M1) */
.finance-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.85rem;
}
.mini-stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.mini-stat-card .mini-stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Venda por sessao de brete */
#session-cattle-table tr.is-muted { opacity: 0.55; }
#session-cattle-table input[type=checkbox] { width: 1.1rem; height: 1.1rem; }

/* Venda — total automatico readonly */
#id_total_amount.is-readonly,
#id_total_amount[readonly] {
  background: var(--surface2, rgba(0,0,0,0.04));
  cursor: default;
}
#session-cattle-table .js-custom-amount { max-width: 7.5rem; }
