.app-tabs {
    position: sticky;
    top: max(10px, env(safe-area-inset-top));
    z-index: 30;
    background: rgba(255, 253, 248, 0.88) !important;
    border-color: var(--jh-line) !important;
    box-shadow: 0 10px 30px rgba(81, 62, 28, 0.12) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.slip-meta-card {
    margin-bottom: 24px;
    padding: 18px;
    border-radius: var(--jh-radius);
}

.slip-meta-eyebrow {
    margin: 0 0 3px;
    color: var(--jh-gold);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.slip-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.slip-field {
    display: grid;
    gap: 7px;
    color: var(--jh-muted);
    font-size: 0.76rem;
    font-weight: 600;
}

.slip-field-date {
    grid-column: 1 / -1;
}

.draw-date-quick {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.draw-date-choice {
    display: grid;
    gap: 3px;
    min-height: 62px;
    padding: 10px 12px;
    text-align: left;
    border-radius: 13px;
}

.draw-date-choice span {
    font-size: 0.66rem;
    font-weight: 600;
}

.draw-date-choice strong {
    font-size: 0.9rem;
    font-weight: 700;
}

.draw-date-manual {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.thai-date-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #d4c4a8;
    border-radius: 12px;
    padding: 6px 14px;
    min-height: 42px;
    width: min(100%, 200px);
    margin: 0;
    cursor: pointer;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.thai-date-container:hover {
    border-color: #b9903d;
    background: #fffdf8;
}

.thai-date-display-box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.thai-date-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a3424;
    font-family: 'Prompt', sans-serif;
    pointer-events: none;
    text-align: center;
}

.thai-date-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.draw-date-manual-label,
.draw-date-rule {
    color: #8d8376;
    font-size: 0.65rem;
    font-weight: 400;
}

.draw-date-rule {
    margin: 0;
    line-height: 1.5;
}

.slip-field input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--jh-ink);
    background: #fff;
    border: 1px solid #ded4c4;
    border-radius: 12px;
    transition: border-color 0.25s ease-out, box-shadow 0.25s ease-out, background 0.25s ease-out;
}

.slip-field input:focus {
    border-color: var(--jh-gold);
    box-shadow: 0 0 0 4px rgba(183, 132, 23, 0.11);
}

.data-tools-actions {
    display: flex;
    flex: none;
    gap: 8px;
}

.data-tool-btn {
    min-height: 40px;
    padding: 9px 11px;
    color: var(--jh-gold-deep);
    background: #fffaf0;
    border: 1px solid #e4cb88;
    border-radius: 11px;
    font-size: 0.72rem;
    font-weight: 700;
    transition: transform 0.25s ease-out, background 0.25s ease-out, border-color 0.25s ease-out;
}

.data-tool-btn:hover {
    background: #f8edcc;
    border-color: var(--jh-gold);
    transform: translateY(-1px);
}

.preview-lottery-title {
    margin: 10px 0 0;
    color: #554a3b;
    font-size: 14px;
    font-weight: 700;
}

.list-item {
    overflow: hidden;
}

.edit-cancel-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px 16px;
    border: 1px solid var(--jh-line);
    border-radius: 12px;
    background: var(--jh-paper);
    color: var(--jh-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

.edit-cancel-btn.hidden {
    display: none;
}

.saved-entry-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.saved-entry-main {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.saved-entry-number {
    min-width: 0;
    font-size: 1.7rem !important;
    line-height: 1;
    letter-spacing: 0.035em !important;
    overflow-wrap: anywhere;
}

.saved-entry-meta,
.saved-entry-government-type {
    min-width: 0;
}

.saved-entry-value {
    display: grid;
    justify-items: end;
    min-width: 64px;
    padding-left: 12px;
    border-left: 1px solid rgba(125, 87, 13, 0.15);
    line-height: 1.2;
}

.saved-entry-value small {
    color: #9a8d7e;
    font-size: 0.58rem;
    font-weight: 500;
}

.saved-entry-value strong {
    margin-top: 3px;
    color: var(--jh-ink);
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 380px) {
    .saved-entry-row {
        gap: 8px;
    }

    .saved-entry-main {
        grid-template-columns: max-content minmax(0, 1fr) auto;
        gap: 8px;
    }

    .saved-entry-value {
        min-width: 54px;
        padding-left: 8px;
    }
}

.list-item .delete-btn {
    min-width: 40px;
    min-height: 40px;
}

/* Custom Scroll List with Gold Scrollbar & Peeking Height */
.custom-scroll-list {
    max-height: 285px !important;
    overflow-y: auto !important;
    padding-right: 4px;
    scroll-behavior: smooth;
}

/* Styled Gold Scrollbar */
.custom-scroll-list::-webkit-scrollbar {
    width: 6px;
}

.custom-scroll-list::-webkit-scrollbar-track {
    background: rgba(235, 222, 195, 0.4);
    border-radius: 10px;
}

.custom-scroll-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d4c4a8 0%, #caa045 100%);
    border-radius: 10px;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.15);
}

.custom-scroll-list::-webkit-scrollbar-thumb:hover {
    background: #a67c2e;
}

.custom-scroll-list {
    scrollbar-width: thin;
    scrollbar-color: #caa045 rgba(235, 222, 195, 0.4);
}

/* Wide cards waste horizontal space; turn the ledger into a balanced card grid. */
@media (min-width: 560px) {
    .custom-scroll-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .custom-scroll-list > .list-item {
        min-width: 0;
        margin-top: 0 !important;
        padding: 12px !important;
    }

    .custom-scroll-list > :not(.list-item) {
        grid-column: 1 / -1;
    }

    .custom-scroll-list > .list-item:last-child:nth-child(odd):not(:first-child) {
        grid-column: 1 / -1;
        justify-self: center;
        width: calc(50% - 5px);
    }

    .saved-entry-row {
        grid-template-columns: minmax(0, 1fr) 40px;
        gap: 8px;
    }

    .saved-entry-main {
        grid-template-columns: max-content minmax(0, 1fr);
        grid-template-areas:
            "number meta"
            "number value";
        gap: 5px 9px;
    }

    .saved-entry-number {
        grid-area: number;
        align-self: center;
        padding-left: 5px;
    }

    .saved-entry-meta,
    .saved-entry-government-type {
        grid-area: meta;
        align-self: end;
    }

    .saved-entry-value {
        grid-area: value;
        display: flex;
        align-items: baseline;
        justify-content: flex-start;
        min-width: 0;
        padding-left: 0;
        border-left: 0;
    }

    .saved-entry-value small {
        margin-right: 6px;
    }

    .saved-entry-value strong {
        margin-top: 0;
    }
}
