:root {
    --ink: #292522;
    --muted: #706963;
    --paper: #fffdf9;
    --canvas: #f5f1eb;
    --line: #ded6cd;
    --brand: #8b4933;
    --brand-dark: #683323;
    --brand-soft: #f2e2d8;
    --green: #3d6654;
    --green-soft: #e1eee7;
    --red: #9d312d;
    --red-soft: #f8dfdd;
    --amber: #8b5b10;
    --amber-soft: #faebc8;
    --blue: #315f75;
    --blue-soft: #dcebf1;
    --shadow: 0 12px 35px rgba(56, 42, 33, 0.08);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

[hidden] {
    display: none !important;
}

a {
    color: var(--brand-dark);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 3px solid #d89458;
    outline-offset: 2px;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
}

.public-header {
    position: sticky;
    z-index: 20;
    top: 0;
    border-bottom: 1px solid rgba(139, 73, 51, 0.16);
    background: rgba(255, 253, 249, 0.95);
    backdrop-filter: blur(10px);
}

.header-inner {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    text-decoration: none;
}

.brand span:last-child {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand strong {
    font-size: 1.08rem;
    letter-spacing: 0.08em;
}

.brand small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.75rem;
}

.brand-logo,
.brand-mark {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
}

.brand-logo {
    object-fit: contain;
}

.brand-mark {
    display: grid;
    place-items: center;
    border-radius: 50% 50% 48% 52%;
    color: #fff;
    background: var(--brand);
    font-family: Georgia, serif;
    font-size: 1.55rem;
    font-weight: 700;
}

.admin-link {
    color: var(--brand-dark);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.public-main {
    padding-block: 48px 80px;
}

.hero {
    max-width: 800px;
    margin-bottom: 34px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    line-height: 1.18;
}

.hero h1 {
    max-width: 760px;
    margin-bottom: 16px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 5vw, 3.65rem);
    font-weight: 500;
    letter-spacing: -0.035em;
}

.hero > p:last-child,
.page-heading p,
.login-card > p,
.confirmation-card > p {
    color: var(--muted);
}

.case-form {
    display: grid;
    gap: 22px;
}

.form-section,
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.form-section {
    min-width: 0;
    margin: 0;
    padding: 24px;
}

.form-section legend {
    display: flex;
    align-items: center;
    padding: 0 8px 0 0;
    font-size: 1.15rem;
    font-weight: 800;
}

.form-section legend > span {
    display: inline-grid;
    width: 32px;
    height: 32px;
    margin-right: 10px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--brand);
    font-size: 0.85rem;
}

.section-note,
.field small,
.muted {
    color: var(--muted);
    font-size: 0.87rem;
}

.form-grid {
    display: grid;
    gap: 18px;
}

.field {
    min-width: 0;
}

.field label,
.field-label,
.upload-box > label {
    display: block;
    margin-bottom: 7px;
    color: #3b3632;
    font-size: 0.9rem;
    font-weight: 700;
}

.field label span,
.field-label span,
.consent-line > span {
    color: var(--red);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
    width: 100%;
    min-height: 45px;
    border: 1px solid #cfc5bc;
    border-radius: 9px;
    color: var(--ink);
    background: #fff;
    padding: 10px 12px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
    resize: vertical;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 73, 51, 0.14);
}

input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    background: #eeeae5;
}

.radio-stack,
.violation-group,
.compact-fieldset {
    display: grid;
    gap: 10px;
}

.radio-stack label,
.violation-group label,
.check-line,
.compact-fieldset label,
.inline-options label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 3px 0 0;
    accent-color: var(--brand);
}

.check-line {
    margin-bottom: 20px;
    font-weight: 650;
}

.inline-options {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.violation-grid {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.violation-group {
    align-content: start;
    border: 1px solid #e5ddd5;
    border-radius: 11px;
    padding: 18px;
    background: #fffcf8;
}

.violation-group h3 {
    margin-bottom: 4px;
    color: var(--brand-dark);
    font-size: 0.96rem;
}

.violation-group label {
    font-size: 0.9rem;
}

.conditional-panel {
    margin-top: 18px;
    border-left: 4px solid var(--brand);
    border-radius: 8px;
    padding: 18px;
    background: var(--brand-soft);
}

.field-error {
    margin: 7px 0 0;
    color: var(--red);
    font-size: 0.86rem;
    font-weight: 650;
}

.upload-box {
    border: 1px dashed #bda99c;
    border-radius: 11px;
    padding: 20px;
    background: #fffaf5;
}

.upload-box input[type="file"] {
    display: block;
    width: 100%;
    margin-block: 10px;
}

.privacy-note {
    margin: 16px 0 0;
    border-radius: 8px;
    padding: 12px;
    color: #4b453f;
    background: #efe9df;
    font-size: 0.86rem;
}

.consent-section {
    border-color: #cbb3a3;
}

.consent-line {
    margin-bottom: 0;
    font-size: 1rem;
}

.form-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 10px 0;
}

.form-actions p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.button {
    display: inline-flex;
    min-height: 43px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 9px 16px;
    cursor: pointer;
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
    transition: transform 0.12s, background 0.12s, border-color 0.12s;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

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

.button-primary:hover {
    background: var(--brand-dark);
}

.button-secondary {
    border-color: var(--brand);
    color: var(--brand-dark);
    background: #fff;
}

.button-ghost {
    border-color: var(--line);
    color: var(--ink);
    background: transparent;
}

.button-danger {
    border-color: #d9aaa7;
    color: var(--red);
    background: #fff;
}

.button-large {
    min-height: 52px;
    padding-inline: 24px;
}

.button-full {
    width: 100%;
}

.alert {
    margin-bottom: 20px;
    border: 1px solid;
    border-radius: 10px;
    padding: 13px 16px;
    font-weight: 650;
}

.alert-error {
    border-color: #e4aaa6;
    color: #7d2522;
    background: var(--red-soft);
}

.alert-success {
    border-color: #a5c8b6;
    color: #294d3d;
    background: var(--green-soft);
}

.public-footer {
    border-top: 1px solid var(--line);
    padding: 28px 0;
    color: var(--muted);
    background: #ede7df;
    font-size: 0.85rem;
}

.public-footer-inner {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.follow-up-contacts {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.follow-up-contacts strong {
    color: var(--ink);
}

.follow-up-contacts a {
    width: fit-content;
    font-weight: 700;
    text-decoration: none;
}

.follow-up-contacts span {
    color: var(--muted);
}

.confirmation-contacts {
    margin: 0 auto 22px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 15px;
    background: #faf7f2;
}

.confirmation-wrap {
    display: grid;
    min-height: calc(100vh - 77px);
    place-items: center;
    padding-block: 45px;
}

.confirmation-card {
    width: min(660px, 100%);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: clamp(28px, 6vw, 56px);
    text-align: center;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.success-symbol {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--green);
    font-size: 2rem;
}

.confirmation-card h1 {
    font-family: Georgia, serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 500;
}

.case-code {
    margin: 26px 0 14px;
    border: 1px dashed var(--brand);
    border-radius: 11px;
    padding: 18px;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-family: Consolas, monospace;
    font-size: clamp(1.2rem, 4vw, 1.8rem);
    font-weight: 800;
    letter-spacing: 0.04em;
}

.login-layout {
    display: grid;
    min-height: 100vh;
}

.login-intro,
.login-panel {
    padding: clamp(30px, 7vw, 80px);
}

.login-intro {
    display: flex;
    min-height: 360px;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background:
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.14), transparent 28%),
        linear-gradient(140deg, #4b2d23, #8b4933);
}

.login-intro .brand,
.login-intro .brand small {
    color: #fff;
}

.login-intro .brand-mark {
    color: var(--brand-dark);
    background: #fff;
}

.login-intro h1 {
    max-width: 600px;
    font-family: Georgia, serif;
    font-size: clamp(2.3rem, 6vw, 4rem);
    font-weight: 500;
}

.login-intro p:not(.eyebrow) {
    max-width: 570px;
    color: rgba(255, 255, 255, 0.78);
}

.login-intro .eyebrow {
    color: #f5c5a9;
}

.login-panel {
    display: grid;
    place-items: center;
    background: var(--paper);
}

.login-card {
    width: min(420px, 100%);
}

.login-card h2 {
    margin-bottom: 8px;
    font-size: 1.75rem;
}

.login-card .field {
    margin: 20px 0;
}

.back-link {
    display: inline-block;
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 650;
    text-decoration: none;
}

/* Admin layout */
.admin-page {
    background: #f2eee8;
}

.admin-topbar {
    position: fixed;
    z-index: 50;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #e3dbd2;
    padding: 0 20px;
    background: var(--paper);
}

.admin-brand .brand-logo,
.admin-brand .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
}

.user-menu {
    display: none;
    align-items: flex-end;
    flex-direction: column;
    line-height: 1.2;
}

.user-menu span {
    font-size: 0.88rem;
    font-weight: 750;
}

.user-menu small {
    color: var(--muted);
    font-size: 0.72rem;
}

.user-menu a {
    margin-top: 3px;
    font-size: 0.76rem;
    font-weight: 700;
    text-decoration: none;
}

.nav-toggle {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 11px;
    color: var(--ink);
    background: #fff;
    font-weight: 700;
}

.admin-shell {
    display: flex;
    min-height: 100vh;
    padding-top: 72px;
}

.sidebar {
    position: fixed;
    z-index: 40;
    top: 72px;
    bottom: 0;
    left: 0;
    display: flex;
    width: 250px;
    padding: 22px 14px;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid #ded5cc;
    background: #332a26;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
}

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

.sidebar nav {
    display: grid;
    gap: 5px;
}

.sidebar nav a,
.sidebar-public {
    border-radius: 8px;
    padding: 11px 13px;
    color: #ded5cf;
    font-size: 0.9rem;
    font-weight: 650;
    text-decoration: none;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.11);
}

.sidebar nav a.active {
    border-left: 3px solid #d7946e;
}

.sidebar-public {
    border: 1px solid rgba(255, 255, 255, 0.14);
    text-align: center;
}

.admin-content {
    width: 100%;
    min-width: 0;
    padding: 28px 18px 60px;
}

.page-heading {
    display: flex;
    margin-bottom: 24px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.page-heading h1 {
    margin-bottom: 6px;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

.page-heading p:last-child {
    margin-bottom: 0;
}

.metric-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 22px;
}

.metric-card {
    display: flex;
    min-height: 120px;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 19px;
    background: var(--paper);
    box-shadow: 0 7px 22px rgba(56, 42, 33, 0.05);
}

.metric-card span {
    color: var(--muted);
    font-size: 0.83rem;
    font-weight: 700;
}

.metric-card strong {
    font-size: 2rem;
    line-height: 1;
}

.metric-highlight {
    color: #fff;
    background: var(--brand);
}

.metric-highlight span {
    color: rgba(255, 255, 255, 0.8);
}

.urgent-panel {
    margin-bottom: 22px;
    border: 1px solid #e3aaa7;
    border-radius: var(--radius);
    padding: 20px;
    background: #fff7f6;
}

.section-heading,
.panel-heading,
.user-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-heading h2,
.panel-heading h2 {
    margin: 0;
    font-size: 1.12rem;
}

.urgent-count {
    display: grid;
    min-width: 35px;
    height: 35px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--red);
    font-weight: 800;
}

.urgent-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.urgent-list a {
    display: flex;
    padding: 11px 13px;
    flex-direction: column;
    border-radius: 8px;
    color: var(--ink);
    background: #fff;
    text-decoration: none;
}

.urgent-list span {
    color: var(--muted);
    font-size: 0.8rem;
}

.chart-grid {
    display: grid;
    gap: 20px;
}

.panel {
    min-width: 0;
}

.panel-heading {
    border-bottom: 1px solid #e8e0d8;
    padding: 17px 20px;
}

.chart-wrap {
    height: 320px;
    padding: 20px;
}

.filter-panel {
    margin-bottom: 20px;
    padding: 18px;
}

.filter-form {
    display: grid;
    align-items: end;
    gap: 13px;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-panel {
    overflow: hidden;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    white-space: nowrap;
}

th,
td {
    border-bottom: 1px solid #ece5de;
    padding: 13px 14px;
    text-align: left;
    vertical-align: top;
}

th {
    color: #665d57;
    background: #faf7f2;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #fffcf8;
}

.compact-cell {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.case-link {
    font-family: Consolas, monospace;
    font-weight: 800;
    text-decoration: none;
}

.badge,
.risk,
.audit-action {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.badge-state-pendente,
.badge-priority-media,
.risk-medio {
    color: #754800;
    background: var(--amber-soft);
}

.badge-state-em_analise,
.badge-state-em_acompanhamento,
.risk-baixo {
    color: #24546a;
    background: var(--blue-soft);
}

.badge-state-encerrado,
.badge-active {
    color: #28533f;
    background: var(--green-soft);
}

.badge-state-nao_procede,
.badge-state-duplicado,
.badge-inactive {
    color: #625c58;
    background: #e8e4e1;
}

.badge-priority-baixa {
    color: #3d6553;
    background: var(--green-soft);
}

.badge-priority-alta,
.risk-alto {
    color: #7f3f12;
    background: #f7dfcf;
}

.badge-priority-urgente,
.risk-iminente {
    color: #812521;
    background: var(--red-soft);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding: 14px 18px;
    font-size: 0.85rem;
}

.pagination a {
    font-weight: 750;
    text-decoration: none;
}

.empty-state {
    padding: 25px !important;
    color: var(--muted);
    text-align: center;
}

.detail-heading .back-link {
    margin: 0 0 12px;
}

.heading-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-layout {
    display: grid;
    gap: 20px;
}

.detail-main,
.management-column {
    display: grid;
    align-content: start;
    gap: 20px;
    min-width: 0;
}

.detail-section {
    overflow: hidden;
}

.data-grid {
    display: grid;
    margin: 0;
    gap: 0;
}

.data-grid > div {
    min-width: 0;
    border-bottom: 1px solid #eee7df;
    padding: 14px 20px;
}

.data-grid > div:last-child {
    border-bottom: 0;
}

.data-grid dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 750;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.data-grid dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.long-text {
    white-space: normal;
}

.attachment-list {
    display: grid;
    padding: 12px;
    gap: 8px;
}

.attachment-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid #e5ddd5;
    border-radius: 9px;
    padding: 11px 13px;
    color: var(--ink);
    text-decoration: none;
}

.attachment-list span:first-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.attachment-list strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-list small {
    color: var(--muted);
}

.inline-form,
.contact-form {
    display: grid;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 18px 20px;
}

.timeline {
    padding: 20px;
}

.timeline article {
    position: relative;
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    padding-bottom: 22px;
}

.timeline article:not(:last-child)::before {
    position: absolute;
    top: 14px;
    bottom: 0;
    left: 6px;
    width: 2px;
    content: "";
    background: #ddd3ca;
}

.timeline-dot {
    position: relative;
    z-index: 1;
    width: 14px;
    height: 14px;
    margin-top: 4px;
    border: 3px solid var(--paper);
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
}

.timeline header {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline time,
.timeline small,
.contact-list small {
    color: var(--muted);
    font-size: 0.76rem;
}

.timeline p,
.contact-list p {
    margin: 6px 0;
}

.contact-list {
    display: grid;
    gap: 10px;
    padding: 18px 20px;
}

.contact-list article {
    border-left: 3px solid #b8876e;
    padding: 8px 12px;
    background: #faf7f3;
}

.management-card {
    overflow: hidden;
}

.management-card form {
    display: grid;
    gap: 15px;
    padding: 20px;
}

.compact-fieldset {
    min-width: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 13px;
}

.compact-fieldset legend {
    padding: 0 5px;
    font-size: 0.86rem;
    font-weight: 750;
}

.closing-panel {
    border: 1px solid #dfaaa7;
    border-radius: 10px;
    padding: 14px;
    background: #fff7f6;
}

.closing-panel h3 {
    color: var(--red);
    font-size: 0.96rem;
}

.user-create-panel {
    margin-bottom: 20px;
    overflow: hidden;
}

.user-create-form {
    display: grid;
    align-items: end;
    gap: 14px;
    padding: 20px;
}

.user-list {
    display: grid;
    gap: 18px;
}

.user-card {
    padding: 20px;
}

.user-edit-form {
    display: grid;
    align-items: end;
    gap: 14px;
}

.user-card-heading {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--line);
    padding-bottom: 13px;
}

.user-card-heading > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-card-heading small {
    color: var(--muted);
}

.user-card-actions {
    display: flex;
    margin-top: 18px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}

.user-card-actions form:first-child {
    display: flex;
    flex: 1;
    align-items: flex-end;
    gap: 10px;
}

.user-card-actions .field {
    flex: 1;
}

.audit-action {
    color: #4e4540;
    background: #eee9e4;
    text-transform: capitalize;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-wide,
    .field-full {
        grid-column: 1 / -1;
    }

    .violation-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-actions,
    .page-heading {
        flex-direction: row;
        align-items: center;
    }

    .user-menu {
        display: flex;
    }

    .public-footer-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .footer-contacts {
        align-items: flex-end;
        text-align: right;
    }

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .search-field,
    .filter-actions {
        grid-column: 1 / -1;
    }

    .data-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .data-grid > div:nth-last-child(2):nth-child(odd) {
        border-bottom: 0;
    }

    .data-full {
        grid-column: 1 / -1;
    }

    .contact-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-create-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-edit-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .login-layout {
        grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
    }

    .login-intro {
        min-height: 100vh;
    }

    .admin-topbar {
        padding-inline: 28px;
    }

    .nav-toggle {
        display: none;
    }

    .sidebar {
        transform: none;
    }

    .admin-content {
        margin-left: 250px;
        padding: 38px 34px 70px;
    }

    .metric-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .chart-grid {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    }

    .filter-form {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .search-field {
        grid-column: span 2;
    }

    .filter-actions {
        grid-column: auto;
    }

    .audit-filters {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .detail-layout {
        grid-template-columns: minmax(0, 1fr) 350px;
        align-items: start;
    }

    .management-column {
        position: sticky;
        top: 94px;
    }

    .user-create-form {
        grid-template-columns: 1.2fr 1.2fr 0.8fr 1fr auto;
    }

    .user-edit-form {
        grid-template-columns: 1.2fr 1.2fr 0.8fr auto auto;
    }
}

@media (min-width: 1100px) {
    .violation-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .form-section {
        padding: 20px 17px;
    }

    .form-section legend {
        max-width: 90%;
        font-size: 1rem;
    }

    .public-main {
        padding-top: 34px;
    }

    .admin-link {
        font-size: 0.78rem;
    }

    .admin-brand small {
        display: none;
    }

    .user-card-actions,
    .user-card-actions form:first-child {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
