:root {
    --komatsu-blue: #140a9a;
    --komatsu-blue-dark: #0d066d;
    --komatsu-blue-hover: #2a20b8;
    --komatsu-blue-light: #efeffc;
    --ink: #1d2530;
    --muted: #6d7785;
    --line: #e4e8ed;
    --surface: #ffffff;
    --background: #f3f5f7;
    --green: #17864b;
    --orange: #d87308;
    --red: #cc3441;
    --gray: #66717f;
    --sidebar-width: 272px;
    --radius: 14px;
    --shadow: 0 8px 25px rgba(30, 40, 52, .06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--background); font-family: Inter, "Segoe UI", Arial, sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 20px; height: 20px; fill: currentColor; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 26px 18px 20px; color: #fff; background: var(--komatsu-blue); box-shadow: 5px 0 24px rgba(20, 10, 154, .18); }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 11px; padding: 0 10px 26px; }
.brand-logo { display: block; width: 178px; max-width: 100%; padding: 9px 10px; background: #fff; border-radius: 12px; box-shadow: 0 8px 18px rgba(8, 4, 91, .22); }
.brand-system { color: #fff; font-size: 18px; font-weight: 900; line-height: 1.1; letter-spacing: -.2px; text-transform: uppercase; }
.nav-menu { display: flex; flex: 1; flex-direction: column; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 13px; min-height: 49px; padding: 10px 13px; border-radius: 10px; font-weight: 650; line-height: 1.25; transition: background .2s, transform .2s; }
.nav-item svg { flex: 0 0 21px; }
.nav-item:hover { background: rgba(255,255,255,.12); transform: translateX(2px); }
.nav-item.active { color: var(--komatsu-blue); background: #fff; box-shadow: 0 7px 15px rgba(8, 4, 91, .24); }
.sidebar-footer { display: flex; align-items: center; gap: 8px; margin: 15px 10px 0; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .22); font-size: 12px; font-weight: 700; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; background: #19a45b; border-radius: 50%; box-shadow: 0 0 0 4px rgba(25, 164, 91, .12); }
.sidebar-overlay { display: none; }

.app-shell { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 30; height: 76px; display: flex; align-items: center; gap: 16px; padding: 0 34px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.menu-toggle { display: none; width: 42px; height: 42px; align-items: center; justify-content: center; padding: 0; color: var(--ink); background: transparent; border: 0; border-radius: 9px; cursor: pointer; }
.topbar-title { flex: 1; }
.topbar-title strong, .topbar-title span { display: block; }
.topbar-title strong { font-size: 17px; }
.topbar-title span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.user-badge { max-width: 260px; overflow: hidden; padding: 9px 12px; color: var(--komatsu-blue); background: var(--komatsu-blue-light); border: 1px solid #d7d6f4; border-radius: 30px; font-size: 12px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.logout-form { margin: 0; }
.logout-btn { min-height: 36px; padding: 8px 12px; color: #556171; background: #fff; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; font-weight: 800; cursor: pointer; }
.logout-btn:hover { color: var(--komatsu-blue); border-color: #c9c7f0; }
.local-badge { display: flex; align-items: center; gap: 9px; padding: 9px 13px; color: #415063; background: #f5f7f8; border: 1px solid var(--line); border-radius: 30px; font-size: 12px; font-weight: 650; }
.main-content { width: 100%; max-width: 1600px; margin: 0 auto; padding: 34px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 27px; }
.page-heading h1 { margin: 5px 0 7px; font-size: clamp(25px, 2.3vw, 34px); line-height: 1.15; letter-spacing: -.9px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.eyebrow { color: var(--komatsu-blue); font-size: 10px; font-weight: 800; letter-spacing: 1.7px; }
.btn { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 10px 17px; border: 1px solid transparent; border-radius: 9px; font-weight: 750; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: #fff; background: var(--komatsu-blue); box-shadow: 0 6px 15px rgba(20, 10, 154, .2); }
.btn-primary:hover { background: var(--komatsu-blue-hover); box-shadow: 0 8px 18px rgba(20, 10, 154, .28); }
.btn-secondary { color: #4f5966; background: #fff; border-color: #d8dde3; }
.btn-secondary:hover { background: #f8f9fa; }
.btn-dark { color: #fff; background: #27313c; }

.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.summary-card { position: relative; display: flex; min-height: 144px; align-items: flex-start; gap: 14px; padding: 22px 18px; overflow: hidden; color: inherit; background: var(--surface); border: 1px solid rgba(221,225,230,.9); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; transition: transform .16s, box-shadow .16s, border-color .16s; }
.summary-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, #dfe4ea); box-shadow: 0 14px 32px rgba(30, 40, 52, .11); }
.summary-card.active-filter { border-color: color-mix(in srgb, var(--accent) 62%, #dfe4ea); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent), var(--shadow); }
.summary-card::after { position: absolute; inset: auto 0 0 0; height: 4px; content: ""; background: var(--accent); }
.summary-card .card-icon { display: grid; width: 43px; height: 43px; flex: 0 0 auto; place-items: center; color: var(--accent); background: var(--tint); border-radius: 11px; }
.summary-card span, .summary-card strong, .summary-card small { display: block; }
.summary-card span { min-height: 34px; color: #586372; font-size: 12px; font-weight: 700; line-height: 1.3; }
.summary-card strong { margin-top: 5px; font-size: 29px; line-height: 1; }
.summary-card small { margin-top: 7px; color: #929ba6; font-size: 10px; }
.card-total { --accent: var(--komatsu-blue); --tint: var(--komatsu-blue-light); }
.card-valid { --accent: var(--green); --tint: #e9f7ef; }
.card-expiring { --accent: var(--orange); --tint: #fff3e5; }
.card-expired { --accent: var(--red); --tint: #fcecef; }
.card-pending { --accent: var(--gray); --tint: #eef1f4; }

.portal-heading { margin-bottom: 22px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 22px; }
.module-card { position: relative; display: flex; min-height: 255px; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 13px; padding: 30px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s, border-color .18s; }
.module-card:hover { transform: translateY(-3px); border-color: #c9c7f0; box-shadow: 0 18px 38px rgba(30, 40, 52, .12); }
.module-card::after { position: absolute; inset: auto 0 0 0; height: 5px; content: ""; background: var(--komatsu-blue); }
.module-card-primary::after { background: var(--green); }
.module-icon { display: grid; width: 58px; height: 58px; place-items: center; color: #fff; background: var(--komatsu-blue); border-radius: 16px; box-shadow: 0 12px 24px rgba(20, 10, 154, .18); }
.module-card-primary .module-icon { background: var(--green); box-shadow: 0 12px 24px rgba(23, 134, 75, .18); }
.module-card h2 { margin: 0; color: var(--ink); font-size: 25px; letter-spacing: -.4px; }
.module-card p { max-width: 520px; margin: 0; color: var(--muted); line-height: 1.55; }
.module-card strong { display: inline-flex; align-items: center; min-height: 38px; padding: 9px 13px; color: var(--komatsu-blue); background: var(--komatsu-blue-light); border-radius: 999px; font-size: 12px; }
.module-card-primary strong { color: #137441; background: #e7f6ed; }

.panel, .filter-panel, .form-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-header h2, .filter-heading h2 { margin: 0 0 4px; font-size: 17px; }
.panel-header p, .filter-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.text-link { display: inline-flex; align-items: center; gap: 4px; color: var(--komatsu-blue); font-size: 12px; font-weight: 800; }
.text-link svg { width: 16px; height: 16px; }
.dashboard-filter { display: flex; align-items: center; gap: 10px; }
.dashboard-filter label { color: #596474; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.dashboard-filter select { min-width: 260px; height: 42px; padding: 0 12px; color: var(--ink); background: #fff; border: 1px solid #d8dde3; border-radius: 9px; outline: none; }
.dashboard-filter select:focus { border-color: var(--komatsu-blue); box-shadow: 0 0 0 3px rgba(20, 10, 154, .13); }
.active-filter-pill { display: inline-flex; align-items: center; margin-top: 10px; padding: 6px 10px; color: var(--komatsu-blue); background: var(--komatsu-blue-light); border: 1px solid #d7d6f4; border-radius: 999px; font-size: 11px; font-weight: 800; }
.dashboard-list { overflow: visible; }
.dashboard-list .panel-header { position: sticky; top: 76px; z-index: 24; background: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.dashboard-list .table-wrap { max-height: calc(100vh - 260px); overflow: auto; }
.dashboard-list thead th { position: sticky; top: 0; z-index: 12; box-shadow: inset 0 -1px 0 var(--line); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 18px; color: #717b87; background: #fafbfc; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 800; letter-spacing: .5px; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 15px 18px; border-bottom: 1px solid #edf0f2; color: #46515e; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfb; }
td strong, td small { display: block; }
td strong { color: var(--ink); font-size: 13px; }
td small { margin-top: 4px; color: #89929d; font-size: 10px; }
.status-badge { display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 20px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-badge::before { width: 6px; height: 6px; margin-right: 6px; content: ""; background: currentColor; border-radius: 50%; }
.status-valido { color: #137441; background: #e7f6ed; }
.status-proximo-do-vencimento { color: #b05c02; background: #fff0dc; }
.status-vencido { color: #b82d39; background: #fbe9ec; }
.status-pendente { color: #606b77; background: #edf0f3; }
.employee-badge { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 20px; font-size: 10px; font-weight: 900; white-space: nowrap; }
.employee-badge::before { width: 6px; height: 6px; margin-right: 6px; content: ""; background: currentColor; border-radius: 50%; }
.employee-ativo { color: #137441; background: #e7f6ed; }
.employee-desligado { color: #606b77; background: #edf0f3; }
.aso-indicator { display: inline-flex; min-width: 145px; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 13px; font-size: 10px; font-weight: 900; line-height: 1.1; white-space: nowrap; }
.aso-indicator span:not(.bomb-icon), .aso-indicator small { display: block; }
.aso-indicator small { margin: 2px 0 0; color: currentColor; font-size: 9px; font-weight: 700; opacity: .78; }
.aso-indicator-verde { color: #137441; background: #e7f6ed; border: 1px solid #bfe8ce; }
.aso-indicator-amarelo { color: #9a5a05; background: #fff3d8; border: 1px solid #f5d08d; }
.aso-indicator-vermelho { color: #b82d39; background: #fbe9ec; border: 1px solid #efbcc3; }
.aso-indicator-sem-data { color: #606b77; background: #edf0f3; border: 1px solid #d8dee4; }
.bomb-icon { display: inline-grid; width: 23px; height: 23px; flex: 0 0 auto; place-items: center; color: #fff; background: var(--red); border-radius: 50%; font-size: 13px; line-height: 1; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; }
.icon-btn { display: inline-grid; width: 34px; height: 34px; place-items: center; padding: 0; color: #586575; background: #fff; border: 1px solid #dde2e7; border-radius: 8px; cursor: pointer; transition: .15s; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: #1c252f; background: #f5f7f8; border-color: #c8cfd7; }
.icon-btn.danger:hover { color: var(--red); background: #fff2f3; border-color: #f1c4c9; }
.align-right { text-align: right; }

.form-panel { overflow: hidden; }
.form-section { padding: 27px 30px 30px; border-bottom: 1px solid var(--line); }
.section-title { display: flex; align-items: center; gap: 13px; margin-bottom: 24px; }
.section-title > span { display: grid; width: 35px; height: 35px; place-items: center; color: var(--komatsu-blue); background: var(--komatsu-blue-light); border-radius: 9px; font-size: 11px; font-weight: 900; }
.section-title h2 { margin: 0; font-size: 17px; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.form-group { min-width: 0; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-full { grid-column: 1 / -1; }
.form-group label { display: block; margin-bottom: 7px; color: #3d4753; font-size: 11px; font-weight: 800; }
.form-group label b { color: #c53b46; }
.form-group input, .form-group select, .form-group textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid #d8dde3; border-radius: 8px; outline: none; transition: border-color .15s, box-shadow .15s; }
.form-group input, .form-group select { height: 43px; padding: 0 12px; }
.form-group textarea { min-height: 95px; padding: 12px; resize: vertical; }
.form-group input::placeholder, .form-group textarea::placeholder { color: #aab1ba; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--komatsu-blue); box-shadow: 0 0 0 3px rgba(20, 10, 154, .13); }
.field-help { display: block; margin-top: 6px; color: #8c95a0; font-size: 10px; }
.check-card { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 15px 16px; color: #3d4753; background: #f8f9ff; border: 1px solid #d7d6f4; border-radius: 12px; cursor: pointer; }
.check-card input { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--komatsu-blue); }
.check-card strong, .check-card small { display: block; }
.check-card strong { color: var(--komatsu-blue); font-size: 13px; }
.check-card small { margin-top: 4px; color: #687485; font-size: 11px; line-height: 1.45; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 20px 30px; background: #fafbfc; }

.filter-panel { margin-bottom: 20px; overflow: hidden; }
.filter-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.filter-heading > div { display: flex; align-items: center; gap: 12px; }
.filter-heading > div > svg { width: 22px; height: 22px; color: var(--komatsu-blue); }
.filter-toggle { display: none; color: var(--komatsu-blue); background: transparent; border: 0; font-size: 11px; font-weight: 800; }
.filter-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 20px 22px; }
.filter-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; padding-top: 2px; }
.compact-filter { padding: 18px 20px; }
.inline-filter-form { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 14px; align-items: end; }
.inline-filter-form .filter-actions { grid-column: auto; }
.list-panel { overflow: hidden; }
.list-panel .table-wrap { max-height: calc(100vh - 390px); overflow: auto; }
.list-panel thead th { position: sticky; top: 0; z-index: 12; box-shadow: inset 0 -1px 0 var(--line); }

.import-grid { display: grid; grid-template-columns: minmax(320px, .8fr) minmax(520px, 1.4fr); gap: 20px; align-items: start; }
.import-card { overflow: hidden; }
.import-card-wide { grid-column: 1 / -1; }
.import-card-body { display: grid; gap: 16px; padding: 24px; }
.pdf-read-form { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 16px; align-items: end; padding: 24px; }
.module-filter-box { padding: 18px 24px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.import-module-filter { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 12px; align-items: end; }
.extraction-summary { margin: 0 24px 24px; padding: 16px 18px; color: #445163; background: var(--komatsu-blue-light); border: 1px solid #d7d6f4; border-radius: 12px; }
.extraction-summary > strong { display: block; margin-bottom: 10px; color: var(--komatsu-blue); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
.extraction-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 10px; }
.extraction-grid span { color: #657084; font-size: 11px; }
.extraction-grid b { display: block; margin-top: 3px; color: var(--ink); font-size: 12px; }
.selected-file-card { display: flex; align-items: center; gap: 11px; min-height: 43px; padding: 10px 12px; color: #334155; background: #edf8f2; border: 1px solid #bfe8ce; border-radius: 9px; }
.selected-file-card svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--green); }
.selected-file-card strong, .selected-file-card span { display: block; }
.selected-file-card strong { color: #176c40; font-size: 12px; }
.selected-file-card span { margin-top: 2px; color: #687485; font-size: 10px; word-break: break-all; }
.file-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.file-list li { display: flex; align-items: center; gap: 9px; padding: 10px 12px; color: #3f4b58; background: #f8f9fa; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; font-weight: 700; }
.file-list svg { width: 17px; height: 17px; color: var(--komatsu-blue); }
.inline-empty { padding: 13px 14px; color: #647080; background: #f7f8f9; border: 1px dashed #d4dae1; border-radius: 10px; font-size: 12px; }
.import-form .form-section { border-bottom: 0; }

.empty-state { display: flex; min-height: 320px; align-items: center; justify-content: center; flex-direction: column; padding: 40px; text-align: center; }
.empty-state.compact { min-height: 260px; }
.empty-icon { display: grid; width: 55px; height: 55px; place-items: center; color: var(--komatsu-blue); background: var(--komatsu-blue-light); border-radius: 50%; }
.empty-state h3 { margin: 14px 0 6px; font-size: 17px; }
.empty-state p { margin: 0 0 18px; color: var(--muted); }
.coming-soon { max-width: 700px; min-height: 470px; margin: 40px auto; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 50px; text-align: center; }
.coming-icon { display: grid; width: 76px; height: 76px; margin-bottom: 22px; place-items: center; color: #fff; background: var(--komatsu-blue); border-radius: 20px; transform: rotate(-3deg); }
.coming-icon svg { width: 35px; height: 35px; transform: rotate(3deg); }
.coming-soon h1 { margin: 8px 0; font-size: 27px; }
.coming-soon > p { max-width: 500px; margin: 0; color: var(--muted); line-height: 1.6; }
.future-note { display: flex; flex-direction: column; gap: 5px; max-width: 480px; margin: 25px 0; padding: 15px 20px; background: #f7f8f9; border: 1px solid var(--line); border-radius: 10px; }
.future-note strong { font-size: 11px; text-transform: uppercase; }
.future-note span { color: var(--muted); font-size: 11px; }
.error-code { color: var(--komatsu-blue-dark); font-size: 72px; font-weight: 900; letter-spacing: -6px; }
.settings-grid { display: grid; gap: 20px; align-items: start; }
.settings-section { display: grid; gap: 16px; margin-bottom: 28px; }
.settings-section-title h2 { margin: 0 0 5px; font-size: 19px; letter-spacing: -.3px; }
.settings-section-title p { margin: 0; color: var(--muted); font-size: 13px; }
.settings-hub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.settings-tile { display: flex; min-height: 210px; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px 18px; text-align: center; background: #eef3f4; border: 1px solid #e0e7ea; border-radius: 3px; transition: transform .15s, box-shadow .15s, background .15s; }
.settings-tile:hover { transform: translateY(-2px); background: #f5f8f9; box-shadow: 0 14px 30px rgba(30, 40, 52, .1); }
.settings-tile-icon { display: grid; width: 58px; height: 58px; place-items: center; color: #0987d9; }
.settings-tile-icon svg { width: 48px; height: 48px; }
.settings-tile h3 { margin: 0; color: var(--ink); font-size: 21px; line-height: 1.15; }
.settings-tile p { max-width: 210px; margin: 0; color: #7a8490; line-height: 1.35; }
.settings-tile .text-link { margin-top: 4px; }
.settings-mini-text { max-width: 220px; color: #8a939e; font-size: 11px; line-height: 1.35; word-break: break-word; }
.tile-action { margin-top: 7px; }
.settings-admin-grid { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr); gap: 20px; align-items: start; }
.settings-card { padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.settings-card .section-title { margin-bottom: 18px; }
.info-list { display: grid; gap: 12px; margin: 0; }
.info-list div { display: grid; grid-template-columns: 180px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.info-list dt { color: #677281; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .4px; }
.info-list dd { margin: 0; color: var(--ink); font-weight: 400; }
.compact-info-list { margin-top: 16px; gap: 8px; }
.compact-info-list div { grid-template-columns: 150px 1fr; padding: 10px 0; }
.muted-card { background: linear-gradient(180deg, #fff, #fafbfc); }
.settings-note { margin: 0; color: var(--muted); line-height: 1.6; }
.settings-action { margin-top: 16px; }
.settings-action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.settings-action-row form { margin: 0; }
.backup-upload-form { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 12px; align-items: end; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.backup-upload-form .form-group input { padding: 9px 12px; height: auto; }
.report-summary-grid { grid-template-columns: repeat(4, minmax(190px, 1fr)); }
.report-card-link { text-decoration: none; }
.report-card-link em { display: inline-flex; margin-top: 8px; color: var(--komatsu-blue); font-size: 11px; font-style: normal; font-weight: 800; text-transform: uppercase; letter-spacing: .45px; }
.reports-stack { display: grid; gap: 20px; }
.report-panel { overflow: hidden; scroll-margin-top: 90px; }
.report-panel .table-wrap { max-height: 360px; overflow: auto; }
.report-panel thead th { position: sticky; top: 0; z-index: 12; box-shadow: inset 0 -1px 0 var(--line); }

.flash-stack { position: fixed; top: 90px; right: 24px; z-index: 60; display: grid; gap: 10px; width: min(390px, calc(100vw - 40px)); }
.flash { display: flex; align-items: center; gap: 11px; padding: 14px 15px; background: #fff; border: 1px solid var(--line); border-left: 4px solid; border-radius: 10px; box-shadow: 0 14px 35px rgba(30, 40, 52, .15); animation: slide-in .25s ease-out; }
.flash-success { color: #126d3e; border-left-color: var(--green); }
.flash-error { color: #a52c36; border-left-color: var(--red); }
.flash span { flex: 1; color: #3e4955; font-size: 12px; font-weight: 650; }
.flash-close { display: grid; width: 26px; height: 26px; place-items: center; padding: 0; color: #9099a4; background: transparent; border: 0; cursor: pointer; }
.flash-close svg { width: 15px; height: 15px; }
@keyframes slide-in { from { opacity: 0; transform: translateX(20px); } }

.auth-page { min-height: 100vh; background: radial-gradient(circle at top left, rgba(20, 10, 154, .14), transparent 32%), var(--background); }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 34px; }
.auth-card { width: min(460px, 100%); padding: 34px; background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 22px 70px rgba(21, 31, 44, .13); }
.auth-logo { display: block; width: 220px; max-width: 100%; margin-bottom: 28px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.auth-card h1 { margin: 8px 0 8px; font-size: 28px; letter-spacing: -.7px; }
.auth-card p { margin: 0 0 24px; color: var(--muted); line-height: 1.55; }
.auth-form { display: grid; gap: 16px; }
.auth-submit { width: 100%; margin-top: 6px; }
.auth-messages { display: grid; gap: 8px; margin-bottom: 18px; }
.auth-message { padding: 11px 12px; border-radius: 10px; font-size: 12px; font-weight: 750; }
.auth-message-success { color: #126d3e; background: #e7f6ed; border: 1px solid #bfe8ce; }
.auth-message-error { color: #a52c36; background: #fff2f3; border: 1px solid #f1c4c9; }

@media (max-width: 1250px) {
    .summary-grid { grid-template-columns: repeat(3, 1fr); }
    .report-summary-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .import-grid { grid-template-columns: 1fr; }
    .extraction-grid { grid-template-columns: repeat(2, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
    .module-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
    :root { --sidebar-width: 260px; }
    .sidebar { transform: translateX(-105%); transition: transform .25s ease; }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-overlay { position: fixed; inset: 0; z-index: 35; display: block; visibility: hidden; padding: 0; background: rgba(18, 23, 29, .45); border: 0; opacity: 0; transition: .25s; }
    body.sidebar-open .sidebar-overlay { visibility: visible; opacity: 1; }
    .app-shell { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
    .topbar { height: 66px; padding: 0 16px; }
    .topbar-title span, .local-badge { display: none; }
    .main-content { padding: 22px 14px; }
    .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 20px; }
    .page-heading .btn { align-self: flex-start; }
    .summary-grid { grid-template-columns: 1fr; gap: 11px; }
    .report-summary-grid { grid-template-columns: 1fr; }
    .summary-card { min-height: 110px; align-items: center; padding: 17px; }
    .summary-card span { min-height: auto; }
    .panel-header { padding: 18px; }
    .dashboard-list .panel-header { align-items: stretch; flex-direction: column; }
    .dashboard-filter { align-items: stretch; flex-direction: column; }
    .dashboard-filter select { min-width: 0; width: 100%; }
    .pdf-read-form, .import-module-filter { grid-template-columns: 1fr; }
    .extraction-grid { grid-template-columns: 1fr; }
    .form-section { padding: 22px 18px; }
    .form-grid { grid-template-columns: 1fr; gap: 16px; }
    .form-group.span-2, .form-group.span-full { grid-column: auto; }
    .form-actions { padding: 17px 18px; }
    .filter-toggle { display: block; }
    .filter-form { display: none; grid-template-columns: 1fr; }
    .filter-form.open { display: grid; }
    .inline-filter-form { grid-template-columns: 1fr; }
    .filter-actions { grid-column: auto; }
    .records-table thead { display: none; }
    .dashboard-list .panel-header { position: static; }
    .dashboard-list .table-wrap, .list-panel .table-wrap { max-height: none; overflow-x: auto; }
    .records-table tr { display: block; padding: 14px 16px; border-bottom: 1px solid var(--line); }
    .records-table td { display: grid; grid-template-columns: 105px 1fr; gap: 10px; padding: 7px 0; border: 0; text-align: left; }
    .records-table td::before { content: attr(data-label); color: #8a939e; font-size: 10px; font-weight: 800; text-transform: uppercase; }
    .records-table .row-actions { display: flex; justify-content: flex-end; padding-top: 12px; }
    .records-table .row-actions::before { display: none; }
    .coming-soon { min-height: 400px; margin: 0; padding: 35px 20px; }
    .flash-stack { top: 76px; right: 14px; }
}

.inline-user-form { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: 4px 0; }
.inline-user-form input, .inline-user-form select { width: auto; min-width: 130px; min-height: 38px; padding: 8px 10px; font-size: 12px; }
.password-form { padding-top: 6px; border-top: 1px solid var(--line); }
.privilege-panel { margin-top: 22px; }
.privilege-table th { background: #ededed; color: #586270; font-size: 11px; }
.privilege-table td { vertical-align: top; }
.privilege-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 82px; margin: 0 6px 6px 0; padding: 7px 10px; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: .5px; }
.privilege-adm { color: #fff; background: var(--komatsu-blue); }
.privilege-auxiliar { color: #8b4e04; background: #fff1da; border: 1px solid #f4ca86; }
.privilege-supervisor { color: #11653a; background: #e6f7ed; border: 1px solid #bde8ce; }
.privilege-gestor { color: #0c5d93; background: #e5f3ff; border: 1px solid #b8dcf7; }
.privilege-diretor { color: #5c2b91; background: #f0e8fb; border: 1px solid #d8c1ef; }
.privilege-consulta { color: #586372; background: #eef1f4; border: 1px solid #d7dde4; }
.privilege-row-form, .privilege-password-form { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(110px, .7fr) minmax(90px, auto); gap: 8px; align-items: center; }
.privilege-row-form input, .privilege-row-form select, .privilege-password-form input { min-height: 36px; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #d8dde3; border-radius: 8px; font-size: 12px; outline: none; }
.privilege-password-form { grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto; }
.privilege-password-form .btn, .privilege-row-form .btn { min-height: 36px; padding: 8px 12px; }

@media (max-width: 1250px) {
    .settings-admin-grid { grid-template-columns: 1fr; }
    .backup-upload-form { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .privilege-row-form, .privilege-password-form { grid-template-columns: 1fr; }
}
