:root {
    --sidebar-width: 260px;
    --header-height: 60px;
    --primary-color: var(--color-primary, #4A6FA5);
    --primary-hover: var(--color-primary-dark, #365983);
    --bg-color: var(--bg-body, #f6f7fb);
    --card-bg: var(--bg-card, #ffffff);
    --text-main: var(--text-main, #1E2430);
    --text-secondary: var(--text-sub, #4B5565);
    --border-color: var(--border, #e1e5ef);
    --success-color: var(--color-success, #2D8F6F);
    --danger-color: var(--color-danger, #D2555A);
    --warning-color: var(--color-warning, #DFA94B);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Layout */
.settings-layout {
    display: flex;
    min-height: calc(100vh - 60px);
    /* Adjust based on main navbar height if any */
    margin-top: 0;
}

.settings-sidebar {
    width: var(--sidebar-width);
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.1rem 0.85rem;
    display: flex;
    flex-direction: column;
}

.settings-content {
    flex: 1;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar Navigation */
.nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

.nav-item-v2 {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
    font-size: 0.925rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item-v2:hover {
    background-color: rgba(74, 111, 165, 0.08);
    color: var(--text-main);
}

.nav-item-v2.active {
    background-color: rgba(74, 111, 165, 0.12);
    color: var(--primary-color);
}

.nav-item-v2 i {
    width: 1.25rem;
    margin-right: 0.75rem;
    text-align: center;
    font-size: 1rem;
}

/* Content Area */
.section-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Cards */
.settings-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header-v2 {
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-card);
}

.card-title-v2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.card-body-v2 {
    padding: 1.1rem;
}

/* Form Elements - Compact */
.form-group-v2 {
    margin-bottom: 0.9rem;
}

.form-group-v2:last-child {
    margin-bottom: 0;
}

.form-label-v2 {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.375rem;
}

.form-control-v2 {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.925rem;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--bg-card, #FFFFFF);
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control-v2:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-text-v2 {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* LINE Notifications */
.line-notification-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.line-group-card {
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    padding: 0.85rem;
    background: var(--card-bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.line-group-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.line-group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
}

.line-group-status {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--text-muted, #6B7280);
    flex-shrink: 0;
}

.line-group-status.active {
    background: var(--success-color);
    box-shadow: 0 0 0 4px rgba(45, 143, 111, 0.15);
}

.line-group-meta {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.line-group-controls {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.line-group-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.line-group-type {
    margin: 0;
}

.line-notification-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.line-notification-stat {
    padding: 0.75rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border-color);
    background: rgba(74, 111, 165, 0.06);
}

.line-notification-stat .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.line-notification-stat .stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.line-notification-days {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 220px;
    overflow-y: auto;
}

.line-notification-day {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.35rem 0.5rem;
    border-radius: 0.4rem;
    background: rgba(255, 255, 255, 0.6);
}

.line-notification-day:nth-child(even) {
    background: rgba(74, 111, 165, 0.05);
}

/* Toggles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
}

.toggle-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border, #E1E5EF);
    transition: .4s;
    border-radius: 20px;
    pointer-events: none;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: #ffffff;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

input:checked+.toggle-slider {
    background-color: var(--primary-color);
}

input:checked+.toggle-slider:before {
    transform: translateX(14px);
}

/* Bot List Items */
.bot-item-compact {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    margin-bottom: 0.5rem;
    background-color: var(--bg-card, #FFFFFF);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bot-item-compact:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.bot-channel {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    font-size: 0.75rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.bot-channel.line {
    background: linear-gradient(135deg, #06c755, #03ad49);
}

.bot-channel.facebook {
    background: linear-gradient(135deg, #1877f2, #0f5ecc);
}

.bot-main {
    flex: 1;
    min-width: 0;
}

.bot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}

.bot-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.bot-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-main);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-default {
    background: rgba(74, 111, 165, 0.12);
    color: var(--primary-color);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
}



.bot-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.25rem;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 0.45rem;
    background-color: #f7f8fb;
    color: var(--text-secondary);
    font-size: 0.78rem;
    white-space: nowrap;
}

.bot-subtext {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.1rem;
}

.bot-inline-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border, #E1E5EF);
    width: 100%;
}

.inline-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 600;
    opacity: 0.85;
}

.inline-control {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.instruction-control {
    flex: 1;
    min-width: 200px;
    flex-wrap: nowrap;
}

.instruction-select {
    padding: 0.1rem 1.4rem 0.1rem 0.4rem;
    font-size: 0.72rem;
    min-height: 0;
    height: auto;
    background-position: right 0.25rem center;
    background-size: 8px 8px;
    border-radius: 0.3rem;
    border-color: var(--border-color);
    width: auto;
    flex: 1;
    max-width: none;
}

.instruction-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.35rem;
    background: rgba(var(--primary-rgb, 74, 111, 165), 0.1);
    color: var(--color-primary, #4A6FA5);
    font-size: 0.72rem;
}

.instruction-chip.slim {
    padding: 0.2rem 0.45rem;
}

.instruction-chip.chip-muted {
    background: var(--bg-body, #F6F7FB);
    color: var(--text-secondary);
}

.bot-actions-compact {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.actions-stack {
    display: inline-flex;
    gap: 0.25rem;
}

.btn-ghost-sm {
    border: 1px solid var(--border-color);
    background: #fff;
    padding: 0.15rem 0.35rem;
    border-radius: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.btn-ghost-xs {
    padding: 0.2rem 0.35rem;
    font-size: 0.75rem;
}

.btn-ghost-sm:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.btn-ghost-sm.text-danger:hover {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

@media (max-width: 768px) {
    .bot-item-compact {
        flex-direction: column;
        align-items: flex-start;
    }

    .bot-actions-compact {
        width: 100%;
        justify-content: flex-end;
    }

    .inline-control {
        width: 100%;
    }

    .inline-control .form-select {
        width: 100%;
    }
}

/* Buttons */
.btn-v2 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    gap: 0.5rem;
    box-shadow: none;
}

.btn-v2-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

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

.btn-v2-secondary {
    background-color: #ffffff;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-v2-secondary:hover {
    background-color: rgba(74, 111, 165, 0.08);
    border-color: var(--border-color);
}

.btn-v2-danger {
    background-color: #ffffff;
    border-color: rgba(var(--danger-rgb, 210, 85, 90), 0.2);
    color: var(--danger-color);
}

.btn-v2-danger:hover {
    background-color: rgba(var(--danger-rgb, 210, 85, 90), 0.08);
    border-color: rgba(var(--danger-rgb, 210, 85, 90), 0.3);
}

.btn-v2-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background: rgba(74, 111, 165, 0.08);
    border-color: var(--border-color);
}

.btn-action.btn-tertiary {
    background: var(--bg-body, #F6F7FB);
}

.btn-action.btn-secondary {
    background: rgba(74, 111, 165, 0.12);
    border-color: var(--border-color);
    color: var(--primary-color);
}

.btn-action.btn-line {
    background: #06c755;
    border-color: #06c755;
    color: #ffffff;
}

.btn-action.btn-facebook {
    background: #1877f2;
    border-color: #1877f2;
    color: #ffffff;
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active {
    background-color: rgba(var(--success-rgb, 45, 143, 111), 0.15);
    color: var(--color-success, #2D8F6F);
}

.status-badge.inactive {
    background-color: var(--bg-body, #F6F7FB);
    color: var(--text-sub, #4B5565);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.375rem;
}

.status-badge.active .status-dot {
    background-color: var(--color-success, #2D8F6F);
}

.status-badge.inactive .status-dot {
    background-color: var(--text-muted, #6B7280);
}

/* Image Grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.image-item:hover img {
    transform: scale(1.05);
}

.image-item.selected {
    border: 2px solid var(--primary-color);
}

.image-item.selected:after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: var(--primary-color);
    color: #ffffff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

/* Image Collections Section */
.image-assets-card,
.image-collections-card {
    border: 1px solid var(--border, #E1E5EF);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.gallery-step-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main, #1E2430);
}

.gallery-step-label .step-number {
    background: var(--primary-color);
    color: #ffffff;
    border-radius: 999px;
    padding: 0.1rem 0.55rem;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.gallery-step-label .step-number:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.gallery-step-label .step-number:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.gallery-step-label .step-text {
    font-weight: 600;
}

.image-assets-card .card-body {
    padding: 1rem;
}

.image-upload-dropzone {
    border: 1px dashed var(--color-primary-light, #6F92C2);
    border-radius: 10px;
    padding: 1.5rem 1rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.08) 0%, rgba(79, 70, 229, 0.02) 100%);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.image-upload-dropzone:hover,
.image-upload-dropzone.is-drag-over {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.15) 0%, rgba(79, 70, 229, 0.05) 100%);
    transform: translateY(-1px);
}

.image-upload-dropzone .dropzone-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.image-upload-dropzone .dropzone-text {
    font-weight: 600;
    color: var(--text-main, #1E2430);
}

.image-upload-dropzone .dropzone-subtext {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.asset-selection-toolbar {
    border: 1px dashed rgba(79, 70, 229, 0.2);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    background: rgba(79, 70, 229, 0.05);
}

.asset-selection-toolbar .asset-selection-actions .btn {
    font-size: 0.75rem;
}

.image-assets-list {
    border: 1px solid var(--border, #E1E5EF);
    border-radius: 8px;
    background: var(--bg-card, #FFFFFF);
    max-height: 360px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
}

.image-asset-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--border, #E1E5EF);
    border-radius: 8px;
    padding: 0.6rem;
    background: var(--bg-card, #FFFFFF);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.image-asset-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
}

.image-asset-item.selected {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.image-asset-item.editing {
    border-color: var(--color-info, #3D7FC1);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

.image-asset-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border, #E1E5EF);
    background: var(--bg-body, #F6F7FB);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-asset-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-asset-thumb-placeholder {
    color: var(--text-muted, #6B7280);
    font-size: 1.25rem;
}

.asset-select {
    align-self: flex-start;
    margin-right: 0.25rem;
}

.asset-select .form-check-input {
    margin-top: 0.35rem;
}

.image-asset-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.image-asset-title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.9rem;
}

.image-asset-description {
    font-size: 0.75rem;
    color: var(--text-sub, #4B5565);
}

.image-asset-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: var(--text-muted, #6B7280);
}

.image-asset-meta .dot {
    color: var(--border, #E1E5EF);
}

.image-asset-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.image-asset-actions .btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
}

.image-asset-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.image-asset-edit-actions {
    display: flex;
    gap: 0.4rem;
}

.image-asset-edit-actions .btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
}

.upload-queue-toolbar {
    font-size: 0.8rem;
}

.upload-queue-list {
    border: 1px solid var(--border, #E1E5EF);
    border-radius: 10px;
    background: var(--bg-body, #F6F7FB);
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.upload-queue-item {
    display: flex;
    gap: 0.75rem;
    border: 1px solid #dbe3f3;
    border-radius: 10px;
    padding: 0.6rem;
    background: var(--bg-card, #FFFFFF);
    align-items: flex-start;
}

.upload-queue-item.status-uploading {
    border-color: #93c5fd;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

.upload-queue-item.status-success {
    border-color: #86efac;
}

.upload-queue-item.status-error {
    border-color: #fca5a5;
}

.queue-thumb {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.queue-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.queue-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.queue-header {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.queue-header .form-control {
    flex: 1;
}

.queue-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.queue-actions .form-check {
    margin-bottom: 0;
}

.queue-description-input {
    resize: vertical;
    min-height: 60px;
}

.queue-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.queue-meta .dot {
    color: #cbd5f5;
}

.queue-status {
    font-weight: 500;
}

.queue-progress {
    height: 4px;
    width: 100%;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.queue-progress div {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #4f46e5);
}

.queue-label-input.is-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 0.15rem rgba(248, 113, 113, 0.25);
}

.queue-label-input.is-duplicate {
    border-color: #fbbf24;
    box-shadow: 0 0 0 0.15rem rgba(251, 191, 36, 0.25);
}

.asset-edit-label-input.is-duplicate {
    border-color: #fbbf24;
    box-shadow: 0 0 0 0.15rem rgba(251, 191, 36, 0.25);
}

.asset-edit-label-input.is-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 0.15rem rgba(248, 113, 113, 0.25);
}

.collection-filter-group .btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
}

.collection-filter-group .btn.active {
    background: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.form-switch.form-switch-sm .form-check-input {
    width: 2rem;
    height: 1rem;
    transform: scale(0.85);
    margin-top: 0.25rem;
}

.form-switch.form-switch-sm .form-check-label {
    font-size: 0.7rem;
}

.image-collections-list {
    overflow-y: auto;
    max-height: 520px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.image-collection-card {
    border: 1px solid #edf1f5;
    border-radius: 8px;
    padding: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #ffffff;
}

.image-collection-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 6px 14px rgba(52, 152, 219, 0.08);
}

.collection-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.collection-title {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.collection-actions {
    display: flex;
    gap: 0.35rem;
}

.collection-preview {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    min-height: 48px;
    margin-bottom: 0.5rem;
}

.collection-preview-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body, #F6F7FB);
}

.collection-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.collection-preview-thumb.more {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
}

.collection-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.collection-stat {
    font-size: 0.6875rem;
}

.assignment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.assignment-item {
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.assignment-info {
    flex: 1;
}

.assignment-collections {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.collection-pill {
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.6875rem;
    background: #f1f5f9;
    color: #1f2937;
}

.collection-pill.default {
    background: #e6f8eb;
    color: #166534;
}

.collection-pill.more {
    background: #e2e8f0;
    color: #475569;
}

.assignment-action .btn {
    white-space: nowrap;
}

.collection-asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem;
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    padding: 0.5rem;
    background: var(--bg-card, #FFFFFF);
}

.collection-asset-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid #eef2f6;
    border-radius: 8px;
    padding: 0.45rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.collection-asset-item:hover {
    border-color: var(--primary-color);
    background: #f9fffb;
}

.collection-asset-item input[type="checkbox"] {
    margin-right: 0.35rem;
}

.collection-asset-thumb {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e0e7ff;
    flex-shrink: 0;
}

.collection-asset-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.collection-asset-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8125rem;
}

.collection-select-item {
    border: 1px solid #e4e7eb;
    border-radius: 8px;
    padding: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.collection-select-item:hover {
    border-color: var(--primary-color);
    background: #f6fff8;
}

.collection-select-item input {
    margin-right: 0.35rem;
}

.collection-select-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
    font-size: 0.9rem;
}

.empty-state i {
    font-size: 1.5rem;
    display: block;
}

.bot-collection-summary {
    background: var(--bg-body, #F6F7FB);
    border: 1px solid var(--border, #E1E5EF);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bot-collections-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 360px;
    overflow-y: auto;
}

/* Legacy settings toast */
.legacy-settings-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 320px;
    max-width: calc(100% - 24px);
    background: linear-gradient(160deg, #0f172a, #0b1a2f 65%, #0f172a);
    color: #f8fafc;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.04);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: all 0.25s ease;
    z-index: 1100;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid #fbbf24;
    position: fixed;
}

.legacy-settings-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1.01);
    pointer-events: auto;
    animation: legacy-pop 0.35s ease;
}

.legacy-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.legacy-toast-title {
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legacy-toast-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(251, 191, 36, 0.16);
    color: #fbbf24;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1px;
}

.legacy-toast-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fbbf24;
    box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.1);
    animation: pulse-legacy 1.8s ease-in-out infinite;
}

.legacy-toast-text {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
}

.legacy-toast-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legacy-toast-actions .btn {
    font-weight: 600;
    border-radius: 10px;
    padding: 6px 10px;
}

.legacy-toast-actions .btn-outline-light {
    color: #e2e8f0;
    border-color: rgba(226, 232, 240, 0.4);
}

.legacy-toast-actions .btn-outline-light:hover {
    background: rgba(226, 232, 240, 0.1);
    color: #ffffff;
}

.sidebar-scroll-hint {
    display: none;
    position: absolute;
    right: 12px;
    top: 8px;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    z-index: 5;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.2s ease;
}

.sidebar-scroll-hint.show {
    display: inline-flex;
    opacity: 1;
    transform: translateY(0);
}

@keyframes pulse-legacy {
    0% {
        box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(251, 191, 36, 0.06);
    }

    100% {
        box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12);
    }
}

@keyframes legacy-pop {
    0% {
        transform: translateY(12px) scale(0.97);
        opacity: 0;
    }

    100% {
        transform: translateY(0) scale(1.01);
        opacity: 1;
    }
}

/* Utilities */
.text-muted-v2 {
    color: var(--text-secondary);
}

.d-none {
    display: none !important;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .settings-layout {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 0.75rem 0.75rem 0.5rem;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        gap: 0.35rem;
    }

    .nav-item-v2 {
        width: auto;
        margin-right: 0.35rem;
        margin-bottom: 0;
        padding: 0.5rem 0.65rem;
    }

    .settings-content {
        padding: 1rem;
    }

    .legacy-settings-toast {
        left: 12px;
        right: 12px;
        width: auto;
    }

    .section-header {
        align-items: flex-start;
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .section-header .d-flex {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .btn-action {
        width: 100%;
        justify-content: center;
    }

    .image-upload-dropzone {
        padding: 1rem;
        text-align: center;
    }

    .upload-queue-toolbar,
    .asset-selection-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .upload-queue-toolbar .d-flex,
    .asset-selection-toolbar .asset-selection-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .upload-queue-toolbar button,
    .asset-selection-toolbar button {
        width: 100%;
    }

    .image-asset-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .image-assets-list,
    .image-collections-list,
    .assignment-list {
        max-height: none;
    }
}
