* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f5f8;
    color: #0f172a;
}

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

.sidebar {
    width: 270px;
    background: linear-gradient(180deg, #0f2f4a 0%, #082033 100%);
    color: white;
    padding: 24px;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    font-weight: 800;
    font-size: 22px;
}

.sidebar h2 {
    margin: 0;
    font-size: 23px;
}

.sidebar p {
    margin: 4px 0 0;
    color: #dbeafe;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar a {
    color: #eaf2ff;
    text-decoration: none;
    padding: 13px 14px;
    border-radius: 12px;
    font-weight: 700;
}

.sidebar a.active,
.sidebar a:hover {
    background: rgba(255, 255, 255, 0.14);
}

.main {
    flex: 1;
    margin-left: 270px;
    padding: 28px;
}

.topbar {
    background: white;
    padding: 24px;
    border-radius: 18px;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(15, 47, 74, 0.08);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

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

.topbar p {
    margin: 10px 0 0;
    color: #64748b;
    font-size: 16px;
}

.topbar small {
    display: block;
    margin-top: 10px;
    color: #475569;
}

.cards {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 47, 74, 0.08);
    border: 1px solid #eef2f7;
}

.card span {
    display: block;
    color: #64748b;
    margin-bottom: 10px;
}

.card strong {
    font-size: 32px;
    color: #0f2f4a;
}

.card-priority {
    border: 1px solid #ffd8a8;
}

.panel {
    background: white;
    padding: 24px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 47, 74, 0.08);
    margin-bottom: 24px;
}

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

.panel h2,
.panel h3 {
    margin: 0;
}

.panel p {
    margin: 8px 0 0;
    color: #64748b;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    text-align: left;
    background: #f8fafc;
    color: #1f2937;
    padding: 13px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

td {
    padding: 13px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.name-cell strong {
    display: block;
    line-height: 1.3;
}

.name-cell small,
td small {
    display: block;
    color: #64748b;
    margin-top: 6px;
    line-height: 1.4;
}

.reason-cell {
    max-width: 320px;
    color: #475569;
}

.badge {
    background: #0f2f4a;
    color: white;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 800;
    display: inline-block;
}

.priority-pill,
.filter-pill {
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
    display: inline-block;
    white-space: nowrap;
}

.priority-high {
    background: #fee2e2;
    color: #991b1b;
}

.priority-medium {
    background: #fef3c7;
    color: #92400e;
}

.priority-low {
    background: #e2e8f0;
    color: #334155;
}

.filter-include {
    background: #dcfce7;
    color: #166534;
}

.filter-exclude {
    background: #fee2e2;
    color: #991b1b;
}

.btn,
button,
.btn-secondary,
.btn-small {
    border: 0;
    cursor: pointer;
    text-decoration: none;
    font-weight: 800;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn,
button {
    background: #0f2f4a;
    color: white;
    padding: 12px 17px;
}

.btn-secondary {
    background: #e2e8f0;
    color: #0f172a;
    padding: 12px 17px;
}

.btn-small {
    background: #e2e8f0;
    color: #0f172a;
    padding: 8px 10px;
    font-size: 12px;
}

.btn-small.danger {
    background: #fee2e2;
    color: #991b1b;
}

select,
input {
    padding: 12px;
    border-radius: 11px;
    border: 1px solid #d1d5db;
    background: white;
    font-size: 14px;
}

.filters {
    display: grid;
    grid-template-columns: 1fr 180px 180px 180px auto auto;
    gap: 10px;
    align-items: center;
}

.filters-panel {
    padding: 18px;
}

a {
    color: #0f2f4a;
    font-weight: 800;
}

.empty {
    color: #64748b;
    text-align: center;
    padding: 28px;
}

.opportunity-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 16px;
}

.opportunity-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px;
    background: #fbfdff;
}

.opportunity-card h3 {
    margin: 14px 0 12px;
    font-size: 16px;
    line-height: 1.35;
}

.opportunity-card p {
    margin: 7px 0;
    font-size: 13px;
}

.opportunity-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}

.actions-cell form {
    margin: 0;
}

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

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

@media (max-width: 820px) {
    .sidebar {
        position: relative;
        width: 100%;
    }

    .layout {
        display: block;
    }

    .main {
        margin-left: 0;
        padding: 16px;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .cards,
    .opportunity-grid,
    .filters {
        grid-template-columns: 1fr;
    }
}

.sidebar-user {
    margin-top: 28px;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.10);
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.sidebar-user span {
    color: #dbeafe;
    font-size: 12px;
    margin-top: 3px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.sidebar-bottom {
    margin-top: 14px;
}

.topbar-actions,
.card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn.secondary,
.btn-small.neutral {
    background: #e2e8f0;
    color: #0f172a;
}

.alert {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 18px;
    font-weight: 700;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #173f61, #082033 55%, #061724);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: white;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.28);
}

.login-brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 24px;
}

.brand-logo.big {
    width: 56px;
    height: 56px;
    font-size: 28px;
    background: #0f2f4a;
    color: white;
}

.login-brand h1 {
    margin: 0;
    font-size: 25px;
}

.login-brand p {
    margin: 4px 0 0;
    color: #64748b;
}

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

.login-form label,
.form-grid label {
    font-weight: 800;
    color: #334155;
}

.login-card small {
    display: block;
    margin-top: 18px;
    color: #64748b;
}

.narrow-panel {
    max-width: 760px;
}

.form-grid.single {
    display: grid;
    gap: 12px;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
textarea {
    width: 100%;
    padding: 12px;
    border-radius: 11px;
    border: 1px solid #d1d5db;
    background: white;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.form-grid hr {
    width: 100%;
    border: 0;
    border-top: 1px solid #e5e7eb;
    margin: 10px 0;
}

.muted {
    color: #64748b;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 22px;
    align-items: start;
}

.detail-header {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.state-pill {
    background: #dbeafe;
    color: #1d4ed8;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.info-grid div {
    border: 1px solid #e5e7eb;
    background: #fbfdff;
    border-radius: 14px;
    padding: 13px;
}

.info-grid span {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-bottom: 6px;
}

.info-grid strong {
    display: block;
    line-height: 1.35;
}

.side-info {
    grid-template-columns: 1fr;
}

.description-box {
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px;
    line-height: 1.55;
    color: #334155 !important;
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    border-left: 4px solid #0f2f4a;
    background: #f8fafc;
    padding: 12px 14px;
    border-radius: 12px;
}

.timeline-item strong,
.timeline-item span {
    display: block;
}

.timeline-item span {
    color: #64748b;
    font-size: 12px;
    margin-top: 4px;
}

.timeline-item p {
    margin: 8px 0 0;
}

.console-output {
    white-space: pre-wrap;
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 14px;
    overflow-x: auto;
    line-height: 1.5;
}

.migration-page {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px;
}

.user-create-form {
    grid-template-columns: 1fr 1fr 180px 1fr auto;
}

@media (max-width: 1200px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 820px) {
    .sidebar-user {
        margin-top: 16px;
    }

    .info-grid,
    .user-create-form {
        grid-template-columns: 1fr;
    }
}

/* ===============================
   Dashboard Fix V4 - Calafquén
   =============================== */

html {
    scroll-behavior: smooth;
}

body {
    background: #eef2f6;
}

.sidebar {
    width: 280px;
    padding: 26px 22px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.brand {
    margin-bottom: 22px;
}

.sidebar-section-title {
    color: #93b4cf;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin: 18px 0 9px;
}

.sidebar nav {
    gap: 6px;
}

.sidebar a {
    display: flex;
    align-items: center;
    min-height: 44px;
}

.sidebar-spacer {
    flex: 1;
    min-height: 18px;
}

.sidebar-user {
    display: none !important;
}

.sidebar-profile-card {
    width: 100%;
    padding: 13px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.09);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 18px;
    flex: 0 0 auto;
}

.profile-data {
    min-width: 0;
}

.profile-data strong {
    display: block;
    color: #ffffff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-data span {
    display: block;
    color: #c9dff2;
    font-size: 12px;
    margin-top: 4px;
}

.sidebar-bottom {
    margin-top: 10px;
}

.main {
    margin-left: 280px;
    padding: 30px;
}

.dashboard-main {
    max-width: 1580px;
}

.dashboard-hero {
    background: linear-gradient(135deg, #ffffff 0%, #f9fbfd 55%, #edf5fb 100%);
    border: 1px solid #e6edf4;
    padding: 26px;
    border-radius: 24px;
    margin-bottom: 24px;
    box-shadow: 0 12px 34px rgba(15, 47, 74, 0.08);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 22px;
    align-items: center;
}

.hero-copy {
    min-width: 0;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    color: #0f2f4a;
    background: #e8f1f8;
    border: 1px solid #d6e8f4;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin-bottom: 11px;
}

.dashboard-hero h1 {
    margin: 0;
    font-size: 34px;
    letter-spacing: -0.03em;
    color: #0a1727;
}

.dashboard-hero p {
    margin: 10px 0 0;
    max-width: 860px;
    color: #5b6b7f;
    font-size: 16px;
    line-height: 1.45;
}

.last-run {
    margin-top: 15px;
    display: grid;
    gap: 3px;
    max-width: 980px;
    padding: 12px 14px;
    border-radius: 15px;
    background: #f6f9fc;
    border: 1px solid #e4edf5;
}

.last-run strong {
    color: #0f2f4a;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.last-run span {
    color: #344256;
    font-size: 13px;
    line-height: 1.35;
}

.hero-actions {
    display: grid;
    gap: 10px;
    justify-items: stretch;
    min-width: 170px;
}

.hero-btn {
    width: 100%;
    white-space: nowrap;
}

.kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    text-decoration: none;
    color: inherit;
    min-height: 128px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(15, 47, 74, 0.12);
    border-color: #c6d7e5;
}

.kpi-card span {
    margin-bottom: 4px;
}

.kpi-card strong {
    line-height: 1;
    margin: 4px 0;
}

.kpi-card small {
    color: #718096;
    font-size: 12px;
    line-height: 1.3;
}

.card-priority {
    border: 1px solid #fecaca !important;
    background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%);
}

.clean-header {
    align-items: flex-start;
}

.clean-header h2 {
    font-size: 25px;
    letter-spacing: -0.02em;
}

.clean-header .eyebrow {
    margin-bottom: 8px;
}

.priority-panel {
    border: 1px solid #e4edf5;
}

.priority-list {
    display: grid;
    gap: 12px;
}

.priority-row {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 15px;
    border: 1px solid #e5eaf0;
    border-radius: 18px;
    background: #fbfdff;
}

.priority-row:hover {
    border-color: #cbd9e6;
    background: #ffffff;
}

.priority-rank {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #0f2f4a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

.priority-content {
    min-width: 0;
}

.priority-title-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.priority-title-row h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
    color: #0f172a;
}

.priority-chips {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex: 0 0 auto;
}

.priority-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 10px;
    color: #5f6f83;
    font-size: 13px;
}

.priority-meta span {
    display: inline-flex;
    gap: 4px;
}

.priority-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dashboard-table th,
.dashboard-table td {
    padding: 12px 13px;
}

.code-cell {
    font-weight: 800;
    color: #0f2f4a;
    white-space: nowrap;
}

.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.btn.secondary,
.btn-small.neutral {
    background: #e7eef5;
    color: #0f2f4a;
}

.btn:hover,
.btn-small:hover {
    filter: brightness(.96);
}

.topbar {
    align-items: flex-start;
}

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

.topbar .btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

@media (max-width: 1320px) {
    .kpi-grid {
        grid-template-columns: repeat(3, minmax(190px, 1fr));
    }
}

@media (max-width: 1060px) {
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .hero-actions {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
        min-width: 0;
    }

    .priority-row {
        grid-template-columns: 46px minmax(0, 1fr);
    }

    .priority-actions {
        grid-column: 2 / 3;
        justify-content: flex-start;
    }

    .priority-title-row {
        display: grid;
    }

    .priority-chips {
        justify-content: flex-start;
    }
}

@media (max-width: 820px) {
    .sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
        overflow: visible;
    }

    .main {
        margin-left: 0;
        padding: 16px;
    }

    .dashboard-hero {
        padding: 20px;
        border-radius: 20px;
    }

    .dashboard-hero h1 {
        font-size: 28px;
    }

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

    .hero-actions {
        grid-template-columns: 1fr;
    }

    .priority-row {
        grid-template-columns: 1fr;
    }

    .priority-rank {
        width: auto;
        height: auto;
        padding: 8px 10px;
        border-radius: 999px;
        justify-self: flex-start;
    }

    .priority-actions {
        grid-column: auto;
    }

    .panel-header,
    .clean-header {
        display: grid;
        gap: 14px;
    }
}

/* ===============================
   Mobile App V4 - Calafquén
   Optimización para celular / PWA
   =============================== */

.mobile-appbar,
.mobile-sidebar-backdrop,
.mobile-sidebar-close {
    display: none;
}

@media (max-width: 900px) {
    html,
    body {
        overflow-x: hidden;
    }

    body:not(.login-body) {
        padding-top: 66px;
        background: #eef2f6;
    }

    .mobile-appbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 66px;
        z-index: 1100;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 14px;
        background: rgba(15, 47, 74, 0.98);
        color: white;
        box-shadow: 0 12px 28px rgba(8, 32, 51, 0.22);
        backdrop-filter: blur(10px);
    }

    .mobile-menu-btn,
    .mobile-sidebar-close {
        width: 44px;
        height: 44px;
        border-radius: 14px;
        padding: 0;
        background: rgba(255, 255, 255, 0.14);
        color: white;
        font-size: 24px;
        line-height: 1;
        flex: 0 0 auto;
    }

    .mobile-appbar-brand {
        display: grid;
        gap: 1px;
        min-width: 0;
        flex: 1;
    }

    .mobile-appbar-brand strong {
        font-size: 17px;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-appbar-brand span {
        color: #c9dff2;
        font-size: 12px;
    }

    .mobile-search-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 38px;
        padding: 0 13px;
        border-radius: 12px;
        background: #ffffff;
        color: #0f2f4a;
        font-weight: 900;
        text-decoration: none;
        flex: 0 0 auto;
    }

    .mobile-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1090;
        background: rgba(3, 10, 18, 0.48);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        display: block;
    }

    body.mobile-menu-open .mobile-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .layout {
        display: block !important;
        min-height: auto;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        z-index: 1110;
        width: min(86vw, 330px) !important;
        height: 100dvh;
        min-height: 100dvh !important;
        padding: 22px 18px 18px !important;
        overflow-y: auto !important;
        transform: translateX(-104%);
        transition: transform .24s ease;
        box-shadow: 20px 0 44px rgba(3, 10, 18, 0.25);
    }

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

    .mobile-sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        right: 14px;
        top: 14px;
        font-size: 32px;
        font-weight: 400;
    }

    .sidebar .brand {
        padding-right: 54px;
        margin-bottom: 18px;
    }

    .sidebar nav a {
        min-height: 48px;
        font-size: 15px;
    }

    .sidebar-profile-card {
        margin-top: 18px;
    }

    .main {
        margin-left: 0 !important;
        padding: 14px !important;
        width: 100%;
    }

    .dashboard-main {
        max-width: none;
    }

    .dashboard-hero,
    .topbar,
    .panel,
    .card {
        border-radius: 18px;
    }

    .dashboard-hero {
        grid-template-columns: 1fr !important;
        padding: 18px !important;
        margin-bottom: 14px;
        gap: 16px;
    }

    .dashboard-hero h1,
    .topbar h1 {
        font-size: 26px !important;
        line-height: 1.1;
    }

    .dashboard-hero p,
    .topbar p,
    .panel p {
        font-size: 14px;
        line-height: 1.45;
    }

    .last-run {
        padding: 11px 12px;
        margin-top: 12px;
    }

    .last-run span {
        font-size: 12px;
    }

    .hero-actions,
    .topbar-actions,
    .card-actions {
        display: grid !important;
        grid-template-columns: 1fr;
        width: 100%;
        gap: 10px;
    }

    .hero-actions .btn,
    .topbar-actions .btn,
    .card-actions .btn,
    .topbar > .btn,
    .btn.hero-btn {
        width: 100%;
        min-height: 46px;
    }

    .kpi-grid,
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
        margin-bottom: 14px;
    }

    .kpi-card,
    .card {
        min-height: 116px;
        padding: 16px;
    }

    .kpi-card span,
    .card span {
        font-size: 13px;
        line-height: 1.2;
    }

    .kpi-card strong,
    .card strong {
        font-size: 30px;
    }

    .kpi-card small {
        font-size: 11px;
    }

    .panel {
        padding: 17px;
        margin-bottom: 14px;
    }

    .panel-header,
    .clean-header,
    .topbar {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 12px;
        align-items: stretch;
    }

    .clean-header h2,
    .panel h2 {
        font-size: 21px;
        line-height: 1.15;
    }

    .priority-list {
        gap: 10px;
    }

    .priority-row {
        grid-template-columns: 1fr !important;
        gap: 10px;
        padding: 14px;
    }

    .priority-rank {
        width: auto;
        height: auto;
        padding: 7px 10px;
        border-radius: 999px;
        justify-self: flex-start;
    }

    .priority-title-row {
        display: grid !important;
        gap: 10px;
    }

    .priority-title-row h3 {
        font-size: 15px;
    }

    .priority-chips,
    .priority-actions {
        justify-content: flex-start !important;
    }

    .priority-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .priority-actions .btn-small,
    .actions-cell .btn-small,
    .btn-small {
        min-height: 40px;
        text-align: center;
    }

    .priority-meta {
        display: grid;
        gap: 7px;
        font-size: 12px;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
        padding: 0 4px 8px;
        border-radius: 14px;
    }

    .table-wrap::before {
        content: 'Desliza la tabla hacia los lados para ver más información';
        display: block;
        margin: 0 0 10px;
        padding: 9px 11px;
        border-radius: 12px;
        background: #eef6ff;
        color: #0f2f4a;
        font-weight: 800;
        font-size: 12px;
    }

    table {
        min-width: 850px;
        font-size: 13px;
    }

    th,
    td {
        padding: 11px 10px;
    }

    .dashboard-table {
        min-width: 920px;
    }

    .actions-cell {
        display: flex;
        flex-wrap: nowrap;
    }

    .filters,
    .user-create-form,
    .info-grid,
    .detail-grid,
    .opportunity-grid {
        grid-template-columns: 1fr !important;
    }

    .filters {
        gap: 9px;
    }

    .filters input,
    .filters select,
    .filters .btn,
    .filters .btn-secondary,
    .form-grid input,
    .form-grid select,
    .form-grid textarea,
    .form-grid button,
    .login-form input,
    .login-form button {
        width: 100%;
        min-height: 46px;
    }

    .detail-grid {
        gap: 14px;
    }

    .detail-header {
        gap: 8px;
    }

    .description-box {
        font-size: 14px;
    }

    .timeline-item {
        padding: 12px;
    }

    .narrow-panel {
        max-width: none;
    }
}

@media (max-width: 520px) {
    body:not(.login-body) {
        padding-top: 62px;
    }

    .mobile-appbar {
        height: 62px;
        padding: 9px 11px;
    }

    .mobile-menu-btn {
        width: 42px;
        height: 42px;
    }

    .mobile-search-btn {
        min-height: 36px;
        padding: 0 11px;
        font-size: 13px;
    }

    .mobile-appbar-brand strong {
        font-size: 16px;
    }

    .main {
        padding: 11px !important;
    }

    .dashboard-hero,
    .topbar,
    .panel {
        border-radius: 16px;
    }

    .dashboard-hero,
    .panel {
        padding: 15px !important;
    }

    .topbar {
        padding: 15px;
    }

    .dashboard-hero h1,
    .topbar h1 {
        font-size: 24px !important;
    }

    .eyebrow {
        font-size: 10px;
        padding: 5px 8px;
    }

    .kpi-grid,
    .cards {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .kpi-card,
    .card {
        min-height: 104px;
    }

    .priority-actions {
        grid-template-columns: 1fr;
    }

    .login-body {
        padding: 14px;
    }

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

    .login-brand h1 {
        font-size: 21px;
    }
}
