:root {
    font-size: 90%;
    --ivv-radius-sm: 0.5rem;
    --ivv-radius-md: 0.75rem;
    --ivv-radius-lg: 1rem;
    --ivv-shadow-soft: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.2);
    --ivv-border: rgba(255, 255, 255, 0.12);
    --ivv-surface: rgba(255, 255, 255, 0.03);
}

body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    text-rendering: optimizeLegibility;
}

.container {
    max-width: clamp(320px, 80%, 1800px);
}

body > .container.pb-4 {
    margin-top: 0.9rem;
}

main.flex-shrink-0 {
    padding-bottom: 2.2rem;
}

main.flex-shrink-0 > .container {
    background: var(--ivv-surface);
    border: 1px solid var(--ivv-border);
    border-radius: var(--ivv-radius-lg);
    box-shadow: var(--ivv-shadow-soft);
    padding: 1.1rem 1.15rem;
}

main.flex-shrink-0 > .container + .container {
    margin-top: 1rem;
}

main .lead {
    font-size: 1.04rem;
    margin-bottom: 0.95rem;
}

header.py-3 {
    background: var(--ivv-surface);
    border: 1px solid var(--ivv-border);
    border-radius: var(--ivv-radius-lg);
    box-shadow: var(--ivv-shadow-soft);
    padding-left: 1rem;
    padding-right: 1rem;
}

.footer {
    border-top: 1px solid var(--ivv-border);
}

.nav-pills .nav-link {
    border-radius: var(--ivv-radius-sm);
    transition: all 0.15s ease;
}

.nav-pills .nav-link:not(.active):hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn,
.form-control,
.form-select,
.page-link,
.dropdown-menu {
    border-radius: var(--ivv-radius-sm);
}

.ivv-btn-brand {
    background-color: var(--ivv-brand) !important;
    border-color: var(--ivv-brand) !important;
    color: #fff !important;
}

.ivv-btn-brand:hover,
.ivv-btn-brand:focus {
    filter: brightness(1.05);
}

.ivv-btn-brand-outline {
    border-color: var(--ivv-brand) !important;
    color: var(--ivv-brand) !important;
}

.ivv-btn-brand-outline:hover {
    background: color-mix(in srgb, var(--ivv-brand) 15%, transparent);
}

.form-control,
.form-select {
    border-color: var(--ivv-border);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(13, 110, 253, 0.65);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
}

.table {
    margin-bottom: 0;
}

.ivv-table-shell {
    border-radius: var(--ivv-radius-md);
    overflow-x: auto;
}

.ivv-table {
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--ivv-border);
    border-radius: var(--ivv-radius-md);
    overflow: hidden;
}

.ivv-table thead th {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.06);
    z-index: 1;
    white-space: nowrap;
}

.ivv-table.ivv-table-sortable thead th.sortable {
    user-select: none;
    padding-right: 1.5rem;
    position: sticky;
}

.ivv-table.ivv-table-sortable thead th.sortable::after {
    content: "\2195";
    position: absolute;
    right: 0.45rem;
    color: #9aa0a6;
    font-size: 0.78rem;
    letter-spacing: -0.05em;
}

.ivv-table.ivv-table-sortable thead th.sorted-asc::after {
    content: "\2191";
    color: #6ea8fe;
}

.ivv-table.ivv-table-sortable thead th.sorted-desc::after {
    content: "\2193";
    color: #6ea8fe;
}

.ivv-table tbody tr.ivv-row-odd > * {
    background: rgba(255, 255, 255, 0.03) !important;
}

.ivv-table tbody tr.ivv-row-even > * {
    background: rgba(255, 255, 255, 0.085) !important;
}

.ivv-table td,
.ivv-table th {
    vertical-align: middle;
    padding-left: 0.9rem;
    padding-right: 0.75rem;
}

.ivv-table thead th:first-child,
.ivv-table tbody td:first-child,
.ivv-table tbody th:first-child {
    padding-left: 1.15rem;
}

.ivv-table-compact {
    font-size: 0.8rem;
}

.ivv-table-toolbar {
    margin-bottom: 0.7rem !important;
    align-items: center;
}

.ivv-search-input {
    min-width: min(100%, 320px);
}

.pagination {
    gap: 0.2rem;
    margin-top: 0.35rem;
    margin-bottom: 0;
}

.pagination .page-link {
    border-color: var(--ivv-border);
    min-width: 2.2rem;
    text-align: center;
    padding: 0.38rem 0.62rem;
}

.ivv-table-control .form-select {
    min-width: 90px;
}

#pagination-info {
    padding-top: 0.5rem;
    color: #adb5bd !important;
}

.ivv-pagination-row {
    margin-top: 0.55rem;
    align-items: center;
}

main form {
    margin-top: 0.2rem;
}

main .form-row.row {
    row-gap: 0.35rem;
    margin-bottom: 0.45rem;
}

main .form-group {
    margin-bottom: 0.35rem;
}

main .form-group label {
    margin-bottom: 0.32rem;
    font-size: 0.86rem;
    color: #cfd4da;
    letter-spacing: 0.01em;
}

main textarea,
main select {
    width: 100%;
    border-radius: var(--ivv-radius-sm);
    border: 1px solid var(--ivv-border);
    background: rgba(255, 255, 255, 0.03);
    color: inherit;
    padding: 0.45rem 0.6rem;
}

main textarea:focus,
main select:focus {
    outline: none;
    border-color: rgba(13, 110, 253, 0.65);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.2);
}

.ivv-textarea-md {
    min-height: 100px;
    resize: vertical;
}

.ivv-danger-box {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.45);
    border-radius: 10px;
    padding: 10px;
}

.nav-tabs {
    border-bottom-color: var(--ivv-border);
}

.nav-tabs .nav-link {
    border-top-left-radius: var(--ivv-radius-sm);
    border-top-right-radius: var(--ivv-radius-sm);
}

.nav-tabs .nav-link.active {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--ivv-border) var(--ivv-border) transparent;
    color: #f8f9fa;
}

.tab-content {
    background: var(--ivv-surface);
    border: 1px solid var(--ivv-border);
    border-top: 0;
    border-bottom-left-radius: var(--ivv-radius-sm);
    border-bottom-right-radius: var(--ivv-radius-sm);
    padding: 0.8rem 0.9rem 0.95rem;
}

.tab-content > .tab-pane > .container {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.ivv-admin-pane {
    margin-top: 0.9rem;
}

.ivv-admin-pane > .tab-pane {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
}

.ivv-status-badge {
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.32rem 0.58rem;
}

#logs .ivv-table td,
#logs .ivv-table th {
    font-size: 0.9rem;
}

#logs .table td,
#logs .table th {
    font-size: 0.9rem;
    overflow-wrap: break-word;
    word-break: break-word;
    padding-right: 1.25rem;
}

#logs .table td:nth-child(4) {
    max-width: 380px;
}

.ivv-table-total-row > * {
    background: rgba(255, 255, 255, 0.07) !important;
    border-top: 1px solid var(--ivv-border) !important;
    font-weight: 600;
}

.ivv-zero-cell {
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.9em;
}

.ivv-sum-col {
    border-left: 1px solid var(--ivv-border) !important;
}

#version .table.table-borderless > :not(caption) > * > * {
    background-color: transparent !important;
}

#stats .table.table-borderless > :not(caption) > * > * {
    background-color: transparent !important;
}

@media (min-width: 768px) {
    .ivv-split-col {
        border-right: 1px solid var(--ivv-border);
        padding-right: 1.25rem;
        margin-right: 0.25rem;
    }
}

/* Hamburger nav toggle */
.ivv-nav-toggle {
    background: transparent;
    border: 1px solid var(--ivv-border);
    border-radius: var(--ivv-radius-sm);
    color: inherit;
    padding: 0.3rem 0.65rem;
    line-height: 1;
}

@media (max-width: 991.98px) {
    #ivv-nav-main.show {
        padding-top: 0.5rem;
        border-top: 1px solid var(--ivv-border);
        margin-top: 0.25rem;
    }
}

/* Notifications: volle Breite auf kleinen Screens */
@media (max-width: 576px) {
    #ivv-notify-container {
        left: 0.5rem;
        right: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}

#misc .row > .col-md-2 {
    background: rgba(220, 53, 69, 0.2) !important;
    border: 1px solid rgba(220, 53, 69, 0.45);
}

/* Notification System */
#ivv-notify-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 320px;
    pointer-events: none;
}

.ivv-notify {
    pointer-events: auto;
    background: rgba(25, 25, 25, 0.95);
    border: 1px solid var(--ivv-border);
    border-radius: var(--ivv-radius-md);
    box-shadow: var(--ivv-shadow-soft);
    padding: 0.6rem 0.9rem;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ivv-notify.show {
    opacity: 1;
    transform: translateX(0);
}

.ivv-notify.hide {
    opacity: 0;
    transform: translateX(12px);
}

.ivv-notify-success { border-left: 3px solid #28a745; }
.ivv-notify-error   { border-left: 3px solid #dc3545; }
.ivv-notify-warning { border-left: 3px solid #ffc107; }
.ivv-notify-info    { border-left: 3px solid #0d6efd; }
