:root {
    --bg: #eef3f5;
    --panel: #ffffff;
    --panel-soft: #f7fafb;
    --text: #1f2937;
    --muted: #5b6779;
    --line: #d7e4ea;
    --brand: #0e7490;
    --brand-dark: #0f3d53;
    --brand-soft: #d9f3fb;
    --ok: #198754;
    --warn: #b7791f;
    --danger: #c0392b;
    --info: #2563eb;
    --shadow: 0 14px 34px rgba(15, 35, 55, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background: var(--bg);
}

body.is-loading {
    overflow: hidden;
}

a {
    color: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 318px) minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: #103d4d;
    color: #ecfeff;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.35rem 0.25rem 0.8rem;
}

.brand-copy {
    min-width: 0;
    display: grid;
    gap: 0.18rem;
}

.brand-logo {
    width: auto;
    max-width: 172px;
    height: 52px;
    object-fit: contain;
    object-position: left center;
    display: block;
    flex: 0 0 auto;
}

.brand-text {
    display: block;
    margin: 0;
    font-size: 1rem;
    line-height: 1.2;
    font-weight: 800;
    color: #ecfeff;
}

.brand-subtitle {
    display: block;
    font-size: 0.78rem;
    line-height: 1.3;
    color: rgba(236, 254, 255, 0.82);
}

.menu {
    display: grid;
    gap: 0.4rem;
}

.menu-item {
    display: grid;
    grid-template-columns: 34px 1fr auto;
    align-items: center;
    gap: 0.65rem;
    min-height: 54px;
    padding: 0.62rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.06);
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.menu-item:hover,
.menu-item:focus-visible {
    transform: translateX(2px);
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.28);
    outline: none;
}

.menu-item.is-active {
    background: #ecfeff;
    border-color: #ecfeff;
    color: #103d4d;
}

.menu-item.is-external {
    border-style: dashed;
}

.menu-item.is-disabled {
    opacity: 0.62;
}

.menu-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    font-weight: 800;
    font-size: 0.72rem;
}

.menu-item.is-active .menu-icon {
    background: var(--brand-soft);
}

.menu-copy {
    min-width: 0;
}

.menu-copy strong,
.menu-copy small {
    display: block;
}

.menu-copy strong {
    font-size: 0.9rem;
    line-height: 1.2;
}

.menu-copy small {
    margin-top: 0.18rem;
    color: rgba(236, 254, 255, 0.78);
    font-size: 0.72rem;
    line-height: 1.25;
}

.menu-item.is-active .menu-copy small {
    color: #49717c;
}

.menu-item em {
    font-style: normal;
    font-size: 0.68rem;
    color: rgba(236, 254, 255, 0.72);
}

.sidebar-profile {
    margin-top: auto;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-profile span,
.sidebar-profile strong {
    display: block;
}

.sidebar-profile span {
    font-size: 0.76rem;
    opacity: 0.8;
}

.sidebar-profile strong {
    margin-top: 0.25rem;
}

.content-area {
    padding: 1.25rem;
    max-width: 1480px;
    width: 100%;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.topbar h2 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.2;
}

.eyebrow {
    margin: 0 0 0.18rem;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.topbar-meta {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--panel);
    padding: 0.55rem;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    margin: 4px 0;
    background: var(--brand-dark);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 8px;
    padding: 0.24rem 0.55rem;
    font-size: 0.76rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.am-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: rgba(15, 35, 55, 0.48);
    backdrop-filter: blur(4px);
}

.am-loading-overlay[hidden] {
    display: none !important;
}

.am-loading-card {
    width: min(460px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.am-loading-card strong {
    display: block;
    font-size: 1.05rem;
}

.am-loading-card p {
    margin: 0.45rem 0 0;
    color: var(--muted);
}

.am-loading-progress {
    margin-top: 1rem;
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e7eef2;
}

.am-loading-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), #22a6c3);
    transition: width 0.18s ease;
}

.am-loading-meta {
    margin-top: 0.7rem;
    display: flex;
    justify-content: flex-end;
    font-weight: 700;
    color: var(--brand-dark);
}

.badge-ok {
    color: #0f5132;
    background: #dff6e8;
    border-color: #bfe9d0;
}

.badge-info {
    color: #16448a;
    background: #e3edff;
    border-color: #c9dafb;
}

.badge-muted {
    color: #475569;
    background: #eef2f7;
    border-color: #d9e0ea;
}

.badge-warn {
    color: #7a4d00;
    background: #fff4db;
    border-color: #f2d7a6;
}

.badge-danger {
    color: #7f1d1d;
    background: #fde8e8;
    border-color: #f8b4b4;
}

.am-abcar-entidades .am-history-block + .am-history-block {
    margin-top: 1.25rem;
}

.am-abcar-entidades .am-abcar-status-row--active {
    background: rgba(25, 135, 84, 0.05);
}

.am-abcar-entidades .am-abcar-status-row--blocked {
    background: rgba(192, 57, 43, 0.05);
}

.am-abcar-entidades .am-abcar-status-row--active td:first-child {
    border-left: 4px solid var(--ok);
}

.am-abcar-entidades .am-abcar-status-row--blocked td:first-child {
    border-left: 4px solid var(--danger);
}

.am-abcar-entidades .am-actions-cell form {
    display: inline-flex;
}

.am-abcar-entidades .am-detail-actions {
    flex-wrap: wrap;
}

.notice-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border: 1px solid #efd089;
    background: #fff9eb;
    color: #5c4300;
    border-radius: 8px;
    padding: 0.82rem 0.95rem;
    margin-bottom: 1rem;
}

.notice-card.is-hidden {
    display: none;
}

.notice-close {
    width: 28px;
    height: 28px;
    border: 1px solid #e0c06e;
    background: #fff;
    color: #5c4300;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

.legacy-status-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.legacy-status-card div,
.panel,
.detail-panel,
.placeholder-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 8px 20px rgba(14, 116, 144, 0.06);
    min-width: 0;
}

.legacy-status-card span,
.status-list dt {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    margin-bottom: 0.25rem;
}

.legacy-status-card strong,
.status-list dd {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
}

.legacy-status-card small {
    display: block;
    color: #7c8899;
    margin-top: 0.2rem;
}

.status-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.status-kpis article {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
}

.status-kpis span {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
}

.status-kpis strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1.3rem;
}

.group-block {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 0.9rem;
    overflow: hidden;
}

.group-block header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    background: var(--panel-soft);
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--line);
}

.group-block h4 {
    margin: 0;
    font-size: 0.95rem;
    text-transform: capitalize;
}

.group-block ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.group-block li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.9rem;
    border-top: 1px solid #edf2f7;
}

.group-block li:first-child {
    border-top: 0;
}

.group-block li strong {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.am-profile-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.am-profile-panel article {
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.85rem;
    box-shadow: 0 4px 14px rgba(14, 116, 144, 0.08);
}

.am-profile-panel span {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
}

.am-profile-panel strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1rem;
}

.am-profile-panel a {
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 800;
}

.am-profile-panel a:hover,
.am-profile-panel a:focus-visible {
    text-decoration: underline;
}

.am-perfil-panel .am-credential-value {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-break: anywhere;
    font-family: "Courier New", monospace;
    font-size: 0.94rem;
}

.am-perfil-panel .am-detail-card strong.am-credential-value {
    margin-top: 0.2rem;
}

.am-perfil-panel pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

.am-perfil-panel .am-code-block {
    white-space: pre-wrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    margin: 0;
}

.am-perfil-panel .am-detail-card small {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted);
    line-height: 1.45;
}

.am-perfil-panel .am-table {
    table-layout: fixed;
}

.am-perfil-panel .am-table th,
.am-perfil-panel .am-table td {
    vertical-align: top;
    word-break: break-word;
}

@media (max-width: 920px) {
    .am-perfil-panel .am-table {
        min-width: 760px;
    }
}

.inline-alert.is-soft {
    margin-top: 0.6rem;
    border: 1px solid #c9dafb;
    background: #eaf2ff;
    color: #143f80;
}

.am-dashboard-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.85rem;
}

.am-module-card {
    border: 1px solid var(--line);
    border-top: 4px solid var(--brand);
    border-radius: 8px;
    padding: 0.95rem;
    background: var(--panel);
    box-shadow: 0 10px 22px rgba(14, 116, 144, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.am-module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 28px rgba(14, 116, 144, 0.12);
}

.am-module-card h4 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
}

.am-module-card p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--muted);
    min-height: 58px;
}

.am-module-card.status-ok {
    border-top-color: var(--ok);
}

.am-module-card.status-info {
    border-top-color: var(--info);
}

.am-module-card.status-warn {
    border-top-color: var(--warn);
}

.am-module-card.status-muted {
    border-top-color: #6b7280;
    background: #f8fafc;
}

.am-module-card.status-danger {
    border-top-color: var(--danger);
}

.am-module-footer {
    margin-top: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
}

.am-module-footer a {
    color: var(--brand-dark);
    font-weight: 700;
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.32rem 0.58rem;
    background: #fff;
}

.am-module-footer a:hover,
.am-module-footer a:focus-visible {
    text-decoration: underline;
}

.am-placeholder-status {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    padding: 0.75rem;
    margin: 0.8rem 0;
}

.am-placeholder-status span {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.am-placeholder-status strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1rem;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.15rem;
    box-shadow: var(--shadow);
}

.dashboard-hero h3 {
    margin: 0.6rem 0 0.45rem;
    font-size: 1.55rem;
}

.dashboard-hero p {
    margin: 0;
    color: var(--muted);
    max-width: 720px;
    line-height: 1.5;
}

.hero-summary {
    border-left: 4px solid var(--brand);
    background: var(--panel-soft);
    border-radius: 8px;
    padding: 0.9rem;
}

.hero-summary span,
.hero-summary small {
    display: block;
    color: var(--muted);
}

.hero-summary strong {
    display: block;
    margin: 0.25rem 0 0.45rem;
    font-size: 1.08rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 4px solid var(--brand);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 8px 18px rgba(14, 116, 144, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 24px rgba(14, 116, 144, 0.12);
}

.stat-card .label {
    margin: 0;
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.35;
}

.stat-card .value {
    margin: 0.5rem 0 0.3rem;
    font-size: 1.85rem;
    font-weight: 800;
}

.stat-card .meta {
    margin: 0;
    color: #7c8899;
    font-size: 0.8rem;
}

.status-ok {
    border-top-color: var(--ok);
}

.status-warn {
    border-top-color: var(--warn);
}

.status-danger {
    border-top-color: var(--danger);
}

.status-info {
    border-top-color: var(--brand);
}

.dashboard-sections {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-heading {
    margin-bottom: 1rem;
}

.section-heading h3 {
    margin: 0;
    font-size: 1.12rem;
}

.section-heading p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.section-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
}

.section-heading-row > div {
    min-width: 0;
}

.section-heading-row .button {
    flex: 0 0 auto;
}

.queue-list {
    list-style: none;
    display: grid;
    gap: 0.65rem;
    margin: 0;
    padding: 0;
}

.queue-item {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: center;
    border-left: 4px solid var(--brand);
    background: var(--panel-soft);
    border-radius: 8px;
    padding: 0.75rem;
}

.queue-item strong {
    white-space: nowrap;
    font-size: 0.78rem;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.7rem;
}

.quick-action {
    display: grid;
    gap: 0.28rem;
    min-height: 104px;
    align-content: start;
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.85rem;
    background: var(--panel-soft);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.quick-action:hover,
.quick-action:focus-visible {
    transform: translateY(-2px);
    border-color: var(--brand);
    outline: none;
}

.quick-action-label {
    font-weight: 800;
}

.quick-action-description {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.quick-action small {
    color: var(--warn);
    font-weight: 800;
}

.quick-action.is-pulsing,
.menu-item.is-pulsing {
    border-color: var(--warn);
}

.protocol-timeline {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0;
}

.timeline-item {
    position: relative;
    display: grid;
    gap: 0.5rem;
}

.timeline-item > span {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #e7edf2;
    border: 2px solid #cdd8e0;
}

.timeline-item.is-done > span {
    background: #dff6e8;
    border-color: var(--ok);
}

.timeline-item.is-current > span {
    background: var(--brand-soft);
    border-color: var(--brand);
}

.timeline-item strong,
.timeline-item small {
    display: block;
}

.timeline-item small {
    color: var(--muted);
    line-height: 1.35;
}

.status-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin: 0;
}

.status-list div {
    border-left: 4px solid var(--brand);
    padding-left: 0.85rem;
}

.status-list dd {
    margin: 0;
    font-weight: 800;
}

.placeholder-panel {
    display: grid;
    gap: 0.8rem;
    max-width: 760px;
}

.placeholder-panel h3 {
    margin: 0;
    font-size: 1.35rem;
}

.placeholder-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.legacy-frame {
    width: 100%;
    min-height: 520px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.inline-alert {
    border: 1px solid #c9dafb;
    background: #eef5ff;
    color: #16448a;
    border-radius: 8px;
    padding: 0.8rem;
}

.inline-alert.is-success {
    border-color: #b7e3c8;
    background: #e9f8ef;
    color: #0f5132;
}

.inline-alert.is-danger {
    border-color: #f5c2c7;
    background: #fdecee;
    color: #842029;
}

.am-filter-bar {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(180px, 260px) auto;
    gap: 0.75rem;
    align-items: end;
    margin: 1rem 0;
}

.am-filter-bar-animals {
    grid-template-columns: minmax(220px, 0.85fr) minmax(420px, 1.55fr) auto;
}

.am-filter-bar-supervisoes {
    grid-template-columns: minmax(220px, 1fr) minmax(150px, 210px) minmax(180px, 220px) minmax(150px, 190px) minmax(150px, 190px) auto;
}

.am-filter-bar-certificados {
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 230px) minmax(150px, 190px) auto;
}

.am-filter-bar-certificados-transacao-full {
    grid-template-columns: minmax(320px, 1.6fr) minmax(320px, 1.2fr) auto;
    width: 100%;
}

.am-filter-bar-certificados-transacao-full .field-actions {
    justify-content: flex-end;
}

.field-group {
    display: grid;
    gap: 0.3rem;
}

.field-group label {
    font-size: 0.84rem;
    color: var(--muted);
    font-weight: 700;
}

.field-group input,
.field-group select,
.field-group textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    font: inherit;
    color: var(--text);
    background: #fff;
}

.field-group textarea {
    min-height: 96px;
    resize: vertical;
}

.field-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.am-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(15, 61, 83, 0.06);
}

.am-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
    background: #fff;
}

.am-table th,
.am-table td {
    border-bottom: 1px solid #edf2f7;
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-size: 0.88rem;
    vertical-align: top;
}

.am-table th {
    background: var(--panel-soft);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--muted);
}

.am-table tbody tr:hover {
    background: #f9fcff;
}

.am-actions-cell {
    display: grid;
    gap: 0.35rem;
}

.am-actions-cell a {
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 700;
    width: fit-content;
}

.am-actions-cell a.button {
    color: var(--brand-dark);
    text-decoration: none;
}

.am-actions-cell a:not(.button):hover,
.am-actions-cell a:not(.button):focus-visible {
    text-decoration: underline;
}

.am-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    min-width: 0;
}

.am-detail-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    padding: 0.75rem;
    box-shadow: 0 4px 12px rgba(15, 61, 83, 0.06);
}

.am-detail-card span,
.am-detail-card small {
    display: block;
    color: var(--muted);
}

.am-detail-card strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 1rem;
}

.am-ct-print {
    max-width: 1120px;
    margin: 0 auto;
    color: #000;
}

.am-ct-manual-header {
    display: grid;
    grid-template-columns: 210px 1fr 250px;
    align-items: stretch;
    border: 1px solid #111;
    margin-bottom: 2rem;
    background: #fff;
}

.am-ct-manual-header-logo,
.am-ct-manual-header-body,
.am-ct-manual-header-meta {
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.8rem;
}

.am-ct-manual-header-logo {
    border-right: 1px solid #111;
}

.am-ct-manual-header-logo img {
    display: block;
    max-width: 150px;
    height: auto;
}

.am-ct-manual-header-body {
    flex-direction: column;
    text-align: center;
    gap: 0.15rem;
    border-right: 1px solid #111;
    font-size: 1.03rem;
}

.am-ct-manual-header-body div:last-child {
    font-size: 1rem;
}

.am-ct-manual-header-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.08rem;
    font-size: 0.95rem;
}

.am-ct-title-block {
    text-align: center;
    margin: 0 0 1.2rem;
}

.am-ct-title-block h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: underline;
}

.am-ct-title-block strong {
    display: block;
    margin-top: 0.55rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #111;
    font-size: 1.05rem;
    line-height: 1.25;
}

.am-ct-section {
    margin-bottom: 1.35rem;
}

.am-ct-section-title {
    background: #b5b5b5;
    border: 1px solid #111;
    font-weight: 700;
    text-align: center;
    padding: 0.25rem 0.65rem;
    font-size: 1.05rem;
}

.am-ct-details-table,
.am-ct-gta-table,
.am-ct-animals-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.am-ct-details-table th,
.am-ct-details-table td,
.am-ct-gta-table th,
.am-ct-gta-table td,
.am-ct-animals-table th,
.am-ct-animals-table td {
    border: 1px solid #111;
    padding: 0.28rem 0.5rem;
    vertical-align: top;
    font-size: 0.95rem;
}

.am-ct-details-table th {
    width: 38%;
    text-align: left;
    font-weight: 500;
}

.am-ct-details-table td {
    width: 62%;
}

.am-ct-inline-right {
    float: right;
    margin-left: 0.8rem;
}

.am-ct-gta-table thead th,
.am-ct-animals-table thead th {
    background: #b5b5b5;
    text-align: center;
    font-weight: 700;
    font-size: 0.98rem;
}

.am-ct-gta-table tbody td {
    height: auto;
    min-height: 0;
    line-height: 1.25;
}

.am-ct-key-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 0.75rem;
    align-items: stretch;
}

.am-ct-key-card,
.am-ct-qr-card {
    border: 1px solid #2c2c2c;
    padding: 0.8rem;
    background: #fff;
    min-height: 150px;
}

.am-ct-key-card span,
.am-ct-qr-card span {
    display: block;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.am-ct-key-card strong {
    display: block;
    font-size: 1.02rem;
    margin-bottom: 0.3rem;
}

.am-ct-key-card small {
    display: block;
    font-size: 0.9rem;
    line-height: 1.35;
}

.am-ct-qr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.am-ct-qr-card img {
    width: 160px;
    height: 160px;
    object-fit: contain;
}

.am-ct-qr-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    font-size: 0.95rem;
}

.am-ct-animals-table tbody td {
    height: 22px;
}

.am-ct-barcode {
    display: block;
    width: 100%;
    height: 44px;
}

.am-ct-barcode-empty {
    display: inline-block;
    min-height: 44px;
}

.am-ct-observations {
    margin: 0 0 0.6rem;
    display: flex;
    gap: 0.35rem;
    align-items: flex-start;
    font-size: 0.97rem;
}

.am-ct-observations strong {
    white-space: nowrap;
}

.am-ct-footer-note {
    margin-top: 0.2rem;
    font-size: 0.95rem;
}

.am-ct-document-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 1rem 0 0.75rem;
}

.am-detail-summary {
    margin-bottom: 1rem;
}

.am-detail-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 1rem 0;
    min-width: 0;
}

.button-danger {
    background: #9f1239;
    border-color: #9f1239;
    color: #fff;
}

.button-danger:hover,
.button-danger:focus-visible {
    background: #881337;
    border-color: #881337;
    color: #fff;
}

.am-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.am-status-badge-danger {
    color: #9f1239;
}

.am-history-block {
    margin-top: 1rem;
    border-top: 1px solid var(--line);
    padding-top: 0.9rem;
    min-width: 0;
}

.am-history-block h4 {
    margin: 0 0 0.6rem;
}

.am-history-block ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

.am-history-block li {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 0.6rem;
    display: grid;
    gap: 0.2rem;
    box-shadow: 0 4px 10px rgba(15, 61, 83, 0.05);
}

.am-identification-history li {
    border-left: 4px solid var(--brand);
}

.am-identification-history strong {
    font-size: 0.92rem;
}

.am-identification-history span {
    color: var(--text);
    font-weight: 700;
}

.am-identification-history small {
    color: var(--muted);
}

.am-form {
    display: grid;
    gap: 0.75rem;
    min-width: 0;
}

.am-supervisao-items {
    margin-top: 0.6rem;
    display: grid;
    gap: 0.5rem;
}

.am-supervisao-items h4 {
    margin: 0;
}

.am-supervisao-items .am-table {
    min-width: 980px;
}

.am-supervisao-items input,
.am-supervisao-items select {
    min-width: 120px;
    width: 100%;
}

.am-inline-form {
    margin: 0;
}

.am-inline-action {
    margin: 0;
}

.am-animal-search-row {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 0.5rem;
}

.field-group .am-animal-search-input {
    width: 220px;
    max-width: 220px;
    flex: 0 0 220px;
}

.am-animal-search-bulk-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.am-abate-actions-row {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .am-animal-search-row {
        flex-wrap: wrap;
    }

    .field-group .am-animal-search-input {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }

    .am-animal-search-bulk-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

.am-dialog {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    margin: 0;
    width: 100%;
    border: 0;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.48);
}

.am-dialog[open] {
    display: flex;
}

.am-dialog::backdrop {
    background: rgba(15, 23, 42, 0.48);
}

.am-dialog-surface {
    width: min(720px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 1rem;
    box-shadow: 0 18px 38px rgba(15, 61, 83, 0.18);
    max-height: calc(100vh - 2rem);
    overflow: auto;
}

.am-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.am-dialog-header h4 {
    margin: 0;
    font-size: 1.1rem;
}

.am-dialog-header p {
    margin: 0.25rem 0 0;
    color: var(--muted);
}

.am-dialog-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.am-status-card {
    border-left: 4px solid transparent;
}

.am-status-card .am-status-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.am-status-card.is-ok {
    border-left-color: #198754;
    background: rgba(25, 135, 84, 0.08);
}

.am-status-card.is-warn {
    border-left-color: #d97706;
    background: rgba(217, 119, 6, 0.10);
}

.am-status-card.is-danger {
    border-left-color: #b91c1c;
    background: rgba(185, 28, 28, 0.10);
}

.am-status-card.is-info {
    border-left-color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

.am-status-card.is-muted {
    border-left-color: #6b7280;
    background: rgba(107, 114, 128, 0.08);
}

.am-autocomplete {
    position: relative;
    width: 100%;
}

.am-autocomplete-menu {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 22px rgba(15, 61, 83, 0.15);
    max-height: 260px;
    overflow-y: auto;
}

.am-autocomplete-item {
    padding: 0.55rem 0.7rem;
    border-top: 1px solid #edf2f7;
    cursor: pointer;
}

.am-autocomplete-item:first-child {
    border-top: 0;
}

.am-autocomplete-item strong,
.am-autocomplete-item small {
    display: block;
}

.am-autocomplete-item small {
    color: var(--muted);
    margin-top: 0.12rem;
}

.am-autocomplete-item .am-autocomplete-meta {
    color: #475569;
}

.am-autocomplete-item:hover {
    background: #f7fbff;
}

.am-autocomplete-item.is-hint,
.am-autocomplete-item.is-loading,
.am-autocomplete-item.is-empty {
    cursor: default;
    color: var(--muted);
}

.am-import-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.65rem;
}

.am-import-summary article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    padding: 0.6rem;
}

.am-import-summary span {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
}

.am-import-summary strong {
    display: block;
    margin-top: 0.15rem;
    font-size: 1.1rem;
}

.am-section-inline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.am-gta-panel {
    margin: 1rem 0;
}

.am-gta-list {
    display: grid;
    gap: 0.85rem;
}

.am-gta-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.95rem;
    background: #fff;
}

.am-gta-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.am-gta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.am-gta-file-field {
    grid-column: 1 / -1;
}

.am-gta-summary {
    margin-top: 0.85rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.am-gta-summary article {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    padding: 0.75rem;
}

.am-gta-summary span {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
}

.am-gta-summary strong {
    display: block;
    margin-top: 0.18rem;
    font-size: 1.15rem;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-size: 0.9rem;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    min-height: 38px;
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
}

.button-primary {
    background: var(--brand);
    color: #fff;
}

.button:not(.button-primary) {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand-dark);
}

.auth-page {
    background:
        radial-gradient(circle at 10% 10%, rgba(14, 116, 144, 0.13), transparent 38%),
        radial-gradient(circle at 88% 22%, rgba(15, 61, 83, 0.12), transparent 42%),
        linear-gradient(145deg, #edf3f6 0%, #f7fbfd 45%, #eef5f8 100%);
}

.app-shell-auth {
    display: block;
}

.content-area-auth {
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    align-items: center;
    padding: 2rem 1.2rem;
}

.auth-shell {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 520px);
    gap: 1rem;
    align-items: stretch;
}

.auth-brand,
.auth-card {
    border-radius: 14px;
    border: 1px solid var(--line);
    box-shadow: 0 16px 38px rgba(15, 61, 83, 0.09);
}

.auth-brand {
    background: linear-gradient(155deg, #0f4a5e 0%, #145f79 52%, #0e7490 100%);
    color: #e9fbff;
    padding: 2.2rem;
    display: grid;
    align-content: center;
    gap: 0.55rem;
}

.auth-logo {
    height: 68px;
    width: auto;
    object-fit: contain;
    object-position: left center;
}

.auth-kicker {
    margin: 0;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(233, 251, 255, 0.78);
}

.auth-title {
    margin: 0;
    font-size: clamp(1.6rem, 2vw, 2rem);
    line-height: 1.2;
}

.auth-subtitle {
    margin: 0;
    font-size: 1.05rem;
    color: rgba(233, 251, 255, 0.9);
}

.auth-lead {
    margin: 0.35rem 0 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.auth-note {
    margin: 0.25rem 0 0;
    color: rgba(233, 251, 255, 0.8);
}

.auth-card {
    background: var(--panel);
    padding: 1.6rem;
    display: grid;
    align-content: center;
    gap: 1rem;
}

.auth-card h2 {
    margin: 0;
    font-size: 1.28rem;
}

.auth-card > p {
    margin: 0;
    color: var(--muted);
}

.auth-alert {
    border: 1px solid #f5c2c7;
    background: #fdecee;
    color: #842029;
    border-radius: 10px;
    padding: 0.78rem 0.9rem;
    font-size: 0.9rem;
}

.auth-form {
    display: grid;
    gap: 0.9rem;
}

.auth-input {
    min-height: 44px;
    border-radius: 10px;
    border: 1px solid #c9d8e2;
    background: #fbfdfe;
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
}

.auth-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.15);
}

.auth-button {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #0e7490 0%, #0f5e75 100%);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.auth-button:hover,
.auth-button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(15, 94, 117, 0.25);
}

@media (max-width: 1180px) {
    .dashboard-hero,
    .dashboard-sections {
        grid-template-columns: 1fr;
    }

    .protocol-timeline {
        grid-template-columns: repeat(3, minmax(150px, 1fr));
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .auth-shell {
        grid-template-columns: 1fr;
        max-width: 680px;
        margin: 0 auto;
    }

    .auth-brand,
    .auth-card {
        padding: 1.3rem;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 330px);
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1000;
    }

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

    .content-area {
        padding: 1rem;
        width: auto;
        max-width: 100%;
        min-width: 0;
    }

    .menu-toggle {
        display: inline-block;
        flex: 0 0 auto;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar-meta {
        margin-left: 0;
        justify-content: flex-start;
    }

    .am-filter-bar,
    .am-filter-bar-animals {
        grid-template-columns: 1fr;
    }

    .am-filter-bar-supervisoes,
    .am-filter-bar-certificados {
        grid-template-columns: 1fr;
    }

    .am-filter-bar-certificados-transacao-full {
        grid-template-columns: 1fr;
    }

    .am-section-inline,
    .am-gta-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .am-gta-summary,
    .am-gta-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .content-area-auth {
        padding: 1rem 0.8rem;
    }

    .auth-shell {
        gap: 0.75rem;
    }

    .auth-title {
        font-size: 1.45rem;
    }

    .topbar {
        flex-wrap: wrap;
    }

    .am-filter-bar {
        grid-template-columns: 1fr;
    }

    .am-filter-bar-supervisoes,
    .am-filter-bar-certificados,
    .am-filter-bar-animals {
        grid-template-columns: 1fr;
    }

    .am-filter-bar-certificados-transacao-full {
        grid-template-columns: 1fr;
    }

    .legacy-status-card,
    .dashboard-grid,
    .protocol-timeline {
        grid-template-columns: 1fr;
    }

    .dashboard-hero h3 {
        font-size: 1.32rem;
    }
}

.am-supervisao-section {
    margin-top: 24px;
    min-width: 0;
}

.am-property-snapshot {
    margin-top: 24px;
    min-width: 0;
}

.table-subtext {
    margin-top: 4px;
    color: #5f6b7a;
    font-size: 13px;
}

.am-report-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    margin: 0 0 0.75rem;
}

.am-report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin: 0 0 0.75rem;
    color: #5f6b7a;
    font-size: 13px;
}

.am-report-meta strong {
    color: #1f2933;
}

.am-inline-list {
    margin: 10px 0 0;
    padding-left: 18px;
}

.am-inline-list li {
    margin: 4px 0;
}

@media print {
    .am-no-print,
    .topbar,
    .sidebar,
    .sidebar-shell {
        display: none !important;
    }

    .app-shell {
        display: block !important;
    }

    .content-area,
    .page-shell,
    .am-print-surface {
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
    }

    .content-area {
        max-width: none !important;
        width: 100% !important;
    }

    .am-ct-print {
        max-width: none;
    }

    .am-ct-manual-header,
    .am-ct-title-block strong,
    .am-ct-section-title,
    .am-ct-details-table th,
    .am-ct-details-table td,
    .am-ct-gta-table th,
    .am-ct-gta-table td,
    .am-ct-animals-table th,
    .am-ct-animals-table td {
        border-color: #000 !important;
    }

    .am-ct-title-block h3 {
        color: #000 !important;
    }

    .am-ct-key-grid {
        grid-template-columns: 1fr 160px;
    }

    .am-ct-key-card,
    .am-ct-qr-card {
        min-height: 130px;
    }

    .am-ct-qr-card img {
        width: 140px;
        height: 140px;
    }

    .am-ct-gta-table tbody td {
        height: auto;
        min-height: 0;
        line-height: 1.2;
    }

    .am-ct-animals-table tbody td {
        height: 46px;
    }
}
