.custom-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-xs);
}
.custom-card > .card-header,
.custom-card > .custom-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.custom-card > .card-body { padding: 20px; }
.custom-card-title { font-size: 15px; font-weight: 600; margin: 0; }
.custom-card-sub { font-size: 12.5px; color: var(--muted); margin: 2px 0 0; }

.btn {
    --bs-btn-font-weight: 500;
    border-radius: var(--r-sm);
    font-size: 14px;
    padding: 8px 16px;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

.btn-brand {
    background: var(--brand);
    border: 1px solid var(--brand);
    color: #fff;
}
.btn-brand:hover, .btn-brand:focus { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-brand:focus-visible { box-shadow: 0 0 0 4px var(--brand-ring); }

.btn-soft {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text-2);
}
.btn-soft:hover { background: var(--surface-2); border-color: var(--muted); color: var(--text); }

.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn-square { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

.form-label, .form-label-sm {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
    letter-spacing: .01em;
}
.form-control, .form-select {
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text);
    background-color: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control::placeholder { color: #9AA7B8; }
.form-control:focus, .form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-ring);
}
.form-control:disabled, .form-select:disabled { background: var(--surface-2); color: var(--muted); }
textarea.form-control { min-height: 92px; resize: vertical; }

.form-group { margin-bottom: 16px; }
.req { color: var(--brand); font-weight: 700; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; display: block; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 5px; display: none; }
.has-error .form-control, .has-error .form-select { border-color: var(--danger); }
.has-error .field-error { display: block; }

.input-icon { position: relative; }
.input-icon > [data-lucide] { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon > .form-control { padding-left: 38px; }

.choice-grid { display: grid; gap: 10px; }
.choice-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.choice {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-2);
    min-height: 48px;
}
.choice:hover { border-color: var(--brand); background: var(--surface-2); }
.choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice .choice-box {
    width: 18px; height: 18px; flex: none;
    border: 1.8px solid var(--border-strong);
    border-radius: 5px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface);
    transition: all .15s ease;
}
.choice.is-radio .choice-box { border-radius: 50%; }
.choice .choice-box svg { width: 12px; height: 12px; color: #fff; opacity: 0; stroke-width: 3.2; }
.choice input:checked ~ .choice-box { background: var(--brand); border-color: var(--brand); }
.choice input:checked ~ .choice-box svg { opacity: 1; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-hover); }
.choice input:focus-visible ~ .choice-box { box-shadow: 0 0 0 4px var(--brand-ring); }

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    letter-spacing: .01em;
    white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-muted   { background: #EEF1F6;             color: var(--muted); }
.badge-brand   { background: var(--brand-soft);   color: var(--brand-hover); }

.badge-soon {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: var(--on-dark-muted);
    letter-spacing: .03em;
    text-transform: uppercase;
}

table.dataTable, .table {
    font-size: 13px;
    color: var(--text-2);
    margin: 0 !important;
    width: 100% !important;
    border-collapse: collapse;
}
.table-responsive .table,
.table-responsive table.dataTable {
    border: 1px solid var(--grid-line-2) !important;
}

.table-responsive .table,
.table-responsive table.dataTable {
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: transparent;
    --bs-table-active-bg: transparent;
    --bs-table-bg-type: transparent;
    --bs-table-bg-state: transparent;
}

.table-responsive thead > tr > th,
.table-responsive table.dataTable thead > tr > th {
    background: var(--row-tint);
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .055em;
    padding: 10px 14px;
    white-space: nowrap;
    vertical-align: middle;
    border-bottom: 1px solid var(--grid-line-2) !important;
    border-right: 1px solid var(--grid-line-2);
}
.table-responsive thead > tr > th:last-child,
.table-responsive table.dataTable thead > tr > th:last-child { border-right: 0; }

.table-responsive thead > tr > th,
.table-responsive table.dataTable thead > tr > th { text-align: left !important; }

.table-responsive table.dataTable tbody > tr > td.dt-type-numeric,
.table-responsive table.dataTable tbody > tr > td.dt-type-date { text-align: left !important; }

.table-responsive tbody > tr > td,
.table-responsive table.dataTable tbody > tr > td {
    padding: 11px 14px;
    vertical-align: middle;
    border-bottom: 1px solid var(--grid-line);
    border-right: 1px solid var(--grid-line);
}
.table-responsive tbody > tr > td:last-child,
.table-responsive table.dataTable tbody > tr > td:last-child { border-right: 0; }
.table-responsive tbody > tr:last-child > td { border-bottom: 0; }

.table-responsive tbody > tr:nth-child(odd) > td,
.table-responsive table.dataTable tbody > tr:nth-child(odd) > td  { background: var(--surface); }
.table-responsive tbody > tr:nth-child(even) > td,
.table-responsive table.dataTable tbody > tr:nth-child(even) > td { background: var(--row-zebra); }

.table-responsive thead > tr > th,
.table-responsive table.dataTable thead > tr > th,
.table-responsive tbody > tr > td,
.table-responsive table.dataTable tbody > tr > td { box-shadow: none !important; }

.table-responsive tbody > tr > td:first-child { box-shadow: inset 3px 0 0 transparent !important; }
.table-responsive tbody > tr:hover > td,
.table-responsive table.dataTable tbody > tr:hover > td { background: var(--row-hover); }
.table-responsive tbody > tr:hover > td:first-child { box-shadow: inset 3px 0 0 var(--brand) !important; }

.table .cell-strong { font-weight: 600; color: var(--text); }

.row-actions { display: flex; gap: 4px; }
.row-actions a {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 7px;
    color: var(--muted);
    border: 1px solid transparent;
    transition: all .15s ease;
}
.row-actions a:hover { background: var(--surface-2); border-color: var(--border); color: var(--brand); text-decoration: none; }
.row-actions a.act-danger:hover { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }

.avatar {
    width: 34px; height: 34px; flex: none;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-soft);
    color: var(--brand-hover);
    font-weight: 600;
    font-size: 12.5px;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.dt-container .dt-length, .dt-container .dt-search { display: none; }
.dt-container .dt-info {
    font-size: 12.5px;
    color: var(--muted);
    padding: 14px 16px 0;
}
.dt-container .dt-paging { padding: 10px 16px 4px; }
.dt-container .pagination { margin: 0; justify-content: flex-end; gap: 4px; }
.dt-container .page-link {
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-2);
    font-size: 13px;
    padding: 5px 11px;
}
.dt-container .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.dt-container .page-item.disabled .page-link { color: #B6C0CD; }
table.dataTable thead > tr > th.dt-orderable-asc,
table.dataTable thead > tr > th.dt-orderable-desc { cursor: pointer; }
.dt-buttons { display: none !important; }

.empty-state { text-align: center; padding: 52px 20px; }
.empty-state .empty-ico {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--muted);
    margin-bottom: 16px;
}
.empty-state .empty-ico [data-lucide] { width: 26px; height: 26px; }
.empty-state h4 { font-size: 15px; margin-bottom: 6px; }
.empty-state p { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.modal-content {
    border: 0;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); gap: 8px; }
.modal-backdrop.show { opacity: .45; }

.divider-text {
    display: flex; align-items: center; gap: 12px;
    color: var(--muted); font-size: 12px; margin: 18px 0;
}
.divider-text::before, .divider-text::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

.img-thumb {
    width: 38px; height: 38px; flex: none;
    border-radius: 7px;
    object-fit: cover;
    border: 1px solid var(--border);
    cursor: zoom-in;
    background: var(--surface-2);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.img-thumb:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }

.select2-container--default .select2-selection--single {
    height: 40px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 38px; padding-left: 12px; font-size: 14px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 38px; }

.swal-lightbox-img {
    max-width: 100%;
    max-height: 72vh;
    width: auto;
    object-fit: contain;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}

.kv-list { display: block; }
.kv-row {
    display: flex; gap: 14px; align-items: baseline;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 13.5px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-key { flex: 0 0 42%; color: var(--muted); }
.kv-val { flex: 1 1 auto; min-width: 0; color: var(--text); font-weight: 500; word-break: break-word; }

.detail-panel {
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
    height: 100%;
}
.detail-panel > .detail-head {
    display: flex; align-items: center; gap: 8px;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--r) var(--r) 0 0;
    font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted);
}
.detail-panel > .detail-head i { width: 15px; height: 15px; }
.detail-panel > .detail-body { padding: 6px 16px 12px; }

.att-tile { width: 178px; }
.att-tile .att-img,
.att-tile .att-empty {
    width: 178px; height: 124px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    object-fit: cover;
    display: block;
}
.att-tile .att-empty {
    display: flex; align-items: center; justify-content: center;
    color: var(--muted);
    border-style: dashed;
}
.att-tile .att-name {
    font-size: 12px; color: var(--muted);
    margin-top: 6px;
    display: flex; align-items: center; gap: 5px;
}
.swal-lightbox-foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap;
    width: 100%;
    border-top: 0 !important;
    padding-top: 4px !important;
}
.swal-lightbox-foot .lb-cap { font-size: 13.5px; font-weight: 600; color: var(--text); }

.thumb-cell {
    display: flex; align-items: center; justify-content: center;
    gap: 5px;
}

.total-chip {
    display: inline-flex; align-items: center;
    height: 38px;
    padding: 0 15px;
    border: 1px solid #BFE4CB;
    border-radius: var(--r-sm);
    background: var(--success-soft);
    color: var(--success);
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
