﻿:root {
    /* Hallmark Â· macrostructure: Workbench Â· tone: utilitarian Â· anchor hue: violet 290Â° */
    /* === Spacing scale (4pt) === */
    --space-3xs: 0.25rem; --space-2xs: 0.5rem; --space-xs: 0.75rem;
    --space-sm: 1rem; --space-md: 1.5rem; --space-lg: 2rem;
    --space-xl: 3rem; --space-2xl: 4.5rem;
    /* === Typography === */
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-family: var(--font-body);
    /* === Easings === */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --dur-short: 180ms; --dur-mid: 250ms;
    /* === Dark Theme === */
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --border-color: rgba(148, 163, 184, 0.18);
    --shadow-color: rgba(0, 0, 0, 0.35);
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-color: #7c3aed;
    --accent-hover: #8b5cf6;
    --accent-soft: rgba(124, 58, 237, 0.12);
    --input-bg: #0b1220;
    --input-focus-bg: #0f172a;
    --primary-color: #7c3aed;
    --primary-hover: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-soft: rgba(16, 185, 129, 0.14);
    --danger-soft: rgba(239, 68, 68, 0.14);
    --warning-soft: rgba(245, 158, 11, 0.14);
    --overlay-bg: rgba(15, 23, 42, 0.85);
    --border-radius: 12px;
}

/* === Skeleton loading === */
.skeleton {
    background: linear-gradient(90deg, var(--card-bg) 25%, var(--border-color) 50%, var(--card-bg) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 0.9rem;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-block {
    height: 3rem;
    margin-bottom: 0.75rem;
}

.skeleton-img {
    width: 100%;
    aspect-ratio: 16 / 9;
}

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
        background: var(--card-bg);
    }
}


[data-theme="light"] {
    --bg-color: #f8fafc;
    --card-bg: #f1f5f9;
    --border-color: rgba(15, 23, 42, 0.12);
    --shadow-color: rgba(15, 23, 42, 0.08);
    --text-color: #0f172a;
    --text-muted: #475569;
    --accent-color: #6d28d9;
    --accent-hover: #7c3aed;
    --accent-soft: rgba(109, 40, 217, 0.08);
    --input-bg: #f8fafc;
    --input-focus-bg: #f1f5f9;
    --primary-color: #6d28d9;
    --primary-hover: #7c3aed;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --success-soft: rgba(5, 150, 105, 0.10);
    --danger-soft: rgba(220, 38, 38, 0.10);
    --warning-soft: rgba(217, 119, 6, 0.10);
    --overlay-bg: rgba(15, 23, 42, 0.45);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: clip;
    scrollbar-color: var(--text-muted) transparent;        /* Firefox */
    scrollbar-width: thin;                                  /* Firefox */
}
html::-webkit-scrollbar {
    width: 10px;                                            /* Webkit/Chromium */
    height: 10px;
}
html::-webkit-scrollbar-track {
    background: transparent;
}
html::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border: 2px solid var(--bg-color);
    border-radius: 6px;
}
html::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

body {
    font-family: var(--font-body);
    background: var(--bg-color);
    min-height: 100vh;
    color: var(--text-color);
    padding: var(--space-md);
    overflow-x: clip;
    margin: 0;
}

/* === Split layout (Workbench) â€” flush-left === */
.app-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-md);
    width: 100%;
    margin: 0;
    min-width: 0;
}

@media (min-width: 1025px) {
    .app-container {
        grid-template-columns: minmax(0, 520px) minmax(0, 1fr);
        gap: var(--space-lg);
        /* #6: scroll independen â€” grid container tidak scroll, tiap panel scroll sendiri */
        height: calc(100vh - var(--space-md) * 2 - 1px);
        overflow: hidden;
        align-items: stretch;
    }
    .form-panel {
        height: 100%;
        overflow-y: auto;
        scrollbar-width: thin;
        overscroll-behavior: contain;
    }
    .preview-panel {
        align-self: stretch;
        display: flex;
        flex-direction: column;
        height: 100%;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .preview-panel .preview-empty {
        flex: 1;
        justify-content: center;
    }
    .preview-panel .preview-wrapper {
        flex: 1;
    }
}

/* Glass Card -> Solid Card */
/* Glass Card -> Solid Card */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    /* Critical: Added padding to prevent content from hitting edges */
}

.glass-card:hover {
    box-shadow: 0 12px 40px 0 var(--shadow-color);
}

/* Header & Controls */
header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.025em;
    color: var(--text-color);
}

/* Form Elements */
.input-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

input,
button,
select,
textarea {
    width: 100%;
    max-width: 100%;
    /* CRITICAL: Prevent overflow */
    box-sizing: border-box;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    /* transition: all 0.2s ease; -> Removed for performance */
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input:focus,
select:focus {
    background: var(--input-focus-bg);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.file-upload-label {
    width: 100%;
    /* Same styles as input */
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
    /* Center Content */
    display: flex;
    align-items: center;
    justify-content: center;
    /* transition: all 0.2s ease; -> Removed */
    margin: 0 !important;
    /* Override potential margins */
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.file-upload-label:hover {
    background: var(--input-focus-bg);
    border-color: var(--accent-color);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 5px;
    outline: none;
    padding: 0;
    margin: 10px 0;
    border: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.time-range {
    display: flex;
    gap: 1rem;
    min-width: 0;
    width: 100%;
}
.time-range input[type="time"] {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}
.time-range span {
    flex-shrink: 0;
    align-self: center;
}

/* Buttons */
.btn-primary {
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
    border: none;
    cursor: pointer;
    margin-top: 1rem;
    border-radius: var(--border-radius);
    /* transition: all 0.2s ... -> Removed */
}

.btn-primary:hover {
    filter: brightness(1.1);
    /* transform: translateY(-1px); -> Removed */
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    border-radius: var(--border-radius);
}

.btn-secondary:hover {
    background: var(--input-focus-bg);
    border-color: var(--text-muted);
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    width: auto;
    padding: 0.5rem;
}

.theme-toggle:hover {
    background: var(--accent-soft);
    color: var(--accent-color);
}

/* Preview Area */
.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 400px;
    position: relative;
    overflow: hidden auto;
    overscroll-behavior: contain;
    max-height: 100vh;
}
.preview-container > * {
    /* ganti justify-content:center â€” flex centering + overflow memotong konten atas yang tak terjangkau scroll */
    margin: auto;
}

#resultCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
}

/* Editor & Image Handling */
.hidden {
    display: none !important;
}
.show-inline {
    visibility: visible;
    pointer-events: auto;
}

.editor-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    /* Solid dark, minimal alpha */
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* Full screen, internal constraints handle padding */
    overflow: hidden;
    /* Main area handles scroll if needed */
}

.editor-container.hidden {
    display: flex !important;
    /* Keep flex for transition */
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
    visibility: hidden;
    /* Hide after transition */
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

/* Color Picker Modal â€” Theme-aware */
#colorPickerModal {
    background: var(--overlay-bg);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    display: flex;
}

#colorPickerModal .glass-card {
    width: 100%;
    max-width: 400px;
    margin: 0;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px var(--shadow-color);
}

#colorPickerModal .cp-header {
    text-align: center;
    margin-bottom: 2rem;
}

#colorPickerModal .cp-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 0;
}

#colorPickerModal .cp-preview-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 3rem;
}

#colorPickerModal #cpPreview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: #1313ec;
    box-shadow: 0 0 40px rgba(19, 19, 236, 0.4);
    border: 4px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#colorPickerModal .cp-preview-badge {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 36px;
    height: 36px;
    background: var(--card-bg);
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

#colorPickerModal .cp-preview-badge i {
    color: var(--text-muted);
    font-size: 16px;
}

#colorPickerModal .cp-slider-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

#colorPickerModal .cp-slider {
    position: relative;
    height: 12px;
    width: 100%;
    border-radius: 9999px;
    background: linear-gradient(to right, #000000 0%, #ff0000 100%);
    cursor: pointer;
}

#colorPickerModal .cp-handle {
    position: absolute;
    top: 50%;
    width: 24px;
    height: 24px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 4px 6px -1px var(--shadow-color);
    left: 0%;
}

#colorPickerModal .cp-hex-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.5rem;
}

#colorPickerModal #cpHexInput {
    width: 100%;
    background: transparent;
    border: none;
    text-align: center;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-color);
    outline: none;
    padding: 0;
    font-family: var(--font-family);
}

#colorPickerModal .cp-hex-underline {
    height: 3px;
    width: 40px;
    background: var(--accent-soft);
    border-radius: 9999px;
    margin: 0.5rem auto 0;
}

#colorPickerModal .cp-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

#colorPickerModal #cancelColorBtn {
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#colorPickerModal #cancelColorBtn:hover {
    color: var(--text-color);
}

#colorPickerModal #saveColorBtn {
    color: var(--accent-color);
    font-weight: 700;
}

#colorPickerModal #saveColorBtn:hover {
    color: var(--accent-hover);
}

.cropper-wrapper {
    width: 100%;
    height: 100%;
    /* Fill main area absolutely */
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    background: #000;
    box-shadow: none;
    /* Shadow less useful in full screen */
    overflow: hidden;
}

#imagePreview {
    display: block;
    max-width: 100%;
    max-height: 100%;
    /* Critical for Flex layout to work */
}

/* --- New App-Style Editor --- */
.editor-header {
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 20;
}

.editor-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.editor-main {
    flex: 1;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    overflow: hidden;
    padding: 1rem;
}

.editor-footer {
    width: 100%;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    /* Vertical padding only */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 20;
}

.toolbar-scroll {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 0 1.5rem;
    /* Horizontal padding for scroll ends */
    width: 100%;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    align-items: center;
}

.toolbar-scroll::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.btn-tool-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    min-width: 60px;
    /* Ensure touch target size */
    cursor: pointer;
    transition: all 0.2s;
}

.btn-tool-col:hover .icon-box {
    background: var(--input-focus-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-tool-col:hover .tool-caption {
    color: var(--text-color);
}

.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.tool-caption {
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.divider-vertical {
    width: 1px;
    height: 32px;
    background: var(--border-color);
    flex-shrink: 0;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-ghost:hover {
    color: var(--text-color);
    background: var(--accent-soft);
    border-radius: 50%;
}

.editor-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    /* Prevent controls from squishing */
}

.editor-controls .btn-icon {
    width: 48px;
    height: 48px;
    background: transparent;
    color: var(--text-color);
    font-size: 1.1rem;
    border: 1px solid transparent;
    transition: background var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}

.editor-controls .btn-icon:hover {
    background: var(--accent-soft);
    color: var(--accent-color);
}

#closeEditorBtn {
    background: var(--accent-color) !important;
    border: none !important;
    box-shadow: 0 4px 10px var(--accent-soft);
}

#closeEditorBtn:hover {
    background: var(--accent-hover) !important;
    box-shadow: 0 6px 15px var(--accent-soft);
}

.editor-controls .btn-icon:hover {
    background: var(--primary-color);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--accent-color);
    color: var(--color-accent-ink, #fff);
}

/* Adjust Canvas for Mobile */
.preview-container canvas {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.section-title {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--text-color);
    text-align: center;
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
    flex-wrap: wrap;
}

.actions button {
    flex: 1;
}

/* Make sure file input looks okay */
input[type="file"] {
    background: var(--input-bg);
    padding: 0.5rem;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    margin-right: 1rem;
    background: var(--accent-color);
    border: none;
    color: var(--color-accent-ink, #fff);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: filter 0.2s;
}

input[type="file"]::file-selector-button:hover {
    filter: brightness(1.1);
}

/* Responsive & Mobile Optimization */
@media (max-width: 768px) {
    body {
        padding: var(--space-sm);
    }

    .app-container {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    /* Mobile: preview scrolls inside its own box */
    .preview-container {
        max-height: 55vh;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* Mobile: time-range fits inside card (smaller gap + padding) */
    .time-range {
        gap: 0.5rem;
    }
    .time-range input[type="time"] {
        padding: 0.75rem 0.5rem;
        font-size: 15px;
    }

    .glass-card {
        padding: 1.25rem;
        min-width: 0;
    }

    /* Make controls easier to hit on mobile */
    .btn-icon {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }

    /* Prevent cropper from being too tall on small screens */
    .cropper-wrapper {
        max-height: 50vh;
    }

    /* Input adjustments */
    input,
    button,
    select {
        padding: 0.875rem 1rem;
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    body {
        padding: var(--space-xs);
    }
    .glass-card {
        padding: 1rem;
    }
}

/* --- Custom Combobox (Generic) --- */
.combobox-wrapper {
    position: relative;
    width: 100%;
}

.combobox-trigger {
    width: 100%;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.combobox-trigger:hover {
    border-color: var(--accent-color);
}

.combobox-menu {
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.combobox-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.combobox-search {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}

.combobox-search-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--input-focus-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.9em;
}

.combobox-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 6px;
}

/* Scrollbar */
.combobox-list::-webkit-scrollbar {
    width: 4px;
}

.combobox-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.combobox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-color);
    border: 1px solid transparent;
}

.combobox-item:hover {
    background: var(--input-bg);
    border-color: var(--border-color);
}

.combobox-item.selected {
    background: var(--accent-soft);
    border-color: var(--accent-color);
}

.combobox-item-icon {
    width: 32px;
    height: 32px;
    background: var(--input-focus-bg);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.combobox-item.selected .combobox-item-icon {
    color: var(--accent-color);
}

.combobox-item-text {
    flex: 1;
    font-weight: 500;
}

/* Sub-text for date desc */
.combobox-item-desc {
    display: block;
    font-size: 0.75em;
    opacity: 0.7;
    margin-top: 2px;
    font-weight: 400;
}

.combobox-item-check {
    color: var(--accent-color);
    opacity: 0;
}

.combobox-item.selected .combobox-item-check {
    opacity: 1;
}

.combobox-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.combobox-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-color);
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Drag & Drop Feedback */
.drag-over {
    border: 2px dashed var(--accent-color) !important;
    background: var(--accent-soft) !important;
    transition: border-color var(--dur-short) var(--ease-out), background var(--dur-short) var(--ease-out);
}


/* --- New Upload UI --- */
.upload-drop-zone {
    border: 2px dashed var(--border-color);
    background: var(--accent-soft);
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--dur-short) var(--ease-out), background var(--dur-short) var(--ease-out);
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
    border-color: var(--accent-color);
    background: var(--accent-soft);
}

.upload-icon-wrapper {
    width: 64px;
    height: 64px;
    background: var(--accent-soft);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--text-muted);
    transition: color var(--dur-short) var(--ease-out);
}

.upload-drop-zone:hover .upload-icon-wrapper {
    color: var(--accent-color);
}

.upload-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 8px;
}

.upload-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.btn-upload {
    background: var(--primary-color);
    color: var(--color-accent-ink, #fff);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: filter var(--dur-short) var(--ease-out);
}

.btn-upload:hover {
    filter: brightness(1.1);
}

.uploaded-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.uploaded-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-color);
}

.uploaded-actions {
    display: flex;
    gap: 16px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.btn-text:hover {
    color: var(--text-color);
}

.btn-text.danger {
    color: #f87171;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-text.danger:hover {
    color: #fca5a5;
}


/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Export Buttons in Modal */
.export-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 15000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.modal.hidden {
    display: none !important;
}

/* Dropdown Menu Items */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 15px 15px;
    /* Generous padding for easier clicking and visual space */
    background: transparent;
    border: none;
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1rem;
    transition: background 0.2s;
    margin: 4px 0;
    /* Vertical margin for separation */
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.menu-item i {
    width: 24px;
    text-align: center;
}

/* ==========================================
   INTERNAL DIALOG (replaces alert/confirm)
   ========================================== */

.notif-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 31000;
    background: var(--overlay-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: notifFadeIn 0.18s var(--ease-out);
}
.notif-dialog-overlay.hidden {
    display: none;
}

.notif-dialog {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 12px 48px var(--shadow-color);
    max-width: 380px;
    width: 100%;
    padding: 28px 24px 20px;
    text-align: center;
    animation: notifScaleIn 0.22s var(--ease-out);
    outline: none;
}
.notif-dialog__icon-wrap {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--accent-color);
}
.notif-dialog__title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-color);
}
.notif-dialog__msg {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0 0 20px;
    word-break: break-word;
}
.notif-dialog__actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Dialog button â€” 8 states */
.notif-dialog__btn {
    flex: 1;
    max-width: 160px;
    padding: 10px 18px;
    border-radius: var(--radius-input, 10px);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-color);
    transition: background var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out);
}
.notif-dialog__btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent-color);
}
.notif-dialog__btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.notif-dialog__btn:active {
    transform: scale(0.97);
}
.notif-dialog__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.notif-dialog__btn--primary {
    background: var(--primary-color);
    color: #fff;
    border-color: transparent;
}
.notif-dialog__btn--primary:hover {
    background: var(--primary-hover);
}
.notif-dialog__btn--primary:disabled {
    background: var(--accent-soft);
    color: var(--text-muted);
}

.notif-dialog__btn--danger {
    background: var(--danger-color);
    color: #fff;
    border-color: transparent;
}
.notif-dialog__btn--danger:hover {
    filter: brightness(1.1);
}
.notif-dialog__btn--danger:disabled {
    background: var(--danger-soft);
    color: var(--text-muted);
}

.notif-dialog__btn--ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.notif-dialog__btn--ghost:hover {
    background: var(--accent-soft);
    color: var(--text-color);
    border-color: var(--border-color);
}
.notif-dialog__btn--ghost:disabled {
    opacity: 0.4;
}

@keyframes notifFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes notifScaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* ==========================================
   CUSTOM DATE PICKER
   ========================================== */

.dp-wrapper {
    position: relative;
}

.dp-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dp-field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: border-color 0.2s;
    cursor: pointer;
}

.dp-field:hover,
.dp-field:focus-within {
    border-color: var(--accent-color);
}

.dp-field input[type="text"] {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 0.9rem;
    outline: none;
    min-width: 0;
}

.dp-field input[type="text"]::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.dp-field .dp-icon {
    color: var(--accent-color);
    font-size: 1rem;
}

.dp-toggle-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--accent-color);
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.dp-toggle-btn:hover {
    background: var(--accent-soft, rgba(124,58,237,0.15));
    border-color: var(--accent-color);
}

/* Calendar popup */
.dp-calendar {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 25000;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.35);
    padding: 14px;
    width: 300px;
    display: none;
    animation: dpSlideDown 0.18s ease;
}

.dp-calendar.dp-open {
    display: block;
}

@keyframes dpSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Header nav */
.dp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.dp-header__month {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.dp-header__nav {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.12s, color 0.12s;
}

.dp-header__nav:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-color);
}

/* Weekday labels */
.dp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 4px;
}

.dp-weekdays span {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 0;
}

/* Day grid */
.dp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.dp-day {
    text-align: center;
    padding: 7px 0;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-color);
    transition: background 0.12s, color 0.12s;
    border: none;
    background: none;
    font-family: var(--font-family);
    line-height: 1;
}

.dp-day:hover {
    background: rgba(255,255,255,0.08);
}

.dp-day.dp-today {
    color: var(--accent-color);
    font-weight: 600;
}

.dp-day.dp-selected {
    background: var(--accent-color);
    color: #fff;
    font-weight: 600;
}

.dp-day.dp-outside {
    color: var(--text-muted);
    opacity: 0.35;
}

.dp-day.dp-disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* Quick Today button */
.dp-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.dp-today-btn {
    font-size: 0.8rem;
    padding: 5px 14px;
    border-radius: 8px;
    background: var(--accent-soft, rgba(124,58,237,0.15));
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.12s;
}

.dp-today-btn:hover {
    background: var(--accent-color);
    color: #fff;
}

/* Login Modal â€” UI/UX Pro Max */
.login-modal-overlay {
    background: var(--overlay-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    display: flex;
    padding: 16px;
    z-index: 31000; /* di atas side-nav drawer (30001) agar panel login meng-override sidebar */
}

.login-modal-overlay.hidden {
    display: flex !important;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
}

.login-card {
    width: 100%;
    max-width: 400px;
    position: relative;
    border-radius: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px var(--shadow-color);
    padding: 28px 28px 24px;
    animation: loginCardIn 0.25s ease-out;
}

@keyframes loginCardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.login-close:hover {
    background: var(--accent-soft);
    color: var(--text-color);
    border-color: var(--accent-color);
}

.login-close:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-brand-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 8px 24px var(--shadow-color);
    margin-bottom: 12px;
}

.login-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field {
    margin: 0;
}

.login-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.login-input-wrap input {
    width: 100%;
    height: 44px;
    padding: 0 44px 0 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 0.95rem;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.login-input-wrap input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.login-input-wrap input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: var(--input-focus-bg);
}

.login-input-wrap input[aria-invalid="true"] {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.login-password-toggle {
    position: absolute;
    right: 6px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.login-password-toggle:hover {
    background: var(--accent-soft);
    color: var(--text-color);
}

.login-password-toggle:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.login-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger-color);
    font-size: 0.85rem;
    line-height: 1.4;
}

.login-error[hidden] {
    display: none !important;
}

.login-submit {
    width: 100%;
    height: 44px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    transition: opacity 0.15s, transform 0.15s;
}

.login-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-submit:active:not(:disabled) {
    transform: scale(0.98);
}

.login-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: loginSpin 0.6s linear infinite;
}

.login-submit.is-loading .login-spinner {
    display: inline-block;
}

.login-submit.is-loading .login-submit-text {
    opacity: 0.9;
}

@keyframes loginSpin {
    to { transform: rotate(360deg); }
}

.login-footer {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
    .login-card { animation: none; }
    .login-spinner { animation: none; }
}

/* Location source input group */
.source-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.source-hint i {
    font-size: 0.9em;
    vertical-align: -0.1em;
}

@media (max-width: 480px) {
    .source-hint {
        font-size: 0.72rem;
    }
}

/* ==========================================
   V4.15 â€” COLLAPSIBLE SECTIONS
   ========================================== */
.form-section {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 14px;
    overflow: visible; /* critical: combobox dropdowns must escape */
}

.form-section > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
    border-radius: var(--border-radius);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.form-section > summary::-webkit-details-marker {
    display: none;
}

.form-section > summary:hover {
    background: var(--accent-soft);
}

.form-section > summary:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.form-section .section-icon {
    color: var(--accent-color);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.form-section .section-chevron {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.form-section[open] > summary .section-chevron {
    transform: rotate(180deg);
}

.form-section .section-body {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    animation: sectionReveal 0.22s ease-out;
}

@keyframes sectionReveal {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Section summary badge (e.g. detected location short label) */
.section-badge {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--accent-soft);
    padding: 2px 8px;
    border-radius: 999px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================
   V4.15 â€” INFO POPUP (Sumber Lokasi)
   ========================================== */
.label-with-info {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.5rem;
}

.info-pop-wrap {
    position: relative;
    display: inline-flex;
}

.info-pop-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: background 0.15s, color 0.15s;
}

.info-pop-btn:hover {
    background: var(--accent-soft);
    color: var(--accent-color);
}

.info-pop-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.info-pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 260px;
    max-width: 80vw;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 40px var(--shadow-color);
    padding: 12px 14px;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-color);
    z-index: 500;
    animation: dpSlideDown 0.15s ease-out;
}

.info-pop[hidden] {
    display: none;
}

.info-pop strong {
    color: var(--accent-color);
}

/* ==========================================
   V5.2 â€” NOTIFICATION SYSTEM (aligned Workbench)
   ==========================================
   Hallmark Â· component: notification Â· genre: modern-minimal Â· theme: custom violet (design.md)
   states: default Â· hover Â· focus-visible Â· active Â· error Â· success
   Toast: fixed 380px bottom-right (near bell), radius 12px, newest on top.
   ========================================== */
.notif-toast-container {
    position: fixed;
    top: 64px; /* #9: tepat di bawah topbar (btn 36px + padding 2Ã—12px + border) */
    right: 16px;
    z-index: 30000;
    display: flex;
    flex-direction: column; /* newest on top */
    gap: var(--space-2xs);
    pointer-events: none;
    width: min(380px, calc(100vw - 2 * var(--space-sm)));
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.notif-toast {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--border-radius);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color);
    color: var(--text-color);
    font-size: 0.875rem;
    line-height: 1.45;
    width: 100%;
    transform: translateY(12px);
    opacity: 0;
    position: relative;
    overflow: hidden;
    transition: transform var(--dur-mid) var(--ease-out), opacity var(--dur-mid) var(--ease-out);
}

/* Type left-border accent */
.notif-toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 3px 0 0 3px;
    pointer-events: none;
}
.notif-toast--info::before    { background: var(--accent-color); }
.notif-toast--success::before { background: var(--success-color); }
.notif-toast--warning::before { background: var(--warning-color); }
.notif-toast--error::before   { background: var(--danger-color); }

.notif-toast--show {
    transform: translateY(0);
    opacity: 1;
}

.notif-toast--leaving {
    transform: translateY(12px);
    opacity: 0;
}

.notif-toast__body {
    flex: 1;
    min-width: 0;
}

.notif-toast__icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    margin-top: 2px;
}

.notif-toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: background var(--dur-short) var(--ease-out);
}

.notif-toast__close:hover {
    background: var(--accent-soft);
    color: var(--text-color);
}

.notif-toast__close:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.notif-toast--info .notif-toast__icon    { color: var(--accent-color); }
.notif-toast--success .notif-toast__icon { color: var(--success-color); }
.notif-toast--warning .notif-toast__icon { color: var(--warning-color); }
.notif-toast--error .notif-toast__icon   { color: var(--danger-color); }

.notif-toast__summary {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.notif-toast__msg {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notif-toast.is-expanded .notif-toast__msg {
    white-space: normal;
    overflow: visible;
}

.notif-toast__expand {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform var(--dur-short) var(--ease-out);
    display: none;
}

.notif-toast.is-truncated .notif-toast__expand {
    display: inline-block;
}

.notif-toast.is-expanded .notif-toast__expand {
    transform: rotate(180deg);
}

.notif-toast__detail {
    display: none;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.notif-toast.is-expanded .notif-toast__detail {
    display: block;
}

/* Notification preview popover (anchored to bell, top-right) */
@media (max-width: 768px) {
    .notif-toast-container {
        top: 64px;
        width: calc(100% - 2 * var(--space-sm));
    }
    .notif-toast {
        max-width: 100%;
        width: 100%;
    }
}
@media (max-width: 480px) {
    .notif-toast-container {
        top: 60px;
    }
}
@media (max-width: 360px) {
    .notif-toast-container {
        width: calc(100% - 2 * var(--space-xs));
    }
}
.btn-stepper {
    width: 40px;
    height: 42px;
    border-radius: 8px;
    background: var(--accent-soft);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color var(--dur-short) var(--ease-out), background var(--dur-short) var(--ease-out);
}
.btn-stepper:hover {
    border-color: var(--accent-color);
    background: var(--accent-soft);
}

.btn-icon-sm {
    width: 46px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.row-flex {
    display: flex;
    gap: 8px;
}

.col-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.col-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

/* Color picker trigger + preview (replaces inline styles) */
.color-trigger {
    width: 100%;
    height: 35px;
    border-radius: 8px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.color-preview {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.section-label {
    font-size: 0.85rem;
    margin-bottom: 8px;
    display: block;
    color: var(--text-muted);
}

input[type="number"] {
    font-variant-numeric: tabular-nums;
}

/* === Layout panels === */
.form-panel {
    min-width: 0;
}
.preview-panel {
    min-width: 0;
}

/* === Mobile: upload at bottom === */
@media (max-width: 1024px) {
    .upload-mobile-bottom {
        order: 10;
    }
}

/* ==========================================
   SIDE NAV DRAWER (left overlay, 280px)
   ========================================== */
.menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 30000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-mid) var(--ease-out);
    display: block;
}
.menu-backdrop.is-open {
    opacity: 1;
    pointer-events: all;
}

.side-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: min(280px, 80vw);
    height: 100%;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    z-index: 30001;
    transform: translateX(-100%);
    transition: transform var(--dur-mid) var(--ease-out);
    display: flex;
    flex-direction: column;
    padding: var(--space-sm);
}
.side-nav.is-open {
    transform: translateX(0);
}
.side-nav__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-xs);
}
.side-nav__close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--accent-soft);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--dur-short) var(--ease-out);
}
.side-nav__close:hover {
    background: var(--accent-soft);
    color: var(--accent-color);
}
.side-nav__close:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.side-nav__brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}
.side-nav__items {
    display: flex;
    flex-direction: column;
    gap: var(--space-3xs);
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}
/* Item tersembunyi = li ikut collapse, flex gap tidak menyisakan ruang kosong */
.side-nav__items li:has(> .side-nav__item.hidden),
.side-nav__items li:has(> .hidden) {
    display: none;
}
.side-nav__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 0.9rem;
    font-family: var(--font-body);
    text-align: left;
    cursor: pointer;
    width: 100%;
    text-decoration: none; /* drawer item juga dipakai <a> (admin) */
    transition: background var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.side-nav__item:hover {
    background: var(--accent-soft);
}
.side-nav__item:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.side-nav__item i {
    width: 20px;
    text-align: center;
    color: var(--text-muted);
    flex-shrink: 0;
}
.side-nav__item:hover i {
    color: var(--accent-color);
}
.side-nav__item--danger {
    color: var(--danger-color);
}
.side-nav__item--danger i {
    color: var(--danger-color);
}
.side-nav__item--accent {
    color: var(--accent-color);
}
.side-nav__item--accent i {
    color: var(--accent-color);
}
.side-nav__divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-3xs) 0;
}
/* Auth block â€” user info (kiri) + logout icon (kanan) */
.side-nav__auth {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) 0 0;
}
.side-nav__auth .side-nav__auth-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.side-nav__auth .side-nav__auth-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.side-nav__auth .side-nav__auth-tier {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.side-nav__auth .side-nav__auth-tier i {
    color: var(--warning-color);
}
.side-nav__auth .side-nav__logout {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--danger-color); /* aksen kontras merah */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
}
.side-nav__auth .side-nav__logout:hover {
    background: var(--danger-soft);
    color: var(--danger-color);
    border-color: var(--danger-color);
}
.side-nav__auth .side-nav__logout:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
/* Guest: login button full width */
.side-nav__auth.side-nav__auth--guest {
    flex-direction: column;
}
.side-nav__auth.side-nav__auth--guest .side-nav__login {
    width: 100%;
    justify-content: center;
    font-weight: 600;
    border-radius: 12px;
    padding: 10px 16px;
    border: 1px solid transparent;
    background: var(--accent-color);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2xs);
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.28);
    transition: background var(--dur-short) var(--ease-out), filter var(--dur-short) var(--ease-out);
}
.side-nav__auth.side-nav__auth--guest .side-nav__login i {
    color: #fff;
}
.side-nav__auth.side-nav__auth--guest .side-nav__login:hover {
    background: var(--accent-hover);
    filter: brightness(1.04);
    color: #fff;
}
.side-nav__auth.side-nav__auth--guest .side-nav__login:active {
    filter: brightness(0.96);
}
.side-nav__footer {
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-sm);
    padding-top: var(--space-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

/* Notification preview popover (anchored to bell, top-right) */
.notif-preview {
    position: fixed;
    top: 64px;
    right: 16px;
    width: min(380px, calc(100% - 2 * var(--space-md)));
    max-height: 50vh;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 16px 48px var(--shadow-color);
    z-index: 29999;
    padding: 8px;
    pointer-events: all;
    animation: dpSlideDown 0.18s ease-out;
}
.notif-preview[hidden] {
    display: none;
}
.notif-preview__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 6px;
}
.notif-preview__head strong {
    font-size: 0.9rem;
    color: var(--text-color);
}
.notif-preview__more {
    font-size: 0.8rem;
    color: var(--accent-color);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background var(--dur-short) var(--ease-out);
}
.notif-preview__more:hover {
    background: var(--accent-soft);
}
.notif-preview__close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.notif-preview__close:hover {
    background: var(--accent-soft);
    color: var(--text-color);
}
.notif-preview__close:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.notif-preview__head-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.notif-preview__clear {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: var(--font-body);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background var(--dur-short) var(--ease-out);
}
.notif-preview__clear:hover {
    background: rgba(239, 68, 68, 0.12);
}
.notif-preview__clear:focus-visible {
    outline: 2px solid var(--danger-color);
    outline-offset: 2px;
}
.notif-preview__list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.notif-preview__item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-color);
    word-break: break-word;
    overflow-wrap: anywhere;
    border-left: 3px solid transparent;
    transition: background var(--dur-short) var(--ease-out);
}
.notif-preview__item:hover {
    background: var(--accent-soft);
}
.notif-preview__msg {
    flex: 1;
    min-width: 0;
}
.notif-preview__time {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-top: 2px;
}
.notif-preview__item--info    { border-left-color: var(--accent-color); }
.notif-preview__item--success { border-left-color: var(--success-color); }
.notif-preview__item--warning { border-left-color: var(--warning-color); }
.notif-preview__item--error   { border-left-color: var(--danger-color); }
.notif-preview__item i {
    margin-top: 2px;
    flex-shrink: 0;
}
.notif-preview__item--info i    { color: var(--accent-color); }
.notif-preview__item--success i { color: var(--success-color); }
.notif-preview__item--warning i { color: var(--warning-color); }
.notif-preview__item--error i   { color: var(--danger-color); }
.notif-preview__empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.notif-preview__more {
    display: block;
    margin-top: 6px;
    padding: 8px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-color);
    background: var(--accent-soft);
    border-radius: 8px;
}
.notif-preview__more:hover {
    background: var(--accent-color);
    color: var(--color-accent-ink, #fff);
}

@media (max-width: 768px) {
    .notif-preview {
        right: var(--space-sm);
        left: var(--space-sm);
        width: auto;
    }
}

/* App top bar â€” full-width, flush to edges, app icon + brand */
.app-topbar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 10;
    margin: calc(-1 * var(--space-md)) calc(-1 * var(--space-md)) var(--space-lg);
}
.app-topbar__icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.top-bar__menu {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--accent-soft);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--dur-short) var(--ease-out);
    flex-shrink: 0;
}
.top-bar__menu:hover {
    background: var(--accent-soft);
    color: var(--accent-color);
}
.top-bar__menu:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.top-bar__title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.025em;
    margin: 0;
}
.top-bar__spacer {
    flex: 1;
}
.top-bar__icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    text-decoration: none;
    transition: background var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.top-bar__icon-btn:hover {
    background: var(--accent-soft);
    color: var(--accent-color);
}
.top-bar__icon-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.top-bar__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger-color);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
}
.top-bar__badge.hidden {
    display: none;
}
.top-bar__badge[hidden] {
    display: none;
}

/* Language switch (topbar globe + dropdown) */
.lang-switch {
    position: relative;
}
.lang-switch__code {
    position: absolute;
    bottom: -2px;
    right: -2px;
    min-width: 16px;
    height: 14px;
    padding: 0 3px;
    border-radius: 4px;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
    letter-spacing: 0.02em;
    pointer-events: none;
}
.lang-switch__menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 12px 40px var(--shadow-color);
    padding: 4px;
    list-style: none;
    margin: 0;
    z-index: 20000;
    animation: dpSlideDown 0.15s var(--ease-out);
}
.lang-switch__menu[hidden] {
    display: none;
}
.lang-switch__opt {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: 7px;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    transition: background var(--dur-short) var(--ease-out);
}
.lang-switch__opt:hover {
    background: var(--accent-soft);
}
.lang-switch__opt:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.lang-switch__opt.is-active {
    background: var(--accent-soft);
    color: var(--accent-color);
    font-weight: 600;
}
.lang-switch__opt.is-active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.75rem;
}
.top-bar__badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent-color);
    border: 1px solid var(--accent-soft);
    white-space: nowrap;
}
.top-bar__badge i {
    margin-right: 4px;
}

/* Mobile: topbar stays sticky, tighter negative margin */
@media (max-width: 768px) {
    .app-topbar {
        margin: calc(-1 * var(--space-sm)) calc(-1 * var(--space-sm)) var(--space-md);
    }
    /* Touch targets â‰¥44px (WCAG 2.5.5) â€” desktop keeps 36px density */
    .top-bar__icon-btn,
    .top-bar__menu,
    .side-nav__close {
        width: 44px;
        height: 44px;
    }
    .side-nav__auth .side-nav__item {
        min-height: 44px;
    }
}

/* === Preview wrapper === */
.preview-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

/* === Preview empty state (right panel, pre-upload) === */
.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    gap: var(--space-sm);
}
.preview-empty__icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}
.preview-empty__title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}
.preview-empty__steps {
    list-style: none;
    counter-reset: step;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    max-width: 320px;
}
.preview-empty__steps li {
    counter-increment: step;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.preview-empty__steps li i {
    color: var(--accent-color);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.action-group {
    margin-top: 20px;
    width: 100%;
}
.btn-block {
    width: 100%;
}

/* === Preview panel desktop === */
@media (min-width: 1025px) {
    .preview-container {
        min-height: auto;
        max-height: none;
    }
    .section-title {
        text-align: left;
    }
}
/* Pin Customization */
.pin-style-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.pin-style-btn:hover,
.pin-style-btn.is-active {
    border-color: var(--accent-color);
    background: var(--accent-soft);
    color: var(--accent-color);
}

/* Draft list (modal) */
.draft-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 46vh;
}

.draft-empty {
    padding: 20px 10px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.draft-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--input-bg);
}

.draft-item__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.draft-item__name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draft-item__time {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.draft-item__actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.draft-item__actions .btn-secondary {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.draft-item__actions .draft-delete {
    color: var(--danger-color);
}

input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: none;
    cursor: pointer;
}
