body {
    background-color: #f8f9fa;
    font-size: 0.9rem;
}

*:focus {
    outline: none !important;
    box-shadow: none !important;
}

.app-header {
    background: #fff;
    border: 1px solid #dee2e6;
    padding: 0.75rem 1rem 0.65rem;
}

.app-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.app-brand-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    object-fit: cover;
    border-radius: 8px;
}

.app-header h4 {
    font-size: 1.15rem;
}

.app-meta {
    text-align: right;
    line-height: 1.35;
}

.app-meta a {
    text-decoration: none;
}

.app-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.app-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.app-toolbar-sep {
    width: 1px;
    height: 1.4rem;
    background: #dee2e6;
    margin: 0 0.2rem;
}

.app-toolbar-search {
    position: relative;
    min-width: 220px;
    flex: 1 1 220px;
    max-width: 28rem;
}

.app-toolbar-search .bi-search {
    position: absolute;
    left: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    pointer-events: none;
    font-size: 0.85rem;
}

.app-toolbar-search input {
    padding-left: 1.75rem;
}

.app-toolbar-hint {
    margin-top: 0.45rem;
}

.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 1070;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 110, 253, 0.12);
}

.drop-box {
    background: #fff;
    border: 2px dashed #0d6efd;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    color: #0d6efd;
}

.logo-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-preview {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border: 1px solid #dee2e6;
    background: #fff;
    flex: 0 0 48px;
}

.channel-group-tag {
    flex: 0 0 auto;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.7rem;
    color: #6c757d;
}

.list-group-item.search-hit {
    box-shadow: inset 3px 0 0 #0d6efd;
}

.list-group-item {
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    user-select: none;
    border-left: none;
    border-right: none;
    border-radius: 0 !important;
}

.list-group-item:hover {
    background-color: #f1f1f1;
}

.list-group-item.active {
    background-color: #e9ecef;
    color: #000;
    border-color: #dee2e6;
    font-weight: 600;
}

.list-group-item.selected {
    background-color: #eef3f8;
}

.list-group-item.active.selected {
    background-color: #e2e8ef;
}

.list-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-meta {
    display: inline-block;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
}


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

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.8em;
    padding: 0.1rem 0.35rem;
    border: 1px solid #ced4da;
    background: #f8f9fa;
    color: #495057;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    margin-left: auto;
}

.status-ok {
    background: #e9f7ef;
    border-color: #badbcc;
    color: #0f5132;
}

.status-warning {
    background: #fff3cd;
    border-color: #ffecb5;
    color: #664d03;
}

.status-bad {
    background: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.status-checking {
    background: #cff4fc;
    border-color: #b6effb;
    color: #055160;
}

.status-neutral {
    background: #f1f3f5;
    border-color: #dee2e6;
    color: #495057;
}

.status-progress {
    min-height: 1.25rem;
    color: #6c757d;
}

.status-legend {
    line-height: 1.45;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 249, 250, 0.85);
}

.loading-box {
    background: #fff;
    border: 1px solid #dee2e6;
    padding: 1.1rem 1.25rem;
    width: 22rem;
    max-width: calc(100vw - 2rem);
}

.loading-phase {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    font-weight: 600;
    color: #495057;
}

.loading-count {
    font-size: 0.78rem;
    font-weight: 400;
    color: #6c757d;
    font-variant-numeric: tabular-nums;
}

.loading-track {
    display: flex;
    gap: 2px;
    margin: 0.6rem 0 0.5rem;
}

.loading-segment {
    flex: 1;
    height: 6px;
    border: 1px solid #ced4da;
    background: #f8f9fa;
    overflow: hidden;
}

.loading-segment-fill {
    display: block;
    width: 0;
    height: 100%;
    background: #0d6efd;
    transition: width 0.12s linear;
}

.loading-detail {
    font-size: 0.78rem;
    color: #6c757d;
    overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
    .loading-segment-fill {
        transition: none;
    }
}

#groupsList, #itemsList {
    max-height: 70vh;
    overflow-y: auto;
}

.form-control, .form-control:focus,
.form-select, .form-select:focus {
    border-radius: 0;
    box-shadow: none;
    border-color: #ced4da;
}

.btn {
    border-radius: 0;
}

.modal-content {
    border-radius: 0;
}

.bulk-rename-preview {
    max-height: 12rem;
    overflow: auto;
}

.bulk-rename-preview-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
}

.bulk-rename-preview-old,
.bulk-rename-preview-new {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bulk-rename-preview-old {
    color: #6c757d;
}

.bulk-rename-preview-arrow {
    flex: 0 0 auto;
    color: #adb5bd;
}

.border {
    border: 1px solid #dee2e6 !important;
}

.form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.col-form-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row > div {
    margin-bottom: 5px;
}

.section-hint {
    line-height: 1.25;
}

.dragging-selected {
    opacity: 0.6;
    background-color: #dbeafe !important;
}

.sortable-drag {
    opacity: 1 !important;
    background-color: #f8f9fa;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.sortable-ghost {
    opacity: 0.5;
    background: #c8ebfb;
}

#itemUrlPreview.disabled {
    color: #adb5bd;
    pointer-events: none;
}

.dropdown-menu {
    max-height: 50vh;
    overflow-y: auto;
}

textarea.form-control-sm {
    min-height: 56px;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

@media (max-width: 992px) {
    .app-header-top {
        flex-direction: column;
    }

    .app-meta {
        text-align: left !important;
    }

    .app-toolbar-search {
        max-width: none;
    }
}
