/* CORREÇÃO DO LAYOUT PRINCIPAL */
html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    max-width: 100%;
}

body {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: 100vh;
    box-sizing: border-box;
}

.main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    box-sizing: border-box;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --sidebar-width: 250px;
    --bg: #05080d;
    --card: #0d141e;
    --text: #edf3fc;
    --muted: #a1b0c4;
    --border: #20334b;
    --primary: #0875e1;
    --primary-dark: #0863c0;
    --green: #16a34a;
    --yellow: #d97706;
    --red: #dc2626;
    --sidebar: #0c1116;
}

.mobile-menu-toggle {
    display: none;
}

body {
    font-family:
        Inter,
        Arial,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--bg);
    color: var(--text);
}

body.unauthenticated {
    display: block;
}

body.unauthenticated > .sidebar,
body.unauthenticated > .main,
body.unauthenticated > .modal,
body.unauthenticated > #toast {
    display: none;
}

.login-screen {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #151a20, #080a0d);
}

body.unauthenticated .login-screen {
    display: flex;
}

.login-card {
    width: min(100%, 420px);
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 18px 48px #e6e9ef1a;
}

.login-brand {
    padding: 0 0 26px;
}

.login-card h1 {
    font-size: 22px;
}

.login-card > p {
    margin: 7px 0 24px;
    color: var(--muted);
}

.login-card form {
    display: grid;
    gap: 16px;
}

.login-submit,
.logout-btn,
.secondary-btn {
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
}

.login-submit {
    padding: 11px 14px;
}

.admin-identity {
    display: grid;
    gap: 3px;
    margin-bottom: 10px;
    color: #fff;
    font-size: 12px;
}

.admin-identity span {
    color: #9ca3af;
    overflow-wrap: anywhere;
}

.logout-btn {
    width: 100%;
    margin-bottom: 14px;
    padding: 8px;
    background: #aeb7c7;
}

.secondary-btn {
    padding: 10px 14px;
    background: #202a35;
    color: var(--text);
}

.secondary-btn:hover:not(:disabled) {
    background: #2b3745;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 250px;
    min-height: 100vh;
    background: var(--sidebar);
    color: white;
    padding: 22px 15px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 5px 10px 28px;
}

.brand-logo {
    display: block;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    object-fit: contain;
    border-radius: 10px;
}

.brand strong {
    display: block;
    font-size: 15px;
}

.brand span {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 3px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: #aeb7c7;
    text-align: left;
    padding: 12px 13px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: .2s;
}

.nav-item:hover {
    background: #1f2937;
    color: white;
}

.nav-item.active {
    background: #2563eb;
    color: white;
}

.nav-item span {
    width: 20px;
    text-align: center;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 15px 10px 5px;
}

.connection {
    font-size: 12px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 8px;
}

.connection-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
}

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

.topbar {
    height: 86px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 34px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    font-size: 23px;
}

.topbar p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.refresh-btn {
    border: 1px solid var(--border);
    background: var(--card);
    padding: 9px 15px;
    border-radius: 8px;
    color: #aeb7c7;
}

.refresh-btn:hover {
    background: #151d25;
}

.section {
    display: none;
    padding: 30px 34px;
}

.section.active {
    display: block;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
    display: block;
}

.stat-card strong {
    display: block;
    font-size: 26px;
    margin-top: 5px;
}

.stat-icon {
    width: 43px;
    height: 43px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.stat-icon.blue {
    background: #112544;
    color: #2563eb;
}

.stat-icon.yellow {
    background: #332b12;
    color: #d97706;
}

.stat-icon.green {
    background: #102c20;
    color: #16a34a;
}

.stat-icon.red {
    background: #341b24;
    color: #dc2626;
}

.panel.system-status-panel {
    padding: 0;
    overflow: hidden;
}

.system-status-header {
    padding: 20px 22px 0;
}

.sao-paulo-clock {
    min-width: 178px;
    text-align: right;
}

.sao-paulo-clock span,
.sao-paulo-clock small {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.sao-paulo-clock strong {
    display: block;
    margin: 4px 0;
    font-size: 14px;
}

.system-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.system-metric {
    min-width: 0;
    padding: 20px 22px;
    border-right: 1px solid var(--border);
}

.system-metric:last-child {
    border-right: 0;
}

.system-metric-label,
.system-metric-detail {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.system-metric strong {
    display: block;
    margin: 7px 0 6px;
    font-size: 22px;
}

.system-metric-detail {
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.system-services {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 22px;
}

.system-service {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.system-service > span {
    color: var(--muted);
    font-size: 11px;
}

.system-service > strong:not(.health-badge) {
    font-size: 15px;
}

.health-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    white-space: nowrap;
}

.health-badge.healthy {
    color: #7be3a0;
    background: #143523;
}

.health-badge.unhealthy {
    color: #ffa2ad;
    background: #3c2027;
}

.health-badge.unavailable {
    color: #aab7c5;
    background: #202832;
}

.system-alerts {
    min-height: 42px;
    padding: 0 22px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.system-alert,
.system-ok,
.system-unavailable {
    display: inline-flex;
    align-items: center;
    padding: 6px 9px;
    border-radius: 6px;
    font-size: 11px;
}

.system-ok {
    color: #7be3a0;
    background: #102c20;
}

.system-unavailable {
    color: #aab7c5;
    background: #202832;
}

.system-alert.warning {
    color: #f2cd73;
    background: #332c17;
}

.system-alert.critical {
    color: #ffa2ad;
    background: #341b24;
}

.grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.panel,
.form-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 23px;
    margin-bottom: 20px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h2 {
    font-size: 16px;
}

.panel-header p {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.account-search {
    margin-bottom: 16px;
}

.small-btn {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 12px;
}

.small-btn:hover {
    background: #151d25;
}

.panel-actions {
    display: flex;
    gap: 8px;
}

.account-summary {
    min-height: 80px;
}

.account-card {
    display: flex;
    align-items: center;
    gap: 13px;
}

.account-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #112544;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.account-info strong {
    display: block;
    font-size: 14px;
}

.account-info {
    min-width: 0;
}

.account-info span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 20px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 600;
}

.status.success {
    color: #7be3a0;
    background: #102c20;
}

.status.queued {
    color: #1d4ed8;
    background: #112544;
}

.status.running {
    color: #f2cd73;
    background: #332b12;
}

.status.failed {
    color: #ffa2ad;
    background: #341b24;
}

.status.cancelled {
    color: #aab7c5;
    background: #202832;
}

.job-row {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 14px;
    margin-bottom: 9px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.job-main {
    min-width: 0;
}

.job-message {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
}

.job-meta {
    color: var(--muted);
    font-size: 11px;
    margin-top: 5px;
    overflow-wrap: anywhere;
}

.job-context {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}

.job-context span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.job-position {
    color: var(--text);
    font-weight: 600;
}

.performance-job {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.performance-job summary {
    min-height: 64px;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
}

.performance-job-title {
    min-width: 0;
}

.performance-job-title strong,
.performance-job-title small {
    display: block;
    overflow-wrap: anywhere;
}

.performance-job-title small {
    margin-top: 5px;
    color: var(--muted);
}

.performance-summary-value {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
}

.performance-sections {
    padding: 0 16px 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.performance-group {
    min-width: 0;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.performance-group h3 {
    margin-bottom: 8px;
    font-size: 12px;
}

.performance-group dl > div {
    min-width: 0;
    padding: 5px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 11px;
}

.performance-group dt {
    color: var(--muted);
}

.performance-group dd {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

.performance-analysis,
.performance-empty {
    margin: 0 16px 16px;
    padding: 12px;
    border-radius: 6px;
    background: #151d25;
    font-size: 12px;
}

.performance-analysis strong,
.performance-analysis span {
    display: block;
}

.performance-analysis span {
    margin-top: 5px;
    color: var(--muted);
}

.job-status {
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 7px;
}

.danger-btn {
    color: #ffa2ad;
    border-color: #fecaca;
}

.danger-btn:hover {
    background: #341b24;
}

.empty,
.loading {
    color: var(--muted);
    font-size: 13px;
    padding: 20px 0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    border: 1px solid #dce2eb;
    border-radius: 8px;
    padding: 11px 12px;
    background: var(--card);
    color: var(--text);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px #2563eb14;
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.form-group small {
    color: var(--muted);
    font-size: 11px;
}

.char-count {
    text-align: right;
    color: var(--muted);
    font-size: 11px;
}

.timezone-info {
    margin-top: 20px;
    padding: 12px 14px;
    background: #151d25;
    border-radius: 8px;
    color: #64748b;
    font-size: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.primary-btn {
    border: 0;
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
}

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

.primary-btn:disabled {
    opacity: .6;
    cursor: wait;
}

.result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 9px;
    font-size: 13px;
}

.result.success {
    background: #102c20;
    color: #7be3a0;
}

.result.error {
    background: #341b24;
    color: #ffa2ad;
}

.hidden {
    display: none;
}

.form-hint {
    color: var(--muted);
    font-size: 12px;
    margin-top: 16px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #0c111680;
}

.modal.hidden {
    display: none;
}

.modal-card {
    width: min(100%, 520px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--card);
    border-radius: 13px;
    padding: 24px;
    box-shadow: 0 20px 55px #0c111640;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 18px;
}

.modal-header p {
    color: var(--muted);
    font-size: 12px;
    margin-top: 4px;
}

.modal-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 28px;
    line-height: 1;
}

.toast {
    position: fixed;
    right: 25px;
    bottom: 25px;
    background: #0c1116;
    color: white;
    padding: 12px 17px;
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: .25s;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 205px;
    }

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-two {
        grid-template-columns: 1fr;
    }

    .system-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .system-metric:nth-child(2) {
        border-right: 0;
    }

    .system-metric:nth-child(-n + 2) {
        border-bottom: 1px solid var(--border);
    }

    .system-services {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    :root {
        --sidebar-width: 0px;
    }

    body {
        display: block;
        min-width: 0;
    }

    .sidebar {
        position: sticky;
        top: 0;
        right: auto;
        bottom: auto;
        z-index: 1000;
        width: 100%;
        height: auto;
        min-height: auto;
        padding: 10px 14px;
        display: block;
        border-bottom: 1px solid #273244;
    }

    .brand {
        min-height: 48px;
        padding: 0 54px 0 0;
    }

    .brand-logo {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
        border-radius: 8px;
    }

    .mobile-menu-toggle {
        position: absolute;
        top: 12px;
        right: 14px;
        display: inline-flex;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border: 1px solid #aeb7c7;
        border-radius: 8px;
        background: #1f2937;
        color: white;
        font-size: 24px;
        line-height: 1;
    }

    nav {
        display: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding-top: 10px;
    }

    .nav-item {
        min-height: 48px;
        padding: 10px;
        white-space: normal;
    }

    .sidebar-bottom {
        display: none;
    }

    .sidebar.mobile-menu-open nav {
        display: grid;
    }

    .sidebar.mobile-menu-open .sidebar-bottom {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        margin-top: 10px;
        padding: 10px 0 0;
        border-top: 1px solid #aeb7c7;
    }

    .sidebar-bottom .admin-identity {
        min-width: 0;
        margin: 0;
    }

    .sidebar-bottom .logout-btn {
        width: auto;
        min-width: 72px;
        min-height: 44px;
        margin: 0;
        padding: 10px 14px;
    }

    .sidebar-bottom .connection {
        display: none;
    }

    .main {
        width: 100%;
        min-width: 0;
        margin-left: 0;
    }

    .topbar {
        gap: 12px;
        padding: 16px;
        height: auto;
    }

    .topbar > div {
        min-width: 0;
    }

    .topbar h1 {
        font-size: 20px;
    }

    .topbar p {
        overflow-wrap: anywhere;
    }

    .refresh-btn {
        min-height: 44px;
        padding: 9px 12px;
        flex: 0 0 auto;
    }

    .section {
        min-width: 0;
        padding: 16px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .system-status-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .sao-paulo-clock {
        min-width: 0;
        text-align: left;
    }

    .system-metrics,
    .system-services {
        grid-template-columns: 1fr;
    }

    .system-status-header,
    .system-metric,
    .system-services {
        padding-left: 16px;
        padding-right: 16px;
    }

    .system-service {
        min-height: 36px;
    }

    .system-alerts {
        padding-right: 16px;
        padding-left: 16px;
    }

    .system-metric,
    .system-metric:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .system-metric:last-child {
        border-bottom: 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full {
        grid-column: auto;
    }

    .panel,
    .form-panel {
        min-width: 0;
        padding: 16px;
    }

    .panel-header {
        align-items: flex-start;
        gap: 12px;
    }

    .panel-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .small-btn,
    .primary-btn,
    .secondary-btn,
    .login-submit {
        min-height: 44px;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        min-height: 46px;
        font-size: 16px;
    }

    .form-actions {
        flex-wrap: wrap;
        gap: 10px;
    }

    .form-actions > button {
        flex: 1 1 180px;
    }

    .job-row {
        min-width: 0;
        flex-direction: column;
        gap: 12px;
    }

    .job-message {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .job-context {
        display: grid;
        grid-template-columns: 1fr;
    }

    .job-status {
        width: 100%;
        align-items: stretch;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .job-status .status {
        min-height: 32px;
        margin-right: auto;
    }

    .job-status button {
        min-height: 44px;
    }

    .account-card {
        align-items: flex-start;
    }

    .performance-job summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .performance-sections {
        grid-template-columns: 1fr;
        padding-right: 12px;
        padding-left: 12px;
    }

    .performance-summary-value {
        flex: auto;
    }

    .performance-group dl > div {
        align-items: flex-start;
    }

    .performance-analysis,
    .performance-empty {
        margin-right: 12px;
        margin-left: 12px;
    }

    .modal {
        align-items: flex-end;
        padding: 8px;
    }

    .modal-card {
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        padding: 18px 16px;
        border-radius: 8px;
    }

    .modal-close {
        width: 44px;
        height: 44px;
        flex: 0 0 auto;
    }

    .toast {
        right: 12px;
        bottom: 12px;
        left: 12px;
        max-width: none;
        text-align: center;
    }

    .login-screen {
        min-height: 100vh;
        min-height: 100dvh;
        padding: 16px;
    }

    .login-card {
        padding: 22px 18px;
        border-radius: 8px;
    }
}

@media (max-width: 360px) {
    .topbar {
        align-items: flex-start;
    }

    .refresh-btn {
        width: 44px;
        padding: 0;
        font-size: 0;
    }

    .refresh-btn::before {
        content: "↻";
        color: #aeb7c7;
        font-size: 20px;
    }

    .section {
        padding: 12px;
    }

    .panel-header:not(.system-status-header) {
        flex-direction: column;
    }

    .panel-actions,
    .panel-header > .small-btn {
        width: 100%;
    }

    .panel-actions .small-btn,
    .panel-header > .small-btn {
        flex: 1 1 auto;
        min-height: 44px;
    }
}

/* FIVE SENHA BAIXA: legacy selectors retained for compatibility. */
:root { --sidebar-width: 238px; --sidebar: #070c14; --accent: #38cfff; color-scheme: dark; }
body { background: var(--bg); }
.sidebar { width: var(--sidebar-width); padding: 14px; border-right: 1px solid var(--border); overflow-y: auto; z-index: 20; }
.sidebar > .brand { flex-direction: column; padding: 0 0 20px; gap: 8px; text-align: center; }
.sidebar .brand-logo { width: 100%; max-width: 190px; height: auto; aspect-ratio: 1 / 1; flex-basis: auto; border-radius: 8px; }
.sidebar > .brand > div { display: block; }
.nav-item { min-height: 44px; font-size: 13px; border: 1px solid transparent; }
.nav-item.active { background: linear-gradient(105deg, #103c68, #0c1e35); border-color: #237bb7; color: #e5f8ff; box-shadow: inset 3px 0 var(--accent), 0 0 16px #008cff12; }
.nav-item:hover { background: #102238; color: #eefaff; }
.nav-item.active:hover { background: #123c61; }
.nav-item span { font-size: 19px; }
.sidebar-bottom { border-top: 1px solid var(--border); padding: 16px 0 0; margin-top: auto; background: transparent; }
.connection { color: #e6e9ef; font-size: 12px; }
.connection-dot { flex: 0 0 7px; width: 7px; height: 7px; box-shadow: 0 0 10px #22c55e50; }
.connection.is-unavailable .connection-dot { background: #e3ac49; box-shadow: none; }
.system-brand, .sidebar-bottom small { display: block; margin: 8px 0 0 15px; color: var(--muted); font-size: 11px; }
.topbar { min-height: 76px; height: auto; padding: 14px 26px; background: #090f18; gap: 18px; flex-wrap: wrap; }
.topbar h1 { font-size: 19px; font-weight: 650; }
.topbar p { font-size: 11px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 15px; min-width: 0; }
.header-actions .admin-identity { margin: 0; text-align: right; min-width: 0; max-width: 240px; }
.header-actions .admin-identity strong { color: var(--accent); font-size: 10px; text-transform: uppercase; order: 2; }
.header-actions .admin-identity span { color: #e5e7eb; }
.header-actions .logout-btn { width: auto; margin: 0; background: #202830; color: #dde2e8; min-height: 40px; padding: 8px 12px; }
.refresh-btn { color: #d6dde6; font-size: 12px; min-height: 40px; }
.section { padding: 20px 26px; }
.blade-banner { margin: -20px -26px 20px; background: #02060c; border-bottom: 1px solid #174c73; overflow: hidden; }
.blade-banner img { display: block; width: 100%; max-width: 100%; height: auto; object-fit: contain; object-position: center; }
.welcome-row { display: flex; gap: 14px; margin-bottom: 16px; }
.welcome-card, .blade-clock { background: transparent; border-bottom: 1px solid var(--border); padding: 18px 0; display: flex; align-items: center; gap: 14px; min-width: 0; }
.welcome-card { flex: 1; }
.welcome-card > div, .stat-card > div { min-width: 0; overflow-wrap: anywhere; }
.welcome-icon { color: var(--accent); font-size: 29px; }
.welcome-card h2 { font-size: 17px; overflow-wrap: anywhere; }
.welcome-card p { color: var(--muted); font-size: 12px; margin-top: 6px; }
.blade-clock { border-color: #20587c; }
.blade-clock > span { color: var(--accent); font-size: 25px; }
.blade-clock small { display: block; color: #99c7e3; font-size: 10px; margin-bottom: 5px; }
.blade-clock strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.stats { gap: 14px; margin-bottom: 18px; }
.stat-card { border-radius: 8px; padding: 18px 14px; gap: 12px; min-width: 0; }
.stat-card strong { font-size: 24px; margin: 0 0 4px; }
.stat-card span { font-size: 11px; }
.stat-icon { flex: 0 0 42px; }
.stat-icon.blue { color: #75baff; }.stat-icon.green { color: #4ade80; }.stat-icon.yellow { color: #58ddf5; background: #102d39; }.stat-icon.red { color: #ff7a91; }
.stat-icon.purple { color: #d3e4fa; background: #243247; }
.blade-stats .stat-card { border-color: #244567; background: linear-gradient(110deg, #0e2034, #0b121c); box-shadow: 0 5px 20px #007aff08; }
.blade-stats .stat-card:nth-child(2) { border-color: #20515a; }
.blade-stats .stat-card:nth-child(2) .stat-icon { color: #63e3ed; background: #103038; }
.blade-stats .stat-card:nth-child(3) { border-color: #205579; }
.blade-stats .stat-card:nth-child(4) { border-color: #394a61; }
.panel, .form-panel { border-radius: 0; background: #0b121b; box-shadow: none; }
.panel-header h2 { font-size: 15px; }.panel-header p { font-size: 12px; }
.grid-two { align-items: stretch; gap: 16px; }
.grid-two > .panel { min-width: 0; }
.overview-actions { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.empty, .loading { color: var(--muted); background: #151c22; border-radius: 8px; padding: 32px 16px; }
.operational-stats { margin-top: 20px; }.operational-stats .stat-card { background: #10161b; padding: 12px; }.operational-stats strong { font-size: 20px; }
.small-btn { color: #7fafff; border-color: #2c3b4d; }.small-btn:hover { color: #bdd5ff; }
.primary-btn, .login-submit { background: linear-gradient(120deg, #0865c4, #07539e); color: #fff; box-shadow: 0 4px 16px #008cff20; }
.primary-btn:hover, .login-submit:hover { background: #0870cb; }
.refresh-btn:hover, .header-actions .logout-btn:hover { background: #173958; border-color: #2588bd; color: #fff; }
input, textarea, select { color: var(--text); background: #0c1218; border-color: #303b46; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline-color: var(--accent); box-shadow: 0 0 0 3px #38cfff18; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.job-message, .account-info, .job-meta, .info-copy { overflow-wrap: anywhere; }
.info-copy { color: #aab3bf; line-height: 1.8; margin: 12px 0 20px; }
.blade-footer { margin: 0 26px; padding: 22px 0; border-top: 1px solid var(--border); color: var(--muted); display: flex; justify-content: space-between; gap: 18px; font-size: 10px; letter-spacing: 0; line-height: 1.8; }
.blade-footer strong { color: var(--accent); }
.login-screen { background: #050a12; }
.login-card { border-radius: 8px; border-color: #224f78; box-shadow: 0 18px 70px #007aff12; }
.login-brand { flex-direction: column; text-align: center; }.login-brand .brand-logo { width: 100%; max-width: 280px; height: auto; aspect-ratio: 1 / 1; flex-basis: auto; }
@media (max-width: 1100px) and (min-width: 651px) {
 :root { --sidebar-width: 205px; }.sidebar .brand-logo { max-width: 172px; height: auto; }
 .blade-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }.welcome-row { flex-wrap: wrap; }.welcome-card { flex-basis: 100%; }.blade-clock { flex: 1; }
 .header-actions { gap: 8px; }.topbar { flex-wrap: wrap; }.blade-footer { flex-wrap: wrap; }
}
@media (max-width: 650px) {
 :root { --sidebar-width: 0px; }
 .sidebar { position: sticky; width: 100%; padding: 8px 14px; overflow-y: auto; max-height: 90dvh; z-index: 1000; }
 .sidebar > .brand { flex-direction: row; padding: 0 54px 0 0; text-align: left; gap: 10px; }.sidebar > .brand > div { display: block; }.sidebar .brand-logo { width: 50px; height: 50px; flex-basis: 50px; }.sidebar .brand strong { font-size: 14px; }
 .sidebar.mobile-menu-open .sidebar-bottom { display: block; padding: 12px; }.sidebar-bottom .connection { display: flex; }
 .topbar { padding: 14px 16px; flex-wrap: wrap; gap: 12px; }.topbar h1 { font-size: 18px; }.header-actions { width: 100%; justify-content: space-between; gap: 8px; }.header-actions .admin-identity { text-align: left; flex: 1; }.header-actions .logout-btn, .refresh-btn { min-height: 44px; }
 .section { padding: 16px; }.blade-banner { margin: -16px -16px 16px; }.blade-banner img { width: 100%; height: auto; object-fit: contain; object-position: center; }
 .welcome-row { flex-direction: column; gap: 10px; }.welcome-card, .blade-clock { padding: 14px; }.welcome-card h2 { font-size: 16px; }.blade-clock strong { font-size: 13px; }
 .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }.stat-card { padding: 14px 10px; gap: 9px; }.stat-icon { flex-basis: 32px; width: 32px; height: 36px; }.stat-card strong { font-size: 21px; }
 .grid-two { grid-template-columns: minmax(0, 1fr); }.small-btn { min-height: 44px; }
 .blade-footer { margin: 0 16px; flex-direction: column; gap: 6px; }.login-brand { padding: 0 0 22px; }.login-card { padding: 24px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

.blade-icon { width: 21px; height: 21px; display: block; flex-shrink: 0; }
@media (max-width: 360px) {
 .header-actions { flex-wrap: wrap; }
 .header-actions .admin-identity { flex-basis: 100%; max-width: none; }
 .refresh-btn { width: auto; }
 .refresh-btn::before { content: none; }
}
