body {
    margin: 0;
    background-color: #e2c7be;
    background-image:
        linear-gradient(rgba(99,47,42,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99,47,42,.035) 1px, transparent 1px);
    background-size: 2px 2px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #A5665F;
    border-bottom: 1px solid #a8665c;
    z-index: 1000;
    transition: all .3s ease;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header.shrink .header-inner { padding: 6px 24px; }
.header.shrink { box-shadow: 0 2px 8px rgba(99,47,42,.12); }

.logo {
    color: #632f2a;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -.3px;
    cursor: pointer;
}

.nav {
    display: flex;
    gap: 14px;
    align-items: center;
}

.nav a {
    color: #632f2a;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
}

.login-btn {
    padding: 5px 11px;
    background: #93463c;
    color: #fff7ea;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: background .2s ease;
}

.login-btn:hover { background: #632f2a; }

.hero-space { height: 60px; }
.spacing-large { height: 40px; }

.footer {
    margin-top: 80px;
    padding: 40px 0;
    text-align: center;
    font-size: 12px;
    color: #632f2a;
}

/* Popup */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    opacity: 0;
    visibility: hidden;
    transition: .3s;
    z-index: 2000;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-container {
    position: fixed;
    top: 0;
    right: -360px;
    width: 360px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 12px rgba(0,0,0,.08);
    transition: .3s;
    z-index: 2001;
    display: flex;
    flex-direction: column;
}

.popup-container.active { right: 0; }

.popup-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.popup-close { cursor: pointer; }

.popup-body {
    padding: 16px;
    overflow-y: auto;
    height: calc(100vh - 60px);
}

.mock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.mock-table th,
.mock-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.mock-table th {
    background: #fafafa;
    font-weight: 600;
}

.popup-body > div:first-child {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

#imagePreviewList img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

/* Keypad */
.keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.key {
    padding: 18px 0;
    background: #1e1e1e;
    color: #fff;
    text-align: center;
    border-radius: 14px;
    font-size: 18px;
    cursor: pointer;
    user-select: none;
    transition: all .15s ease;
}

.key:hover { background: #333; }
.key:active { transform: scale(.95); }
.key:last-child { background: #4caf50; }
.key:nth-last-child(2) { background: #e53935; }

.popup-container.popup-large {
    width: 80vw;
    max-width: 1200px;
    height: 100%;
    right: 0;
    left: auto;
    transform: none;
    border-radius: 0;
}

#imagePreview {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,.95);
    z-index: 20000;
}

#imagePreview img {
    max-width: 90%;
    max-height: 90%;
}

#popupForm .popup-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#popupForm .popup-body > div {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

#imagePreviewList {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    padding-bottom: 90px;
}

#popupForm button { min-height: 42px; }

#popupForm .form-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 12px;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid #eee;
    margin-top: auto;
}

/* Cat images */
.cat-item img {
    filter:
        sepia(.58)
        saturate(.72)
        contrast(.78)
        brightness(1.05);
    transition: all .25s ease;
}

.cat-item img:hover {
    filter:
        sepia(.34)
        saturate(.9)
        contrast(.88)
        brightness(1.02);
    transform: scale(1.03);
}

@media (min-width: 768px) {
    .keypad-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
    }

    .key {
        padding: 12px 0;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .header-inner { padding: 14px 20px; }
    .hero-space { height: 80px; }

    .keypad-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .key {
        padding: 14px 0;
        font-size: 16px;
        border-radius: 12px;
    }

    .popup-container.popup-large { width: 100%; }
    .form-actions { margin-bottom: 80px; }
}