/* ==========================================================================
   SupportDesk Template Manager - Clean Minimal Pro UI
   ========================================================================== */

:root,
[data-theme="dark"] {
    --bg-app: #0b0f19;
    --bg-sidebar: #111827;
    --bg-surface: #1e293b;
    --bg-surface-hover: #263449;
    --bg-elevated: #0f172a;
    --bg-input: #0f172a;
    --border-color: #2e3c51;
    --border-subtle: #1f2937;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-wa: #22c55e;
    --accent-tg: #38bdf8;
    --accent-warn: #facc15;
    --accent-danger: #ef4444;

    --card-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.3);
    --highlight-bg: rgba(250, 204, 21, 0.28);
    --highlight-text: #fde047;
}

[data-theme="light"] {
    --bg-app: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f8fafc;
    --bg-elevated: #f8fafc;
    --bg-input: #ffffff;
    --border-color: #cbd5e1;
    --border-subtle: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-wa: #16a34a;
    --accent-tg: #0284c7;
    --accent-warn: #eab308;
    --accent-danger: #dc2626;

    --card-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    --highlight-bg: rgba(250, 204, 21, 0.45);
    --highlight-text: #854d0e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 13.5px;
    overflow-x: hidden;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

.hidden {
    display: none !important;
}

kbd {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 11px;
    font-family: monospace;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ==========================================================================
   SIDEBAR & DRAG-AND-DROP FOLDERS
   ========================================================================== */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 40;
}

.sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-text h1 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.storage-mini {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-muted);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-warn);
}

.status-dot.online { background: var(--accent-wa); }
.status-dot.local { background: var(--accent-tg); }

.btn-sync-local {
    margin: 8px 12px 0;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--accent-primary);
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.btn-sync-local:hover {
    background: var(--accent-primary);
    color: #fff;
}

.sidebar-cta {
    padding: 12px 12px 6px;
}

.btn-new-template {
    width: 100%;
    padding: 9px 12px;
    font-weight: 600;
    border-radius: 8px;
}

.sidebar-section {
    padding: 6px 10px;
}

.folder-scroll-section {
    flex: 1;
    overflow-y: auto;
    min-height: 100px;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 6px 6px;
}

.sidebar-section-title {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}

.btn-add-folder {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    cursor: pointer;
}

.btn-add-folder:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
}

.folder-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    border-radius: 7px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.12s, border-color 0.12s;
    user-select: none;
    border: 1px solid transparent;
}

.folder-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.folder-item.active {
    background-color: rgba(59, 130, 246, 0.16);
    color: var(--text-primary);
    font-weight: 600;
}

/* Drag & Drop Folder Styles */
.folder-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 12px;
    opacity: 0.45;
    line-height: 1;
    padding-right: 1px;
}

.folder-item:hover .folder-drag-handle {
    opacity: 0.9;
}

.folder-item.dragging {
    opacity: 0.4;
    background: var(--bg-elevated);
    border: 1px dashed var(--accent-primary);
}

.folder-item.drag-over {
    border-top: 2px solid var(--accent-primary);
}

.folder-color-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.folder-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.folder-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-count {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 99px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-weight: 600;
}

.folder-item.active .folder-count {
    background: var(--accent-primary);
    color: #fff;
}

.folder-actions {
    display: none;
    align-items: center;
    gap: 2px;
}

.folder-item:hover .folder-actions {
    display: flex;
}

.folder-item:hover .folder-count {
    display: none;
}

.btn-folder-act {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 11.5px;
    opacity: 0.75;
}

.btn-folder-act:hover {
    opacity: 1;
    background: var(--bg-elevated);
}

.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.backup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

/* ==========================================================================
   MAIN CONTENT & HEADER
   ========================================================================== */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.top-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-container {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 7px 32px 7px 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.search-clear {
    position: absolute;
    right: 8px;
    background: var(--bg-surface);
    border: none;
    color: var(--text-secondary);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
}

/* VARIABEL DI HEADER */
.var-inputs-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.var-field {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-elevated);
    padding: 4px 8px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
}

.var-field code {
    color: var(--accent-tg);
    font-size: 11.5px;
    font-weight: 600;
}

.var-select,
.var-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 3px 7px;
    font-size: 12px;
    color: var(--text-primary);
}

.var-input { width: 135px; }

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

.var-clear-btn {
    position: absolute;
    right: 5px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
}

/* ==========================================================================
   CONTENT TOOLBAR
   ========================================================================== */
.content-toolbar {
    padding: 12px 18px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.active-folder-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.active-folder-info h2 {
    font-size: 15.5px;
    font-weight: 700;
}

.result-badge {
    font-size: 11.5px;
    padding: 1px 8px;
    border-radius: 99px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.toolbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-select {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
}

.view-mode-toggle {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.btn-view {
    border: none;
    border-right: 1px solid var(--border-subtle);
    background: transparent;
    padding: 4px 9px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn-view:last-child {
    border-right: none;
}

.btn-view:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.btn-view.active {
    background: var(--accent-primary);
    color: #fff;
    font-weight: 600;
}

/* ==========================================================================
   TEMPLATE CARDS
   ========================================================================== */
.templates-grid {
    padding: 6px 14px 28px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
}

.templates-grid.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.templates-grid.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.templates-grid.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.templates-grid.compact-view {
    grid-template-columns: 1fr;
    gap: 6px;
}

.template-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.template-card:hover {
    border-color: #475569;
}

.template-card.pinned-card {
    border-color: rgba(250, 204, 21, 0.45);
}

.template-card.copied-flash {
    border-color: var(--accent-wa) !important;
}

.card-header {
    padding: 7px 10px 6px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: grab;
}

.card-header:active {
    cursor: grabbing;
}

.template-card.card-dragging {
    opacity: 0.4;
    border: 1.5px dashed var(--accent-primary) !important;
    transform: scale(0.98);
}

.template-card.card-drag-over {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2.5px rgba(59, 130, 246, 0.35);
}

.card-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tpl-number-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(59, 130, 246, 0.16);
    color: var(--accent-tg);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.folder-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 5px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.usage-pill {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 1px 6px;
    border-radius: 5px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.btn-card-icon {
    background: transparent;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 12.5px;
}

.btn-card-icon:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* Star Icon (Pinned vs Unpinned) */
.star-svg {
    width: 16px;
    height: 16px;
    display: block;
    transition: transform 0.12s;
}

.btn-card-icon:hover .star-svg {
    transform: scale(1.12);
}

.star-svg.unpinned {
    fill: none;
    stroke: var(--text-secondary);
    stroke-width: 2;
}

.star-svg.pinned {
    fill: #facc15;
    stroke: #facc15;
    stroke-width: 2;
}

.card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* TEXT SECTION: KLIK BOX = COPY TELEGRAM, HOVER = TOMBOL COPY WA */
.card-text-section {
    padding: 6px 9px 7px;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.text-preview-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 6px 8px;
    flex: 1;
    min-height: 102px;
    height: 102px;
    contain: size;
    font-size: 12.5px;
    line-height: 1.32;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}

.text-preview-box::-webkit-scrollbar {
    width: 5px;
}

.text-preview-box::-webkit-scrollbar-track {
    background: transparent;
}

.text-preview-box::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.templates-grid.compact-view .text-preview-box {
    contain: none;
    height: auto;
    min-height: 44px;
    max-height: 115px;
}

.text-preview-box:hover {
    border-color: var(--accent-tg);
}

.text-preview-box.copied-tg {
    border-color: var(--accent-tg);
}

.text-preview-box strong {
    font-weight: 700;
    color: var(--text-primary);
}

.text-preview-box em {
    font-style: italic;
}

.text-preview-box s {
    text-decoration: line-through;
    opacity: 0.8;
}

.text-preview-box code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    background: rgba(59, 130, 246, 0.14);
    color: var(--accent-tg);
    padding: 1px 4px;
    border-radius: 3px;
}

.copy-text-actions {
    position: absolute;
    right: 15px;
    bottom: 12px;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.14s ease, transform 0.14s ease;
    z-index: 5;
}

.template-card:hover .copy-text-actions,
.card-text-section:hover .copy-text-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.btn-copy-wa {
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--accent-wa);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    transition: filter 0.12s, transform 0.1s;
}

.btn-copy-wa:active {
    transform: scale(0.98);
}

.btn-copy-wa:hover {
    filter: brightness(1.08);
}

/* IMAGES SECTION (DI ATAS TEKS SEPERTI TELEGRAM) */
.card-images-section {
    padding: 6px 9px;
    border-bottom: 1px dashed var(--border-color);
    background: rgba(15, 23, 42, 0.2);
}

.card-images-section:last-child {
    border-bottom: none;
    flex: 1;
}

.card-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
    gap: 6px;
}

.card-images-grid.single-image {
    grid-template-columns: 1fr;
}

.img-step-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.img-step-card:hover {
    border-color: var(--accent-primary);
}

.img-step-card.copied-step {
    border-color: var(--accent-wa);
}

.img-step-card.next-step-hint {
    border-color: var(--accent-warn);
}

.img-thumb-wrapper {
    position: relative;
    width: 100%;
    height: 92px;
    background: #090d16;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.single-image .img-thumb-wrapper {
    height: 108px;
}

.img-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.img-copy-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.12s;
    color: #fff;
    font-weight: 600;
    font-size: 12px;
}

.img-thumb-wrapper:hover .img-copy-overlay {
    opacity: 1;
}

.btn-zoom-img {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 3;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11.5px;
}

.btn-zoom-img:hover {
    background: var(--accent-primary);
}

.img-step-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 2;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
}

.img-step-footer {
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.img-step-label {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-copy-img {
    width: 100%;
    border: 1px solid var(--accent-primary);
    background: rgba(59, 130, 246, 0.14);
    color: var(--text-primary);
    border-radius: 5px;
    padding: 5px 8px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.btn-copy-img:hover {
    background: var(--accent-primary);
    color: #fff;
}

.btn-copy-img.copied-btn {
    background: var(--accent-wa);
    border-color: var(--accent-wa);
    color: #fff;
}

/* FILES SECTION (PDF, EXE, ZIP, DLL) */
.card-files-section {
    padding: 6px 9px;
    border-bottom: 1px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.card-files-section:last-child {
    border-bottom: none;
}

.file-step-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.12s, background 0.12s;
}

.file-step-card:hover {
    border-color: var(--accent-primary);
    background: var(--bg-surface-hover);
}

.file-step-card.copied-step {
    border-color: var(--accent-wa);
}

.file-ext-icon {
    font-size: 10px;
    font-weight: 800;
    padding: 4px 6px;
    border-radius: 5px;
    min-width: 38px;
    text-align: center;
    background: rgba(59, 130, 246, 0.16);
    color: var(--accent-tg);
    border: 1px solid rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
}

.file-ext-icon.ext-pdf {
    background: rgba(239, 68, 68, 0.16);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.32);
}

.file-ext-icon.ext-exe {
    background: rgba(139, 92, 246, 0.16);
    color: #c084fc;
    border-color: rgba(139, 92, 246, 0.32);
}

.file-ext-icon.ext-zip {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.32);
}

.file-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 10.5px;
    color: var(--text-muted);
}

.file-copy-hint {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(59, 130, 246, 0.14);
    color: var(--accent-tg);
    opacity: 0;
    transition: opacity 0.12s;
    flex-shrink: 0;
}

.file-step-card:hover .file-copy-hint,
.file-step-card.copied-step .file-copy-hint {
    opacity: 1;
}

.file-step-card.copied-step .file-copy-hint {
    background: rgba(34, 197, 94, 0.18);
    color: var(--accent-wa);
}

.btn-preview-pdf {
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11.5px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s, background 0.12s;
    flex-shrink: 0;
}

.file-step-card:hover .btn-preview-pdf {
    opacity: 1;
    pointer-events: auto;
}

.btn-preview-pdf:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

mark.hl {
    background-color: var(--highlight-bg);
    color: var(--highlight-text);
    padding: 0 2px;
    border-radius: 3px;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn-primary {
    background: var(--accent-primary);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 7px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 11px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 6px 11px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-sm {
    font-size: 12px;
    padding: 5px 9px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state {
    margin: 30px 18px;
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: 10px;
}

.empty-icon {
    font-size: 34px;
    margin-bottom: 8px;
}

.empty-state h3 {
    font-size: 15px;
    margin-bottom: 14px;
    color: var(--text-secondary);
}

/* ==========================================================================
   MODAL & FORM
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.75);
    backdrop-filter: blur(2px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
}

.modal-lg { max-width: 660px; }
.modal-sm { max-width: 400px; }

.modal-header {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 15px;
    font-weight: 700;
}

.modal-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 80px 1.4fr 1fr;
    gap: 12px;
}

.form-group {
    margin-bottom: 13px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 8px 11px;
    color: var(--text-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 7px 7px 0 0;
    padding: 5px 8px;
}

.form-textarea {
    border-radius: 0 0 7px 7px;
    resize: vertical;
    line-height: 1.5;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.toolbar-divider {
    width: 1px;
    height: 18px;
    background: var(--border-color);
}

.btn-tool {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    width: 26px;
    height: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.btn-tool:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-var-insert {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: var(--accent-tg);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.btn-var-insert:hover {
    background: var(--accent-tg);
    color: #0b0f19;
}

.image-dropzone {
    border: 1.5px dashed var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12.5px;
}

.image-dropzone:hover,
.image-dropzone.dragover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.uploaded-images-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.uploaded-img-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 6px 8px;
}

.uploaded-img-thumb {
    width: 52px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    background: #000;
    flex-shrink: 0;
}

.uploaded-img-info { flex: 1; }

.uploaded-img-label-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 12px;
}

.uploaded-img-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-weight: 500;
    font-size: 12.5px;
    color: var(--text-primary);
}

/* IMPORT MODAL ACTIONS */
.import-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.btn-import-folder,
.btn-import-json {
    width: 100%;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
}

.import-progress {
    margin-top: 12px;
    padding: 8px 10px;
    border-radius: 7px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--accent-tg);
    text-align: center;
    font-weight: 600;
}

.emoji-picker-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.emoji-quick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.emoji-btn {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 2px 5px;
    cursor: pointer;
    font-size: 13px;
}

.form-color {
    width: 100%;
    height: 35px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-input);
    padding: 2px;
    cursor: pointer;
}

/* ==========================================================================
   LIGHTBOX
   ========================================================================== */
.lightbox-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lightbox-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.lightbox-title {
    font-weight: 600;
    font-size: 13.5px;
}

.lightbox-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lightbox-body {
    padding: 14px;
    background: #05080f;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    max-height: calc(90vh - 55px);
}

.lightbox-body img {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
}

.lightbox-container.pdf-mode {
    width: 86vw;
    height: 88vh;
}

.lightbox-container.pdf-mode .lightbox-body {
    padding: 0;
    flex: 1;
    height: 100%;
}

.lightbox-pdf {
    width: 100%;
    height: 100%;
    border: none;
    background: #1e293b;
}

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 18px;
    right: 18px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.toast {
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid var(--accent-wa);
    border-radius: 8px;
    padding: 8px 13px;
    font-weight: 600;
    font-size: 12.5px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: slideInUp 0.15s ease-out;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.mobile-menu-btn,
.mobile-close-sidebar {
    display: none;
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -260px;
        transition: left 0.2s ease;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open { left: 0; }
    .mobile-menu-btn, .mobile-close-sidebar { display: flex; }
    .form-row-2 { grid-template-columns: 1fr; }
}
