.layout > *,
.panel,
.summary-card,
.management-grid > * {
    min-width: 0;
    width: 100%;
}

.compact {
    max-width: none;
}

.account-name {
    color: #d7daea;
    font-size: 13px;
    white-space: nowrap;
}

input,
select,
textarea,
.button {
    min-width: 0;
}

@media (max-width: 700px) {
    main {
        padding: 18px 12px 42px;
    }

    .topbar {
        align-items: flex-start;
        gap: 10px;
        padding: 10px 12px;
    }

    .topbar > div:first-child {
        padding-top: 3px;
    }

    .topbar-actions {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-end;
    }

    .account-name {
        font-size: 11px;
        text-align: right;
        width: 100%;
    }

    .topbar .button {
        font-size: 11px;
        padding: 8px 9px;
        white-space: nowrap;
    }

    .hero {
        display: grid;
        gap: 18px;
        margin-bottom: 20px;
    }

    .hero h1 {
        font-size: 28px;
        line-height: 1.1;
    }

    .hero > div,
    .month-picker {
        width: 100%;
    }

    .month-picker {
        display: grid;
        grid-template-columns: 1fr;
    }

    .summary-grid,
    .layout,
    .management-grid {
        gap: 12px;
    }

    .summary-card,
    .panel {
        border-radius: 14px;
        padding: 16px;
    }

    .summary-card strong {
        font-size: 25px;
    }

    .panel-title {
        align-items: flex-start;
        gap: 10px;
    }

    .count {
        flex-shrink: 0;
    }

    .form-grid {
        gap: 12px;
    }

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

    .form-grid .button {
        width: 100%;
    }

    .table-wrap {
        overflow: visible;
    }

    table,
    tbody,
    tr,
    td {
        display: block;
        width: 100%;
    }

    thead {
        display: none;
    }

    tbody {
        display: grid;
        gap: 12px;
    }

    tbody tr {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 8px 12px;
    }

    tbody td {
        align-items: start;
        border-bottom: 1px solid var(--border);
        display: grid;
        gap: 10px;
        grid-template-columns: minmax(90px, 36%) minmax(0, 1fr);
        overflow-wrap: anywhere;
        padding: 9px 0;
    }

    tbody td::before {
        color: var(--muted);
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .05em;
        text-transform: uppercase;
    }

    tbody td:nth-child(1)::before { content: "Fecha"; }
    tbody td:nth-child(2)::before { content: "Persona / tarjeta"; }
    tbody td:nth-child(3)::before { content: "Gasto"; }
    tbody td:nth-child(4)::before { content: "Categoría"; }
    tbody td:nth-child(5)::before { content: "Cuota"; }
    tbody td:nth-child(6)::before { content: "Monto"; }

    tbody td:last-child {
        border-bottom: 0;
        display: flex;
        justify-content: flex-end;
    }

    tbody td:last-child::before,
    tbody td.empty::before {
        display: none;
    }

    tbody td.empty {
        border: 0;
        display: block;
        padding: 24px 8px;
    }

    .category {
        white-space: normal;
    }

    footer {
        padding: 20px 16px;
    }
}

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

@media (max-width: 700px) {
    .import-table td:nth-child(1)::before { content: "Importar"; }
    .import-table td:nth-child(2)::before { content: "Fecha"; }
    .import-table td:nth-child(3)::before { content: "Descripción"; }
    .import-table td:nth-child(4)::before { content: "Categoría"; }
    .import-table td:nth-child(5)::before { content: "Lo paga"; }
    .import-table td:nth-child(6)::before { content: "Moneda"; }
    .import-table td:nth-child(7)::before { content: "Monto"; }
    .import-table {
        min-width: 0;
    }
    .import-table select {
        min-width: 0;
    }
    .import-table td:last-child {
        display: grid;
        justify-content: initial;
    }
    .import-table td:last-child::before {
        display: block;
    }
}

@media (max-width: 420px) {
    .topbar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .topbar-actions {
        max-width: 100%;
    }

    .topbar .button {
        font-size: 10px;
        padding: 8px;
    }

    .panel-title {
        display: grid;
    }

    .count {
        justify-self: start;
    }

    .login-shell {
        padding: 12px;
    }

    .login-panel {
        padding: 24px 18px;
    }

    .login-panel h1 {
        font-size: 26px;
    }
}
