/* ==================== MASTER DATA SHARED STYLES ==================== */
/* Used by: CarMarker, VehicleRegistration, OEM, PartNoList, DrawingECN, etc. */

/* ── Base ── */
.cm-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #0d6efd;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cm-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0d6efd;
    display: inline-block;
}

.cm-page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    letter-spacing: -.02em;
}

.cm-page-sub {
    font-size: 13px;
    color: #6b7280;
}

/* ── Buttons ── */
.cm-btn-add {
    height: 40px;
    padding: 0 18px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
}

.cm-btn-action {
    height: 38px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
}

/* ── Cards ── */
.cm-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ── Filter ── */
.cm-filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #9ca3af;
}

.cm-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    display: block;
}

/* ── Inputs ── */
.cm-input {
    height: 38px;
    font-size: 13px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
}

.cm-input:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

.cm-input.is-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220,53,69,.12);
}

.cm-field-error {
    font-size: 11px;
    color: #dc3545;
    min-height: 16px;
    margin-top: 3px;
}

/* ── Table ── */
.cm-table {
    table-layout: auto;
    overflow: visible !important;
}

.cm-table-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f3f4f6;
}

.cm-table-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.cm-count-badge {
    background: #e8f0fe;
    color: #1a56db;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.cm-table thead th,
.dataTables_wrapper .cm-table thead th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280 !important;
    background: #f9fafb !important;
    border-bottom: 1px solid #f0f0f0;
    padding: 10px 14px;
}

.cm-table td {
    font-size: 13px;
    padding: 12px 14px;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-table tbody tr:hover {
    background: #f8fbff !important;
}

.cm-empty-row {
    text-align: center;
    padding: 3rem 14px !important;
    color: #9ca3af;
    font-size: 13px;
}

.cm-empty-row i {
    font-size: 28px;
    opacity: .5;
}

/* ── Sort indicator ── */
.cm-sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 26px !important;
}

.cm-sortable::before,
.cm-sortable::after {
    display: block;
    position: absolute;
    right: 10px;
    line-height: 9px;
    font-size: .8em;
    opacity: .125;
    pointer-events: none;
}

.cm-sortable::before { bottom: 50%; content: '\25B2'; }
.cm-sortable::after  { top: 50%;    content: '\25BC'; }
.cm-sortable:hover::before,
.cm-sortable:hover::after { opacity: .35; }
.sorting_asc::before  { opacity: .6 !important; }
.sorting_desc::after  { opacity: .6 !important; }

/* ── Code Pill ── */
.cm-code-pill {
    background: #e8f0fe;
    color: #1a56db;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    font-family: monospace;
    letter-spacing: .03em;
}

.cm-select-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    background: #f8fafc;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

.cm-table .cm-code-pill,
.cm-table .cm-select-pill {
    white-space: nowrap;
}

/* ── Badges ── */
.cm-badge-active {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #dcfce7;
    color: #15803d;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.cm-badge-active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #16a34a;
}

.cm-badge-inactive {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.cm-badge-inactive::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9ca3af;
}

/* ── Action Buttons ── */
.cm-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
    color: #6b7280;
    font-size: 14px;
    transition: all .15s;
}

.cm-action-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.cm-action-btn.del:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fca5a5;
}

.cm-action-btn.status:hover {
    background: #eff6ff;
    color: #2563eb;
    border-color: #93c5fd;
}

.cm-action-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ── Child Card Num ── */
.child-card-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #dbeafe;
    color: #1e40af;
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ── Child Table ── */
.cm-child-box {
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fbff;
    overflow: hidden;
}

.cm-child-note {
    font-size: 12px;
    color: #475569;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
}

.cm-child-table {
    table-layout: auto;
    margin-bottom: 0;
}

.cm-child-table thead th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #6b7280;
    background: #f9fafb;
    padding: 9px 12px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.cm-child-table td {
    font-size: 13px;
    padding: 8px 12px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.cm-child-table tbody tr:last-child td {
    border-bottom: none;
}

.cm-child-table tbody tr:hover td {
    background: #f0f7ff;
}

/* ── Row highlight ── */
.cm-row-match {
    background: #fff7ed !important;
    box-shadow: inset 4px 0 0 #f59e0b;
}

.cm-row-context {
    background: #eff6ff !important;
}

/* ── Toast ── */
.cm-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    background: #1f2937;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 11px 18px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: .25s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cm-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.cm-toast.success i { color: #22c55e; }
.cm-toast.error i { color: #ef4444; }

/* ── Modal ── */
.cm-modal-content {
    border-radius: 14px;
    border: none;
    overflow: hidden;
}

.cm-modal-header {
    background: #0d6efd;
    padding: 16px 20px;
    border-bottom: none;
}

.cm-modal-eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.7);
    margin-bottom: 2px;
}

.cm-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cm-modal-footer {
    background: #f9fafb;
    border-top: 1px solid #f0f0f0;
    padding: 12px 20px;
}

.cm-mode-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    letter-spacing: .04em;
    vertical-align: middle;
}

.cm-mode-new {
    background: rgba(255,255,255,.22);
    color: #fff;
}

.cm-mode-edit {
    background: #fef08a;
    color: #713f12;
}

/* ── Confirm Icon ── */
.cm-confirm-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #fff3cd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #f59e0b;
}

/* ── Textarea ── */
.cm-textarea {
    min-height: 100px;
    resize: vertical;
}

/* ── Switch ── */
.cm-switch-row {
    margin-bottom: 0;
    padding-left: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cm-switch-row .form-check-input {
    float: none;
    margin: 0;
    width: 2.75rem;
    height: 1.4rem;
    cursor: pointer;
}

.cm-switch-label {
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
}

/* ── Option Pills ── */
.option-pills-wrap {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 2px 0;
    align-items: center;
    vertical-align: middle;
}

.opt-pill {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
    line-height: 1;
    letter-spacing: .01em;
}

/* ── Dropzone ── */
.cm-dropzone {
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    background: #fafafa;
    user-select: none;
}

.cm-dropzone:hover, .cm-dropzone.drag-over {
    border-color: #0d6efd;
    background: #eff6ff;
}

.cm-dropzone-icon {
    font-size: 26px;
    color: #9ca3af;
    margin-bottom: 6px;
    display: block;
}

.cm-dropzone-text {
    font-size: 13px;
    color: #374151;
    margin-bottom: 2px;
}

.cm-dropzone-sub {
    font-size: 11px;
    color: #9ca3af;
}

.cm-dropzone-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
    font-size: 12px;
    font-weight: 500;
    color: #0d6efd;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 5px 14px;
    pointer-events: none;
}

/* ── File Chips ── */
.cm-file-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    min-height: 0;
}

.cm-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 5px 6px 5px 10px;
    font-size: 12px;
    color: #374151;
    max-width: 220px;
}

.cm-chip-icon { font-size: 14px; flex-shrink: 0; }
.cm-chip-icon.pdf { color: #e24b4a; }
.cm-chip-icon.img { color: #3b82f6; }
.cm-chip-icon.xls { color: #3b6d11; }
.cm-chip-icon.doc { color: #185fa5; }
.cm-chip-icon.other { color: #888780; }

.cm-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.cm-chip-size {
    font-size: 11px;
    color: #9ca3af;
    flex-shrink: 0;
    white-space: nowrap;
}

.cm-chip-del {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    flex-shrink: 0;
    padding: 0;
    transition: all .12s;
    font-size: 10px;
    line-height: 1;
}

.cm-chip-del:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ── Attach List ── */
.cm-attach-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cm-attach-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
}

.cm-attach-icon { font-size: 15px; flex-shrink: 0; color: #9ca3af; }
.cm-attach-icon.pdf { color: #e24b4a; }
.cm-attach-icon.img { color: #3b82f6; }
.cm-attach-icon.xls { color: #3b6d11; }
.cm-attach-icon.doc { color: #185fa5; }

.cm-attach-main { flex: 1; min-width: 0; }

.cm-attach-name {
    font-size: 12px;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cm-attach-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 1px;
}

.cm-attach-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cm-attach-empty {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
    padding: 6px 2px;
}

/* ── Bar Filter Button ── */
.bar-filter-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background: #fff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 36px;
}

.bar-filter-btn:hover { border-color: #86b7fe; }
.bar-filter-btn:focus, .bar-filter-btn.active { border-color: #86b7fe; outline: 0; box-shadow: 0 0 0 0.2rem rgba(13,110,253,.15); }
.bar-filter-btn .bar-filter-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.bar-filter-btn .bar-filter-badge {
    font-size: 10px; padding: 1px 6px; border-radius: 8px;
    background: #0d6efd; color: #fff; margin-left: 6px; flex-shrink: 0;
}
.bar-filter-btn:not(.active) .bar-filter-badge { display: none; }

/* ── Column Filter Dropdown ── */
.col-filter-dropdown {
    display: none; position: fixed; z-index: 1060;
    background: #fff; border: 1px solid #dee2e6; border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,.15); min-width: 220px; padding: 0;
}
.col-filter-dropdown .filter-search { padding: 8px; border-bottom: 1px solid #eee; }
.col-filter-dropdown .filter-search input {
    width: 100%; border: 1px solid #dee2e6; border-radius: 4px; padding: 5px 8px; font-size: 12px; outline: none;
}
.col-filter-dropdown .filter-search input:focus { border-color: #86b7fe; }
.col-filter-dropdown .filter-list { max-height: 220px; overflow-y: auto; padding: 4px 0; }
.col-filter-dropdown .filter-list label {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 12px; margin: 0; font-size: 12px; cursor: pointer; transition: background 0.1s;
}
.col-filter-dropdown .filter-list label:hover { background: #f0f4ff; }
.col-filter-dropdown .filter-list label input { margin: 0; flex-shrink: 0; }
.col-filter-dropdown .filter-actions { display: flex; justify-content: space-between; padding: 6px 8px; border-top: 1px solid #eee; }
.col-filter-dropdown .filter-actions button { font-size: 11px; padding: 2px 10px; }
