/* =========================================================
   DOCOMATE — Visual Document Designer
   ========================================================= */

/* ---------------------------------------------------------
   1. RESET / BASE
   --------------------------------------------------------- */
.dcm-module *,
.dcm-module *::before,
.dcm-module *::after { box-sizing: border-box; }

/* Mobile panel system: hidden by default (desktop-safe).
   Shown only inside @media (max-width: 1024px) below. */
.dcm-mobile-fab-stack,
.dcm-mobile-drawer {
    display: none;
}

/* ---------------------------------------------------------
   2. SHELL / TOP BAR / TABS / FOOTER
   --------------------------------------------------------- */
.dcm-shell {
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #e2e8f0);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 60px);
}

.dcm-brand {
    font-weight: 700;
    color: #00924A;
    font-size: 15px;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(0, 146, 74, .08);
}

.dcm-top-bar {
    padding: 10px 14px;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border-bottom: 1px solid var(--bs-border-color);
}

.dcm-main-tabs {
    padding: 0 14px;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 0 !important;
}

.dcm-main-tabs .nav-link {
    border: none;
    font-weight: 600;
    color: #64748b;
    padding: 10px 18px;
    border-bottom: 3px solid transparent;
    background: transparent;
}

.dcm-main-tabs .nav-link.active {
    color: #00924A !important;
    border-bottom-color: #00924A;
    background: transparent;
}

.dcm-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dcm-tab-content > .tab-pane {
    flex: 1;
    min-height: 0;
}

.dcm-footer-bar {
    padding: 8px 14px;
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
    font-size: 12px;
    color: #475569;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.dcm-footer-bar i { color: var(--theme-primary); }

/* ---------------------------------------------------------
   3. DESIGN SHELL — 3 COLUMN GRID (DESKTOP)
   --------------------------------------------------------- */
.dcm-design-shell {
    display: grid;
    grid-template-columns: 220px 1fr 300px;
    height: calc(89dvh - 120px);
}

/* ---------------------------------------------------------
   4. PALETTE (LEFT PANEL)
   --------------------------------------------------------- */
.dcm-palette {
    background: var(--bs-tertiary-bg, #f8f9fa);
    border-right: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dcm-palette-header,
.dcm-props-header {
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
    color: #334155;
    background: var(--bs-body-bg, #fff);
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.dcm-palette-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.dcm-palette-group { margin-bottom: 14px; }

.dcm-palette-group-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    margin-bottom: 6px;
    padding-left: 2px;
}

.dcm-palette-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.dcm-palette-item {
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
    cursor: grab;
    transition: transform .12s, border-color .12s, background .12s, box-shadow .12s;
    font-size: 10.5px;
    color: #475569;
    user-select: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.dcm-palette-item i {
    font-size: 16px;
    color: var(--theme-primary);
}

.dcm-palette-item:hover {
    border-color: #00924A;
    background: rgba(0, 146, 74, .05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 146, 74, .12);
}

.dcm-palette-item:active { cursor: grabbing; }

.dcm-palette-footer {
    border-top: 1px solid var(--bs-border-color);
    padding: 10px;
    background: var(--bs-body-bg, #fff);
    flex: 1;
    overflow-y: auto;
}

/* Background tools + page settings (inside palette footer) */
.dcm-bg-tools {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
}

.dcm-bg-tool {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bs-body-bg);
    position: relative;
    overflow: hidden;
}

.dcm-bg-tool input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: .9;
}

.dcm-bg-tool i {
    position: relative;
    z-index: 2;
    pointer-events: none;
    color: #334155;
}

.dcm-page-settings label {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    gap: 3px;
    margin-bottom: 8px;
}

.dcm-page-settings label > span {
    font-size: 10px;
    color: var(--theme-primary);
    font-weight: 700;
}

.dcm-custom-size {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.dcm-custom-size input { flex: 1; }

/* ---------------------------------------------------------
   5. CANVAS
   --------------------------------------------------------- */
.dcm-canvas-wrap {
    background: repeating-conic-gradient(#e2e8f0 0% 25%, #f1f5f9 0% 50%) 50% / 20px 20px;
    overflow: hidden;
    position: relative;
    display: flex;
    height: calc(100dvh - 198px);
}

.dcm-canvas-scroll {
    flex: 1;
    overflow: auto;
    padding: 30px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.dcm-canvas {
    background: #fff;
    box-shadow: 0 8px 30px rgba(15, 23, 42, .12);
    position: relative;
    transform-origin: top center;
    transition: transform .15s;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    margin: 0 auto;
    display: block;
    touch-action: none;
    overflow: visible;
}

.dcm-canvas-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    display: none;
    opacity: 1;
    transition: opacity .15s;
}

.dcm-canvas-bg.active { display: block; }

.dcm-page-surface { pointer-events: auto; }

.dcm-page-label {
    letter-spacing: .06em;
    text-transform: uppercase;
    user-select: none;
}

/* ---------------------------------------------------------
   6. CANVAS ELEMENTS
   --------------------------------------------------------- */
.dcm-el {
    position: absolute;
    cursor: move;
    border: 1px dashed transparent;
    border-radius: 3px;
    padding: 2px 4px;
    font-family: 'Helvetica', 'Arial', sans-serif;
    line-height: 1.25;
    overflow: hidden;
    user-select: none;
    min-width: 20px;
    min-height: 18px;
    transition: border-color .1s, box-shadow .1s;
    background: transparent;
}

.dcm-el:hover {
    border-color: rgba(0, 146, 74, .5);
    box-shadow: 0 0 0 1px rgba(0, 146, 74, .2);
}

.dcm-el.selected {
    border-color: #00924A;
    border-style: solid;
    box-shadow: 0 0 0 2px rgba(0, 146, 74, .25);
}

.dcm-el.multi-selected {
    outline: 2px dashed #7c3aed;
    outline-offset: 2px;
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, .15) !important;
}

.dcm-el[data-page] { z-index: 5 !important; }

.dcm-el-text {
    white-space: pre-wrap;
    word-break: break-word;
    width: 100%;
    height: 100%;
    outline: none;
}

.dcm-el-text[contenteditable="true"] {
    cursor: text;
    user-select: text;
}

.dcm-el-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.dcm-el-line {
    width: 100%;
    height: 100%;
    background: #334155;
}

.dcm-el-rect {
    width: 100%;
    height: 100%;
    border: 2px solid #334155;
}

.dcm-el-qr,
.dcm-el-barcode {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #cbd5e1;
    font-size: 11px;
    color: #64748b;
}

.dcm-el-table {
    width: 100%;
    height: 100%;
    background: #fff;
    border: 1px solid #cbd5e1;
    overflow: hidden;
    font-size: 11px;
}

.dcm-el-table table {
    width: 100%;
    border-collapse: collapse;
}

.dcm-el-table th,
.dcm-el-table td {
    border: 1px solid #e2e8f0;
    padding: 3px 6px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dcm-el-table th {
    background: #f1f5f9;
    font-weight: 600;
}

/* Resize handles */
.dcm-handle {
    position: absolute;
    width: 9px;
    height: 9px;
    background: #fff;
    border: 1.5px solid #00924A;
    border-radius: 50%;
    z-index: 10;
}

.dcm-handle-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.dcm-handle-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.dcm-handle-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.dcm-handle-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.dcm-handle-n { left: 50%; top: -5px; transform: translateX(-50%); cursor: ns-resize; }
.dcm-handle-s { left: 50%; bottom: -5px; transform: translateX(-50%); cursor: ns-resize; }
.dcm-handle-w { left: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.dcm-handle-e { right: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

/* Marquee selection */
.dcm-marquee {
    position: absolute;
    border: 1.5px dashed #00924A;
    background: rgba(0, 146, 74, .08);
    pointer-events: none;
    z-index: 999;
}

/* ---------------------------------------------------------
   7. PROPERTIES PANEL (RIGHT)
   --------------------------------------------------------- */
.dcm-props {
    background: var(--bs-tertiary-bg, #f8f9fa);
    border-left: 1px solid var(--bs-border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dcm-props-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-size: 12.5px;
}

.dcm-prop-row { margin-bottom: 10px; }

.dcm-prop-row label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 4px;
}

.dcm-prop-row input[type="text"],
.dcm-prop-row input[type="number"],
.dcm-prop-row select,
.dcm-prop-row textarea {
    width: 100%;
    font-size: 12.5px;
}

.dcm-prop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dcm-prop-color {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dcm-prop-color input[type="color"] {
    width: 32px;
    height: 32px;
    border: 1px solid var(--bs-border-color);
    border-radius: 6px;
    padding: 0;
    cursor: pointer;
}

.dcm-prop-color input[type="text"] { flex: 1; }

.dcm-prop-row label[style*="00924A"] {
    border-bottom: 1px solid rgba(0, 146, 74, .15);
    padding-bottom: 6px;
}

.dcm-field-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    background: #dbeafe;
    color: #1e40af;
    border-radius: 20px;
    font-weight: 600;
}

.dcm-field-tag.empty {
    background: #fef3c7;
    color: #92400e;
}

/* Input group (currency symbol + value) */
.dcm-ig {
    display: flex;
    gap: 4px;
    align-items: stretch;
}

.dcm-ig > .form-control { flex: 1; }
.dcm-ig > .form-select { width: auto; min-width: 70px; }
.dcm-ig-custom { margin-top: 4px; }

/* ---------------------------------------------------------
   8. ALIGNMENT TOOLBAR (multi-select)
   --------------------------------------------------------- */
.dcm-align-toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .08);
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.dcm-align-toolbar.d-none { display: none !important; }

.dcm-align-toolbar .badge {
    background: #7c3aed;
    color: #fff;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.dcm-align-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    font-size: 15px;
    color: #475569;
}

.dcm-align-btn:hover {
    background: #f1f5f9;
    border-color: #7c3aed;
    color: #7c3aed;
}

.dcm-align-sep {
    width: 1px;
    height: 22px;
    background: #e2e8f0;
    margin: 0 4px;
}

/* ---------------------------------------------------------
   9. DATA TAB
   --------------------------------------------------------- */
.dcm-data-shell {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.dcm-data-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bs-border-color);
}

.dcm-data-counter {
    font-size: 12px;
    color: #64748b;
    padding: 4px 10px;
    background: var(--bs-tertiary-bg);
    border-radius: 20px;
    font-weight: 600;
}

.dcm-data-table-wrap {
    flex: 1;
    overflow: auto;
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    background: var(--bs-body-bg);
}

.dcm-data-table {
    margin: 0;
    font-size: 12.5px;
    min-width: 100%;
}

.dcm-data-table th {
    background: var(--bs-tertiary-bg);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
    padding: 6px 8px;
    border-color: var(--bs-border-color);
}

.dcm-data-table td {
    padding: 3px 4px;
    border-color: var(--bs-border-color);
    vertical-align: middle;
}

.dcm-data-table input[type="text"] {
    border: none;
    background: transparent;
    width: 100%;
    padding: 4px 6px;
    font-size: 12.5px;
    outline: none;
    border-radius: 4px;
    transition: background .1s;
}

.dcm-data-table input[type="text"]:focus {
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, .2);
}

.dcm-th-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 120px;
}

.dcm-th-wrap input {
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 2px 4px;
    width: 100%;
    outline: none;
    border-radius: 4px;
}

.dcm-th-wrap input:focus {
    background: #fff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, .25);
}

.dcm-th-actions,
.dcm-td-actions {
    display: flex;
    gap: 3px;
}

.dcm-mini-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background .1s, color .1s;
}

.dcm-mini-btn:hover { background: #f1f5f9; color: #334155; }
.dcm-mini-btn.danger:hover { background: #fee2e2; color: #dc2626; }

.dcm-data-row-num {
    text-align: center;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    width: 40px;
    background: var(--bs-tertiary-bg);
    position: sticky;
    left: 0;
}

/* Items cell + expand button */
.dcm-cell-with-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.dcm-items-cell {
    flex: 1;
    padding: 4px 8px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: border-color .12s, background .12s;
}

.dcm-items-cell:hover {
    border-color: #00924A;
    background: rgba(0, 146, 74, .05);
}

.dcm-items-cell i { color: #00924A; }

.dcm-td-expand {
    background: transparent;
    border: none;
    color: #00924A;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: background .12s;
    position: relative;
}

.dcm-td-expand:hover { background: rgba(0, 146, 74, .1); }

.dcm-td-expand .count-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #00924A;
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 8px;
    font-weight: 700;
}

/* Row duplicate button */
.dcm-td-dup-row {
    background: transparent;
    border: none;
    color: #00924A;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background .12s;
    margin-right: 2px;
}

.dcm-td-dup-row:hover { background: rgba(0, 146, 74, .12); }

/* ---------------------------------------------------------
   10. FILENAME PATTERN PANEL
   --------------------------------------------------------- */
.dcm-filename-panel {
    padding: 10px 12px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    margin-bottom: 10px;
}

.dcm-filename-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0;
}

.dcm-fn-token {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .12s;
    font-family: 'Consolas', monospace;
}

.dcm-fn-token:hover {
    background: #dbeafe;
    border-color: #60a5fa;
    transform: translateY(-1px);
}

.dcm-filename-preview {
    font-size: 11.5px;
    color: #64748b;
}

.dcm-filename-preview code {
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    color: #00924A;
    font-weight: 600;
    font-family: 'Consolas', monospace;
}

/* ---------------------------------------------------------
   11. TABLE DATA ENTRY MODAL
   --------------------------------------------------------- */
.dcm-td-grid {
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    max-height: 55vh;
    background: var(--bs-body-bg);
}

.dcm-td-grid table {
    margin: 0;
    font-size: 12.5px;
}

.dcm-td-grid th {
    background: var(--bs-tertiary-bg);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 5px 8px;
}

.dcm-td-grid td {
    padding: 3px 4px;
    vertical-align: middle;
}

.dcm-td-grid input[type="text"] {
    border: none;
    background: transparent;
    width: 100%;
    padding: 4px 6px;
    font-size: 12.5px;
    outline: none;
    border-radius: 4px;
}

.dcm-td-grid input[type="text"]:focus {
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, .2);
}

.dcm-td-col-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px 3px 10px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    color: #334155;
}

.dcm-td-col-chip input {
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 11.5px;
    width: 80px;
    outline: none;
}

.dcm-td-col-chip button {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 11px;
    transition: background .1s, color .1s;
}
/* Hide only the type-toggle button that shows the "fonts" icon */
.dcm-th-actions button[data-action="toggle-type"]:has(i.bi-fonts) {display: none !important;}
.dcm-td-col-chip button:hover { background: #fee2e2; color: #dc2626; }
.dcm-data-table input[type="text"]:focus {color: #0f172a !important;-webkit-text-fill-color: #0f172a;}

/* ---------------------------------------------------------
   12. ADD FIELD MODAL
   --------------------------------------------------------- */
.dcm-af-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.dcm-af-type {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid var(--bs-border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .15s;
    background: var(--bs-body-bg);
}

.dcm-af-type:hover {
    border-color: #00924A;
    transform: translateY(-2px);
}

.dcm-af-type.selected {
    border-color: #00924A;
    background: rgba(0, 146, 74, .06);
}

.dcm-af-type i {
    font-size: 22px;
    color: #00924A;
    flex-shrink: 0;
}

.dcm-af-type > div { line-height: 1.3; }

/* ---------------------------------------------------------
   13. TEMPLATE LIST / PREVIEW MODAL
   --------------------------------------------------------- */
.dcm-template-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.dcm-template-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    padding: 12px;
    background: var(--bs-body-bg);
    cursor: pointer;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dcm-template-card:hover {
    border-color: #00924A;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 146, 74, .1);
}

.dcm-template-card .dcm-tc-name {
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dcm-template-card .dcm-tc-meta {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
}

.dcm-template-card .dcm-tc-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.dcm-preview-body {
    background: #e2e8f0;
    display: flex;
    justify-content: center;
    padding: 24px;
    min-height: 500px;
}

.dcm-preview-body .dcm-canvas {
    box-shadow: 0 8px 30px rgba(15, 23, 42, .15);
}

/* ---------------------------------------------------------
   14. GLOBAL PROGRESS BAR
   --------------------------------------------------------- */
.dcm-global-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 9999;
    display: none;
}

.dcm-global-bar-fill {
    height: 100%;
    background: #00924A;
    width: 0%;
    transition: width .3s;
}

/* ---------------------------------------------------------
   15. TOASTS
   --------------------------------------------------------- */
.dcm-toast-stack {
    position: fixed;
    top: 65px;
    right: 16px;
    z-index: 9999999 !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.dcm-toast {
    background: var(--bs-body-bg, #fff);
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    animation: dcm-slidein .25s ease;
    pointer-events: auto;
    min-width: 220px;
    max-width: 340px;
    color: var(--bs-body-color);
}

@keyframes dcm-slidein {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes dcm-slideout {
    to { transform: translateX(110%); opacity: 0; }
}

/* ---------------------------------------------------------
   16. ICON BUTTON
   --------------------------------------------------------- */
.dcm-icon-btn {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s, background .15s;
    font-size: 17px;
    position: relative;
    flex-shrink: 0;
    color: #334155;
}

.dcm-icon-btn:hover {
    transform: translateY(-2px);
    background: var(--bs-secondary-bg);
}

.dcm-icon-btn.dcm-disabled {
    opacity: .35;
    pointer-events: none;
}

/* ---------------------------------------------------------
   17. LOADING OVERLAY
   --------------------------------------------------------- */
.dcm-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 99999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.dcm-loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.dcm-loading-card {
    background: #fff;
    border-radius: 14px;
    padding: 26px 36px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-width: 220px;
    animation: dcm-pop-in .25s ease;
}

@keyframes dcm-pop-in {
    from { transform: scale(.9); opacity: 0; }
    to   { transform: scale(1);  opacity: 1; }
}

.dcm-loading-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #e2e8f0;
    border-top-color: #00924A;
    border-radius: 50%;
    animation: dcm-spin .8s linear infinite;
}

@keyframes dcm-spin {
    to { transform: rotate(360deg); }
}

.dcm-loading-text {
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    letter-spacing: .01em;
}

/* ---------------------------------------------------------
   18. LOGIN BANNER
   --------------------------------------------------------- */
.dcm-login-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: linear-gradient(90deg, #fef3c7, #fde68a);
    border-bottom: 1px solid #f59e0b;
    font-size: 12.5px;
    color: #78350f;
    flex-wrap: wrap;
}

.dcm-login-banner a.btn {
    font-size: 12px;
    padding: 3px 10px;
}

select option[data-loaded="0"] { color: #94a3b8; }

/* ---------------------------------------------------------
   19. DARK THEME
   --------------------------------------------------------- */
[data-bs-theme="dark"] .dcm-palette,
[data-bs-theme="dark"] .dcm-props,
[data-bs-theme="dark"] .dcm-top-bar,
[data-bs-theme="dark"] .dcm-main-tabs,
[data-bs-theme="dark"] .dcm-footer-bar {
    background: #1e293b;
    border-color: #334155;
}

[data-bs-theme="dark"] .dcm-palette-header,
[data-bs-theme="dark"] .dcm-props-header,
[data-bs-theme="dark"] .dcm-palette-footer {
    background: #0f172a;
    color: #cbd5e1;
    border-color: #334155;
}

[data-bs-theme="dark"] .dcm-palette-item,
[data-bs-theme="dark"] .dcm-icon-btn {
    background: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .dcm-palette-item:hover {
    background: rgba(0, 146, 74, .15);
}

[data-bs-theme="dark"] .dcm-canvas-wrap {
    background: repeating-conic-gradient(#1e293b 0% 25%, #0f172a 0% 50%) 50% / 20px 20px;
}

[data-bs-theme="dark"] .dcm-el-table th {
    background: #1e293b;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .dcm-el-table td {
    border-color: #334155;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .dcm-items-cell {
    background: #1e293b;
    border-color: #475569;
    color: #cbd5e1;
}

[data-bs-theme="dark"] .dcm-loading-card {
    background: #1e293b;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

[data-bs-theme="dark"] .dcm-loading-text { color: #cbd5e1; }

[data-bs-theme="dark"] .dcm-loading-spinner {
    border-color: #334155;
    border-top-color: #10b981;
}

/* ---------------------------------------------------------
   20. DESKTOP SAFETY NET (>= 1025px)
   Real panels visible, mobile FABs & drawer hidden.
   --------------------------------------------------------- */
@media (min-width: 1025px) {
    .dcm-palette { display: flex !important; }
    .dcm-props   { display: flex !important; }

    .dcm-mobile-fab-stack,
    .dcm-mobile-drawer {
        display: none !important;
    }
}

/* ---------------------------------------------------------
   21. TABLET (769px – 1024px) — hide props only, show FABs
   --------------------------------------------------------- */
@media (min-width: 769px) and (max-width: 1024px) {
    .dcm-props { display: none !important; }

    .dcm-mobile-fab-stack {
        display: flex;
        flex-direction: column;
        gap: 12px;
        position: fixed;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1045;
        pointer-events: none;
        max-height: calc(100dvh - 120px);
        overflow-y: auto;
    }

    .dcm-mobile-fab {
        pointer-events: auto;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: none;
        background: #00924A;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
        cursor: pointer;
        transition: transform .15s ease, background .15s ease;
        position: relative;
    }

    .dcm-mobile-fab:active { transform: scale(.92); }
    .dcm-mobile-fab.fab-accent { background: #2563eb; }
    .dcm-mobile-fab.fab-secondary { background: #4b5563; }

    .dcm-mobile-fab::after {
        content: attr(data-label);
        position: absolute;
        right: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: rgba(15, 23, 42, .92);
        color: #fff;
        font-size: 11px;
        font-weight: 600;
        padding: 4px 9px;
        border-radius: 6px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity .15s;
    }

    .dcm-mobile-fab:hover::after,
    .dcm-mobile-fab:focus::after { opacity: 1; }

    .dcm-mobile-drawer {
        position: fixed;
        inset: 0;
        z-index: 1060;
        display: none;
    }

    .dcm-mobile-drawer.dcm-open { display: block; }

    .dcm-mobile-drawer-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        animation: dcmFadeIn .2s ease;
    }

    .dcm-mobile-drawer-sheet {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: min(440px, 90vw);
        background: var(--bs-body-bg, #fff);
        display: flex;
        flex-direction: column;
        box-shadow: -8px 0 32px rgba(0, 0, 0, .25);
        animation: dcmSlideIn .25s ease;
        overflow: hidden;
    }

    .dcm-mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        border-bottom: 1px solid var(--bs-border-color);
        background: var(--bs-body-bg, #fff);
        flex: 0 0 auto;
    }

    .dcm-mobile-drawer-header h6 { margin: 0; font-weight: 700; }

    .dcm-mobile-drawer-close {
        border: none;
        background: transparent;
        font-size: 22px;
        line-height: 1;
        color: #6b7280;
        cursor: pointer;
        padding: 4px 8px;
    }

    .dcm-mobile-drawer-body {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dcm-mobile-drawer-body .dcm-palette,
    .dcm-mobile-drawer-body .dcm-props {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        border: none !important;
    }

    .dcm-mobile-drawer-body .dcm-palette-body,
    .dcm-mobile-drawer-body .dcm-props-body {
        overflow: visible !important;
    }
}

/* ---------------------------------------------------------
   22. MOBILE (<= 768px) — hide both panels, show FABs,
       full-height canvas
   --------------------------------------------------------- */
@media (max-width: 768px) {

    /* Shell fills viewport under top bar */
    .dcm-shell {
        height: calc(100dvh - 59px);
        overflow: hidden;
    }

    /* Design area fills remaining space; 3-col grid → 1-col */
    .dcm-design-shell {
        display: block;
        height: calc(100dvh - 59px - 56px - 108px);
        position: relative;
        overflow: hidden;
    }

    /* Hide both panels on mobile */
    .dcm-palette,
    .dcm-props {
        display: none !important;
    }

    /* Canvas fills entire design area */
    .dcm-canvas-wrap {
        position: absolute;
        inset: 0;
        height: 100% !important;
        width: 100%;
    }

    .dcm-canvas-scroll {
        height: 100%;
        padding: 12px;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .dcm-shell,
    .dcm-design-shell,
    .dcm-canvas-wrap {
        overscroll-behavior: contain;
    }

    .dcm-prop-grid { margin-bottom: 0 !important; }

    /* ---- FAB STACK ---- */
    .dcm-mobile-fab-stack {
        display: flex;
        flex-direction: column;
        gap: 12px;
        position: fixed;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1045;
        pointer-events: none;
        max-height: calc(100dvh - 120px);
        overflow-y: auto;
    }

    .dcm-mobile-fab {
        pointer-events: auto;
        width: 52px;
        height: 52px;
        border-radius: 50%;
        border: none;
        background: #00924A;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
        transition: transform .15s ease, background .15s ease;
        cursor: pointer;
        position: relative;
    }

    .dcm-mobile-fab::after {
        content: attr(data-label);
        position: absolute;
        right: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: rgba(15, 23, 42, .92);
        color: #fff;
        font-size: 11px;
        font-weight: 600;
        padding: 4px 9px;
        border-radius: 6px;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity .15s;
    }

    .dcm-mobile-fab:hover::after,
    .dcm-mobile-fab:focus::after { opacity: 1; }

    .dcm-mobile-fab:active { transform: scale(.92); }
    .dcm-mobile-fab.fab-accent { background: #2563eb; }
    .dcm-mobile-fab.fab-secondary { background: #4b5563; }

    /* ---- DRAWER ---- */
    .dcm-mobile-drawer {
        position: fixed;
        inset: 0;
        z-index: 1060;
        display: none;
    }

    .dcm-mobile-drawer.dcm-open { display: block; }

    .dcm-mobile-drawer-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        animation: dcmFadeIn .2s ease;
    }

    .dcm-mobile-drawer-sheet {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: min(60vw, 400px);
        background: var(--bs-body-bg, #fff);
        display: flex;
        flex-direction: column;
        box-shadow: -8px 0 32px rgba(0, 0, 0, .25);
        animation: dcmSlideIn .25s ease;
        overflow: hidden;
    }

    .dcm-mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 16px;
        border-bottom: 1px solid var(--bs-border-color);
        background: var(--bs-body-bg, #fff);
        flex: 0 0 auto;
    }

    .dcm-mobile-drawer-header h6 { margin: 0; font-weight: 700; }

    .dcm-mobile-drawer-close {
        border: none;
        background: transparent;
        font-size: 22px;
        line-height: 1;
        color: #6b7280;
        cursor: pointer;
        padding: 4px 8px;
    }

    .dcm-mobile-drawer-body {
        flex: 1 1 auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dcm-mobile-drawer-body .dcm-palette,
    .dcm-mobile-drawer-body .dcm-props {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        border: none !important;
    }

    .dcm-mobile-drawer-body .dcm-palette-body,
    .dcm-mobile-drawer-body .dcm-props-body {
        overflow: visible !important;
    }

    /* ---- FILENAME TOKENS (single scrolling row) ---- */
    .dcm-filename-panel {
        padding: 8px 10px;
        margin-bottom: 8px;
        overflow: auto;
    }

    .dcm-filename-tokens {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        gap: 6px;
        margin: 6px 0;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scroll-snap-type: x proximity;
    }

    .dcm-filename-tokens::-webkit-scrollbar { height: 4px; }
    .dcm-filename-tokens::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }
    .dcm-filename-tokens::-webkit-scrollbar-track { background: transparent; }

    .dcm-fn-token {
        flex: 0 0 auto !important;
        white-space: nowrap;
        scroll-snap-align: start;
        font-size: 11px;
        padding: 3px 10px;
    }

    .dcm-data-table-wrap {
        max-height: calc(100dvh - 260px);
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dcm-filename-preview {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dcm-filename-preview code {
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: bottom;
    }

    .dcm-brand { display: none; }
    .dcm-palette-header { display: none; }
    .dcm-props-header { display: none; }

    .main-content { padding-bottom: 0px !important; }

    /* ---- Shared keyframes ---- */
    @keyframes dcmSlideIn {
        from { transform: translateX(100%); }
        to   { transform: translateX(0); }
    }
    @keyframes dcmFadeIn {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}

/* ---------------------------------------------------------
   23. TAB STATE HELPERS
   --------------------------------------------------------- */
/* Hide FAB stack when the Data tab is active */
body.dcm-on-data-tab .dcm-mobile-fab-stack {
    display: none !important;
}
.dcm-icons-grid {
   max-height: fit-content !important;
}
#dcm-fab-pagesettings{
   display:none !important;
}