:root {
    --ink: #111;
    --muted: #454545;
    --blue: #173b63;
    --blue-hover: #102c4a;
    --line: #b7b7b7;
    --paper: #fff;
    --bg: #fafafa;
    --secondary: #e6e6e6;
    --red: #a12020;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--ink);
    background: var(--bg);
    font: 13px/1.4 Arial, Helvetica, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

/* Barra superior com botões convencionais. */
.topbar {
    display: flex;
    align-items: center;
    gap: 28px;
    min-height: 66px;
    padding: 8px 24px;
    background: #f0f0f0;
    border-bottom: 3px solid var(--blue);
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    font-weight: bold;
    white-space: nowrap;
}
.brand img { width: 90px; height: 42px; object-fit: contain; }
.brand span { padding-left: 12px; border-left: 1px solid var(--line); font-size: 16px; }
.brand small { display: block; margin-top: 2px; font-size: 10px; font-weight: normal; }
nav { display: flex; gap: 5px; }
nav a {
    padding: 6px 16px;
    color: var(--ink);
    background: var(--secondary);
    border: 1px solid #969696;
    border-radius: 2px;
}
nav a:hover { background: #d8d8d8; text-decoration: none; }
nav a.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.session { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.session form, .actions form { margin: 0; }

.container { max-width: 1600px; min-height: calc(100vh - 113px); margin: auto; padding: 22px 24px 32px; }
h1 { margin: 0 0 6px; font-size: 22px; line-height: 1.25; font-weight: bold; }
h2 { margin: 0; font-size: 15px; font-weight: bold; }
h3 { font-size: 14px; }
p { margin: 0 0 10px; }
.muted, small { color: var(--muted); }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.page-heading p { margin-bottom: 0; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 5px 13px;
    border: 1px solid #929292;
    border-radius: 2px;
    background: var(--secondary);
    color: var(--ink);
    line-height: 1.3;
    white-space: nowrap;
    cursor: pointer;
}
.button:hover { background: #d8d8d8; text-decoration: none; }
.button.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.button.primary:hover { background: var(--blue-hover); }
.button.danger { color: #fff; background: var(--red); border-color: #851818; }
.button.danger:hover { background: #851818; }
.button.quiet { background: var(--secondary); color: var(--ink); }
.button.small { min-height: 25px; padding: 3px 9px; font-size: 12px; }
.button:disabled { color: #666; background: #eee; border-color: #bcbcbc; cursor: default; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.catalog-tabs { margin-bottom: 14px; }
.settings-catalogs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 0 16px; }
.settings-catalog { min-width: 0; scroll-margin-top: 16px; }
.settings-furos { grid-column: 1 / -1; }
.settings-catalog .section-heading { flex-wrap: wrap; gap: 8px; min-height: 46px; }
.settings-catalog .catalog-value { width: 100%; min-width: 100px; white-space: normal; overflow-wrap: anywhere; }
.settings-catalog td:last-child .actions { flex-wrap: nowrap; }
.catalog-list-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 7px; font-size: 12px; }
@media (max-width: 700px) { .settings-catalogs { grid-template-columns: 1fr; } }

/* Resumo em uma faixa compacta, sem cartões. */
.metrics { display: flex; flex-wrap: wrap; margin-bottom: 22px; border: 1px solid var(--line); background: #f0f0f0; }
.metrics > div { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-right: 1px solid var(--line); }
.metrics > div:last-child { border-right: 0; }
.metrics span { color: var(--ink); }
.metrics strong { font-size: 14px; font-weight: bold; }

/* Resumo visual do início, mantendo a identidade administrativa do sistema. */
.dashboard-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.dashboard-metrics > a { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 12px; min-width: 0; padding: 12px 14px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--blue); }
.dashboard-metrics > a:hover { background: #f1f4f7; text-decoration: none; }
.dashboard-metrics span { color: var(--muted); }
.dashboard-metrics strong { grid-column: 2; grid-row: 1 / span 2; color: var(--blue); font-size: 25px; font-variant-numeric: tabular-nums; }
.dashboard-metrics small { grid-column: 1; font-size: 11px; }
.dashboard-panels { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 16px; margin-bottom: 8px; }
.dashboard-panel { min-width: 0; padding: 12px; background: #fff; border: 1px solid var(--line); }
.dashboard-panel .section-heading { margin-bottom: 8px; }
.chart-legend { display: flex; gap: 16px; margin: 4px 0 10px 88px; color: var(--muted); font-size: 11px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 10px; height: 10px; border: 1px solid #777; }
.legend-dcp { background: #173b63; }
.legend-dpl { background: #8da5ba; }
.monthly-chart { display: grid; gap: 7px; }
.monthly-row { display: grid; grid-template-columns: 78px minmax(50px, 1fr) 32px; align-items: center; gap: 10px; min-height: 18px; }
.monthly-label { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.monthly-track { display: flex; width: 100%; height: 15px; overflow: hidden; background: #f0f0f0; border: 1px solid #d0d0d0; }
.monthly-segment { min-width: 1px; height: 100%; }
.monthly-dcp { background: #173b63; }
.monthly-dpl { background: #8da5ba; }
.monthly-total { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.dashboard-status { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 9px; min-height: 42px; padding: 6px 3px; color: var(--ink); border-bottom: 1px solid #ddd; }
.dashboard-status:hover { background: #f5f6f7; text-decoration: none; }
.dashboard-status strong { color: var(--blue); font-size: 17px; font-variant-numeric: tabular-nums; }
.status-mark { width: 10px; height: 10px; border: 1px solid #555; }
.status-ready { background: #e6f2e8; }
.status-error { background: #f2dddd; }
.status-waiting { background: #ececec; }
.dashboard-note { margin: 9px 0 0; color: var(--muted); font-size: 11px; }

.section { margin-bottom: 24px; }
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 32px;
    margin-bottom: 10px;
    padding: 0 0 5px;
    border-bottom: 2px solid var(--blue);
}
.section-body { padding: 4px 0; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; background: var(--paper); }
th, td { padding: 6px 9px; border: 1px solid var(--line); vertical-align: middle; color: var(--ink); }
th { background: #e5e5e5; font-size: 12px; font-weight: bold; }
tbody tr:nth-child(even) { background: #f6f6f6; }
tbody tr:hover { background: #edf2f7; }
.tag, .tag.dpl, .tag.pending { display: inline-block; padding: 1px 5px; font-size: 12px; color: var(--ink); background: #ededed; border: 1px solid #bcbcbc; border-radius: 0; }
.tag.pending { border-style: dashed; }
.empty { padding: 22px 12px; border: 1px solid var(--line); background: #fff; text-align: left; color: var(--muted); }
.empty strong { display: block; margin-bottom: 4px; font-size: 13px; color: var(--ink); }

/* Cada campo mantém seu rótulo à esquerda e o controle à direita. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 30px; }
.field { display: grid; grid-template-columns: 145px minmax(0, 1fr); align-items: center; gap: 5px 10px; min-width: 0; }
.field > label { color: var(--ink); font-size: 13px; text-align: right; }
.field > input, .field > select, .field > textarea { grid-column: 2; }
.field > small, .field > .field-validation-error { grid-column: 2; }
.field input, .field select, .field textarea {
    min-width: 0;
    width: 100%;
    min-height: 30px;
    padding: 4px 7px;
    color: var(--ink);
    background: #fff;
    border: 1px solid #999;
    border-radius: 1px;
}
.field textarea { min-height: 76px; resize: vertical; }
.field:has(textarea) { align-items: start; }
.field:has(textarea) > label { padding-top: 5px; }
.field input[readonly] { background: #f0f0f0; }
.full { grid-column: 1 / -1; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; padding: 10px; background: #efefef; border: 1px solid var(--line); }
.filters .field { grid-template-columns: auto minmax(135px, 1fr); }
.filters .field:first-child { flex: 1; min-width: 290px; }
.readings input { width: 100%; min-width: 70px; padding: 3px 6px; color: var(--ink); background: #fff; border: 1px solid #999; border-radius: 1px; }
.readings input[readonly] { background: #f0f0f0; }
.field .check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding-left: 155px; text-align: left; }
.check input[type="checkbox"] { width: auto; min-height: 0; margin: 0; accent-color: var(--blue); }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.notice, .notice.success { margin-bottom: 14px; padding: 9px 12px; color: var(--ink); background: #edf2f7; border: 1px solid #9caec0; border-left: 3px solid var(--blue); }
.validation-summary-valid { display: none; }
.validation-summary-errors { margin-bottom: 14px; padding: 10px 14px; color: var(--ink); background: #f0f0f0; border: 1px solid var(--blue); }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.field-validation-error { color: var(--ink); font-size: 12px; }
.input-validation-error { border: 2px solid var(--blue) !important; }

.login { max-width: 460px; margin: 50px auto; padding: 18px; background: #f6f6f6; border: 1px solid #aaa; }
.login .intro { margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid var(--blue); }
.login h1 { font-size: 20px; }
.login .field { grid-template-columns: 70px minmax(0, 1fr); margin-bottom: 12px; }
.login .button { margin-left: 80px; min-width: 95px; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 0 24px; padding: 12px 0; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.detail-grid > div { display: grid; grid-template-columns: 155px minmax(0, 1fr); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-grid dt { padding: 7px 9px; color: var(--ink); background: #eee; border-right: 1px solid var(--line); }
.detail-grid dd { margin: 0; padding: 7px 9px; background: #fff; overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.photos img { width: 100%; height: 170px; object-fit: contain; border: 1px solid var(--line); background: #fff; }
.code { padding: 10px; background: #f0f0f0; border: 1px solid var(--line); font-family: Consolas, monospace; overflow-wrap: anywhere; white-space: pre-wrap; }
.prewrap { white-space: pre-wrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 1000px) {
    .topbar { flex-wrap: wrap; gap: 10px 20px; }
    .form-grid { column-gap: 18px; }
    .field { grid-template-columns: 120px minmax(0, 1fr); }
    .field .check { padding-left: 130px; }
    .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .topbar { padding: 8px 12px; }
    .brand { flex: 1; }
    nav { order: 3; width: 100%; flex-wrap: wrap; }
    nav a { padding: 6px 12px; }
    .session { gap: 6px; }
    .container { padding: 16px 12px 24px; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
    .form-grid { grid-template-columns: 1fr; gap: 10px; }
    .field { grid-template-columns: 135px minmax(0, 1fr); }
    .field .check { padding-left: 145px; }
    .metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metrics > div { justify-content: space-between; gap: 6px; padding: 7px 9px; border-bottom: 1px solid var(--line); }
    .metrics > div:nth-child(even) { border-right: 0; }
    .metrics > div:nth-last-child(-n+2) { border-bottom: 0; }
    .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
    .dashboard-metrics > a { padding: 9px 10px; }
    .dashboard-metrics strong { font-size: 21px; }
    .dashboard-panels { grid-template-columns: 1fr; gap: 8px; }
    .filters .field:first-child { flex-basis: 100%; min-width: 0; }
    .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer { margin: 0 12px; }
}
@media (max-width: 420px) {
    .brand img { width: 65px; }
    .brand span { font-size: 14px; }
    .session > span { display: none; }
    .field { grid-template-columns: 112px minmax(0, 1fr); gap: 5px 8px; }
    .field > label { font-size: 12px; }
    .field .check { padding-left: 120px; }
    .detail-grid > div { grid-template-columns: 112px minmax(0, 1fr); }
    .login { margin: 25px auto; padding: 14px; }
    .photos { grid-template-columns: 1fr; }
    .monthly-row { grid-template-columns: 66px minmax(40px, 1fr) 25px; gap: 7px; }
    .chart-legend { margin-left: 73px; }
}

.settings-furos .catalog-value { width: auto; }

/* Cores de situação solicitadas para os furos, mantendo texto preto. */
td.furo-status-pendente { background-color: #fce8e6; color: #111; }
td.furo-status-concluido { background-color: #e6f2e8; color: #111; }
.quick-filters, .batch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.quick-filters strong { padding-left: 8px; border-left: 1px solid currentColor; font-variant-numeric: tabular-nums; }
.batch-bar { padding: 10px; background: #f0f2f4; border: 1px solid var(--line); }
.batch-bar p { flex-basis: 100%; margin: 0; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--blue); vertical-align: middle; }
.photos figure { margin: 0; min-width: 0; }
.photos figcaption { font-size: 12px; overflow-wrap: anywhere; margin-top: 5px; }
.photo-dialog { width: min(1100px, 96vw); max-height: 94vh; padding: 14px; background: #fafafa; color: #111; border: 2px solid var(--blue); }
.photo-dialog::backdrop { background: rgb(0 0 0 / 65%); }
.photo-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.photo-toolbar [data-close] { margin-left: auto; }
.photo-stage { min-height: 120px; text-align: center; }
.photo-stage img { max-width: 100%; max-height: 70vh; object-fit: contain; }
.photo-dialog [data-caption] { overflow-wrap: anywhere; }
#furo-feedback { margin-top: 8px; }
.photo-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; margin-bottom: 14px; border: 1px solid var(--line); }
.photo-upload small, .photo-upload > label { flex-basis: 100%; }
.photo-upload input, .photo-edit input[type="file"] { max-width: 100%; }
.photo-edit { margin-top: 8px; padding: 8px; border: 1px solid var(--line); }
.photo-edit summary { cursor: pointer; color: var(--blue); }
.photo-edit form { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 12px; }

/* Leitura e hierarquia visual comuns às telas administrativas. */
.page-heading { padding-bottom: 14px; border-bottom: 1px solid #d5dbe1; }
.section-heading { padding-top: 5px; }
.table-wrap { border-radius: 2px; scrollbar-color: #9aa9b8 #f0f2f4; }
th { padding-top: 9px; padding-bottom: 9px; background: #e9ecef; }
td { height: 38px; }
.numeric, .readings td, .readings input { font-variant-numeric: tabular-nums; }
.numeric { text-align: right; }
.cell-description { white-space: normal; min-width: 125px; max-width: 300px; overflow-wrap: anywhere; }
.cell-note { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: normal; }
.pdf-state { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.pdf-state form { margin: 0; }
.pdf-state .busy-message { white-space: normal; min-width: 170px; max-width: 230px; }
.pdf-state .cell-note { max-width: 240px; white-space: normal; }
.cell-audit { min-width: 205px; white-space: normal; font-variant-numeric: tabular-nums; }
.cell-audit > div + div { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.cell-audit .cell-note { display: inline; margin-right: 4px; }
.available { background: #edf2f7; border-color: #9caec0; }
.table-scroll-hint { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.table-scroll-hint[hidden] { display: none; }
.table-wrap td:last-child .actions { flex-wrap: nowrap; }
.table-wrap td:first-child { overflow-wrap: anywhere; }
.settings-catalog .table-wrap td:last-child .actions { flex-wrap: wrap; min-width: 140px; }
.filters .busy-message { flex-basis: 100%; margin-top: 0; }
.field-validation-error::before { content: '⚠ '; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { background: #f0f4f8; }
.notice[role="alert"]::before { content: 'Atenção: '; font-weight: bold; }
.empty { padding: 24px 16px; border-style: dashed; }
@media (min-width: 701px) and (max-width: 1150px) {
    .settings-catalogs { gap: 0 10px; }
    .settings-catalog .section-heading .actions { width: 100%; }
}
.tag { min-width: 38px; text-align: center; padding: 3px 7px; }
.tag.pending { background: #f3f4f5; }
.field > label { line-height: 1.35; }
.field > small { line-height: 1.4; }
.field input, .field select { min-height: 34px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.required-marker { margin-left: 4px; color: var(--blue); font-weight: bold; }
.form-help { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.document-status { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 14px; margin-bottom: 22px; background: #f0f4f8; border: 1px solid #becbd8; border-left: 3px solid var(--blue); }
.document-status p { margin: 7px 0 0; }
.document-status form { margin: 0; }
.busy-message { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid #becbd8; background: #edf2f7; }
.busy-message::before { content: ''; flex: 0 0 15px; height: 15px; border: 2px solid #b6c4d2; border-top-color: var(--blue); border-radius: 50%; animation: busy-turn 1s linear infinite; }
@keyframes busy-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .busy-message::before { animation: none; } }
@media (max-width: 760px) {
    .filters .field { flex: 1 1 100%; grid-template-columns: 112px minmax(0, 1fr); }
    .filters .field:first-child { min-width: 0; }
    .document-status { align-items: flex-start; }
    .button { min-height: 34px; }
    .button.small { min-height: 30px; }
}

/* Refinamentos discretos de interação e estados, sem mudar a identidade visual. */
:root { --success-line: #78947d; --success-bg: #edf4ee; --error-line: #b78080; --error-bg: #f8eded; --waiting-line: #b5a16b; --waiting-bg: #f7f3e7; }
a, button, .button, nav a, tbody tr, .dashboard-metrics > a, .dashboard-status, .field input, .field select, .field textarea {
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
nav a { border-bottom: 2px solid transparent; }
nav a.active { border-bottom-color: #91abc4; }
nav a:hover:not(.active) { border-color: #8f9dab; }
.button:hover:not(:disabled) { border-color: #66798c; }
.button.primary:hover:not(:disabled) { border-color: var(--blue-hover); }
.button.danger:hover:not(:disabled) { border-color: #851818; }
.dashboard-metrics > a { border-left: 3px solid #d5dbe1; }
.dashboard-metrics > a:hover { border-left-color: var(--blue); }
.dashboard-metrics > a:focus-visible, .dashboard-status:focus-visible { outline-offset: 2px; }
.dashboard-filter { margin-bottom: 14px; }
.dashboard-period-filter { align-items: end; margin-bottom: 8px; }
.dashboard-period-filter .field { min-width: 190px; flex: 0 1 230px; }
.dashboard-period-filter .field input { width: 100%; }
.dashboard-filter .quick-filters { margin: 0; }
.filters-ensaios { display: grid; gap: 13px; padding: 12px; }
.filter-toolbar { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.filter-count { margin-left: 8px; padding-left: 8px; border-left: 1px solid currentColor; font-size: 12px; }
.filter-dialog { width: min(960px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); margin: auto; padding: 16px; overflow-y: auto; color: var(--ink); background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 36px rgb(0 0 0 / 22%); }
.filter-dialog::backdrop { background: rgb(0 0 0 / 42%); }
.filter-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 2px solid var(--blue); }
.filter-dialog-header p { margin: 4px 0 0; }
.filter-dialog .filters-ensaios { margin: 14px 0 0; padding: 0; background: transparent; border: 0; }
.filter-dialog .filter-row-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 12px 20px; }
.filter-dialog .filter-type-buttons { grid-column: 1 / -1; }
.filter-dialog .filter-row-primary > .field { grid-template-columns: 112px minmax(0, 1fr); }
.filter-dialog .filter-row-secondary { grid-template-columns: minmax(300px, .75fr) minmax(0, 1.25fr); align-items: start; gap: 14px 16px; border-top: 1px solid #d5dbe1; padding-top: 13px; }
.filter-dialog .filter-group { padding: 9px 10px; background: #f6f6f6; border: 1px solid #d5dbe1; }
.filter-dialog .filter-period-fields { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.filter-dialog .filter-period-fields > input { width: 100%; min-width: 0; min-height: 34px; padding: 4px 7px; color: var(--ink); background: #fff; border: 1px solid #999; border-radius: 1px; }
.filter-dialog .filter-period-separator { color: var(--muted); white-space: nowrap; }
.filter-dialog .filter-view-fields { grid-template-columns: minmax(135px, .8fr) minmax(190px, 1.25fr) minmax(145px, .95fr); gap: 8px; }
.filter-dialog .filter-view-fields .field { flex: initial; min-width: 0; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 7px; }
.filter-dialog .filter-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 12px; border-top: 1px solid #d5dbe1; }
.filter-row-primary { display: grid; grid-template-columns: minmax(245px, auto) minmax(210px, 1.8fr) minmax(145px, 1fr) minmax(160px, 1.2fr) minmax(150px, 1.1fr); align-items: end; gap: 14px; }
.filter-type-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0; }
.filter-type-buttons > span { margin-right: 4px; font-weight: bold; }
.filter-row .field { min-width: 0; margin: 0; grid-template-columns: auto minmax(0, 1fr); gap: 5px 9px; }
.filter-row .field input, .filter-row .field select { width: 100%; min-width: 0; }
.filter-row-secondary { display: grid; grid-template-columns: minmax(285px, 1fr) minmax(470px, 1.7fr) auto; align-items: end; gap: 14px; }
.filter-group { min-width: 0; }
.filter-group-title { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: bold; }
.filter-period-fields, .filter-view-fields { display: grid; gap: 8px; }
.filter-period-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filter-view-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filter-actions { display: flex; align-items: center; gap: 7px; }
.filter-actions .button { min-width: 78px; }
.active-filters { margin: -4px 0 14px; color: var(--muted); }
.active-filters summary { width: fit-content; cursor: pointer; }
.active-filter-list { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.filter-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 27px; padding: 3px 8px; color: var(--ink); background: #fff; border: 1px solid #aeb8c2; border-radius: 2px; }
.filter-chip:hover { background: #edf2f7; text-decoration: none; }
.filter-chip span:last-child { color: var(--blue); font-size: 16px; font-weight: bold; line-height: 1; }
.table-wrap-sticky { max-height: min(72vh, 760px); overflow: auto; }
.table-wrap-sticky thead th { position: sticky; top: 0; z-index: 2; }
@media (max-width: 760px) {
    .filter-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); padding: 12px; }
    .filter-dialog .filter-row-primary, .filter-dialog .filter-row-secondary { grid-template-columns: minmax(0, 1fr); }
    .filter-dialog .filter-type-buttons, .filter-dialog .filter-actions { grid-column: auto; }
    .filter-dialog .filter-actions { justify-content: flex-start; flex-wrap: wrap; }
    .filter-dialog .filter-period-fields { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
    .filter-dialog .filter-view-fields { grid-template-columns: minmax(0, 1fr); }
    .filter-row-primary { grid-template-columns: minmax(0, 1fr); }
    .filter-row-primary .field, .filter-row-secondary .field { grid-template-columns: 112px minmax(0, 1fr); }
    .filter-row-secondary { grid-template-columns: minmax(0, 1fr); }
    .filter-period-fields, .filter-view-fields { grid-template-columns: minmax(0, 1fr); }
    .filter-actions { justify-content: flex-start; }
    .table-wrap-sticky { max-height: none; overflow-x: auto; }
    .table-wrap-sticky thead th { position: static; }
}
@media (min-width: 761px) and (max-width: 1000px) {
    .filter-dialog .filter-row-secondary { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 761px) and (max-width: 1150px) {
    .filter-row-primary { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
    .filter-type-buttons { grid-column: 1 / -1; }
    .filter-row-secondary { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
    .filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
tbody tr:hover { box-shadow: inset 3px 0 0 var(--blue); }
.field input:focus, .field select:focus, .field textarea:focus { box-shadow: 0 0 0 2px rgb(23 59 99 / 14%); }
.notice.success { background: var(--success-bg); border-color: var(--success-line); border-left-color: #52755a; }
.notice[role="alert"] { background: var(--error-bg); border-color: var(--error-line); border-left-color: var(--red); }
.tag { display: inline-flex; align-items: center; gap: 6px; }
.tag.available::before, .tag.pending::before, .tag.waiting::before, .tag.error::before { content: ""; width: 7px; height: 7px; flex: 0 0 7px; border: 1px solid #73869a; background: #d9e1e9; }
.tag.available { color: #183c64; background: #edf2f7; border-color: #9caec0; }
.tag.available::before { border-color: #416b4a; background: #a8c6ad; }
.tag.pending::before { border-color: #737373; background: #d4d4d4; }
.tag.waiting { background: var(--waiting-bg); border-color: var(--waiting-line); border-style: solid; }
.tag.waiting::before { border-color: #927c3e; background: #e4d49e; }
.tag.error { background: var(--error-bg); border-color: var(--error-line); border-style: solid; }
.tag.error::before { border-color: #8e3333; background: #cc8989; }
.document-status-available { background: #f2f6f3; border-color: #afc2b2; border-left-color: #52755a; }
.document-status-waiting { background: var(--waiting-bg); border-color: #d4c89f; border-left-color: #927c3e; }
.document-status-error { background: var(--error-bg); border-color: var(--error-line); border-left-color: var(--red); }
.document-status-pending { background: #f0f4f8; }
.monthly-segment { transform-origin: left center; animation: chart-grow 350ms ease-out both; }
@keyframes chart-grow { from { transform: scaleX(.15); opacity: .55; } to { transform: scaleX(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
