:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 72px;
    --topbar-height: 58px;
    --bg: #0b0b0b;
    --bg-elevated: #121212;
    --bg-card: #151515;
    --bg-card-soft: #1b1b1b;
    --bg-surface: #101010;
    --border: #2a2a2a;
    --muted: #a7a7a7;
    --text: #f4f4f4;
    --accent: #ff7a18;
    --accent-strong: #ff8f2b;
    --accent-dim: rgba(255, 122, 24, 0.18);
    --glow: 0 10px 35px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: "Sora", "Segoe UI", sans-serif;
    background: radial-gradient(1200px 600px at 10% 0%, rgba(255, 122, 24, 0.08), transparent),
        radial-gradient(900px 500px at 80% 20%, rgba(255, 122, 24, 0.05), transparent),
        var(--bg);
    color: var(--text);
}

label,
.form-label,
.form-check-label,
.form-text,
.helptext,
small {
    color: #f2f2f2;
}

legend {
    color: #f2f2f2;
    background: transparent;
    padding: 0;
}

fieldset {
    border-color: var(--border);
}

hr {
    border-color: var(--border);
    opacity: 1;
}

a {
    color: inherit;
}

a:hover {
    color: var(--accent);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0d0d0d 0%, #141414 100%);
    padding-top: 1rem;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    transition: width 0.2s ease, transform 0.2s ease;
    z-index: 1030;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.72);
    padding: 0.7rem 0.9rem;
    border-radius: 0.55rem;
    margin: 0.15rem 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar .nav-link.active {
    color: #0b0b0b;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    box-shadow: 0 8px 20px rgba(255, 122, 24, 0.2);
}

.sidebar .nav-link i {
    font-size: 1.05rem;
}

.sidebar-header {
    color: #fff;
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h5 {
    margin: 0;
    font-weight: 600;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
    background: #0f0f0f;
    border: 1px solid var(--border);
    padding: 4px;
}

.section-divider {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 1.1rem 0.5rem;
    margin-top: 0.4rem;
}

.sidebar .section-toggle {
    cursor: pointer;
    font-weight: 500;
}

.sidebar .section-toggle .caret {
    transition: transform 0.2s ease;
    font-size: 0.8rem;
    opacity: 0.5;
}

.sidebar .section-toggle:not(.collapsed) .caret {
    transform: rotate(180deg);
    opacity: 1;
}

.sidebar .nav-link.small {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
    font-size: 0.88rem;
    opacity: 0.85;
}

.sidebar .nav-link.small:hover {
    opacity: 1;
}

.sidebar .nav-link.small i {
    font-size: 0.95rem;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

.navbar-top {
    background: rgba(16, 16, 16, 0.9);
    border-bottom: 1px solid var(--border);
    height: var(--topbar-height);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.navbar-text {
    color: var(--text);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent);
    color: #111;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}

.notif-menu {
    width: 340px;
    max-height: 420px;
    overflow: hidden;
    padding: 0;
}

.notif-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 0.25rem 0.5rem 0.5rem;
}

.notif-item {
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #161616;
    margin-bottom: 0.5rem;
}

.notif-item.status-running {
    border-color: rgba(255, 122, 24, 0.5);
}

.notif-item.status-failed {
    border-color: rgba(255, 80, 80, 0.5);
}

.notif-title {
    font-weight: 600;
    color: #fff;
}

.notif-meta {
    font-size: 0.75rem;
    color: #c9c9c9;
}

.notif-msg {
    font-size: 0.82rem;
    color: #e5e5e5;
}

.notif-empty {
    padding: 1rem;
    color: #bdbdbd;
    text-align: center;
}

.content-wrapper {
    padding: 1.6rem;
}

.card {
    background: linear-gradient(180deg, #171717 0%, #141414 100%);
    border: 1px solid var(--border);
    box-shadow: var(--glow);
}

.card.bg-light,
.card-header.bg-light,
.card-footer.bg-light,
.bg-light {
    background: #1a1a1a !important;
    color: #f2f2f2 !important;
    border-color: var(--border);
}

.card-header,
.card-footer {
    background: #1a1a1a;
    border-color: var(--border);
}

.card-title,
.card-header,
.card h5,
.card h6 {
    color: #f0f0f0;
}

.card .text-muted,
.card small,
.card .text-secondary {
    color: #b9b9b9 !important;
}

.table th {
    font-weight: 600;
    background: #1a1a1a;
    color: #d7d7d7;
    border-color: var(--border);
}

.table td {
    border-color: var(--border);
    color: #e6e6e6;
}

.table {
    color: var(--text);
    background: #151515;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.table > :not(caption) > * > * {
    background-color: transparent;
}

.table a {
    color: #f2f2f2;
}

.table a:hover {
    color: var(--accent);
}

.table-responsive {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #151515;
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.table-scrollbar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    height: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    background: #111;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
}

.table-scrollbar div {
    height: 1px;
}

.table-responsive::-webkit-scrollbar {
    height: 10px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #111;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 10px;
}

.form-control,
.form-select {
    background: #101010;
    border: 1px solid var(--border);
    color: #f6f6f6;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
textarea,
select {
    background-color: #101010;
    border: 1px solid var(--border);
    color: #f6f6f6;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.25rem rgba(255, 122, 24, 0.15);
    outline: none;
}

.form-control::placeholder {
    color: #b5b5b5;
}

.form-select option {
    background: #121212;
    color: #f2f2f2;
}

.form-check-input {
    background-color: #111;
    border-color: #3a3a3a;
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.stat-card,
.stat-card * {
    color: #f4f4f4;
}

.stat-card .text-muted {
    color: #cfcfcf !important;
}

.card .text-muted,
.card .text-secondary {
    color: #d7d7d7 !important;
}

.card p,
.card li,
.card span,
.card div {
    color: #f0f0f0;
}

.card .text-muted,
.card small {
    color: #d6d6d6 !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.25rem rgba(255, 122, 24, 0.15);
    background: #0f0f0f;
    color: var(--text);
}

.btn-primary,
.btn-success,
.btn-warning,
.btn-danger {
    border-radius: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    border: none;
    color: #111;
    font-weight: 600;
}

.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-dark,
.btn-outline-success,
.btn-outline-danger {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-dark:hover,
.btn-outline-success:hover,
.btn-outline-danger:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #111;
}

.pagination .page-link {
    background: #151515;
    color: var(--accent);
    border-color: var(--accent);
}

.pagination .page-link:hover {
    background: var(--accent);
    color: #111;
}

.pagination .active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #111;
}

.badge {
    border-radius: 999px;
}

.badge-preco {
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-card {
    border-left: 4px solid var(--accent);
}

.text-muted {
    color: var(--muted) !important;
}

.alert {
    background: #121212;
    border-color: var(--border);
    color: var(--text);
}

.list-group-item {
    background: #151515;
    border-color: var(--border);
    color: var(--text);
}

.dropdown-menu {
    background: #141414;
    border-color: var(--border);
}

.dropdown-item {
    color: var(--text);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.accordion-item {
    background: #151515;
    border-color: var(--border);
}

.accordion-button {
    background: #1a1a1a;
    color: #f2f2f2;
    border-color: var(--border);
}

.accordion-button:not(.collapsed) {
    background: #202020;
    color: #ffffff;
    box-shadow: inset 0 -1px 0 var(--border);
}

.accordion-button::after {
    filter: invert(1);
}

.accordion-body {
    background: #151515;
    color: #f2f2f2;
}

.accordion-button:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(255, 122, 24, 0.2);
}

/* Scrollbar */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-track {
    background: #111;
}

*::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 10px;
    border: 2px solid #111;
}

*::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a;
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar .nav-link span,
.sidebar-collapsed .sidebar .section-divider,
.sidebar-collapsed .sidebar-header h5 {
    display: none;
}

.sidebar-collapsed .sidebar-header {
    padding: 1rem 0;
    text-align: center;
}

.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    margin: 0.25rem 0.5rem;
}

.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: min(85vw, 320px);
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 1020;
    }
}
