@keyframes systemPageArrival {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes systemContentArrival {
    from { opacity: 0; translate: 0 8px; }
    to { opacity: 1; translate: 0 0; }
}

html { scroll-behavior: smooth; }

body { animation: systemPageArrival .28s ease-out both; }

:where(button:not(:disabled), [role="button"], .btn, .action-tile) {
    transition: translate .17s ease, scale .17s ease, box-shadow .2s ease, filter .17s ease;
}

:where(button:not(:disabled), [role="button"], .btn, .action-tile):hover {
    translate: 0 -1px;
    filter: brightness(1.025);
}

:where(button:not(:disabled), [role="button"], .btn, .action-tile):active {
    translate: none !important;
    scale: none !important;
    transform: none !important;
}

.auth-pane :where(.btn, .btn-primary-highlight, .register-link, .back-link, .back-to-home-link),
.auth-pane :where(.btn, .btn-primary-highlight, .register-link, .back-link, .back-to-home-link):hover,
.auth-pane :where(.btn, .btn-primary-highlight, .register-link, .back-link, .back-to-home-link):active {
    translate: none !important;
    scale: none !important;
}

:where(.btn, .btn-primary-highlight):hover,
:where(.btn, .btn-primary-highlight):active {
    text-align: center;
}

:where(button:not(:disabled), a[href], [role="button"], input[type="button"]:not(:disabled), input[type="submit"]:not(:disabled)):active {
    translate: none !important;
    scale: none !important;
    transform: none !important;
}

:where(a[href]) { transition: color .18s ease, opacity .18s ease; }
:where(a[href]):hover { opacity: .9; }

:where(input, select, textarea) {
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

input[type="date"] {
    min-height: 3rem;
    padding: .65rem .85rem;
    border: 1px solid #d4e0d8;
    border-radius: .9rem;
    background: linear-gradient(180deg, #fff 0%, #f7faf8 100%);
    color: #26372d;
    color-scheme: light;
    accent-color: #166539;
    cursor: pointer;
    font-size: .925rem;
    font-weight: 650;
    box-shadow: 0 2px 5px rgba(38, 55, 45, .05), inset 0 1px 0 rgba(255, 255, 255, .9);
}

input[type="date"]:hover:not(:disabled) {
    border-color: #9bb7a5;
    background: #fff;
    box-shadow: 0 4px 12px rgba(38, 55, 45, .08);
}

input[type="date"]:focus-visible {
    border-color: #166539;
    outline: 3px solid rgba(22, 101, 57, .14);
    outline-offset: 1px;
    background: #fff;
    box-shadow: 0 0 0 1px #166539, 0 5px 14px rgba(22, 101, 57, .12);
}

input[type="date"]:disabled {
    background: #f1f4f2;
    color: #849188;
    cursor: not-allowed;
    opacity: .8;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    width: 1.2rem;
    height: 1.2rem;
    margin-left: .5rem;
    padding: .2rem;
    border-radius: .45rem;
    background-color: #eaf4ed;
    cursor: pointer;
    transition: background-color .18s ease, transform .18s ease;
}

input[type="date"]:hover::-webkit-calendar-picker-indicator {
    background-color: #dceee2;
    transform: scale(1.06);
}

:where(input, select, textarea):focus-visible {
    outline: 2px solid rgba(22, 101, 57, .45);
    outline-offset: 1px;
}

.visual-content > * {
    animation: systemContentArrival .42s cubic-bezier(.2, .75, .25, 1) both;
}

.visual-content > :nth-child(2) { animation-delay: .07s; }
.visual-content > :nth-child(3) { animation-delay: .14s; }

.action-tile {
    animation: systemContentArrival .42s cubic-bezier(.2, .75, .25, 1) both;
}

.action-tile:nth-child(2) { animation-delay: .06s; }
.action-tile:nth-child(3) { animation-delay: .12s; }
.action-tile:nth-child(4) { animation-delay: .18s; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }

    :where(button, [role="button"], .btn, .action-tile):hover,
    :where(button, [role="button"], .btn, .action-tile):active {
        translate: none !important;
        scale: none !important;
        filter: none !important;
    }
}

@media (max-width: 767px) {
    html, body {
        max-width: 100%;
        overflow-x: hidden;
    }

    body { min-width: 320px; }

    img, svg, video, canvas { max-width: 100%; }

    :where(main, section, article, aside, header, footer, div, form, fieldset) {
        min-width: 0;
    }

    :where(h1, h2, h3, h4, p, label, a, button, th, td) {
        overflow-wrap: anywhere;
    }

    :where(input, select, textarea) {
        min-width: 0;
        max-width: 100%;
        font-size: 16px;
    }

    :where(button, [role="button"], input[type="submit"], input[type="button"]) {
        min-height: 44px;
    }

    .overflow-x-auto {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    table {
        max-width: 100%;
    }

    .modal-content {
        width: min(100%, calc(100vw - 1.5rem)) !important;
        max-height: calc(100dvh - 1.5rem);
        overflow-y: auto;
    }

    .public-site .container,
    .public-site .contact-content,
    .public-site .about-content {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    body.flex {
        flex-direction: column;
        min-width: 0;
    }

    body.flex > .w-64 {
        width: 100% !important;
        min-height: 0 !important;
        height: auto;
        padding: 1rem !important;
    }

    body.flex > .w-64 > h2 {
        margin-bottom: .75rem;
        font-size: 1.25rem;
    }

    body.flex > .w-64 > ul {
        display: flex;
        flex: none;
        gap: .4rem;
        min-width: 0;
        margin: 0;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    body.flex > .w-64 > ul::-webkit-scrollbar { display: none; }
    body.flex > .w-64 > ul > li { flex: 0 0 auto; white-space: nowrap; }

    body.flex > .w-64 > form { margin-top: .75rem; }

    body.flex > .flex-1 {
        width: 100%;
        min-width: 0;
        padding: 1rem !important;
    }

    body.flex > .flex-1 .max-w-4xl { max-width: 100%; }

    .public-site { overflow-x: hidden; }

    .public-site main {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

    .public-site main > aside {
        position: sticky !important;
        top: 0;
        z-index: 30;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: .45rem .75rem !important;
        border-right: 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, .18);
        box-shadow: 0 4px 12px rgba(10, 48, 29, .12);
    }

    .public-site main > aside nav {
        display: flex;
        gap: .15rem;
        min-width: 0;
        margin: 0;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        white-space: nowrap;
    }

    .public-site main > aside nav::-webkit-scrollbar { display: none; }

    .public-site main > aside nav > a {
        flex: 0 0 auto;
        min-height: 44px;
        align-items: center;
        padding: .45rem .5rem !important;
        border: 1px solid transparent !important;
        border-bottom: 2px solid transparent !important;
        border-radius: 8px 8px 0 0 !important;
        font-size: .8125rem;
        white-space: nowrap;
    }

    .public-site main > aside nav > a > i {
        width: 1rem !important;
    }

    .public-site main > aside nav > a > span {
        margin-left: .35rem !important;
    }

    .public-site main > aside nav > a[style*="border-color"] {
        border-bottom-color: var(--gold) !important;
        background: rgba(255, 255, 255, .1) !important;
    }

    .public-site .container,
    .public-site .contact-content,
    .public-site .about-content {
        min-width: 0;
        max-width: 100%;
    }

    .public-site > div > header {
        min-height: 4rem;
        height: auto;
        gap: .5rem;
        padding: .5rem .75rem;
    }

    .public-site .system-brand {
        font-size: .72rem;
        line-height: 1.2;
    }

    .public-site .municipal-seal {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    .content-black-theme {
        width: 100%;
        padding-right: .75rem !important;
        padding-left: .75rem !important;
        padding-top: 4.5rem !important;
        padding-bottom: 1rem !important;
    }

    .content-black-theme > div:not(#dashboardSection) {
        margin-right: .25rem !important;
        margin-left: .25rem !important;
    }

    .content-black-theme .grid > *,
    .content-black-theme .flex > * {
        min-width: 0;
    }

    .content-black-theme .min-h-\[690px\],
    .content-black-theme .min-h-\[420px\] {
        min-height: 0 !important;
    }

    .content-black-theme .user-hero {
        min-height: 0;
        padding: 1rem;
    }

    .content-black-theme .user-hero h2 {
        font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
        line-height: 1.08;
    }

    .content-black-theme .rounded-3xl {
        border-radius: 1rem !important;
    }

    .content-black-theme .table-scroll {
        max-height: none;
    }

    .content-black-theme .grid.grid-cols-2 {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .content-black-theme .ml-4 {
        margin-left: 0 !important;
    }

    .content-black-theme .mb-10 {
        margin-bottom: 1.25rem !important;
    }

    .content-black-theme #farmerRequestSection > .min-h-\[690px\] {
        padding: 1rem !important;
    }

    .farmer-chat-panel {
        right: .5rem;
        bottom: 5rem;
        width: calc(100vw - 1rem);
        height: min(34rem, calc(100dvh - 6rem));
    }

    .farmer-chat-launcher-wrap {
        right: .75rem;
        bottom: .75rem;
    }

    .farmer-chat-hint {
        max-width: calc(100vw - 2rem);
        white-space: normal;
        text-align: center;
    }
}

@media (max-width: 420px) {
    .public-site > div > header .max-w-48 > span:last-child {
        display: none;
    }

    .otp-layout,
    .container {
        width: 100%;
        max-width: 100%;
    }
}

@media (hover: none) {
    :where(button:not(:disabled), [role="button"], .btn, .action-tile):hover {
        translate: none;
        filter: none;
    }
}

@media (max-width: 767px) {
    .public-site > div > header {
        justify-content: space-between;
    }

    .public-site > div > header > a {
        flex: 1 1 auto;
    }

    .public-site > div > header > div {
        flex: 0 0 auto;
    }

    .public-site main > aside nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: .25rem .35rem;
        overflow: visible;
        scroll-snap-type: none;
        white-space: normal;
    }

    .public-site main > aside nav > a {
        justify-content: center;
        gap: .25rem;
        min-width: 0;
        margin-top: 0 !important;
        padding: .45rem .25rem !important;
        font-size: .65rem;
        white-space: nowrap;
    }

    .public-site main > aside nav > a > span {
        margin-left: 0 !important;
        font-size: inherit !important;
    }

    .public-site main > section,
    .public-site main > div {
        min-width: 0;
    }

    .content-black-theme .dashboard-section,
    .content-black-theme > div {
        max-width: 100%;
    }

    .content-black-theme .dashboard-section > .grid,
    .content-black-theme .dashboard-section > .flex,
    .content-black-theme .dashboard-section .flex-wrap {
        min-width: 0;
    }

    .content-black-theme :where(button, a[role="button"], input[type="submit"]) {
        touch-action: manipulation;
    }

    .content-black-theme input,
    .content-black-theme select,
    .content-black-theme textarea,
    .public-site input,
    .public-site select,
    .public-site textarea {
        scroll-margin-top: 5rem;
    }
}

@media (max-width: 480px) {
    .public-site > div > header {
        padding-right: .75rem;
        padding-left: .75rem;
    }

    .public-site > div > header .municipal-seal {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .content-black-theme {
        padding-right: .625rem !important;
        padding-left: .625rem !important;
    }

    .content-black-theme .dashboard-section > :where(.mb-6, .mb-8) {
        margin-bottom: 1rem;
    }

    .otp-panel {
        padding-right: 1.125rem;
        padding-left: 1.125rem;
    }

    .otp-code {
        height: 56px;
        font-size: 24px;
        letter-spacing: .32em;
    }
}

@media (prefers-reduced-motion: reduce) {
    .public-site main > aside nav {
        scroll-behavior: auto;
        scroll-snap-type: none;
    }
}