:root {
    --op-gold: #FFD700;
    --op-gold-dark: #B8860B;
    --op-red: #8B0000;
    --op-ocean: #003366;
}

body {
    background-color: #0b1121;
    line-height: 1.5;
}

body.modal-open {
    overflow: hidden;
}

.vault-language-switcher {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 260;
    display: inline-flex;
    gap: 0.25rem;
    padding: 0.25rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.8rem;
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 14px 35px rgba(2, 6, 23, 0.4);
    backdrop-filter: blur(12px);
}

.vault-language-switcher button {
    min-width: 2.6rem;
    min-height: 2rem;
    border: 0;
    border-radius: 0.6rem;
    padding: 0.35rem 0.6rem;
    color: #cbd5e1;
    font-size: 0.75rem;
    font-weight: 800;
    background: transparent;
    cursor: pointer;
}

.vault-language-switcher button.active {
    color: #0f172a;
    background: #facc15;
}

@media (max-width: 640px) {
    .vault-language-switcher {
        right: 0.75rem;
        bottom: 0.75rem;
    }
}

.font-pirata {
    font-family: 'Pirata One', system-ui, cursive;
}

.font-inter {
    font-family: 'Inter', sans-serif;
}

/* Ocean Background Effect */
.ocean-bg {
    background: radial-gradient(circle at top right, #1a2a40 0%, #080d1a 100%);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%231f2f47' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-attachment: fixed;
}

/* Wanted Poster Style for Login */
.wanted-poster {
    background: #e8dcc4;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.08'/%3E%3C/svg%3E");
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 60px rgba(139, 69, 19, 0.4);
    border: 8px solid #c4a484; /* Slightly thinner for mobile */
    border-radius: 4px;
    margin: auto;
}

@media (min-width: 768px) {
    .wanted-poster {
        border-width: 12px;
    }
}

.wanted-title {
    text-shadow: 2px 2px 0px rgba(0,0,0,0.15);
    letter-spacing: 0.1em;
    font-weight: normal;
}

@media (max-width: 640px) {
    .wanted-title {
        font-size: 3.5rem; /* Shrink title slightly on very small phones */
    }
}

/* One Piece Themed Animations & Effects */
@keyframes hakiGlow {
    0% { box-shadow: 0 0 5px rgba(234, 179, 8, 0.2); }
    50% { box-shadow: 0 0 20px rgba(234, 179, 8, 0.5); }
    100% { box-shadow: 0 0 5px rgba(234, 179, 8, 0.2); }
}

@keyframes shipRock {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-2px) rotate(0.5deg); }
    75% { transform: translateY(2px) rotate(-0.5deg); }
}

.haki-border:focus {
    animation: hakiGlow 2s infinite ease-in-out;
    border-color: var(--op-gold) !important;
}

/* Premium Dark Mode Surface */
.bg-dark-surface {
    background-color: #0f172a; /* Deep Navy Dark */
    background-image: linear-gradient(to bottom right, rgba(255,255,255,0.02), transparent);
}

/* Responsive Grid Improvements */
#vaultGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

#vaultLoadingState {
    display: grid;
    gap: 1.25rem;
}

#vaultLoadingState.hidden {
    display: none;
}

.vault-loading-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.3rem;
    border: 1px solid rgba(234, 179, 8, 0.16);
    border-radius: 1.35rem;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.84)),
        radial-gradient(circle at top left, rgba(234, 179, 8, 0.12), transparent 46%);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.22);
}

.vault-loading-wheel {
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #facc15;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(250, 204, 21, 0.24);
    animation: vaultSpin 1.1s linear infinite;
    flex-shrink: 0;
}

.vault-loading-title {
    margin: 0;
    color: #facc15;
    font-family: 'Pirata One', system-ui, cursive;
    font-size: 1.75rem;
    line-height: 1.1;
}

.vault-loading-copy {
    margin: 0.35rem 0 0;
    color: #cbd5e1;
    font-size: 0.92rem;
}

.vault-loading-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 1rem;
}

.vault-skeleton-card {
    min-height: 14rem;
    border-radius: 1.35rem;
    border: 1px solid rgba(148, 163, 184, 0.12);
    background:
        linear-gradient(110deg, rgba(30, 41, 59, 0.95) 8%, rgba(51, 65, 85, 0.82) 18%, rgba(30, 41, 59, 0.95) 33%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.88));
    background-size: 220% 100%, 100% 100%;
    animation: vaultSkeletonPulse 1.35s ease-in-out infinite;
    box-shadow: 0 16px 36px rgba(2, 6, 23, 0.2);
}

@keyframes vaultSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes vaultSkeletonPulse {
    0% { background-position: 200% 0, 0 0; opacity: 0.82; }
    50% { opacity: 1; }
    100% { background-position: -20% 0, 0 0; opacity: 0.82; }
}

.dashboard-main {
    padding-bottom: 3rem;
}

.vault-nav-shell {
    gap: 1rem;
}

.vault-actions {
    flex-wrap: nowrap;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.vault-actions::-webkit-scrollbar {
    display: none;
}

.vault-actions > a,
.vault-actions > button,
.vault-actions > form {
    flex: 0 0 auto;
}

.new-treasure-btn {
    justify-content: center;
    white-space: nowrap;
}

.filter-strip {
    padding: 0.9rem;
    border: 1px solid rgba(234, 179, 8, 0.14);
    border-radius: 1.4rem;
    background:
        linear-gradient(135deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.82)),
        radial-gradient(circle at top left, rgba(234, 179, 8, 0.14), transparent 48%);
    box-shadow: 0 20px 45px rgba(2, 6, 23, 0.32);
}

.filter-btn {
    min-height: 2.75rem;
}

.search-shell {
    display: flex;
}

.search-bar {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 1.35rem;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.84)),
        radial-gradient(circle at top right, rgba(234, 179, 8, 0.12), transparent 42%);
    box-shadow: 0 20px 45px rgba(2, 6, 23, 0.22);
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.95rem;
    color: #94a3b8;
    pointer-events: none;
}

.search-input {
    width: 100%;
    min-width: 0;
    padding: 0.9rem 2.8rem 0.9rem 2.7rem;
    border-radius: 1rem;
    border: 1px solid rgba(71, 85, 105, 0.9);
    background: rgba(15, 23, 42, 0.88);
    color: #f8fafc;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.search-input::placeholder {
    color: #64748b;
}

.search-input:focus {
    border-color: rgba(234, 179, 8, 0.9);
    background: rgba(15, 23, 42, 0.96);
}

.clear-search-btn {
    position: absolute;
    right: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    color: #cbd5e1;
    background: rgba(51, 65, 85, 0.7);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.clear-search-btn:hover {
    color: #fff;
    background: rgba(71, 85, 105, 0.95);
    transform: scale(1.05);
}

.search-meta {
    margin-top: 0.7rem;
    color: #94a3b8;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.contacts-hero {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.82)),
        radial-gradient(circle at top right, rgba(16, 185, 129, 0.18), transparent 42%),
        radial-gradient(circle at bottom left, rgba(234, 179, 8, 0.12), transparent 35%);
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.3);
}

.contacts-tools-nav {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.contacts-tools-nav-head {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.contacts-tools-nav-row {
    display: flex;
    gap: 0.7rem;
    overflow-x: auto;
    padding-bottom: 0.1rem;
    scrollbar-width: none;
}

.contacts-tools-nav-row::-webkit-scrollbar {
    display: none;
}

.contacts-tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    white-space: nowrap;
    min-height: 2.8rem;
    padding: 0.78rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(234, 179, 8, 0.2);
    background: rgba(15, 23, 42, 0.78);
    color: #e2e8f0;
    font-size: 0.88rem;
    font-weight: 700;
    transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.contacts-tool-chip:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(234, 179, 8, 0.44);
    color: #fff;
    transform: translateY(-1px);
}

.contacts-panel,
.contacts-side-card {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(15, 23, 42, 0.84)),
        radial-gradient(circle at top right, rgba(148, 163, 184, 0.08), transparent 45%);
    box-shadow: 0 20px 48px rgba(2, 6, 23, 0.28);
}

.contacts-list {
    min-height: 18rem;
}

.contacts-item {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.52), rgba(15, 23, 42, 0.2));
}

.contacts-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f8fafc;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(234, 179, 8, 0.22));
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.contacts-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    border-radius: 9999px;
    border: 1px solid rgba(71, 85, 105, 0.8);
    background: rgba(15, 23, 42, 0.85);
    color: #cbd5e1;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.contacts-link,
.contacts-info {
    display: inline-flex;
    align-items: flex-start;
    max-width: 100%;
    color: #e2e8f0;
    font-size: 0.92rem;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.contacts-link--phone {
    padding: 0.6rem 0.8rem;
    border-radius: 0.95rem;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(34, 197, 94, 0.18);
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.contacts-link--phone:hover {
    background: rgba(15, 23, 42, 0.96);
    border-color: rgba(34, 197, 94, 0.45);
    transform: translateY(-1px);
}

.contacts-notes {
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(71, 85, 105, 0.55);
    color: #cbd5e1;
    font-size: 0.88rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.contacts-action-btn {
    width: 2.6rem;
    height: 2.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.9rem;
    border: 1px solid rgba(71, 85, 105, 0.75);
    background: rgba(15, 23, 42, 0.88);
    color: #cbd5e1;
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.contacts-action-btn:hover {
    transform: translateY(-1px);
    color: #facc15;
    border-color: rgba(250, 204, 21, 0.55);
}

.contacts-action-btn--danger:hover {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.55);
}

.duplicate-card {
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(71, 85, 105, 0.65);
    background: rgba(15, 23, 42, 0.78);
}

.duplicate-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.9rem;
    background: rgba(2, 6, 23, 0.45);
}

.normalize-help-text {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.5;
}

.normalize-preview-card {
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(71, 85, 105, 0.65);
    background: rgba(15, 23, 42, 0.78);
}

.normalize-preview-card--excluded {
    opacity: 0.72;
    border-color: rgba(100, 116, 139, 0.55);
}

.normalize-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin-top: 0.9rem;
}

.normalize-preview-label {
    font-size: 0.68rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 0.45rem;
}

.normalize-preview-values {
    padding: 0.8rem;
    border-radius: 0.9rem;
    background: rgba(2, 6, 23, 0.45);
    border: 1px solid rgba(71, 85, 105, 0.45);
    color: #e2e8f0;
    font-size: 0.84rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.normalize-preview-toggle {
    padding: 0.38rem 0.7rem;
    border-radius: 9999px;
    border: 1px solid rgba(234, 179, 8, 0.4);
    background: rgba(234, 179, 8, 0.12);
    color: #fde68a;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.normalize-preview-toggle:hover {
    background: rgba(234, 179, 8, 0.2);
}

.normalize-preview-toggle--excluded {
    border-color: rgba(148, 163, 184, 0.4);
    background: rgba(51, 65, 85, 0.4);
    color: #cbd5e1;
}

@media (max-width: 640px) {
    .contacts-item {
        padding: 1rem;
    }

    .contacts-link--phone {
        width: 100%;
        justify-content: flex-start;
    }

    .normalize-preview-grid {
        grid-template-columns: 1fr;
    }
}

.image-picker-preview {
    display: grid;
    gap: 0.75rem;
}

.file-picker-preview {
    display: grid;
    gap: 0.75rem;
}

.file-drop-zone {
    border: 1px dashed rgba(71, 85, 105, 0.7);
    border-radius: 1rem;
    padding: 0.85rem;
    background: rgba(15, 23, 42, 0.28);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.file-drop-zone.drag-active {
    border-color: rgba(234, 179, 8, 0.95);
    background: rgba(234, 179, 8, 0.08);
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.12);
}

.file-status-text {
    font-size: 0.75rem;
    color: #94a3b8;
    letter-spacing: 0.04em;
}

.file-meta-line {
    font-size: 0.75rem;
    color: #94a3b8;
}

.image-thumb-box {
    width: 100%;
    max-width: 100%;
    min-height: 10rem;
    max-height: 14rem;
    padding: 0.75rem;
    border-radius: 1rem;
    border: 1px solid rgba(71, 85, 105, 0.7);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.82)),
        radial-gradient(circle at top right, rgba(234, 179, 8, 0.08), transparent 45%);
    overflow: hidden;
}

.image-thumb-fit {
    width: 100%;
    height: 100%;
    max-height: 12rem;
    object-fit: contain;
    display: block;
    border-radius: 0.75rem;
}

.pdf-thumb-box {
    width: 100%;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(71, 85, 105, 0.7);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.82)),
        radial-gradient(circle at top right, rgba(248, 113, 113, 0.1), transparent 45%);
}

.pdf-thumb-inner {
    min-height: 8.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-align: center;
}

.image-thumb-button {
    width: 100%;
    display: block;
    background: transparent;
}

.image-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.image-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.9rem;
    border-radius: 0.8rem;
    border: 1px solid rgba(71, 85, 105, 0.75);
    background: rgba(15, 23, 42, 0.86);
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 700;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.image-action-btn:hover {
    border-color: rgba(234, 179, 8, 0.7);
    color: #fff;
}

.lightbox-shell {
    border-radius: 1.35rem;
    border: 1px solid rgba(71, 85, 105, 0.7);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.92)),
        radial-gradient(circle at top right, rgba(234, 179, 8, 0.08), transparent 42%);
    padding: 1rem;
    box-shadow: 0 28px 70px rgba(2, 6, 23, 0.55);
}

.lightbox-image {
    width: 100%;
    max-height: min(78vh, 60rem);
    object-fit: contain;
    border-radius: 1rem;
    display: block;
    background: rgba(2, 6, 23, 0.55);
}

.lightbox-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.9rem;
}

#addModalContent,
#editModalContent,
#viewModalContent {
    max-width: min(42rem, calc(100vw - 2rem));
}

#historyModalContent,
#settingsModalContent {
    max-width: min(36rem, calc(100vw - 2rem));
}

.vault-toast {
    backdrop-filter: blur(12px);
}

@media (min-width: 768px) {
    #vaultGrid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 1.5rem;
    }

    .vault-nav-shell {
        min-height: 5rem;
    }

    .filter-strip {
        padding: 1rem 1.1rem;
    }

    .search-bar {
        padding: 1rem 1.1rem;
    }
}

@media (max-width: 1023px) {
    .vault-nav-shell {
        height: auto !important;
        min-height: 0;
        align-items: stretch !important;
        flex-direction: column !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .vault-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        overflow: visible;
        padding-bottom: 0;
    }

    .new-treasure-btn {
        flex: 1 1 12rem;
        min-width: 12rem;
    }
}

@media (min-width: 1280px) {
    #vaultGrid {
        grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    }
}

@media (max-width: 640px) {
    #vaultGrid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .treasure-card {
        margin-bottom: 0.5rem;
    }

    .treasure-card:hover {
        transform: none;
    }
}

@media (max-width: 640px) {
    .category-filters {
        margin-inline: -0.25rem;
        padding-inline: 0.25rem;
        padding-bottom: 0;
    }

    .filter-strip {
        padding: 0.7rem;
        border-radius: 1.1rem;
    }

    .search-bar {
        padding: 0.75rem;
        border-radius: 1.1rem;
    }

    .search-input {
        padding: 0.85rem 2.65rem 0.85rem 2.45rem;
        font-size: 0.92rem;
    }

    .search-icon {
        left: 0.85rem;
    }

    .search-meta {
        margin-top: 0.6rem;
        font-size: 0.72rem;
        line-height: 1.4;
    }

    .image-thumb-box {
        min-height: 8.5rem;
        max-height: 11rem;
        padding: 0.55rem;
    }

    .image-thumb-fit {
        max-height: 9.8rem;
    }

    .pdf-thumb-box {
        padding: 0.85rem;
    }

    .pdf-thumb-inner {
        min-height: 7.5rem;
    }

    .file-drop-zone {
        padding: 0.7rem;
    }

    .image-action-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .image-action-btn {
        width: 100%;
    }

    .lightbox-shell {
        padding: 0.7rem;
        border-radius: 1rem;
    }

    .lightbox-image {
        max-height: 72vh;
        border-radius: 0.8rem;
    }

    .vault-actions {
        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        width: 100%;
        gap: 0.55rem;
        justify-content: stretch;
    }

    .vault-actions > a,
    .vault-actions > button:not(.new-treasure-btn),
    .vault-actions > form {
        order: 1;
        width: 100%;
        min-width: 0;
    }

    .vault-actions > a,
    .vault-actions > button:not(.new-treasure-btn),
    .vault-actions > form > button {
        width: 100% !important;
        height: 2.75rem !important;
        border-radius: 0.75rem !important;
    }

    .new-treasure-btn {
        grid-column: 1 / -1;
        order: 2;
        width: 100%;
        min-width: 0;
        min-height: 2.85rem;
    }

    #addModal,
    #editModal,
    #viewModal,
    #settingsModal,
    #historyModal {
        align-items: stretch;
        justify-content: stretch;
        padding: 0;
    }

    #addModalContent,
    #editModalContent,
    #viewModalContent,
    #settingsModalContent,
    #historyModalContent {
        width: 100vw;
        max-width: none;
        max-height: 100dvh;
        min-height: 100dvh;
        height: 100dvh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }

    #addModalContent .p-6,
    #editModalContent .p-6,
    #viewModalContent .p-6,
    #settingsModalContent .p-6,
    #historyModalContent .p-6 {
        padding: 0.85rem 0.85rem 1rem;
    }

    .mobile-modal-shell > :first-child {
        padding: 0.9rem 0.85rem 0.75rem;
    }

    .mobile-modal-shell h3 {
        font-size: 1.15rem;
        line-height: 1.2;
    }

    .mobile-modal-actions {
        position: sticky;
        bottom: -1rem;
        margin: 0 -0.85rem -1rem;
        padding: 0.85rem;
        background: linear-gradient(to top, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.92));
        border-top: 1px solid rgba(148, 163, 184, 0.18);
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .mobile-modal-actions button,
    .mobile-modal-actions a {
        min-height: 3rem;
        width: 100%;
        justify-content: center;
    }

    #addForm,
    #editForm,
    #settingsForm {
        gap: 1rem;
    }

    #addForm input,
    #addForm textarea,
    #addForm select,
    #editForm input,
    #editForm textarea,
    #editForm select,
    #settingsForm input,
    #settingsForm textarea,
    #settingsForm select {
        font-size: 16px;
    }

    #dynamicFields,
    #editDynamicFields {
        padding: 0.75rem;
    }

    nav .font-pirata {
        font-size: 1.5rem !important;
        line-height: 1.1;
    }

    .vault-brand {
        width: 100%;
        justify-content: center;
    }

    nav .font-pirata i {
        margin-right: 0.65rem !important;
    }

    main {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .filter-btn {
        font-size: 0.78rem;
        padding-inline: 0.85rem !important;
    }

    #toast {
        left: 0.75rem !important;
        right: 0.75rem !important;
        bottom: 0.75rem !important;
        padding: 0.9rem 1rem !important;
    }
}

/* Treasure Card Animation */
.treasure-card {
    background:
        linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98)),
        radial-gradient(circle at top, rgba(234, 179, 8, 0.06), transparent 55%);
    border: 1px solid rgba(255, 215, 0, 0.08);
    border-radius: 1.35rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 16px 32px rgba(2, 6, 23, 0.24);
}

.compact-card {
    justify-content: space-between;
    min-height: 10.5rem;
}

.card-header {
    align-items: flex-start;
}

.card-title-wrap {
    min-width: 0;
}

.card-title-block {
    min-width: 0;
}

.card-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.card-actions {
    align-self: flex-start;
    padding: 0.2rem;
    border-radius: 0.85rem;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.14);
}

.note-detail-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.note-detail-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.note-detail-text {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.compact-card-hint {
    padding-top: 0.85rem;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.treasure-card:hover {
    transform: scale(1.02) translateY(-5px);
    border-color: var(--op-gold);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4), 0 0 15px rgba(234, 179, 8, 0.2);
    z-index: 10;
}

@media (max-width: 640px) {
    .contacts-tools-nav {
        position: sticky;
        top: 5.15rem;
        z-index: 20;
        margin-top: -0.25rem;
        backdrop-filter: blur(12px);
    }

    .contacts-tool-chip {
        padding: 0.72rem 0.9rem;
        font-size: 0.8rem;
    }

    .card-header {
        gap: 0.75rem;
    }

    .card-actions {
        flex-direction: column;
    }

    .note-detail-card {
        padding: 0.9rem;
        border-radius: 0.95rem;
    }

    .note-detail-toolbar {
        margin-bottom: 0.65rem;
    }

    .note-detail-text {
        font-size: 0.92rem;
        line-height: 1.65;
    }
}

/* Modal "Chest" Animation */
.modal-open-anim {
    animation: chestOpen 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes chestOpen {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Den Den Mushi Settings Icon Vibration */
.fa-phone-volume {
    display: inline-block;
}
button:hover .fa-phone-volume {
    animation: shipRock 0.5s infinite linear;
}

/* Button "Gear Second" Effect */
.btn-gear-second {
    position: relative;
    overflow: hidden;
}
.btn-gear-second::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: 0.5s;
    left: -100%;
}
.btn-gear-second:hover::after {
    left: 100%;
}


.copy-btn {
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
}
.copy-btn:hover {
    color: var(--op-gold);
    background: rgba(255, 215, 0, 0.15);
    transform: scale(1.1);
}
.copy-btn:active {
    transform: scale(0.95);
}

/* Hide scrollbar for category filters but keep functionality */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Custom Scrollbar for page */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: #0b1121;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 5px;
    border: 2px solid #0b1121;
}
::-webkit-scrollbar-thumb:hover {
    background: #eab308;
}

/* Input styles */
input:focus, textarea:focus, select:focus {
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2);
}

.ai-workspace-hero {
    background:
        linear-gradient(135deg, rgba(8, 47, 73, 0.96), rgba(15, 23, 42, 0.88)),
        radial-gradient(circle at top right, rgba(34, 211, 238, 0.18), transparent 38%),
        radial-gradient(circle at bottom left, rgba(250, 204, 21, 0.12), transparent 34%);
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.3);
}

.ai-panel {
    box-shadow: 0 18px 42px rgba(2, 6, 23, 0.24);
}

.ai-rule-card {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.ai-warning-stack {
    display: grid;
    gap: 0.75rem;
    width: min(100%, 24rem);
}

.ai-image-list {
    display: grid;
    gap: 0.85rem;
}

.ai-image-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.8rem;
    border-radius: 1rem;
    border: 1px solid rgba(71, 85, 105, 0.7);
    background: rgba(15, 23, 42, 0.82);
}

.ai-image-thumb {
    width: 4rem;
    height: 4rem;
    object-fit: cover;
    border-radius: 0.85rem;
    border: 1px solid rgba(71, 85, 105, 0.7);
    flex-shrink: 0;
}

.ai-image-remove {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.22);
    border: 1px solid rgba(239, 68, 68, 0.2);
    flex-shrink: 0;
}

.ai-image-remove:hover {
    background: rgba(127, 29, 29, 0.34);
}

@media (max-width: 640px) {
    .ai-workspace-hero {
        padding: 1.15rem;
        border-radius: 1.35rem;
    }

    .ai-panel {
        border-radius: 1.25rem;
    }
}
