:root {
    --ink: #17322f;
    --muted: #71817e;
    --teal: #12695e;
    --teal-dark: #0c4f47;
    --line: #e0e7e3;
    --canvas: #f5f7f4;
    --white: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, sans-serif; background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 32px; font-weight: 650; letter-spacing: -1.1px; line-height: 1.2; }
h2 { margin-bottom: 6px; font-size: 18px; font-weight: 650; letter-spacing: -.35px; }
h3 { font-size: 16px; }
p { margin-bottom: 14px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.eyebrow { display: block; color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: 1.8px; margin-bottom: 13px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 238px; background: #fff; border-right: 1px solid var(--line); padding: 32px 20px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); padding: 0 10px; font-size: 17px; line-height: 1.2; }
.brand:hover { text-decoration: none; }
.brand strong { font-weight: 700; }
.brand small { display: block; font-size: 8px; letter-spacing: 1.9px; margin-top: 8px; color: var(--muted); }
.brand-symbol { width: 38px; height: 42px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--teal); border-radius: 10px 10px 10px 2px; font-size: 24px; font-weight: 350; flex-shrink: 0; }
.nav-label { font-size: 10px; letter-spacing: 1.7px; color: #8b9996; font-weight: 600; margin: 58px 12px 15px; }
.sidebar nav a { color: #647570; display: flex; align-items: center; gap: 12px; padding: 12px 13px; border-radius: 7px; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.sidebar nav a:hover { background: #f4f7f5; text-decoration: none; }
.sidebar nav a.active { color: var(--teal); background: #e9f3ed; font-weight: 650; }
.nav-icon { font-size: 21px; line-height: 1; width: 22px; text-align: center; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 22px 8px 0; color: #516a63; font-size: 10px; font-weight: 600; }
.sidebar-bottom p { color: #8a9893; font-size: 11px; font-weight: 400; margin-top: 12px; }
.connection-dot { display: inline-block; width: 6px; height: 6px; background: #44a377; border-radius: 50%; margin-right: 5px; }
.workspace { margin-left: 238px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { min-height: 75px; padding: 0 42px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: #fff; }
.topbar-caption { font-size: 9px; letter-spacing: 1.7px; color: #83928b; }
.user-menu { display: flex; gap: 25px; align-items: center; font-size: 12px; }
.user-menu a { color: var(--ink); }
.text-button { border: 0; background: none; color: var(--teal); padding: 0; font-weight: 600; }
.danger { color: #b1403e; margin-top: 15px; }
main { padding: 38px 42px 48px; flex: 1; width: 100%; max-width: 1700px; margin: auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 29px; }
.page-heading p { margin-bottom: 0; font-size: 13px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 14px; border: 1px solid transparent; border-radius: 6px; padding: 11px 17px; font-size: 12px; font-weight: 650; min-height: 42px; line-height: 1.35; white-space: nowrap; transition: background .15s; }
.button:hover { text-decoration: none; }
.button.primary { background: var(--teal); color: #fff; }
.button.primary:hover { background: var(--teal-dark); }
.button.secondary { background: #fff; color: var(--ink); border-color: #d9e1db; }
.button.secondary:hover { background: #f1f6f2; }
.button:disabled { background: #dce7df; color: #75867d; cursor: default; }
.button.full { width: 100%; justify-content: space-between; }
.actions { display: flex; gap: 10px; align-items: center; }
.intro-strip { border: 1px solid #dce8de; border-radius: 9px; padding: 22px 25px; display: flex; align-items: center; gap: 19px; background: #eef4eb; margin-bottom: 30px; }
.intro-strip strong { font-size: 14px; }
.intro-strip p { font-size: 12px; color: #6c7f72; margin: 5px 0 0; }
.intro-strip > .pill { margin-left: auto; }
.intro-icon { width: 44px; height: 44px; background: #e1ebdc; color: #4f7660; font-size: 27px; text-align: center; border-radius: 10px; flex-shrink: 0; }
.pill { display: inline-flex; padding: 5px 9px; border-radius: 5px; font-size: 10px; font-weight: 650; line-height: 1.2; white-space: nowrap; }
.pill.green { color: #247357; background: #e8f3eb; }
.pill.amber { color: #997328; background: #fbf3dc; }
.pill.red { color: #a24c48; background: #f8eae8; }
.pill.light { background: #fff; color: #5c7562; }
.search-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; }
.search-bar input { max-width: 390px; background: white; }
.search-bar > span { margin-left: auto; font-size: 12px; }
.company-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.company-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 23px; display: flex; flex-direction: column; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 22px; }
.company-avatar { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; border-radius: 9px; background: #f0f3ed; color: #71836b; font-size: 13px; font-weight: 650; }
.company-card h2 { font-size: 15px; overflow-wrap: anywhere; }
.cnpj { color: #87958c; font-size: 12px; margin: 4px 0 21px; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: #77877c; padding-bottom: 17px; border-bottom: 1px solid #edf0eb; margin-top: auto; }
.last-sync { font-size: 10px; color: #8a968d; margin: 16px 0 22px; }
.last-sync strong { display: block; color: #617568; font-size: 11px; font-weight: 500; margin-top: 3px; }
.card-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-actions .button { padding: 9px 13px; min-height: 36px; font-size: 11px; }
.settings-link { font-size: 11px; color: #7a887f; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 26px; margin-bottom: 23px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack .panel { margin-bottom: 0; }
.stack.compact { margin-top: 14px; gap: 12px; }
.form-grid, .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.span-2 { grid-column: span 2; }
label { display: flex; flex-direction: column; gap: 7px; font-size: 12px; font-weight: 600; color: #455f54; }
label small { font-size: 11px; font-weight: 400; color: #869389; }
input, select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #dce3dc; border-radius: 6px; background: #fdfefd; color: var(--ink); outline: none; font-size: 13px; }
input:focus, select:focus, textarea:focus { border-color: #568c75; box-shadow: 0 0 0 3px #12695e12; }
input:disabled { background: #f1f4ef; color: #8b978e; }
input::placeholder, textarea::placeholder { color: #a0aba3; }
input[type=file] { font-size: 12px; padding: 10px; }
input[type=checkbox] { width: 17px; height: 17px; min-height: 0; accent-color: var(--teal); flex-shrink: 0; margin-top: 2px; }
.checkbox { flex-direction: row; align-items: flex-start; gap: 10px; }
.checkbox small { display: block; margin-top: 5px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 26px; align-items: start; }
.section-heading { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.section-heading p { margin: 4px 0 0; font-size: 12px; }
.step { color: #7c9986; background: #f0f5ed; padding: 9px; border-radius: 6px; font-size: 12px; align-self: flex-start; }
.help-panel { padding: 33px; border: 1px solid #e0e6d9; border-radius: 9px; background: #edf2e6; }
.help-panel h2 { font-size: 28px; line-height: 1.25; color: #48624a; letter-spacing: -1px; }
.help-panel ol { padding-left: 16px; font-size: 12px; color: #6b7d66; }
.help-panel li { margin: 20px 0; padding-left: 5px; }
.help-note { border-top: 1px solid #dce4d2; margin-top: 25px; padding-top: 20px; font-size: 11px; color: #7a8b70; }
.form-actions { display: flex; justify-content: space-between; margin-top: 5px; }
.certificate-box { background: #f6f9f3; padding: 18px; border-radius: 6px; margin-bottom: 24px; display: flex; gap: 7px; flex-direction: column; overflow-wrap: anywhere; }
.certificate-box .pill { align-self: start; margin-bottom: 5px; }
.certificate-box strong { font-size: 12px; }
.certificate-box > span:not(.pill) { font-size: 11px; color: var(--muted); }
.info-line { display: flex; justify-content: space-between; font-size: 11px; border-top: 1px solid #edf0eb; padding-top: 14px; margin-top: 18px; gap: 14px; color: var(--muted); }
.info-line strong { font-weight: 500; color: var(--ink); }
.back-link { display: inline-block; font-size: 11px; color: #7c8e80; margin-bottom: 19px; }
.documents-grid { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 25px; align-items: start; }
.months-panel { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 22px 14px; }
.months-panel h2, .months-panel .eyebrow { padding: 0 9px; }
.months-panel h2 { margin-bottom: 20px; }
.months-panel .eyebrow { font-size: 8px; letter-spacing: 1.1px; }
.months-panel p { padding: 0 8px; margin: 20px 0 0; font-size: 10px; }
.months-panel nav { max-height: 550px; overflow-y: auto; }
.month-link { display: flex; justify-content: space-between; align-items: center; color: #7f8e82; padding: 10px 9px; border-radius: 5px; font-size: 11px; text-transform: capitalize; }
.month-link:hover { background: #f4f7f0; text-decoration: none; }
.month-link.selected { background: #e7f1e7; color: #28704b; font-weight: 650; }
.month-count { font-size: 9px; padding: 1px 6px; border-radius: 4px; background: #f0f3eb; }
.stats-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.stat > span { display: block; font-size: 8px; color: #8a988b; letter-spacing: 1.2px; margin-bottom: 11px; }
.stat strong { font-size: 23px; letter-spacing: -.8px; font-weight: 600; }
.filters-panel { padding: 20px; }
.filters-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; align-items: end; }
.filters-form label { font-size: 10px; }
.filters-form input, .filters-form select { font-size: 11px; padding: 9px; }
.search-filter { grid-column: span 3; }
.filters-form button { align-self: end; }
.table-panel { padding: 0; overflow: hidden; }
.table-heading { padding: 23px 23px 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.table-heading .actions { flex-wrap: wrap; }
.file-actions { display: flex; align-items: center; gap: 16px; }
.file-actions .button { min-width: 76px; padding: 10px 14px; }
.file-actions .button:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
#pdf-exports { scroll-margin-top: 24px; }
.table-heading p { font-size: 11px; margin: 4px 0 0; }
.table-heading h2 { font-size: 16px; margin: 0; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
th { font-size: 9px; color: #8a988d; font-weight: 600; padding: 13px 20px; background: #fafbf8; border-top: 1px solid #edf0e9; border-bottom: 1px solid #e7ece4; }
td { padding: 16px 20px; border-bottom: 1px solid #edf0e9; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: #8b978e; font-size: 10px; margin-top: 3px; }
.note-number { font-size: 13px; font-weight: 650; }
.table-name { font-size: 11px; font-weight: 500; display: block; min-width: 150px; }
.nowrap { white-space: nowrap; }
.download-link { font-size: 11px; font-weight: 600; white-space: nowrap; }
.detail-link { display: block; font-size: 10px; margin-top: 5px; color: #8b978e; }
.table-footer { border-top: 1px solid #edf0e9; padding: 14px 20px; }
.table-footer > span { font-size: 10px; }
.empty-state { grid-column: 1 / -1; border: 1px dashed #cedacd; border-radius: 10px; padding: 65px 25px; text-align: center; background: #f9fbf6; }
.empty-symbol { display: block; font-size: 35px; color: #8fa48c; margin-bottom: 10px; }
.empty-state p { color: #8b988b; font-size: 12px; }
.empty-table { text-align: center; padding: 38px 25px; }
.empty-table p { font-size: 11px; color: #93a08f; max-width: 350px; margin: 0 auto; }
.alert { padding: 16px 20px; margin-bottom: 24px; border-radius: 7px; font-size: 12px; border: 1px solid; }
.alert.success { background: #e9f5eb; border-color: #cee4ce; color: #3a7046; }
.alert.error { background: #fff0ed; border-color: #eed2cc; color: #a65349; }
.alert.warning { background: #faf5e4; border-color: #eadfb6; color: #8e7b3d; }
.alert.info { background: #eaf3f1; border-color: #d1e4df; color: #3f7b6d; }
.alert ul { margin-bottom: 0; padding-left: 18px; }
.import-form { display: flex; gap: 15px; align-items: end; }
.import-form label { flex: 1; }
summary { font-size: 12px; color: #607758; font-weight: 600; }
details[open] > summary { margin-bottom: 15px; }
.detail-grid { margin: 10px 0 25px; }
dt { font-size: 10px; color: #8c9b8b; margin-bottom: 8px; }
dd { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.mono { font-family: Consolas, monospace; font-size: 11px; word-break: break-all; }
.user-row { border-bottom: 1px solid var(--line); padding: 15px 0; }
.user-row:last-child { border-bottom: 0; }
.narrow { max-width: 580px; }
.footer { display: flex; justify-content: space-between; gap: 20px; color: #9aa696; font-size: 10px; padding: 20px 42px; }
.separator { padding: 0 10px; color: #b5bfb1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
nav[aria-label="Pagination Navigation"] { display: flex; justify-content: space-between; gap: 20px; padding: 20px 0; font-size: 12px; }
.guest { min-height: 100vh; background: radial-gradient(ellipse at 20% 10%, #e3ecdf, transparent 65%), #f1f5ee; }
.auth-main { max-width: 460px; padding: 45px 20px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 19px; font-weight: 600; margin-bottom: 35px; }
.auth-card { border: 1px solid #dce5d7; border-radius: 13px; padding: 38px; background: #fff; box-shadow: 0 15px 65px #233c2010; }
.auth-card h1 { font-size: 34px; line-height: 1.15; margin-bottom: 18px; }
.auth-card > p { font-size: 12px; margin-bottom: 28px; }
.auth-card .button { margin-top: 5px; }
.auth-footnote { color: #8d9c86; text-align: center; font-size: 11px; margin-top: 25px; }
@media (min-width: 1600px) { .company-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1250px) {
    .company-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sidebar { width: 210px; }
    .workspace { margin-left: 210px; }
    main { padding: 30px; }
    .topbar { padding: 0 30px; }
    .page-heading { align-items: flex-start; flex-wrap: wrap; }
    .settings-grid { grid-template-columns: minmax(0, 1fr); }
    .help-panel { display: none; }
    .documents-grid { grid-template-columns: 150px minmax(0, 1fr); gap: 15px; }
    .stat { padding: 16px; }
    .stat strong { font-size: 19px; }
    .filters-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .search-filter { grid-column: auto; }
}
@media (max-width: 850px) {
    .sidebar { position: static; width: 100%; padding: 18px; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar nav { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 20px; }
    .sidebar nav a { margin: 0; padding: 8px 10px; font-size: 11px; }
    .nav-label, .sidebar-bottom { display: none; }
    .workspace { margin: 0; }
    .topbar { min-height: 55px; padding: 0 20px; }
    main { padding: 27px 20px; }
    h1 { font-size: 27px; }
    .documents-grid { grid-template-columns: minmax(0, 1fr); }
    .months-panel nav { display: flex; gap: 5px; overflow-x: auto; }
    .month-link { flex-shrink: 0; gap: 12px; }
    .months-panel h2, .months-panel p, .months-panel .eyebrow { display: none; }
    .months-panel { padding: 10px; }
    .intro-strip > .pill { display: none; }
    .footer { padding: 20px; }
}
@media (max-width: 520px) {
    .company-grid { grid-template-columns: minmax(0, 1fr); }
    .topbar-caption { display: none; }
    .topbar { justify-content: end; }
    .page-heading, .actions { gap: 13px; }
    .actions { flex-wrap: wrap; }
    .button { font-size: 11px; padding: 10px 13px; }
    .stats-row { grid-template-columns: 1fr; gap: 8px; }
    .stat { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 14px; }
    .stat > span { margin: 0; }
    .stat strong { font-size: 21px; }
    .form-grid, .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
    .search-bar { flex-wrap: wrap; }
    .search-bar input { flex: 1; min-width: 160px; }
    .search-bar > span { width: 100%; }
    .panel { padding: 20px; }
    .table-panel { padding: 0; }
    .table-heading { flex-wrap: wrap; padding: 20px; }
    .import-form { flex-wrap: wrap; }
    .import-form label { flex-basis: 100%; }
    .footer { flex-direction: column; gap: 5px; }
    .auth-card { padding: 28px; }
    .intro-strip { padding: 18px; }
}
