
@charset "UTF-8";
:root {
    --bg: #f5f6f8;
    --surface: #fff;
    --ink: #26344a;
    --muted: #778295;
    --line: #e5e9ef;
    --blue: #254775;
    --blue-dark: #19365d;
    --blue-soft: #edf2f9;
    --green: #172983;
    --radius: 6px;
    --shadow: 0 4px 22px #26344a06;
    --sidebar: 244px;
}
* {
    box-sizing: border-box;
}
html {
    font-size: 14px;
    scroll-behavior: smooth;
}
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.5;
}
button,
input,
select,
textarea {
    font: inherit;
}
button,
a,
input,
select,
textarea {
    outline-offset: 3px;
}
a {
    color: var(--blue);
    text-decoration: none;
}
button {
    cursor: pointer;
}
button:disabled {
    opacity: 0.55;
    cursor: wait;
}
button,
input,
select,
textarea,
.card,
.notice,
.badge,
dialog,
.btn {
    border-radius: 6px;
}
button,
a {
    transition:
        background 0.2s,
        color 0.2s,
        border-color 0.2s,
        box-shadow 0.2s;
}
button:focus-visible,
a:focus-visible {
    outline: 2px solid #477cb8;
}
h1,
h2,
h3,
p {
    margin-top: 0;
}
h1 {
    font-size: 28px;
    letter-spacing: -0.8px;
    line-height: 1.2;
    font-weight: 650;
    margin-bottom: 8px;
}
h2 {
    font-size: 19px;
    letter-spacing: -0.3px;
    margin-bottom: 7px;
}
h3 {
    font-size: 15px;
    margin-bottom: 4px;
    font-weight: 600;
}
p {
    margin-bottom: 16px;
}
small {
    font-size: 12px;
}
.muted {
    color: var(--muted);
}
.eyebrow {
    font-size: 10px;
    letter-spacing: 1.8px;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 12px;
}
.eyebrow.light {
    color: #99d4cd;
}
.icon {
    width: 19px;
    height: 19px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}



.icon-button {
    width: 65px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: #ff7373;
    font-size: 24px;
    padding: 0;
    flex-shrink: 0;
    font-size: 15px;
    gap: 8px;
}


#logout:hover {
    background-color: #870a0a;
    color: #ffffff;
    padding: 0 0 0 140px;
    transition: .3s ease;
}

#logout span:hover {
    color: #ffffff !important;
}

.icon-button:hover {
    background: var(--blue-soft);
    color: var(--blue);
}
.btn {
    min-height: 38px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 9px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}
.btn:hover {
    background: #edf0f4;
    border-color: #d1d8e2;
}
.btn.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: white;
}
.btn.primary:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
}
.btn.danger {
    color: #ae3d49;
    background: #fff8f8;
    border-color: #efdadc;
}
.btn.danger:hover {
    background: #ffecec;
}
.btn.small {
    padding: 6px 10px;
    min-height: 31px;
    font-size: 11px;
}
.btn.ghost {
    background: transparent;
}
.button-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.spacer {
    flex: 1;
}
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    min-width: 0;
}
.card-pad {
    padding: 22px;
}
.card-head {
    padding: 20px 22px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.card-head p {
    font-size: 11px;
    color: var(--muted);
    margin: 2px 0 0;
}
.tag {
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    background: #f4f6f8;
    padding: 4px 7px;
    white-space: nowrap;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.badge {
    font-size: 10px;
    display: inline-block;
    padding: 4px 8px;
    background: #eef2f7;
    color: #556578;
    white-space: nowrap;
}
.badge.green {
    background: #eaf6f2;
    color: #267d6a;
}
.badge.red {
    background: #fcf0f0;
    color: #aa5260;
}
.badge.blue {
    background: #eaf1fc;
    color: #4269a2;
}
.badge.amber {
    background: #fff6e6;
    color: #997335;
}
.notice {
    padding: 13px 15px;
    font-size: 12px;
    margin: 14px 0;
    border: 1px solid #e4eaf1;
    background: #f3f6fa;
    color: #51677e;
}
.notice.error {
    background: #fff3f3;
    border-color: #f2d7d7;
    color: #a13546;
}
.notice.success {
    background: #edf8f3;
    border-color: #cbe7d9;
    color: #277451;
}
.notice.warning {
    background: #fff9ed;
    border-color: #ecdfc0;
    color: #8d682d;
}
.help {
    font-size: 11px;
    color: var(--muted);
    margin: 7px 0 0;
}
.divider {
    height: 1px;
    background: var(--line);
    margin: 20px 0;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    padding: 26px 16px 20px;
    background: white;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 40;
}
.brand {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 35px;
    color: var(--ink);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.1px;
}
.brand img {
    width: 150px;
    height: 85px;
    object-fit: contain;
}
.brand b {
    font-weight: 700;
    color: var(--blue);
}
.nav-caption {
    font-size: 9px;
    color: #99a3b1;
    letter-spacing: 1.6px;
    margin: 20px 0px 5px 0px;
    font-weight: 700;
    border-bottom: 1px solid #e8e8e875;
    padding: 10px 10px 5px 10px;
}
.sidebar > .nav-caption {
    margin-top: 0;
}
.sidebar nav {
    overflow-y: auto;
}
.sidebar nav > a,
.nav-dropdown {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 13px;
    color: #758093;
    font-size: 12px;
    font-weight: 500;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    border-radius: 6px;
    margin: 3px 0;
    min-height: 43px;
}
.sidebar nav > a.active {
    background: #edf2f9;
    color: #254775;
    font-weight: 650;
}
.sidebar nav > a:hover,
.nav-dropdown:hover {
    background: #f2f5f8;
    color: var(--blue);
}
.nav-dropdown .chevron {
    margin-left: auto;
}
.nav-sub {
    padding: 1px 0 3px 44px;
}
.nav-sub a {
    display: block;
    padding: 9px 0;
    color: var(--muted);
    font-size: 11px;
}
.nav-sub a.active {
    color: var(--blue);
    font-weight: 700;
}
.sidebar-bottom {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: auto;
    padding: 25px 10px 0;
    font-size: 10px;
    color: #86909e;
}
.sidebar-bottom strong {
    font-weight: 500;
    display: block;
}
.sidebar-bottom small {
    display: block;
    font-size: 9px;
    color: #a0a9b5;
}
.scope-dot {
    width: 6px;
    height: 6px;
    background: var(--green);
    border-radius: 6px;
}
.sidebar-close {
    display: none;
}
.workspace {
    margin-left: var(--sidebar);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    height: 76px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 999999999999;
}
.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}
.breadcrumb {
    font-size: 11px;
    color: #939ca8;
}
.breadcrumb span {
    padding: 0 10px;
    color: #c2c9d1;
}
.breadcrumb b {
    font-weight: 500;
    color: #5e6b7c;
}
.role-pill {
    border: 1px solid #e3e8ef;
    color: #6a7a90;
    padding: 4px 8px;
    font-size: 9px;
    border-radius: 6px;
}
.profile-button {
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0;
    color: var(--ink);
    text-align: left;
}
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: #edf1f8;
    color: #426087;
    font-size: 12px;
    font-weight: 600;
}
.profile-name {
    font-size: 11px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.profile-name small {
    display: block;
    color: var(--muted);
    font-size: 9px;
}
.menu-toggle {
    display: none;
}
#main {
    padding: 30px 34px 40px;
    width: 100%;
    max-width: 1900px;
    margin: auto auto 0;
    flex: 1;
    min-width: 0;
}
.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e9ef;
}
.page-heading p {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}
.page-heading .eyebrow {
    margin-bottom: 9px;
}
.page-heading h1 {
    font-size: 27px;
}
.source-switch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    padding: 8px 11px;
    font-size: 10px;
    color: #728198;
}
.source-switch .scope-dot {
    width: 5px;
    height: 5px;
}
.app-footer {
    padding: 15px 34px;
    border-top: 1px solid var(--line);
    color: #99a2af;
    font-size: 10px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(140px, 1.25fr)) repeat(4, minmax(110px, 1fr)) auto;
    gap: 12px;
    padding: 17px 19px;
    margin-bottom: 20px;
    align-items: end;
}
.filters label {
    font-size: 10px;
    font-weight: 600;
    color: #7a8799;
}
.filters input,
.filters select {
    height: 36px;
    font-size: 11px;
    margin-top: 5px;
}
.filter-extra {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 12px;
    grid-column: 1/-1;
}
.filter-details {
    grid-column: 1/-1;
}
.filter-details summary {
    font-size: 11px;
    color: var(--blue);
    cursor: pointer;
    margin-top: 3px;
}
.filter-details[open] summary {
    margin-bottom: 12px;
}
.kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.kpi {
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}
.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: #7a8796;
}
.kpi-icon {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff3f8;
    border-radius: 6px;
    color: #6781a0;
}
.kpi-value {
    font-size: 30px;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -1px;
    margin: 12px 0 8px;
    color: #2d405b;
}
.kpi-bottom {
    font-size: 10px;
    color: #172983;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    line-height: 1.45;
    flex-wrap: wrap;
}
.kpi-bottom b {
    color: #378575;
    font-weight: 500;
}
.charts-row {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}
.charts-row.equal {
    grid-template-columns: 1fr 1fr;
}
.chart {
    height: 275px;
    width: 100%;
    min-width: 0;
}
.chart.tall {
    height: 330px;
}
.chart-note {
    margin: 0 22px 16px;
    color: #98a2b1;
    font-size: 10px;
}
.chart-table {
    margin: 0 22px 15px;
}
.chart-table summary {
    font-size: 10px;
    color: #74859c;
    cursor: pointer;
}
.chart-table table {
    font-size: 11px;
    margin-top: 10px;
}
.section-gap {
    margin-top: 22px;
}
.table-wrap {
    overflow: auto;
    width: 100%;
    max-width: 100%;
    border-radius: 0 0 6px 6px;
}
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 12px;
}
th {
    font-size: 9px;
    letter-spacing: 0.55px;
    text-transform: uppercase;
    color: #8b96a5;
    font-weight: 600;
    background: #fafbfc;
    white-space: nowrap;
}
th,
td {
    padding: 13px 17px;
    border-bottom: 1px solid #eff1f5;
    vertical-align: middle;
}
tbody tr:hover {
    background: #fafbfd;
}
tbody tr:last-child td {
    border-bottom: 0;
}
td .name {
    font-weight: 500;
    color: #475870;
    display: block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
td small {
    font-size: 9px;
    display: block;
    color: #9aa4b2;
    margin-top: 3px;
}
td.actions {
    white-space: nowrap;
    width: 100px;
    display: grid;
    grid-auto-flow: column;
    gap: 5px;
}
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 22px;
}
.table-toolbar h3 {
    font-size: 13px;
}
.table-toolbar p {
    font-size: 10px;
    margin: 0;
    color: var(--muted);
}
.table-search {
    position: relative;
    max-width: 270px;
    width: 100%;
}
.table-search input {
    height: 34px;
    font-size: 11px;
    padding-left: 33px;
    margin: 0;
}
.table-search .icon {
    position: absolute;
    left: 10px;
    top: 9px;
    width: 15px;
    height: 15px;
    color: #9ba8b7;
}
.pagination {
    padding: 13px 20px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 10px;
    color: var(--muted);
}
.pagination .button-row {
    gap: 4px;
}
.pagination .btn {
    min-height: 29px;
    padding: 5px 9px;
    font-size: 10px;
}
.empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--muted);
}
.empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--blue-soft);
    color: #7791af;
    margin: 0 auto 14px;
    border-radius: 6px;
}
.empty h3 {
    color: #63758b;
    font-size: 15px;
}
.empty p {
    font-size: 12px;
    max-width: 380px;
    margin: 6px auto 16px;
}
.loading {
    padding: 80px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}
.spinner {
    width: 19px;
    height: 19px;
    border: 2px solid #dbe2eb;
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #5f6c7e;
    min-width: 0;
}
input,
select,
textarea {
    color-scheme: light;
    width: 100%;
    border: 1px solid #dfe5ed;
    background: #fff;
    color: #3f4d63;
    padding: 10px 11px;
    margin-top: 6px;
    min-width: 0;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}
input:focus,
select:focus,
textarea:focus {
    border-color: #829bbd;
    box-shadow: 0 0 0 3px #2547750a;
    outline: none;
}
input::placeholder,
textarea::placeholder {
    color: #a8b0bd;
}
input[readonly] {
    background: #f5f7fa;
    color: #8390a3;
}
input[type='checkbox'] {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--blue);
}
.checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 17px;
}
.form-grid.two {
    grid-template-columns: 1fr 1fr;
}
.form-grid .full {
    grid-column: 1/-1;
}
.form-intro {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}
.form-intro .step {
    width: 34px;
    height: 34px;
    background: #edf2f8;
    color: #6987ad;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;
}
.form-intro p {
    font-size: 11px;
    color: var(--muted);
    margin: 0;
}
.form-section {
    padding: 21px 24px;
    border-bottom: 1px solid var(--line);
}
.form-section:last-of-type {
    border-bottom: 0;
}
.form-section summary {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 600;
    font-size: 13px;
    color: #53677f;
    cursor: pointer;
    list-style: none;
}
.form-section summary::-webkit-details-marker {
    display: none;
}
.form-section summary small {
    font-size: 10px;
    color: #96a1af;
    font-weight: 400;
    margin: 0;
}
.form-section-summary-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    flex-direction: row-reverse;
}
.form-section-chevron {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #8090a5;
    transition: transform 0.18s ease;
}
.form-section-chevron svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.form-section[open] .form-section-chevron {
    transform: rotate(180deg);
}
.form-section[open] .form-grid {
    margin-top: 20px;
}
.entry-field-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.select-input-shell {
    position: relative;
    display: block;
    width: 100%;
    margin-top: 6px;
}
.select-input-shell > select {
    margin-top: 0;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
}
.select-input-shell > .select-field-chevron {
    position: absolute;
    z-index: 2;
    right: 12px;
    top: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #708096;
    transform: translateY(-50%);
    pointer-events: none;
}
.select-input-shell > .select-field-chevron svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.select-input-shell .custom-select {
    margin-top: 0;
}
.form-actions {
    padding: 18px 24px;
    background: #fafbfd;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: sticky;
    bottom: 0;
    z-index: 10;
    border-radius: 0 0 6px 6px;
}
.form-actions p {
    margin: 0;
    font-size: 10px;
    color: #92a0b0;
}
.editor-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    align-items: start;
}
.editor-aside {
    padding: 20px;
    position: sticky;
    top: 96px;
}
.editor-aside h3 {
    font-size: 12px;
    margin-bottom: 13px;
}
.editor-aside p {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.8;
}
.editor-aside .aside-item {
    padding: 12px 0;
    border-top: 1px solid var(--line);
    font-size: 11px;
    display: flex;
    gap: 9px;
    color: #7b8ba1;
}
.editor-aside .icon {
    width: 16px;
    height: 16px;
    color: #6889ad;
}
.upload-zone {
    border: 1px dashed #b9c9dd;
    background: #f8fafc;
    border-radius: 6px;
    padding: 34px 20px;
    text-align: center;
    position: relative;
}
.upload-zone.dragging {
    background: #eaf2fb;
    border-color: var(--blue);
}
.upload-zone .empty-icon {
    background: #e9f0f8;
    color: #617ea5;
}
.upload-zone input {
    margin: 12px auto 0;
    max-width: 360px;
    font-size: 11px;
    background: white;
}
.upload-zone h3 {
    font-size: 14px;
}
.upload-zone p {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 0;
}
.upload-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr);
    gap: 20px;
}
.upload-info {
    padding: 24px;
}
.upload-info ol {
    padding-left: 20px;
    color: var(--muted);
    font-size: 12px;
}
.upload-info li {
    margin: 14px 0;
}
.upload-info strong {
    display: block;
    color: #5e728b;
    font-size: 12px;
}
.progress-bar {
    height: 7px;
    background: #e6ecf3;
    border-radius: 6px;
    overflow: hidden;
    margin: 16px 0;
}
.progress-bar span {
    height: 100%;
    display: block;
    background: var(--green);
    width: 0;
    transition: width 0.3s;
}
.progress-metrics {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.progress-metrics div {
    font-size: 10px;
    color: var(--muted);
}
.progress-metrics b {
    display: block;
    font-size: 19px;
    color: #536b85;
    font-weight: 600;
    margin: 4px 0;
}
.import-console {
    background: #202d41;
    color: #d1dceb;
    font-family: Consolas, monospace;
    font-size: 11px;
    padding: 16px;
    border-radius: 6px;
    height: 210px;
    overflow: auto;
    line-height: 1.9;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.preview-table {
    max-height: 280px;
    overflow: auto;
}
.preview-table table {
    min-width: max-content;
}
.preview-table td {
    max-width: 230px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    font-size: 10px;
}
.preview-table th {
    position: sticky;
    top: 0;
}
.layout-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 420px;
    overflow: auto;
    padding-right: 7px;
}
.layout-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #fafbfd;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.layout-item input[type='text'] {
    margin: 0;
    flex: 1;
    font-size: 11px;
    padding: 6px 9px;
}
.layout-item .field-code {
    width: 95px;
    font-size: 10px;
    overflow-wrap: anywhere;
    color: var(--muted);
}
.layout-item .icon-button {
    width: 26px;
    height: 26px;
    font-size: 16px;
}
.layout-item label {
    display: contents;
}
.export-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
    align-items: start;
}
.export-summary {
    position: sticky;
    top: 95px;
}
.summary-pair {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    color: var(--muted);
}
.summary-pair strong {
    font-weight: 600;
    color: #5d6f86;
}
.record-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 18px;
}
.record-field {
    padding: 11px 0;
    border-bottom: 1px solid #eff1f5;
    overflow-wrap: anywhere;
}
.record-field dt {
    font-size: 10px;
    color: #91a0b3;
    margin-bottom: 4px;
}
.record-field dd {
    margin: 0;
    font-size: 12px;
    color: #485d76;
}
.detail-heading {
    margin-top: 24px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--blue);
}
dialog {
    border: 1px solid var(--line);
    padding: 0;
    max-width: 950px;
    width: calc(100% - 32px);
    max-height: 90dvh;
    box-shadow: 0 20px 100px #162d5033;
    color: var(--ink);
    background: white;
}
dialog::backdrop {
    background: #20304766;
    backdrop-filter: blur(3px);
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 21px 25px;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 3;
}
.modal-head .eyebrow {
    margin-bottom: 4px;
    font-size: 9px;
}
.modal-head h2 {
    margin: 0;
    font-size: 19px;
}
#modal-body {
    padding: 24px 25px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}
.toast-region {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    max-width: calc(100% - 40px);
}
.toast {
    border: 1px solid #bcded2;
    background: #f2fbf7;
    box-shadow: 0 8px 30px #20304714;
    padding: 14px 18px;
    border-radius: 6px;
    color: #386f59;
    font-size: 12px;
    max-width: 400px;
    animation: appear 0.2s ease;
}
.toast.error {
    background: #fff3f3;
    border-color: #efced2;
    color: #a44351;
}
@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
#sidebar-shade {
    display: none;
}
body.modal-open {
    overflow: hidden;
}
[hidden] {
    display: none !important;
}
.auth-page {
    background: #f3f5f8;
}
.auth-shell {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr 370px;
}
.auth-story {
    background: #203d68;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: 50px 12%;
    position: relative;
    overflow: hidden;
}
.institution {
    font-size: 12px;
    letter-spacing: 2px;
    font-weight: 600;
}
.institution span {
    display: block;
    font-size: 8px;
    color: #a1b6d0;
    margin-top: 7px;
    letter-spacing: 2.6px;
}
.auth-story h1 {
    font-size: clamp(38px, 4.2vw, 65px);
    line-height: 1.07;
    letter-spacing: -2px;
    font-weight: 500;
    margin: 19px 0 23px;
}
.auth-story h1 span {
    color: #aec0d7;
}
.auth-story p {
    color: #b5c6db;
    font-size: 13px;
    line-height: 1.8;
    max-width: 320px;
}
.auth-story > small {
    color: #8ba5c5;
    font-size: 10px;
}
.story-visual {
    height: 110px;
    display: flex;
    align-items: end;
    gap: 15px;
    margin-top: 40px;
    border-bottom: 1px solid #8da7c833;
    position: relative;
}
.story-visual i {
    width: 22px;
    background: #aec9dc30;
    border-radius: 6px 6px 0 0;
    height: 28%;
}
.story-visual i:nth-of-type(2) {
    height: 38%;
}
.story-visual i:nth-of-type(3) {
    height: 46%;
}
.story-visual i:nth-of-type(4) {
    height: 39%;
}
.story-visual i:nth-of-type(5) {
    height: 63%;
    background: #78b2ae66;
}
.story-visual i:nth-of-type(6) {
    height: 75%;
    background: #78b2ae88;
}
.story-visual i:nth-of-type(7) {
    height: 70%;
    background: #78b2aeaa;
}
.story-visual i:nth-of-type(8) {
    height: 90%;
    background: #78b2ae;
}
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px 35px;
    background: #fff;
}
.auth-box {
    width: 100%;
    max-width: 365px;
}
.login-logo {
    width: 150px;
    height: 100px;
    object-fit: contain;
    display: block;
    margin: 0 auto 30px;
}
.auth-box .eyebrow {
    font-size: 9px;
    margin-bottom: 9px;
}
.auth-box h2 {
    font-size: 25px;
    font-weight: 600;
    margin-bottom: 9px;
}
.auth-box > p {
    font-size: 12px;
    margin-bottom: 15px;
}
.auth-box form > label {
    margin-bottom: 10px;
    font-size: 11px;
}
.auth-box input,
.auth-box select {
    font-size: 12px;
    height: 43px;
}
.auth-submit {
    width: 100%;
    margin-top: 19px;
    min-height: 44px;
}
.password-field {
    position: relative;
}
.password-field input {
    padding-right: 72px;
}
.show-password {
    position: absolute;
    right: 9px;
    top: 17px;
    font-size: 10px;
    padding: 3px 4px;
    border: 0;
    background: transparent;
    color: #8090a6;
}
.recover-link {
    display: block;
    font-size: 11px;
    margin-top: 5px;
    text-align: left;
}
.auth-foot {
    border-top: 1px solid var(--line);
    padding-top: 24px;
    margin-top: 34px;
    color: #99a4b3;
    text-align: center;
    font-size: 10px;
}
.back-login {
    display: block;
    text-align: center;
    margin-top: 19px;
    font-size: 11px;
}
.install-page {
    max-width: 820px;
    margin: 45px auto;
    padding: 25px;
}
.install-page .login-logo {
    margin: 0 auto 25px;
}
.install-page .card {
    padding: 25px;
}
.install-page code {
    background: #eef2f6;
    padding: 2px 5px;
    border-radius: 6px;
    font-size: 11px;
}
.checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 18px 0;
}
@media (min-width: 1700px) {
    :root {
        --sidebar: 265px;
    }
    #main {
        padding: 40px 55px;
    }
    .chart {
        height: 310px;
    }
    .chart.tall {
        height: 370px;
    }
    .kpi {
        padding: 24px;
    }
    .kpi-value {
        font-size: 37px;
    }
    .form-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
@media (max-width: 1200px) {
    :root {
        --sidebar: 220px;
    }
    .topbar {
        padding: 0 24px;
    }
    #main {
        padding: 26px 24px 35px;
    }
    .sidebar {
        padding-inline: 12px;
    }
    .sidebar nav > a,
    .nav-dropdown {
        font-size: 11px;
        gap: 9px;
    }
    .filters {
        grid-template-columns: 1.5fr 1fr 1fr;
    }
    .filters > .button-row {
        grid-column: 3;
        justify-content: flex-end;
    }
    .filters > .filter-sex {
        grid-column: 1/3;
    }
    .filters.has-area-filter > .filter-sex {
        grid-column: 2/3;
    }
    .kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 12px;
    }
    .kpi {
        padding: 15px;
    }
    .kpi-value {
        font-size: 27px;
    }
    .charts-row {
        grid-template-columns: 1.4fr 1fr;
    }
    .editor-layout {
        grid-template-columns: 1fr;
    }
    .editor-aside {
        display: none;
    }
    .form-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .profile-name {
        max-width: 105px;
    }
    .breadcrumb {
        font-size: 10px;
    }
}
@media (max-width: 1000px) {
    :root {
        --sidebar: 220px;
    }
    .workspace {
        margin-left: 0;
    }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .sidebar.is-open {
        transform: translateX(0);
    }
    .menu-toggle,
    .sidebar-close {
        display: flex;
    }
    .sidebar-close {
        position: absolute;
        right: 6px;
        top: 6px;
    }
    .sidebar.is-open ~ .workspace {
        pointer-events: none;
    }
    #sidebar-shade.visible {
        display: block;
        position: fixed;
        inset: 0;
        border: 0;
        background: #24384d66;
        z-index: 35;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    .upload-layout {
        grid-template-columns: 1.5fr 1fr;
    }
    .topbar {
        height: 66px;
    }
    .export-summary {
        top: 86px;
    }
}
@media (max-width: 700px) {
    html {
        font-size: 13px;
    }
    .topbar {
        padding: 0 17px;
    }
    .topbar-left,
    .topbar-right {
        gap: 9px;
    }
    .breadcrumb {
        display: none;
    }
    .role-pill {
        display: none;
    }
    .profile-name {
        max-width: 130px;
    }
    #main {
        padding: 23px 16px 28px;
    }
    .page-heading {
        align-items: flex-start;
        margin-bottom: 20px;
        gap: 12px;
    }
    .page-heading h1 {
        font-size: 23px;
    }
    .page-heading p {
        font-size: 11px;
        line-height: 1.6;
    }
    .page-heading .eyebrow {
        font-size: 9px;
    }
    .source-switch {
        display: none;
    }
    .page-heading .btn {
        font-size: 10px;
        padding: 8px 10px;
        flex-shrink: 0;
    }
    .kpis {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .kpi {
        padding: 15px;
    }
    .kpi-top {
        font-size: 10px;
    }
    .kpi-value {
        font-size: 27px;
        margin: 10px 0 7px;
    }
    .kpi-icon {
        width: 25px;
        height: 25px;
    }
    .kpi-icon .icon {
        width: 15px;
        height: 15px;
    }
    .kpi-bottom {
        font-size: 9px;
        line-height: 1.5;
    }
    .charts-row,
    .charts-row.equal,
    .upload-layout,
    .export-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .chart {
        height: 270px;
    }
    .chart.tall {
        height: 340px;
    }
    .card-head {
        padding: 18px 17px 0;
    }
    .card-head h3 {
        font-size: 13px;
    }
    .card-head p {
        font-size: 10px;
    }
    .filters {
        grid-template-columns: 1fr 1fr;
        padding: 15px;
        gap: 10px;
    }
    .filters > label:first-child {
        grid-column: 1/-1;
    }
    .filters > .filter-sex {
        grid-column: auto;
    }
    .filters > .button-row {
        grid-column: 1/-1;
        justify-content: stretch;
    }
    .filters > .button-row .btn {
        flex: 1;
    }
    .filter-extra {
        grid-template-columns: 1fr 1fr;
    }
    .form-grid,
    .form-grid.two {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }
    .form-section {
        padding: 18px;
    }
    .form-intro {
        padding: 18px;
    }
    .form-actions {
        padding: 14px;
        flex-wrap: wrap;
    }
    .form-actions p {
        display: none;
    }
    .form-actions .button-row {
        width: 100%;
    }
    .form-actions .btn {
        flex: 1;
    }
    .table-toolbar {
        padding: 16px;
        flex-wrap: wrap;
    }
    .table-search {
        max-width: 100%;
    }
    .table-wrap table {
        min-width: 650px;
    }
    th,
    td {
        padding: 12px 14px;
    }
    .table-toolbar h3 {
        font-size: 12px;
    }
    .card-pad {
        padding: 18px;
    }
    .app-footer {
        padding: 15px 16px;
        font-size: 9px;
        flex-wrap: wrap;
    }
    .pagination {
        padding: 12px 14px;
        flex-wrap: wrap;
        font-size: 9px;
    }
    .progress-metrics {
        grid-template-columns: repeat(3, 1fr);
    }
    .record-details {
        grid-template-columns: 1fr 1fr;
    }
    .modal-head {
        padding: 18px;
    }
    .modal-head h2 {
        font-size: 17px;
    }
    #modal-body {
        padding: 18px;
    }
    .auth-shell {
        grid-template-columns: 1fr;
    }
    .auth-story {
        display: none;
    }
    .auth-form-panel {
        padding: 34px 24px;
        min-height: 100dvh;
    }
    .login-logo {
        width: 135px;
        height: 95px;
        margin-bottom: 36px;
    }
    .auth-box h2 {
        font-size: 24px;
    }
    .export-summary {
        position: static;
    }
    .layout-item {
        gap: 7px;
        padding: 7px;
    }
    .layout-item .field-code {
        width: 72px;
        font-size: 9px;
    }
    .upload-info {
        padding: 20px;
    }
}
@media (max-width: 420px) {
    .form-grid,
    .form-grid.two {
        grid-template-columns: 1fr;
    }
    .kpi-value {
        font-size: 25px;
    }
    .kpi-top {
        font-size: 9px;
    }
    .kpi-bottom {
        font-size: 8px;
    }
    .record-details {
        grid-template-columns: 1fr;
    }
    .page-heading .btn .icon {
        display: none;
    }
    .profile-name {
        font-size: 10px;
    }
    .kpi {
        padding: 13px;
    }
    .filter-extra {
        grid-template-columns: 1fr;
    }
    .layout-item .field-code {
        display: none;
    }
    .modal-actions .btn {
        flex: 1;
    }
    .progress-metrics {
        grid-template-columns: 1fr 1fr;
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
@media print {
    .sidebar,
    .topbar,
    .filters,
    .app-footer,
    .button-row,
    .table-search,
    .pagination {
        display: none !important;
    }
    .workspace {
        margin: 0;
    }
    #main {
        padding: 0;
    }
    .card {
        break-inside: avoid;
        box-shadow: none;
    }
    .charts-row {
        display: block;
    }
    .chart {
        height: 280px;
    }
    .charts-row > .card {
        margin-bottom: 15px;
    }
    .kpis {
        grid-template-columns: repeat(5, 1fr);
    }
    body {
        background: #fff;
    }
    .form-actions {
        position: static;
    }
}

/* Dropdowns e sugestões padronizados — evita menus nativos diferentes entre navegadores/SO. */
.custom-select,
.custom-autocomplete {
    position: relative;
    width: 100%;
    min-width: 0;
    margin-top: 6px;
}

.custom-select .native-select-hidden {
    position: absolute !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 1px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-select-trigger {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border: 1px solid #dfe5ed;
    border-radius: 6px;
    background: #fff;
    color: #3f4d63;
    text-align: left;
    font: inherit;
    line-height: 1.45;
    box-shadow: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s,
        background 0.2s;
}

.custom-select-trigger:hover {
    border-color: #c8d2df;
    background: #fbfcfe;
}

.custom-select-trigger:focus-visible,
.custom-select.is-open .custom-select-trigger {
    outline: none;
    border-color: #829bbd;
    box-shadow: 0 0 0 3px #2547750a;
}

.custom-select.is-invalid .custom-select-trigger {
    border-color: #cf6e6e;
    box-shadow: 0 0 0 3px #cf6e6e12;
}

.custom-select-trigger:disabled {
    cursor: not-allowed;
    background: #f5f7fa;
    color: #939dab;
}

.custom-select-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-chevron {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #708096;
    transition: transform 0.18s ease;
    pointer-events: none;
}
.custom-select-chevron svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.custom-select-chevron:empty::before {
    content: '';
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
}
.custom-select.is-open .custom-select-chevron {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    z-index: 1400;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    min-width: 180px;
    max-height: var(--dropdown-max-height, 260px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 5px;
    border: 1px solid #dfe5ed;
    border-radius: 7px;
    background: #fff;
    box-shadow: 0 14px 38px #26344a20, 0 3px 10px #26344a0f;
}

.custom-dropdown-menu[hidden] {
    display: none !important;
}

.custom-select.is-open,
.custom-autocomplete.is-open {
    z-index: 1400;
}

.custom-select.opens-up .custom-dropdown-menu {
    top: auto;
    bottom: calc(100% + 6px);
}

.custom-dropdown-option {
    width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #44546b;
    font: inherit;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    word-break: break-word;
}

.custom-dropdown-option:hover,
.custom-dropdown-option:focus-visible {
    outline: none;
    background: #f1f5fa;
    color: #203d66;
}

.custom-dropdown-option.is-selected {
    background: #edf2f9;
    color: #254775;
    font-weight: 600;
}

.custom-dropdown-option.is-placeholder {
    color: #7f8b9d;
}

.custom-dropdown-option:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.custom-dropdown-menu::-webkit-scrollbar {
    width: 8px;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
    border: 2px solid #fff;
    border-radius: 999px;
    background: #cad3df;
}

.custom-autocomplete > input {
    margin-top: 0;
}

.custom-autocomplete.is-open > input {
    border-color: #829bbd;
    box-shadow: 0 0 0 3px #2547750a;
}

.filters .custom-select,
.filters .custom-autocomplete {
    margin-top: 5px;
}

.filters .custom-select-trigger {
    min-height: 36px;
    height: 36px;
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 11px;
}

.auth-box .custom-select-trigger {
    min-height: 44px;
}

@media (max-width: 720px) {
    .custom-dropdown-menu {
        max-height: 220px;
    }
}

/* Seletor único de período: ano + mês */
.period-filter-field {
    min-width: 0;
}
.period-picker {
    position: relative;
    margin-top: 5px;
    min-width: 0;
}
.period-picker-trigger {
    width: 100%;
    height: 36px;
    border: 1px solid #dfe5ed;
    background: #fff;
    color: #33445d;
    padding: 0 34px 0 34px;
    display: flex;
    align-items: center;
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    position: relative;
    box-shadow: 0 1px 2px rgba(38, 52, 74, 0.02);
}
.period-picker-trigger:hover {
    border-color: #cbd5e2;
    background: #fbfcfe;
}
.period-picker-trigger:focus-visible,
.period-picker.is-open .period-picker-trigger {
    border-color: #7e9fc7;
    box-shadow: 0 0 0 3px rgba(65, 105, 156, 0.1);
}
.period-picker.has-value .period-picker-trigger {
    color: var(--blue);
    background: #fbfdff;
}
.period-picker-leading {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: #8da0b6;
    display: grid;
    place-items: center;
}
.period-picker-leading .icon {
    width: 14px;
    height: 14px;
}
.period-picker-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.period-picker-chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid #8da0b6;
    border-bottom: 1.5px solid #8da0b6;
    transform: translateY(-65%) rotate(45deg);
    transition: transform 0.18s ease;
}
.period-picker.is-open .period-picker-chevron {
    transform: translateY(-20%) rotate(225deg);
}
.period-picker-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 310px;
    max-width: min(310px, calc(100vw - 48px));
    padding: 12px;
    background: #fff;
    border: 1px solid #dfe5ed;
    border-radius: 8px;
    box-shadow: 0 16px 42px rgba(38, 52, 74, 0.16);
    z-index: 1200;
}
.period-picker-popover[hidden] {
    display: none !important;
}
.period-picker-yearbar {
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    align-items: center;
    gap: 8px;
    padding: 2px 2px 10px;
    border-bottom: 1px solid #eef1f5;
    margin-bottom: 10px;
}
.period-year-caption {
    text-align: center;
    line-height: 1.15;
}
.period-year-caption span {
    display: block;
    color: #9aa5b4;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.75px;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.period-year-caption strong {
    color: #324b6d;
    font-size: 15px;
    font-weight: 700;
}
.period-year-nav {
    width: 34px;
    height: 32px;
    border: 1px solid #e1e7ee;
    background: #f8fafc;
    color: #49678e;
    font-size: 20px;
    line-height: 1;
    display: grid;
    place-items: center;
    padding: 0 0 2px;
}
.period-year-nav:hover:not(:disabled) {
    background: #edf3fa;
    border-color: #cad7e6;
}
.period-year-nav:disabled {
    cursor: default;
    opacity: 0.35;
}
.period-month-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.period-month-option {
    min-height: 34px;
    border: 1px solid transparent;
    background: #f7f9fb;
    color: #56677e;
    padding: 7px 8px;
    font-size: 10px;
    font-weight: 600;
}
.period-month-option:hover {
    background: #edf3fa;
    color: var(--blue);
    border-color: #dbe5f0;
}
.period-month-option.is-selected {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
    box-shadow: 0 4px 12px rgba(37, 71, 117, 0.16);
}
.period-picker-clear {
    width: 100%;
    min-height: 32px;
    margin-top: 10px;
    border: 0;
    border-top: 1px solid #eef1f5;
    border-radius: 0;
    background: transparent;
    color: #73839a;
    padding: 10px 6px 1px;
    font-size: 10px;
    font-weight: 600;
}
.period-picker-clear:hover {
    color: var(--blue);
}

@media (max-width: 640px) {
    .period-picker-popover {
        width: min(310px, calc(100vw - 44px));
    }
    .period-month-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Administração: vínculo entre área de atendimento e unidades */
.area-unit-admin-grid {
    display: grid;
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}
.area-unit-area-card {
    position: sticky;
    top: 88px;
}
.area-unit-select-label {
    display: grid;
    gap: 7px;
    margin-top: 18px;
    color: #6b7890;
    font-size: 12px;
    font-weight: 600;
}
.area-unit-select-label select {
    width: 100%;
    min-height: 44px;
}
.area-unit-summary {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #e4eaf1;
    border-radius: 8px;
    background: #f8fafc;
    display: grid;
    gap: 5px;
}
.area-unit-summary strong {
    color: #2f496d;
    font-size: 13px;
}
.area-unit-summary span {
    color: #7e8ca0;
    font-size: 11px;
    line-height: 1.45;
}
.area-unit-units-card {
    overflow: hidden;
}
.area-unit-toolbar {
    gap: 14px;
}
.area-unit-tools {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.area-unit-tools .table-search {
    min-width: 230px;
}
.area-unit-list-placeholder {
    min-height: 180px;
    display: grid;
    place-items: center;
    padding: 28px;
    color: #8a97a8;
    font-size: 12px;
    text-align: center;
}
.area-unit-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(145px, auto) minmax(190px, 220px);
    gap: 12px;
    align-items: center;
    min-height: 62px;
    padding: 10px 18px;
    border-top: 1px solid #eef2f6;
    transition: background-color .16s ease;
}
.area-unit-row:hover {
    background: #f8fafc;
}

.area-unit-link-control {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-width: 0;
    cursor: pointer;
}
.area-unit-row-population {
    display: grid;
    gap: 4px;
    min-width: 0;
}
.area-unit-row-population > span {
    color: #7f8da0;
    font-size: 9px;
    font-weight: 650;
}
.area-unit-row-population input {
    width: 100%;
    min-height: 36px;
    padding: 7px 9px;
    font-size: 11px;
}
.area-unit-row-population input:disabled {
    background: #f5f7fa;
    color: #a4aebb;
}

.area-unit-row[hidden] {
    display: none !important;
}
.area-unit-check {
    position: relative;
    width: 18px;
    height: 18px;
}
.area-unit-check input {
    position: absolute;
    inset: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.area-unit-check span {
    display: block;
    width: 18px;
    height: 18px;
    border: 1.5px solid #b9c6d7;
    border-radius: 5px;
    background: #fff;
    transition: .16s ease;
}
.area-unit-check input:checked + span {
    background: var(--blue);
    border-color: var(--blue);
}
.area-unit-check input:checked + span::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.area-unit-row-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}
.area-unit-row-main strong {
    color: #304968;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.area-unit-row-main small {
    color: #94a0b0;
    font-size: 10px;
}
.area-unit-row-meta {
    justify-self: end;
    padding: 5px 8px;
    border: 1px solid #e7ebf0;
    border-radius: 999px;
    background: #fafbfd;
    color: #929dab;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}
.area-unit-row-meta.has-records {
    border-color: #d6e2ef;
    background: #f1f6fb;
    color: #49698d;
}
.area-unit-actions {
    min-height: 64px;
    padding: 12px 18px;
    border-top: 1px solid #e8edf3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fbfcfd;
}
#filter-unit option:disabled {
    color: #9aa6b5;
}

@media (max-width: 980px) {
    .area-unit-admin-grid {
        grid-template-columns: 1fr;
    }
    .area-unit-area-card {
        position: static;
    }
}
@media (max-width: 680px) {
    .area-unit-row {
        grid-template-columns: 28px minmax(0, 1fr);
    }
    .area-unit-row-meta {
        grid-column: 2;
        justify-self: start;
    }
    .area-unit-tools,
    .area-unit-tools .table-search {
        width: 100%;
    }
    .area-unit-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Dashboard: card de resumo epidemiológico ao lado de Encerramento dos casos */
.dashboard-overview-row {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, .95fr) minmax(310px, .9fr);
    align-items: stretch;
}
.dashboard-overview-row > .card {
    height: 100%;
}
.dashboard-summary-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.dashboard-summary-head {
    padding-bottom: 14px;
    border-bottom: 1px solid #edf1f5;
}
.dashboard-summary-body {
    padding: 12px 20px 18px;
    display: grid;
    gap: 10px;
    flex: 1;
}
.dashboard-summary-total,
.dashboard-summary-filtered {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid #e4eaf1;
    border-radius: 8px;
    background: #f8fafc;
}
.dashboard-summary-total > div {
    display: grid;
    gap: 2px;
}
.dashboard-summary-total > div > span,
.dashboard-summary-filtered > span:first-child {
    color: #405a7a;
    font-size: 11px;
    font-weight: 650;
}
.dashboard-summary-total small {
    color: #8a98aa;
    font-size: 9px;
}
.dashboard-summary-filtered {
    padding-block: 8px;
    background: #fbfcfd;
}
.dashboard-summary-filtered > span:first-child {
    color: #7a889b;
    font-weight: 500;
}
.dashboard-summary-section {
    display: grid;
    gap: 0;
}
.dashboard-summary-section h4 {
    margin: 2px 0 4px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e8edf3;
    color: #344d6c;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .02em;
}
.dashboard-summary-row {
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 6px;
    border-radius: 5px;
    color: #617087;
    font-size: 10px;
}
.dashboard-summary-row:nth-of-type(even) {
    background: #f7f8fa;
}
.dashboard-summary-values {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}
.dashboard-summary-values strong {
    min-width: 42px;
    color: #344d6c;
    font-size: 11px;
    font-weight: 700;
    text-align: right;
}
.dashboard-summary-values em {
    min-width: 48px;
    padding: 3px 6px;
    border-radius: 999px;
    background: #eef4f8;
    color: #4f708f;
    font-size: 9px;
    font-style: normal;
    font-weight: 650;
    text-align: center;
}
.dashboard-incidence {
    margin-top: 2px;
    padding: 10px 12px;
    border: 1px solid #dfe8ef;
    border-radius: 8px;
    background: #f7fafc;
}
.dashboard-incidence-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #405a7a;
    font-size: 10px;
    font-weight: 650;
}
.dashboard-incidence-top strong {
    color: #2f6f67;
    font-size: 16px;
    font-weight: 700;
}
.dashboard-incidence small {
    display: block;
    margin-top: 4px;
    color: #8a98aa;
    font-size: 9px;
    line-height: 1.45;
}
.dashboard-incidence.is-empty .dashboard-incidence-top strong {
    color: #9aa5b2;
}

@media (max-width: 920px) {
    .area-unit-row {
        grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
    }
    .area-unit-row-meta {
        display: none;
    }
}
@media (max-width: 640px) {
    .area-unit-row {
        grid-template-columns: 1fr;
        gap: 9px;
    }
    .area-unit-row-population {
        padding-left: 40px;
    }
}

@media (max-width: 1100px) {
    .dashboard-overview-row {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    }
    .dashboard-overview-row .dashboard-summary-card {
        grid-column: 1 / -1;
    }
}
@media (max-width: 700px) {
    .dashboard-overview-row {
        grid-template-columns: 1fr;
    }
    .dashboard-overview-row .dashboard-summary-card {
        grid-column: auto;
    }
    .dashboard-summary-body {
        padding-inline: 16px;
    }
}

/* Cadastro em formato de ficha/planilha */
.excel-entry-shell {
    /* Os dropdowns da ficha precisam ultrapassar os limites visuais dos cards. */
    overflow: visible;
}
.excel-sheet-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}
.excel-sheet-toolbar > div:first-child {
    display: grid;
    gap: 3px;
}
.excel-sheet-toolbar strong {
    color: #42546d;
    font-size: 14px;
}
.excel-sheet-kicker {
    color: #8b98aa;
    font-size: 9px;
    letter-spacing: .09em;
    font-weight: 700;
}
.cadastro-unit-select,
.cadastro-unit-fixed {
    min-width: 260px;
    max-width: 390px;
}
.cadastro-unit-select > span,
.cadastro-unit-fixed > span {
    display: block;
    margin-bottom: 5px;
    color: #8b98aa;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.cadastro-unit-select select {
    margin: 0;
    min-height: 37px;
}
.cadastro-unit-fixed {
    border: 1px solid #dfe5ed;
    background: #fff;
    padding: 9px 12px;
    border-radius: 6px;
}
.cadastro-unit-fixed strong {
    display: block;
    font-size: 12px;
    color: #52647b;
}
.excel-entry-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
    min-width: 0;
}
.excel-entry-column {
    min-width: 0;
    padding: 18px;
    background: #fff;
}
.excel-entry-column-right {
    border-left: 1px solid #e5e9ef;
    background: #fcfdff;
}
.excel-section {
    border: 1px solid #dfe4eb;
    background: #fff;
    margin-bottom: 14px;
    overflow: visible;
    border-radius: 6px;
    position: relative;
}
.excel-section:has(.custom-select.is-open),
.excel-section:has(.custom-autocomplete.is-open) {
    z-index: 1300;
}
.excel-row-control .custom-select,
.excel-row-control .custom-autocomplete {
    margin-top: 0;
}
.excel-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 39px;
    padding: 9px 12px;
    background: #f3f6f9;
    border-bottom: 1px solid #dfe4eb;
}
.excel-section-title strong {
    color: #43556d;
    font-size: 12px;
}
.excel-section-title span {
    color: #97a2b0;
    font-size: 9px;
    text-align: right;
}
.excel-section-body {
    background-image:
        linear-gradient(to right, transparent calc(42% - .5px), #edf0f4 calc(42% - .5px), #edf0f4 calc(42% + .5px), transparent calc(42% + .5px));
}
.excel-row {
    display: grid;
    grid-template-columns: 42% 58%;
    min-height: 42px;
    margin: 0;
    border-bottom: 1px solid #edf0f4;
    color: #59697e;
}
.excel-row:last-child {
    border-bottom: 0;
}
.excel-row-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 7px 11px;
    font-size: 10px;
    font-weight: 500;
    min-width: 0;
}
.excel-row-label small {
    color: #9ba5b2;
    font-size: 8px;
    font-weight: 400;
    line-height: 1.35;
}
.excel-row-control {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 4px 6px;
}
.excel-row-control input,
.excel-row-control select,
.excel-row-control textarea {
    margin: 0;
    border-color: transparent;
    background: transparent;
    border-radius: 4px;
    min-height: 32px;
    font-size: 10px;
    padding: 6px 8px;
}
.excel-row-control textarea {
    resize: vertical;
    min-height: 58px;
}
.excel-row-control input:hover,
.excel-row-control select:hover,
.excel-row-control textarea:hover {
    border-color: #d8e0e9;
    background: #fff;
}
.excel-row-control input:focus,
.excel-row-control select:focus,
.excel-row-control textarea:focus {
    border-color: #7f98b9;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(37, 71, 117, .07);
}
.followup-block {
    position: relative;
}
.excel-add-month,
.excel-add-row {
    width: 100%;
    border: 1px dashed #bdc9d7;
    background: #f8fafc;
    color: #5e7592;
    font-size: 10px;
    min-height: 36px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}
.excel-add-month:hover,
.excel-add-row:hover {
    background: #f1f5f9;
    border-color: #91a5bf;
}
.excel-add-row {
    width: calc(100% - 16px);
    margin: 8px;
}
.contact-sheet {
    border-bottom: 1px solid #e5e9ef;
}
.contact-sheet:last-of-type {
    border-bottom: 0;
}
.contact-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    background: #fbfcfd;
    border-bottom: 1px solid #edf0f4;
}
.contact-sheet-head strong {
    color: #718198;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.contact-sheet-head .icon-button {
    width: 28px;
    height: 28px;
}
.cadastro-actions {
    position: sticky;
    bottom: 0;
}

/* Página Dados cadastrados */
.registered-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 18px;
}
.registered-kpis .kpi {
    min-width: 0;
    padding: 14px 15px;
}
.registered-kpis .kpi-top {
    font-size: 10px;
}
.registered-kpis .kpi-icon {
    width: 27px;
    height: 27px;
}
.registered-kpis .kpi-value {
    margin: 9px 0 6px;
    font-size: 25px;
}
.registered-kpis .kpi-bottom {
    font-size: 9px;
}
.registered-kpi-skeleton {
    min-height: 112px;
    display: grid;
    place-items: center;
}
.registered-filter-card {
    padding: 16px 18px;
}
.registered-filter-grid {
    display: grid;
    grid-template-columns: minmax(150px, 1.1fr) minmax(130px, .8fr) minmax(170px, 1fr) minmax(170px, 1fr) minmax(190px, 1fr) auto;
    gap: 12px;
    align-items: end;
}
.registered-filter-grid label,
.registered-unit-scope {
    min-width: 0;
}
.registered-filter-grid input,
.registered-filter-grid select {
    margin-top: 6px;
    min-height: 37px;
}
.registered-unit-scope {
    min-height: 57px;
    padding: 8px 11px;
    border: 1px solid #dfe5ed;
    background: #f8fafc;
    border-radius: 6px;
    display: grid;
    align-content: center;
    gap: 3px;
}
.registered-unit-scope span {
    color: #8b96a5;
    font-size: 9px;
}
.registered-unit-scope strong {
    color: #52647b;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.registered-filter-actions {
    display: flex;
    gap: 7px;
    align-items: center;
}
.registered-filter-actions .btn {
    min-height: 37px;
    white-space: nowrap;
}
.registered-table {
    min-width: 1100px;
}
.registered-table th:nth-child(1) { min-width: 190px; }
.registered-table th:nth-child(3) { min-width: 185px; }
.registered-table th:nth-child(5) { min-width: 320px; }
.registered-table td {
    vertical-align: top;
}
.exam-result-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 430px;
}
.exam-result-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #e1e6ec;
    background: #f8fafc;
    color: #6f7e91;
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 9px;
    line-height: 1.2;
}
.exam-result-chip b {
    color: #53677f;
    font-weight: 600;
}
.exam-result-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    border-radius: 5px;
    background: #edf2f8;
    color: #647a96;
    font-size: 9px;
    font-weight: 600;
    padding: 4px 6px;
}

@media (max-width: 1180px) {
    .excel-entry-grid {
        grid-template-columns: 1fr;
    }
    .excel-entry-column-right {
        border-left: 0;
        border-top: 1px solid #e5e9ef;
    }
    .registered-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .registered-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .registered-filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}
@media (max-width: 760px) {
    .excel-sheet-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
    .cadastro-unit-select,
    .cadastro-unit-fixed {
        max-width: none;
        min-width: 0;
    }
    .excel-entry-column {
        padding: 10px;
    }
    .excel-section-body {
        background-image: none;
    }
    .excel-row {
        grid-template-columns: 1fr;
    }
    .excel-row-label {
        padding-bottom: 2px;
    }
    .excel-row-control {
        padding: 2px 8px 8px;
    }
    .registered-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .registered-filter-grid {
        grid-template-columns: 1fr;
    }
    .registered-filter-actions {
        grid-column: auto;
        justify-content: stretch;
    }
    .registered-filter-actions .btn {
        flex: 1;
    }
}


/* Escopo territorial e censo da ficha de Cadastro */
.cadastro-scope-grid {
    display: grid;
    grid-template-columns: minmax(190px, .9fr) minmax(230px, 1.15fr) minmax(260px, 1fr);
    gap: 12px;
    align-items: end;
    width: min(860px, 72vw);
}
.cadastro-scope-field,
.cadastro-scope-fixed {
    min-width: 0;
}
.cadastro-scope-field > span,
.cadastro-scope-fixed > span {
    display: block;
    margin-bottom: 5px;
    color: #8b98aa;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
}
.cadastro-scope-field select,
.cadastro-scope-field input {
    min-height: 39px;
    margin: 0;
}
.cadastro-scope-fixed {
    min-height: 64px;
    border: 1px solid #dfe5ed;
    background: #fff;
    padding: 9px 12px;
    border-radius: 6px;
}
.cadastro-scope-fixed strong {
    display: block;
    color: #42546d;
    font-size: 12px;
    line-height: 1.35;
}
.cadastro-census-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
}
.cadastro-census-control input {
    width: 100%;
}
.census-save-btn {
    min-height: 39px;
    padding-inline: 12px;
}
.cadastro-census-field small {
    display: block;
    margin-top: 5px;
    color: #8b98aa;
    font-size: 10px;
    line-height: 1.3;
}
.census-modal-copy {
    display: grid;
    gap: 18px;
}
.census-modal-copy > p {
    margin: 0;
    color: #607089;
    line-height: 1.6;
}
.census-modal-field {
    display: grid;
    gap: 7px;
}
.census-modal-field > span {
    color: #42546d;
    font-size: 12px;
    font-weight: 700;
}
.census-modal-field input {
    min-height: 44px;
    font-size: 15px;
}

@media (max-width: 1320px) {
    .excel-sheet-toolbar {
        align-items: flex-start;
    }
    .cadastro-scope-grid {
        grid-template-columns: repeat(2, minmax(210px, 1fr));
        width: min(650px, 68vw);
    }
    .cadastro-census-field {
        grid-column: 1 / -1;
    }
}
@media (max-width: 760px) {
    .cadastro-scope-grid {
        grid-template-columns: 1fr;
        width: 100%;
    }
    .cadastro-census-field {
        grid-column: auto;
    }
}
