:root {
    --page: #f4f7fb;
    --panel: rgba(255, 255, 255, .92);
    --panel-solid: #ffffff;
    --ink: #162033;
    --muted-ink: #647086;
    --line-soft: #d9e2ef;
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eaf2ff;
    --mint: #0f9f7a;
    --amber: #b7791f;
    --rose: #d92d20;
    --radius: 22px;
    --radius-sm: 14px;
    --shadow-soft: 0 18px 42px rgba(22, 32, 51, .09);
    --shadow-tight: 0 8px 22px rgba(22, 32, 51, .08);
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, .10), transparent 34%),
        linear-gradient(225deg, rgba(15, 159, 122, .10), transparent 30%),
        var(--page) !important;
    color: var(--ink);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .28);
    outline-offset: 3px;
}

.container {
    width: min(100%, 1440px);
    padding: clamp(10px, 2vw, 22px) !important;
}

.app-shell,
.login {
    background: rgba(255, 255, 255, .72) !important;
    border: 1px solid rgba(255, 255, 255, .88) !important;
    box-shadow: 0 22px 70px rgba(22, 32, 51, .12) !important;
}

.app-shell {
    border-radius: 28px !important;
}

.topbar {
    background: rgba(255, 255, 255, .82) !important;
}

.topbar-inner {
    padding: clamp(12px, 2vw, 20px) !important;
}

.brand-icon {
    border-radius: 18px !important;
    background: linear-gradient(135deg, var(--brand), var(--mint)) !important;
    box-shadow: 0 12px 26px rgba(37, 99, 235, .24);
}

.brand h1 {
    letter-spacing: 0;
}

.top-actions {
    align-items: center;
}

.top-pill,
.btn,
button {
    min-height: 46px;
    border-radius: 14px !important;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
    text-align: center;
}

.top-pill:hover,
.btn:hover,
button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-tight);
}

.main {
    padding: clamp(12px, 2vw, 24px) !important;
}

.hero {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px !important;
    margin-bottom: 18px !important;
}

.stat-card,
.card,
.cat-card {
    border: 1px solid rgba(217, 226, 239, .82) !important;
    box-shadow: var(--shadow-soft) !important;
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 112px;
    background: var(--panel) !important;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -24px -34px auto;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: rgba(37, 99, 235, .10);
}

.stat-label {
    color: var(--muted-ink) !important;
    font-size: .92rem !important;
}

.stat-value {
    color: var(--ink);
    font-size: clamp(1.55rem, 4vw, 2.35rem) !important;
}

.card {
    background: var(--panel) !important;
    border-radius: var(--radius) !important;
}

.card-body {
    padding: clamp(16px, 2.4vw, 26px) !important;
}

.section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-title h2 {
    font-size: clamp(1.2rem, 2vw, 1.55rem) !important;
}

.form-grid,
.check-grid {
    gap: 14px !important;
}

label {
    color: #26344d;
}

input[type="text"],
input[type="password"],
textarea,
select,
input[type="file"] {
    min-height: 50px;
    border-color: var(--line-soft) !important;
    border-radius: 14px !important;
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(22, 32, 51, .02);
}

textarea {
    line-height: 1.5;
}

.field-hint,
.small {
    color: var(--muted-ink) !important;
}

.check-item {
    min-height: 58px;
    border-radius: 14px !important;
    background: #f8fbff !important;
}

.check-item input {
    width: 20px;
    height: 20px;
    accent-color: var(--brand);
}

.file-box {
    border-radius: 16px !important;
    background: #f8fbff !important;
}

.preview img,
.upload-preview img {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--line-soft);
}

.upload-preview {
    display: none;
    margin-top: 12px;
}

.upload-preview.is-visible {
    display: block;
}

.notice {
    border-radius: 16px !important;
}

.notice.error {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

.filters {
    align-items: end;
}

.results-head h2 {
    font-size: clamp(1.25rem, 2vw, 1.6rem);
}

.view-switch {
    border: 1px solid #dbeafe;
}

.cat-card {
    background: var(--panel-solid) !important;
    border-radius: var(--radius) !important;
}

.cat-photo {
    background:
        linear-gradient(135deg, rgba(37, 99, 235, .08), rgba(15, 159, 122, .08)),
        #f8fbff !important;
}

.cat-photo img {
    object-fit: cover !important;
}

.list-view .cat-photo img {
    object-fit: contain !important;
}

.cat-name {
    color: var(--ink);
}

.badge {
    border: 1px solid rgba(255, 255, 255, .62);
}

.badge.zone {
    background: var(--brand-soft) !important;
}

.badge.success {
    background: #ddf8ec !important;
    color: #067647 !important;
}

.badge.warning {
    background: #fff4d6 !important;
    color: #8a5200 !important;
}

.badge.danger {
    background: #ffe4e0 !important;
    color: #b42318 !important;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 260px;
    padding: 28px;
    border: 1px dashed var(--line-soft);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .64);
    text-align: center;
}

.empty-state h3 {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.empty-state p {
    margin: 0 0 18px;
    color: var(--muted-ink);
}

.login {
    width: min(100%, 420px) !important;
    border-radius: 24px !important;
}

.login h1 {
    margin-bottom: 8px;
}

.login-subtitle {
    margin: 0 0 20px;
    color: var(--muted-ink);
}

.login button {
    background: linear-gradient(135deg, var(--brand), var(--mint)) !important;
}

@media (max-width: 920px) {
    .hero {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filters {
        grid-template-columns: 1fr 1fr !important;
    }

    .filters input[type="text"] {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    body {
        font-size: 16px !important;
    }

    .container {
        padding: 0 !important;
    }

    .app-shell {
        min-height: 100vh;
        border-radius: 0 !important;
        border-left: 0 !important;
        border-right: 0 !important;
    }

    .topbar {
        position: sticky;
        top: 0;
    }

    .topbar-inner {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .brand-icon {
        width: 46px !important;
        height: 46px !important;
    }

    .brand h1 {
        font-size: 1.08rem !important;
    }

    .brand p {
        font-size: .9rem !important;
    }

    .top-actions,
    .top-pill {
        width: 100%;
    }

    .hero {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        min-height: 88px;
        padding: 16px !important;
    }

    .section-title {
        display: block;
    }

    .form-grid,
    .check-grid,
    .filters {
        grid-template-columns: 1fr !important;
    }

    .filters input[type="text"] {
        grid-column: auto;
    }

    .actions,
    .cat-actions {
        position: sticky;
        bottom: 0;
        z-index: 10;
        margin: 16px -15px -18px;
        padding: 12px 15px calc(12px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, .92);
        border-top: 1px solid var(--line-soft);
        backdrop-filter: blur(14px);
    }

    .cat-actions {
        position: static;
        margin: 0;
        padding: 0;
        background: transparent;
        border: 0;
        backdrop-filter: none;
    }

    button,
    .btn {
        min-height: 52px !important;
        width: 100%;
    }

    .list.grid-view {
        gap: 14px !important;
    }

    .cat-photo {
        aspect-ratio: 1 / .86 !important;
    }
}
