* {
    box-sizing: border-box;
}

:root {
    --primary: #1d4ed8;
    --primary-dark: #1e3a8a;
    --sidebar: #0f172a;
    --sidebar-hover: #1e293b;
    --background: #f5f7fa;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --warning: #f59e0b;
    --danger: #dc2626;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
}

button,
input {
    font: inherit;
}

/* LOGIN */

.login-page {
    min-height: 100vh;
    background: #f8fafc;
}

.login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(380px, 45%) 1fr;
}

.login-brand {
    background: var(--sidebar);
    color: white;
    padding: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-mark {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 34px;
    font-weight: 700;
}

.brand-mark.small {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    font-size: 21px;
}

.login-brand h1 {
    font-size: 42px;
    margin: 24px 0 5px;
}

.brand-subtitle {
    font-size: 18px;
    color: #cbd5e1;
    margin: 0 0 34px;
}

.brand-description {
    max-width: 480px;
    color: #94a3b8;
    line-height: 1.7;
}

.login-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.login-card {
    width: 100%;
    max-width: 430px;
}

.mobile-brand {
    display: none;
}

.login-card h2 {
    font-size: 30px;
    margin: 0 0 8px;
}

.login-help {
    color: var(--muted);
    margin: 0 0 30px;
}

.form-group {
    margin-bottom: 19px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    padding: 13px 14px;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .1);
}

.btn-primary {
    width: 100%;
    border: 0;
    border-radius: 9px;
    background: var(--primary);
    color: white;
    padding: 13px 18px;
    cursor: pointer;
    font-weight: 600;
}

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

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 12px 14px;
    border-radius: 9px;
    margin-bottom: 20px;
    font-size: 14px;
}

.login-footer {
    margin-top: 25px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

/* APP */

.app-page {
    background: var(--background);
}

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px 1fr;
}

.sidebar {
    background: var(--sidebar);
    color: white;
    min-height: 100vh;
    padding: 22px 14px;
}

.sidebar-brand {
    display: flex;
    gap: 11px;
    align-items: center;
    padding: 0 10px 23px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

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

.sidebar-brand span {
    display: block;
    margin-top: 2px;
    color: #94a3b8;
    font-size: 11px;
}

.sidebar-nav {
    padding-top: 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: #cbd5e1;
    padding: 11px 13px;
    border-radius: 8px;
    margin-bottom: 3px;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    color: white;
    background: var(--primary);
}

.nav-item.disabled {
    opacity: .65;
    cursor: default;
}

.nav-icon {
    width: 19px;
    text-align: center;
    font-size: 16px;
}

.nav-section {
    color: #64748b;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 1.1px;
    padding: 24px 13px 9px;
}

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

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

.topbar h1 {
    font-size: 21px;
    margin: 0;
}

.user-area {
    display: flex;
    gap: 18px;
    align-items: center;
}

.user-info {
    text-align: right;
}

.user-info strong,
.user-info span {
    display: block;
}

.user-info strong {
    font-size: 13px;
}

.user-info span {
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
}

.btn-logout {
    border: 1px solid var(--border);
    background: white;
    border-radius: 8px;
    padding: 8px 13px;
    cursor: pointer;
}

.content {
    max-width: 1250px;
    margin: auto;
    padding: 34px;
}

.welcome-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 30px;
    margin-bottom: 22px;
}

.eyebrow {
    color: var(--primary);
    font-size: 11px;
    letter-spacing: 1px;
    font-weight: 700;
}

.welcome-panel h2 {
    font-size: 27px;
    margin: 8px 0 8px;
}

.welcome-panel p {
    color: var(--muted);
    max-width: 720px;
    line-height: 1.6;
    margin: 0;
}

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

.status-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.status-heading {
    min-height: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.status-card > strong {
    display: block;
    font-size: 23px;
    margin: 10px 0 8px;
}

.status-card p {
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
    margin: 0;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.status-dot.warning {
    background: var(--warning);
}

.setup-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 25px;
}

.setup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.setup-header h3 {
    margin: 0 0 5px;
}

.setup-header p {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}

.progress-label {
    background: #eff6ff;
    color: var(--primary);
    border-radius: 20px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
}

.setup-list {
    padding-top: 5px;
}

.setup-item {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 13px;
    align-items: center;
    padding: 17px 5px;
    border-bottom: 1px solid #f1f5f9;
}

.setup-item:last-child {
    border-bottom: 0;
}

.step-number {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    color: var(--muted);
}

.setup-item strong {
    font-size: 14px;
}

.setup-item p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.step-status {
    font-size: 12px;
    color: var(--warning);
}

@media (max-width: 950px) {
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 760px) {

    .login-layout {
        display: block;
    }

    .login-brand {
        display: none;
    }

    .mobile-brand {
        display: flex;
        gap: 10px;
        align-items: center;
        margin-bottom: 35px;
    }

    .login-panel {
        min-height: 100vh;
        padding: 25px;
    }

    .app-layout {
        grid-template-columns: 75px 1fr;
    }

    .sidebar-brand > div:last-child,
    .nav-item:not(.active) {
        font-size: 0;
    }

    .sidebar-brand {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    .nav-section {
        display: none;
    }

    .nav-item {
        justify-content: center;
    }

    .nav-icon {
        font-size: 18px;
    }

    .content {
        padding: 20px;
    }

    .topbar {
        padding: 0 18px;
    }

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

/* CONFIGURACION ONEDRIVE */

.page-intro {
    margin-bottom: 24px;
}

.page-intro h2 {
    margin: 7px 0 7px;
    font-size: 27px;
}

.page-intro p {
    margin: 0;
    color: var(--muted);
}

.config-panel,
.diagnostic-panel,
.security-note {
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 25px;
    margin-bottom: 20px;
}

.config-title,
.diagnostic-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.config-title h3,
.diagnostic-header h3 {
    margin: 0 0 5px;
}

.config-title p,
.diagnostic-header p {
    color: var(--muted);
    margin: 0;
    font-size: 13px;
}

.onedrive-form {
    padding-top: 22px;
}

.form-group small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
}

.button-auto {
    width: auto;
    min-width: 190px;
}

.btn-secondary {
    border: 1px solid #cbd5e1;
    background: white;
    color: var(--text);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #f8fafc;
}

.connection-badge {
    white-space: nowrap;
    border-radius: 20px;
    padding: 7px 11px;
    font-size: 11px;
    font-weight: 600;
}

.connection-badge.warning {
    background: #fffbeb;
    color: #92400e;
}

.connection-badge.error {
    background: #fef2f2;
    color: #991b1b;
}

.connection-badge.neutral {
    background: #f1f5f9;
    color: #475569;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 13px 15px;
    border-radius: 9px;
    margin-bottom: 20px;
    font-size: 14px;
}

.diagnostic-list {
    padding-top: 8px;
}

.diagnostic-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 16px 3px;
    border-bottom: 1px solid #f1f5f9;
}

.diagnostic-row strong,
.diagnostic-row span {
    display: block;
}

.diagnostic-row strong {
    font-size: 14px;
    margin-bottom: 4px;
}

.diagnostic-row div > span {
    color: var(--muted);
    font-size: 12px;
}

.check {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.check.ok {
    background: #dcfce7;
    color: #166534;
}

.check.fail {
    background: #fee2e2;
    color: #991b1b;
}

.check.pending {
    background: #f1f5f9;
    color: #94a3b8;
}

.status-text {
    font-size: 12px;
    font-weight: 600;
}

.pending-text {
    color: #d97706;
}

.last-test {
    display: flex;
    justify-content: space-between;
    padding-top: 18px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--muted);
}

.last-test strong {
    color: var(--text);
}

.security-note strong {
    display: block;
    margin-bottom: 6px;
}

.security-note p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

@media (max-width: 700px) {
    .config-title,
    .diagnostic-header {
        flex-direction: column;
    }

    .button-auto {
        width: 100%;
    }
}

/* FUENTE DOCUMENTAL WINDOWS */

.connection-badge.success {
    background: #f0fdf4;
    color: #166534;
}

.agent-status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    margin-top: 22px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.agent-info {
    background: white;
    padding: 18px;
}

.agent-info span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 7px;
}

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

.source-value {
    font-size: 12px;
    max-width: 45%;
    text-align: right;
    overflow-wrap: anywhere;
}

.source-count {
    font-size: 20px;
}

.architecture-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 25px;
    margin-bottom: 20px;
}

.architecture-panel h3 {
    margin: 0 0 22px;
}

.architecture-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.architecture-node {
    flex: 1;
    min-width: 120px;
    text-align: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 12px;
}

.architecture-node strong,
.architecture-node span {
    display: block;
}

.architecture-node strong {
    font-size: 14px;
}

.architecture-node span {
    color: var(--muted);
    font-size: 11px;
    margin-top: 5px;
}

.architecture-arrow {
    color: #94a3b8;
    font-size: 19px;
}

@media (max-width: 950px) {

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

    .architecture-flow {
        flex-direction: column;
    }

    .architecture-node {
        width: 100%;
    }

    .architecture-arrow {
        transform: rotate(90deg);
    }
}

@media (max-width: 600px) {

    .agent-status-grid {
        grid-template-columns: 1fr;
    }

    .source-value {
        max-width: 50%;
    }
}
